Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
Projectile.cs
Go to the documentation of this file.
1using System;
4using Microsoft.Xna.Framework.Audio;
7using Terraria.Chat;
21using Terraria.ID;
27
28namespace Terraria;
29
30public class Projectile : Entity
31{
32 private class NPCDistanceByIndexComparator : IComparer<Tuple<int, float>>
33 {
35 {
36 return npcIndex1.Item2.CompareTo(npcIndex2.Item2);
37 }
38 }
39
81
82 public static uint[][] perIDStaticNPCImmunity = new uint[ProjectileID.Count][];
83
84 public const int SentryLifeTime = 36000;
85
86 public const int ArrowLifeTime = 1200;
87
88 public float ownerHitCheckDistance = 1000f;
89
90 public bool arrow;
91
92 public int numHits;
93
94 public bool bobber;
95
96 public bool netImportant;
97
98 public bool noDropItem;
99
100 public static int maxAI = 3;
101
102 public bool counterweight;
103
104 public float scale = 1f;
105
106 public float rotation;
107
108 public int type;
109
110 public int alpha;
111
112 public bool sentry;
113
114 public short glowMask;
115
116 public int owner = 255;
117
118 public float[] ai = new float[maxAI];
119
120 public float[] localAI = new float[maxAI];
121
122 public float gfxOffY;
123
124 public float stepSpeed = 1f;
125
126 public int aiStyle;
127
128 public int timeLeft;
129
130 public int soundDelay;
131
132 public int damage;
133
134 public int originalDamage;
135
136 public int spriteDirection = 1;
137
138 public bool hostile;
139
140 public bool reflected;
141
142 public float knockBack;
143
144 public bool friendly;
145
146 public int penetrate = 1;
147
148 private int[] localNPCImmunity = new int[200];
149
151
153
155
156 public int maxPenetrate = 1;
157
158 public int identity;
159
160 public float light;
161
162 public bool netUpdate;
163
164 public bool netUpdate2;
165
166 public int netSpam;
167
168 public Vector2[] oldPos = new Vector2[10];
169
170 public float[] oldRot = new float[10];
171
172 public int[] oldSpriteDirection = new int[10];
173
174 public bool minion;
175
176 public float minionSlots;
177
178 public int minionPos;
179
180 public int restrikeDelay;
181
182 public bool tileCollide;
183
184 public int extraUpdates;
185
187
188 public int numUpdates;
189
190 public bool ignoreWater;
191
192 public bool isAPreviewDummy;
193
194 public bool hide;
195
196 public bool ownerHitCheck;
197
199
200 public int[] playerImmune = new int[255];
201
202 public string miscText = "";
203
204 public bool melee;
205
206 public bool ranged;
207
208 public bool magic;
209
210 public bool coldDamage;
211
212 public bool noEnchantments;
213
215
216 public bool trap;
217
218 public bool npcProj;
219
221
222 public int frameCounter;
223
224 public int frame;
225
227
228 public int projUUID = -1;
229
231
232 public bool shouldFallThrough;
233
234 public int localNPCHitCooldown = -2;
235
236 public int idStaticNPCHitCooldown = -1;
237
239
241
243
244 private static Point[] _javelinsMax6 = new Point[6];
245
246 private static Point[] _javelinsMax8 = new Point[8];
247
248 private static Point[] _javelinsMax10 = new Point[10];
249
251
252 private static Rectangle _lanceHitboxBounds = new Rectangle(0, 0, 300, 300);
253
255
257
259
261
263
264 private static float[] _CompanionCubeScreamCooldown = new float[255];
265
266 public string Name => Lang.GetProjectileName(type).Value;
267
268 public bool WipableTurret
269 {
270 get
271 {
272 if (owner == Main.myPlayer && sentry)
273 {
274 return !TurretShouldPersist();
275 }
276 return false;
277 }
278 }
279
280 public float Opacity
281 {
282 get
283 {
284 return 1f - (float)alpha / 255f;
285 }
286 set
287 {
288 alpha = (int)MathHelper.Clamp((1f - value) * 255f, 0f, 255f);
289 }
290 }
291
292 public int MaxUpdates
293 {
294 get
295 {
296 return extraUpdates + 1;
297 }
298 set
299 {
300 extraUpdates = value - 1;
301 }
302 }
303
305 {
306 get
307 {
308 if (Main.player[owner].MinionAttackTargetNPC < 0)
309 {
310 return null;
311 }
312 return Main.npc[Main.player[owner].MinionAttackTargetNPC];
313 }
314 }
315
316 public static void InitializeStaticThings()
317 {
319 for (int i = 0; i < perIDStaticNPCImmunity.Length; i++)
320 {
321 perIDStaticNPCImmunity[i] = new uint[200];
322 }
323 WorldGen.Hooks.OnWorldLoad += ResetImmunity;
324 }
325
326 public static void ResetImmunity()
327 {
328 for (int i = 0; i < ProjectileID.Count; i++)
329 {
330 for (int j = 0; j < 200; j++)
331 {
333 }
334 }
335 }
336
341
343 {
344 switch (type)
345 {
346 case 663:
347 case 665:
348 case 667:
349 case 677:
350 case 678:
351 case 679:
352 case 688:
353 case 689:
354 case 690:
355 case 691:
356 case 692:
357 case 693:
358 return DD2Event.Ongoing;
359 default:
360 return false;
361 }
362 }
363
364 public void SetDefaults(int Type)
365 {
366 ownerHitCheckDistance = 1000f;
367 counterweight = false;
368 sentry = false;
369 arrow = false;
370 bobber = false;
371 numHits = 0;
372 netImportant = false;
373 manualDirectionChange = false;
375 shouldFallThrough = false;
380 usesLocalNPCImmunity = false;
382 usesOwnerMeleeHitCD = false;
384 int num = 10;
385 if (Type >= 0)
386 {
388 }
389 if (num != oldPos.Length)
390 {
391 Array.Resize(ref oldPos, num);
392 Array.Resize(ref oldRot, num);
393 Array.Resize(ref oldSpriteDirection, num);
394 }
395 for (int i = 0; i < oldPos.Length; i++)
396 {
397 oldPos[i].X = 0f;
398 oldPos[i].Y = 0f;
399 oldRot[i] = 0f;
400 oldSpriteDirection[i] = 0;
401 }
402 for (int j = 0; j < maxAI; j++)
403 {
404 ai[j] = 0f;
405 localAI[j] = 0f;
406 }
407 for (int k = 0; k < 255; k++)
408 {
409 playerImmune[k] = 0;
410 }
412 noDropItem = false;
413 minion = false;
414 minionSlots = 0f;
415 soundDelay = 0;
416 spriteDirection = 1;
417 melee = false;
418 ranged = false;
419 magic = false;
420 ownerHitCheck = false;
421 hide = false;
422 lavaWet = false;
423 wetCount = 0;
424 wet = false;
425 ignoreWater = false;
426 isAPreviewDummy = false;
427 hostile = false;
428 reflected = false;
429 netUpdate = false;
430 netUpdate2 = false;
431 netSpam = 0;
432 numUpdates = 0;
433 extraUpdates = 0;
434 identity = 0;
435 restrikeDelay = 0;
436 light = 0f;
437 penetrate = 1;
438 tileCollide = true;
441 aiStyle = 0;
442 alpha = 0;
443 glowMask = -1;
444 type = Type;
445 active = true;
446 rotation = 0f;
447 scale = 1f;
448 owner = 255;
449 timeLeft = 3600;
450 friendly = false;
451 damage = 0;
452 originalDamage = 0;
453 knockBack = 0f;
454 miscText = "";
455 coldDamage = false;
456 noEnchantments = false;
457 noEnchantmentVisuals = false;
458 trap = false;
459 npcProj = false;
461 projUUID = -1;
462 frame = 0;
463 frameCounter = 0;
464 if (type == 1)
465 {
466 arrow = true;
467 width = 10;
468 height = 10;
469 aiStyle = 1;
470 friendly = true;
471 ranged = true;
472 timeLeft = 1200;
473 }
474 else if (type == 2)
475 {
476 arrow = true;
477 width = 10;
478 height = 10;
479 aiStyle = 1;
480 friendly = true;
481 light = 1f;
482 ranged = true;
483 timeLeft = 1200;
484 }
485 else if (type == 3)
486 {
487 width = 22;
488 height = 22;
489 aiStyle = 2;
490 friendly = true;
491 penetrate = 4;
492 ranged = true;
493 }
494 else if (type == 4)
495 {
496 arrow = true;
497 width = 10;
498 height = 10;
499 aiStyle = 1;
500 friendly = true;
501 light = 0.35f;
502 penetrate = 5;
503 ranged = true;
504 timeLeft = 1200;
505 }
506 else if (type == 5)
507 {
508 arrow = true;
509 width = 10;
510 height = 10;
511 aiStyle = 1;
512 friendly = true;
513 light = 0.4f;
514 penetrate = -1;
515 alpha = 100;
516 ignoreWater = true;
517 ranged = true;
518 extraUpdates = 1;
519 timeLeft = 120;
520 }
521 else if (type == 6)
522 {
523 width = 22;
524 height = 22;
525 aiStyle = 3;
526 friendly = true;
527 penetrate = -1;
528 melee = true;
529 light = 0.4f;
530 }
531 else if (type == 7 || type == 8)
532 {
533 width = 28;
534 height = 28;
535 aiStyle = 4;
536 friendly = true;
537 penetrate = -1;
538 tileCollide = false;
539 alpha = 255;
540 ignoreWater = true;
541 magic = true;
542 }
543 else if (type == 9)
544 {
545 width = 24;
546 height = 24;
547 aiStyle = 5;
548 friendly = true;
549 penetrate = 2;
550 scale = 0.8f;
551 tileCollide = false;
552 melee = true;
553 }
554 else if (type == 10)
555 {
556 width = 64;
557 height = 64;
558 aiStyle = 6;
559 friendly = true;
560 tileCollide = false;
561 penetrate = -1;
562 alpha = 255;
563 ignoreWater = true;
564 }
565 else if (type == 11)
566 {
567 width = 48;
568 height = 48;
569 aiStyle = 6;
570 friendly = true;
571 tileCollide = false;
572 penetrate = -1;
573 alpha = 255;
574 ignoreWater = true;
575 }
576 else if (type == 12)
577 {
578 width = 18;
579 height = 18;
580 aiStyle = 5;
581 if (Main.remixWorld)
582 {
583 hostile = true;
584 }
585 friendly = true;
586 penetrate = -1;
587 alpha = 50;
588 light = 1f;
589 }
590 else if (type == 13)
591 {
592 netImportant = true;
593 width = 18;
594 height = 18;
595 aiStyle = 7;
596 friendly = true;
597 penetrate = -1;
598 tileCollide = false;
599 timeLeft *= 10;
600 }
601 else if (type == 14)
602 {
603 width = 4;
604 height = 4;
605 aiStyle = 1;
606 friendly = true;
607 penetrate = 1;
608 light = 0.5f;
609 alpha = 255;
610 scale = 1.2f;
611 timeLeft = 600;
612 ranged = true;
613 extraUpdates = 1;
614 }
615 else if (type == 15)
616 {
617 width = 16;
618 height = 16;
619 aiStyle = 8;
620 friendly = true;
621 light = 0.8f;
622 alpha = 100;
623 magic = true;
624 }
625 else if (type == 16)
626 {
627 width = 32;
628 height = 32;
629 aiStyle = 9;
630 friendly = true;
631 light = 0.8f;
632 alpha = 100;
633 magic = true;
634 ignoreWater = true;
635 }
636 else if (type == 17)
637 {
638 width = 10;
639 height = 10;
640 aiStyle = 10;
641 friendly = true;
642 ignoreWater = true;
643 }
644 else if (type == 18)
645 {
646 netImportant = true;
647 width = 32;
648 height = 32;
649 aiStyle = 11;
650 friendly = true;
651 light = 0.9f;
652 alpha = 150;
653 tileCollide = false;
654 penetrate = -1;
655 timeLeft *= 5;
656 ignoreWater = true;
657 scale = 0.8f;
658 }
659 else if (type == 19)
660 {
661 width = 22;
662 height = 22;
663 aiStyle = 3;
664 friendly = true;
665 penetrate = -1;
666 light = 1f;
667 melee = true;
668 }
669 else if (type == 20)
670 {
671 width = 4;
672 height = 4;
673 aiStyle = 1;
674 friendly = true;
675 penetrate = 3;
676 light = 0.75f;
677 alpha = 255;
678 extraUpdates = 2;
679 scale = 1.4f;
680 timeLeft = 600;
681 magic = true;
682 }
683 else if (type == 21)
684 {
685 width = 16;
686 height = 16;
687 aiStyle = 2;
688 scale = 1.2f;
689 friendly = true;
690 ranged = true;
691 }
692 else if (type == 22)
693 {
694 width = 18;
695 height = 18;
696 aiStyle = 12;
697 friendly = true;
698 alpha = 255;
699 penetrate = 5;
700 extraUpdates = 2;
701 ignoreWater = true;
702 magic = true;
703 if (Main.remixWorld)
704 {
707 }
708 }
709 else if (type == 23)
710 {
711 width = 4;
712 height = 4;
713 aiStyle = 13;
714 friendly = true;
715 penetrate = -1;
716 alpha = 255;
717 ranged = true;
720 }
721 else if (type == 24)
722 {
723 width = 14;
724 height = 14;
725 aiStyle = 14;
726 friendly = true;
727 penetrate = 7;
728 ranged = true;
729 }
730 else if (type == 25)
731 {
732 netImportant = true;
733 width = 22;
734 height = 22;
735 aiStyle = 15;
736 friendly = true;
737 penetrate = -1;
738 melee = true;
739 scale = 0.9f;
742 }
743 else if (type == 26)
744 {
745 netImportant = true;
746 width = 22;
747 height = 22;
748 aiStyle = 15;
749 friendly = true;
750 penetrate = -1;
751 melee = true;
752 scale = 0.8f;
755 }
756 else if (type == 27)
757 {
758 width = 16;
759 height = 16;
760 aiStyle = 8;
761 friendly = true;
762 alpha = 255;
763 timeLeft /= 2;
764 penetrate = 10;
765 magic = true;
766 }
767 else if (type == 28)
768 {
769 width = 22;
770 height = 22;
771 aiStyle = 16;
772 friendly = true;
773 penetrate = -1;
774 }
775 else if (type == 29)
776 {
777 width = 10;
778 height = 10;
779 aiStyle = 16;
780 friendly = true;
781 penetrate = -1;
782 }
783 else if (type == 30)
784 {
785 width = 14;
786 height = 14;
787 aiStyle = 16;
788 friendly = true;
789 penetrate = -1;
790 ranged = true;
791 }
792 else if (type == 31)
793 {
794 knockBack = 6f;
795 width = 10;
796 height = 10;
797 aiStyle = 10;
798 friendly = true;
799 hostile = true;
800 penetrate = -1;
801 }
802 else if (type == 32)
803 {
804 netImportant = true;
805 width = 18;
806 height = 18;
807 aiStyle = 7;
808 friendly = true;
809 penetrate = -1;
810 tileCollide = false;
811 timeLeft *= 10;
812 }
813 else if (type == 33)
814 {
815 width = 38;
816 height = 38;
817 aiStyle = 3;
818 friendly = true;
819 scale = 0.9f;
820 penetrate = -1;
821 melee = true;
822 }
823 else if (type == 34)
824 {
825 width = 32;
826 height = 32;
827 aiStyle = 9;
828 friendly = true;
829 light = 0.8f;
830 penetrate = 2;
831 magic = true;
834 }
835 else if (type == 35)
836 {
837 netImportant = true;
838 width = 22;
839 height = 22;
840 aiStyle = 15;
841 friendly = true;
842 penetrate = -1;
843 melee = true;
844 scale = 0.8f;
847 }
848 else if (type == 36)
849 {
850 width = 4;
851 height = 4;
852 aiStyle = 1;
853 friendly = true;
854 penetrate = 2;
855 light = 0.6f;
856 alpha = 255;
857 scale = 1.4f;
858 timeLeft = 600;
859 ranged = true;
860 extraUpdates = 1;
863 }
864 else if (type == 37)
865 {
866 width = 22;
867 height = 22;
868 aiStyle = 16;
869 friendly = true;
870 penetrate = -1;
871 tileCollide = false;
872 }
873 else if (type == 38)
874 {
875 width = 14;
876 height = 14;
877 aiStyle = 0;
878 hostile = true;
879 penetrate = -1;
880 aiStyle = 1;
881 tileCollide = true;
882 }
883 else if (type == 39)
884 {
885 knockBack = 6f;
886 width = 10;
887 height = 10;
888 aiStyle = 10;
889 friendly = true;
890 hostile = true;
891 penetrate = -1;
892 }
893 else if (type == 40)
894 {
895 knockBack = 6f;
896 width = 10;
897 height = 10;
898 aiStyle = 10;
899 friendly = true;
900 hostile = true;
901 penetrate = -1;
902 }
903 else if (type == 41)
904 {
905 arrow = true;
906 width = 10;
907 height = 10;
908 aiStyle = 1;
909 friendly = true;
910 penetrate = -1;
911 ranged = true;
912 light = 0.3f;
913 }
914 else if (type == 42)
915 {
916 knockBack = 8f;
917 width = 10;
918 height = 10;
919 aiStyle = 10;
920 ranged = true;
921 friendly = true;
922 extraUpdates = 1;
923 }
924 else if (type == 43)
925 {
926 knockBack = 12f;
927 width = 24;
928 height = 24;
929 aiStyle = 17;
930 penetrate = -1;
931 if (Main.getGoodWorld)
932 {
933 friendly = true;
934 hostile = true;
935 }
936 }
937 else if (type == 44)
938 {
939 width = 48;
940 height = 48;
941 alpha = 100;
942 light = 0.2f;
943 aiStyle = 18;
944 hostile = true;
945 penetrate = -1;
946 tileCollide = true;
947 scale = 0.9f;
948 }
949 else if (type == 45)
950 {
951 width = 48;
952 height = 48;
953 alpha = 100;
954 light = 0.2f;
955 aiStyle = 18;
956 friendly = true;
957 penetrate = 5;
958 tileCollide = true;
959 scale = 0.9f;
960 magic = true;
961 }
962 else if (type == 46)
963 {
964 width = 20;
965 height = 20;
966 aiStyle = 19;
967 friendly = true;
968 penetrate = -1;
969 tileCollide = false;
970 scale = 1.1f;
971 hide = true;
972 ownerHitCheck = true;
973 melee = true;
974 }
975 else if (type == 47)
976 {
977 width = 18;
978 height = 18;
979 aiStyle = 19;
980 friendly = true;
981 penetrate = -1;
982 tileCollide = false;
983 scale = 1.1f;
984 hide = true;
985 ownerHitCheck = true;
986 melee = true;
987 }
988 else if (type == 48)
989 {
990 width = 12;
991 height = 12;
992 aiStyle = 2;
993 friendly = true;
994 penetrate = 2;
995 ranged = true;
996 }
997 else if (type == 49)
998 {
999 width = 18;
1000 height = 18;
1001 aiStyle = 19;
1002 friendly = true;
1003 penetrate = -1;
1004 tileCollide = false;
1005 scale = 1.2f;
1006 hide = true;
1007 ownerHitCheck = true;
1008 melee = true;
1009 }
1010 else if (type == 50)
1011 {
1012 netImportant = true;
1013 width = 6;
1014 height = 6;
1015 aiStyle = 14;
1016 penetrate = -1;
1017 alpha = 75;
1018 light = 1f;
1019 timeLeft *= 5;
1020 }
1021 else if (type == 51)
1022 {
1023 width = 8;
1024 height = 8;
1025 aiStyle = 1;
1026 ranged = true;
1027 friendly = true;
1028 }
1029 else if (type == 52)
1030 {
1031 width = 22;
1032 height = 22;
1033 aiStyle = 3;
1034 friendly = true;
1035 penetrate = -1;
1036 melee = true;
1037 }
1038 else if (type == 53)
1039 {
1040 netImportant = true;
1041 width = 6;
1042 height = 6;
1043 aiStyle = 14;
1044 penetrate = -1;
1045 alpha = 75;
1046 light = 1f;
1047 timeLeft *= 5;
1048 tileCollide = false;
1049 }
1050 else if (type == 54)
1051 {
1052 width = 12;
1053 height = 12;
1054 aiStyle = 2;
1055 friendly = true;
1056 penetrate = 2;
1057 ranged = true;
1058 }
1059 else if (type == 55)
1060 {
1061 width = 10;
1062 height = 10;
1063 aiStyle = 0;
1064 hostile = true;
1065 penetrate = -1;
1066 aiStyle = 1;
1067 tileCollide = true;
1068 }
1069 else if (type == 56)
1070 {
1071 knockBack = 6f;
1072 width = 10;
1073 height = 10;
1074 aiStyle = 10;
1075 friendly = true;
1076 hostile = true;
1077 penetrate = -1;
1078 }
1079 else if (type == 57)
1080 {
1081 width = 18;
1082 height = 18;
1083 aiStyle = 20;
1084 friendly = true;
1085 penetrate = -1;
1086 tileCollide = false;
1087 hide = true;
1088 ownerHitCheck = true;
1089 melee = true;
1090 }
1091 else if (type == 58)
1092 {
1093 width = 18;
1094 height = 18;
1095 aiStyle = 20;
1096 friendly = true;
1097 penetrate = -1;
1098 tileCollide = false;
1099 hide = true;
1100 ownerHitCheck = true;
1101 melee = true;
1102 scale = 1.08f;
1103 }
1104 else if (type == 59)
1105 {
1106 width = 22;
1107 height = 22;
1108 aiStyle = 20;
1109 friendly = true;
1110 penetrate = -1;
1111 tileCollide = false;
1112 hide = true;
1113 ownerHitCheck = true;
1114 melee = true;
1115 scale = 0.9f;
1116 }
1117 else if (type == 60)
1118 {
1119 width = 22;
1120 height = 22;
1121 aiStyle = 20;
1122 friendly = true;
1123 penetrate = -1;
1124 tileCollide = false;
1125 hide = true;
1126 ownerHitCheck = true;
1127 melee = true;
1128 scale = 0.9f;
1129 }
1130 else if (type == 61)
1131 {
1132 width = 18;
1133 height = 18;
1134 aiStyle = 20;
1135 friendly = true;
1136 penetrate = -1;
1137 tileCollide = false;
1138 hide = true;
1139 ownerHitCheck = true;
1140 melee = true;
1141 scale = 1.16f;
1142 }
1143 else if (type == 62)
1144 {
1145 width = 22;
1146 height = 22;
1147 aiStyle = 20;
1148 friendly = true;
1149 penetrate = -1;
1150 tileCollide = false;
1151 hide = true;
1152 ownerHitCheck = true;
1153 melee = true;
1154 scale = 0.9f;
1155 }
1156 else if (type == 63)
1157 {
1158 netImportant = true;
1159 width = 22;
1160 height = 22;
1161 aiStyle = 15;
1162 friendly = true;
1163 penetrate = -1;
1164 melee = true;
1165 usesLocalNPCImmunity = true;
1167 }
1168 else if (type == 64)
1169 {
1170 width = 18;
1171 height = 18;
1172 aiStyle = 19;
1173 friendly = true;
1174 penetrate = -1;
1175 tileCollide = false;
1176 scale = 1.25f;
1177 hide = true;
1178 ownerHitCheck = true;
1179 melee = true;
1180 }
1181 else if (type == 65)
1182 {
1183 knockBack = 6f;
1184 width = 10;
1185 height = 10;
1186 aiStyle = 10;
1187 friendly = true;
1188 ranged = true;
1189 penetrate = -1;
1190 extraUpdates = 1;
1191 }
1192 else if (type == 66)
1193 {
1194 width = 18;
1195 height = 18;
1196 aiStyle = 19;
1197 friendly = true;
1198 penetrate = -1;
1199 tileCollide = false;
1200 scale = 1.27f;
1201 hide = true;
1202 ownerHitCheck = true;
1203 melee = true;
1204 }
1205 else if (type == 67)
1206 {
1207 knockBack = 6f;
1208 width = 10;
1209 height = 10;
1210 aiStyle = 10;
1211 friendly = true;
1212 hostile = true;
1213 penetrate = -1;
1214 }
1215 else if (type == 68)
1216 {
1217 knockBack = 6f;
1218 width = 10;
1219 height = 10;
1220 aiStyle = 10;
1221 friendly = true;
1222 ranged = true;
1223 penetrate = -1;
1224 extraUpdates = 1;
1225 }
1226 else if (type == 69)
1227 {
1228 width = 14;
1229 height = 14;
1230 aiStyle = 2;
1231 friendly = true;
1232 penetrate = 1;
1233 }
1234 else if (type == 70)
1235 {
1236 width = 14;
1237 height = 14;
1238 aiStyle = 2;
1239 friendly = true;
1240 penetrate = 1;
1241 }
1242 else if (type == 621)
1243 {
1244 width = 14;
1245 height = 14;
1246 aiStyle = 2;
1247 friendly = true;
1248 penetrate = 1;
1249 }
1250 else if (type == 71)
1251 {
1252 knockBack = 6f;
1253 width = 10;
1254 height = 10;
1255 aiStyle = 10;
1256 friendly = true;
1257 hostile = true;
1258 penetrate = -1;
1259 }
1260 else if (type == 72)
1261 {
1262 netImportant = true;
1263 width = 18;
1264 height = 18;
1265 aiStyle = 11;
1266 friendly = true;
1267 light = 0.9f;
1268 tileCollide = false;
1269 penetrate = -1;
1270 timeLeft *= 5;
1271 ignoreWater = true;
1272 scale = 0.8f;
1273 }
1274 else if (type == 73 || type == 74)
1275 {
1276 netImportant = true;
1277 width = 18;
1278 height = 18;
1279 aiStyle = 7;
1280 friendly = true;
1281 penetrate = -1;
1282 tileCollide = false;
1283 timeLeft *= 10;
1284 light = 0.4f;
1285 }
1286 else if (type == 75)
1287 {
1288 width = 22;
1289 height = 22;
1290 aiStyle = 16;
1291 hostile = true;
1292 penetrate = -1;
1293 }
1294 else if (type == 76 || type == 77 || type == 78)
1295 {
1296 if (type == 76)
1297 {
1298 width = 10;
1299 height = 22;
1300 }
1301 else if (type == 77)
1302 {
1303 width = 18;
1304 height = 24;
1305 }
1306 else
1307 {
1308 width = 22;
1309 height = 24;
1310 }
1311 aiStyle = 21;
1312 friendly = true;
1313 alpha = 100;
1314 light = 0.3f;
1315 penetrate = -1;
1316 timeLeft = 180;
1317 magic = true;
1318 }
1319 else if (type == 79)
1320 {
1321 width = 32;
1322 height = 32;
1323 aiStyle = 9;
1324 friendly = true;
1325 light = 0.8f;
1326 magic = true;
1327 penetrate = 3;
1328 usesLocalNPCImmunity = true;
1330 ignoreWater = true;
1331 }
1332 else if (type == 80)
1333 {
1334 width = 16;
1335 height = 16;
1336 aiStyle = 22;
1337 friendly = true;
1338 magic = true;
1339 tileCollide = false;
1340 light = 0.5f;
1341 coldDamage = true;
1342 }
1343 else if (type == 81)
1344 {
1345 width = 10;
1346 height = 10;
1347 aiStyle = 1;
1348 hostile = true;
1349 }
1350 else if (type == 82)
1351 {
1352 width = 10;
1353 height = 10;
1354 aiStyle = 1;
1355 hostile = true;
1356 }
1357 else if (type == 83)
1358 {
1359 width = 4;
1360 height = 4;
1361 aiStyle = 1;
1362 hostile = true;
1363 penetrate = 3;
1364 light = 0.75f;
1365 alpha = 255;
1366 extraUpdates = 2;
1367 scale = 1.7f;
1368 timeLeft = 600;
1369 magic = true;
1370 }
1371 else if (type == 84)
1372 {
1373 width = 4;
1374 height = 4;
1375 aiStyle = 1;
1376 hostile = true;
1377 penetrate = 3;
1378 light = 0.75f;
1379 alpha = 255;
1380 extraUpdates = 2;
1381 scale = 1.2f;
1382 timeLeft = 600;
1383 magic = true;
1384 }
1385 else if (type == 85)
1386 {
1387 width = 6;
1388 height = 6;
1389 aiStyle = 193;
1390 friendly = true;
1391 alpha = 255;
1392 penetrate = 4;
1393 extraUpdates = 2;
1394 ranged = true;
1395 usesLocalNPCImmunity = true;
1397 }
1398 else if (type == 86)
1399 {
1400 netImportant = true;
1401 width = 18;
1402 height = 18;
1403 aiStyle = 11;
1404 friendly = true;
1405 light = 0.9f;
1406 tileCollide = false;
1407 penetrate = -1;
1408 timeLeft *= 5;
1409 ignoreWater = true;
1410 scale = 0.8f;
1411 }
1412 else if (type == 87)
1413 {
1414 netImportant = true;
1415 width = 18;
1416 height = 18;
1417 aiStyle = 11;
1418 friendly = true;
1419 light = 0.9f;
1420 tileCollide = false;
1421 penetrate = -1;
1422 timeLeft *= 5;
1423 ignoreWater = true;
1424 scale = 0.8f;
1425 }
1426 else if (type == 88)
1427 {
1428 width = 6;
1429 height = 6;
1430 aiStyle = 1;
1431 friendly = true;
1432 penetrate = 3;
1433 light = 0.75f;
1434 alpha = 255;
1435 extraUpdates = 4;
1436 scale = 1.4f;
1437 timeLeft = 600;
1438 magic = true;
1439 }
1440 else if (type == 89)
1441 {
1442 width = 4;
1443 height = 4;
1444 aiStyle = 1;
1445 friendly = true;
1446 penetrate = 1;
1447 light = 0.5f;
1448 alpha = 255;
1449 scale = 1.2f;
1450 timeLeft = 600;
1451 ranged = true;
1452 extraUpdates = 1;
1453 }
1454 else if (type == 90)
1455 {
1456 width = 6;
1457 height = 6;
1458 aiStyle = 24;
1459 friendly = true;
1460 penetrate = 1;
1461 light = 0.5f;
1462 alpha = 50;
1463 scale = 1.2f;
1464 timeLeft = 600;
1465 ranged = true;
1466 tileCollide = false;
1467 }
1468 else if (type == 91)
1469 {
1470 arrow = true;
1471 width = 10;
1472 height = 10;
1473 aiStyle = 1;
1474 friendly = true;
1475 ranged = true;
1476 timeLeft = 1200;
1477 }
1478 else if (type == 92)
1479 {
1480 width = 24;
1481 height = 24;
1482 aiStyle = 5;
1483 friendly = true;
1484 penetrate = 1;
1485 alpha = 50;
1486 scale = 0.8f;
1487 tileCollide = false;
1488 ranged = true;
1489 }
1490 else if (type == 93)
1491 {
1492 light = 0.15f;
1493 width = 12;
1494 height = 12;
1495 aiStyle = 2;
1496 friendly = true;
1497 penetrate = 2;
1498 magic = true;
1499 usesLocalNPCImmunity = true;
1501 }
1502 else if (type == 94)
1503 {
1504 ignoreWater = true;
1505 width = 8;
1506 height = 8;
1507 aiStyle = 24;
1508 friendly = true;
1509 light = 0.5f;
1510 alpha = 50;
1511 scale = 1.2f;
1512 timeLeft = 600;
1513 magic = true;
1514 tileCollide = true;
1515 penetrate = 1;
1516 }
1517 else if (type == 95)
1518 {
1519 width = 16;
1520 height = 16;
1521 aiStyle = 8;
1522 friendly = true;
1523 light = 0.8f;
1524 alpha = 100;
1525 magic = true;
1526 penetrate = 2;
1527 }
1528 else if (type == 96)
1529 {
1530 width = 16;
1531 height = 16;
1532 aiStyle = 8;
1533 hostile = true;
1534 light = 0.8f;
1535 alpha = 100;
1536 magic = true;
1537 penetrate = -1;
1538 scale = 0.9f;
1539 scale = 1.3f;
1540 }
1541 else if (type == 97)
1542 {
1543 width = 18;
1544 height = 18;
1545 aiStyle = 19;
1546 friendly = true;
1547 penetrate = -1;
1548 tileCollide = false;
1549 scale = 1.1f;
1550 hide = true;
1551 ownerHitCheck = true;
1552 melee = true;
1553 }
1554 else if (type == 98)
1555 {
1556 width = 10;
1557 height = 10;
1558 aiStyle = 1;
1559 friendly = true;
1560 hostile = true;
1561 penetrate = -1;
1562 trap = true;
1563 }
1564 else if (type == 99 || type == 727 || type == 1013 || type == 1014)
1565 {
1566 width = 31;
1567 height = 31;
1568 aiStyle = 25;
1569 friendly = true;
1570 hostile = true;
1571 penetrate = -1;
1572 trap = true;
1573 }
1574 else if (type == 1005)
1575 {
1576 width = 15;
1577 height = 15;
1578 aiStyle = 25;
1579 friendly = true;
1580 hostile = true;
1581 penetrate = -1;
1582 trap = true;
1583 }
1584 else if (type == 1021)
1585 {
1586 width = 31;
1587 height = 31;
1588 aiStyle = 25;
1589 hostile = true;
1590 penetrate = -1;
1591 extraUpdates = 1;
1592 timeLeft *= 3;
1593 }
1594 else if (type == 100)
1595 {
1596 width = 4;
1597 height = 4;
1598 aiStyle = 1;
1599 hostile = true;
1600 penetrate = 3;
1601 light = 0.75f;
1602 alpha = 255;
1603 extraUpdates = 2;
1604 scale = 1.8f;
1605 timeLeft = 2700;
1606 magic = true;
1607 }
1608 else if (type == 101)
1609 {
1610 width = 6;
1611 height = 6;
1612 aiStyle = 23;
1613 hostile = true;
1614 alpha = 255;
1615 penetrate = -1;
1616 extraUpdates = 3;
1617 magic = true;
1618 }
1619 else if (type == 102)
1620 {
1621 width = 22;
1622 height = 22;
1623 aiStyle = 16;
1624 hostile = true;
1625 penetrate = -1;
1626 ranged = true;
1627 }
1628 else if (type == 103)
1629 {
1630 arrow = true;
1631 width = 10;
1632 height = 10;
1633 aiStyle = 1;
1634 friendly = true;
1635 light = 1f;
1636 ranged = true;
1637 timeLeft = 1200;
1638 }
1639 else if (type == 104)
1640 {
1641 width = 4;
1642 height = 4;
1643 aiStyle = 1;
1644 friendly = true;
1645 penetrate = 1;
1646 light = 0.5f;
1647 alpha = 255;
1648 scale = 1.2f;
1649 timeLeft = 600;
1650 ranged = true;
1651 extraUpdates = 2;
1652 }
1653 else if (type == 105)
1654 {
1655 width = 18;
1656 height = 18;
1657 aiStyle = 19;
1658 friendly = true;
1659 penetrate = -1;
1660 tileCollide = false;
1661 scale = 1.3f;
1662 hide = true;
1663 ownerHitCheck = true;
1664 melee = true;
1665 }
1666 else if (type == 106)
1667 {
1668 width = 32;
1669 height = 32;
1670 aiStyle = 3;
1671 friendly = true;
1672 penetrate = -1;
1673 melee = true;
1674 light = 0.4f;
1675 }
1676 else if (type == 107)
1677 {
1678 width = 22;
1679 height = 22;
1680 aiStyle = 20;
1681 friendly = true;
1682 penetrate = -1;
1683 tileCollide = false;
1684 hide = true;
1685 ownerHitCheck = true;
1686 melee = true;
1687 scale = 1.1f;
1688 }
1689 else if (type == 108)
1690 {
1691 width = 260;
1692 height = 260;
1693 aiStyle = 16;
1694 friendly = true;
1695 hostile = true;
1696 penetrate = -1;
1697 tileCollide = false;
1698 alpha = 255;
1699 timeLeft = 2;
1700 trap = true;
1701 }
1702 else if (type == 109)
1703 {
1704 knockBack = 6f;
1705 width = 10;
1706 height = 10;
1707 aiStyle = 10;
1708 hostile = true;
1709 scale = 0.9f;
1710 penetrate = -1;
1711 coldDamage = true;
1712 ranged = true;
1713 }
1714 else if (type == 110)
1715 {
1716 width = 4;
1717 height = 4;
1718 aiStyle = 1;
1719 hostile = true;
1720 penetrate = -1;
1721 light = 0.5f;
1722 alpha = 255;
1723 scale = 1.2f;
1724 timeLeft = 600;
1725 ranged = true;
1726 extraUpdates = 1;
1727 }
1728 else if (type == 111)
1729 {
1730 netImportant = true;
1731 width = 18;
1732 height = 18;
1733 aiStyle = 26;
1734 friendly = true;
1735 penetrate = -1;
1736 timeLeft *= 5;
1737 }
1738 else if (type == 112)
1739 {
1740 netImportant = true;
1741 width = 18;
1742 height = 18;
1743 aiStyle = 26;
1744 friendly = true;
1745 penetrate = -1;
1746 timeLeft *= 5;
1747 }
1748 else if (type == 113)
1749 {
1750 width = 22;
1751 height = 22;
1752 aiStyle = 3;
1753 friendly = true;
1754 penetrate = -1;
1755 melee = true;
1756 light = 0.4f;
1757 coldDamage = true;
1758 }
1759 else if (type == 114)
1760 {
1761 width = 16;
1762 height = 16;
1763 aiStyle = 27;
1764 magic = true;
1765 penetrate = 3;
1766 light = 0.5f;
1767 alpha = 255;
1768 friendly = true;
1769 }
1770 else if (type == 115)
1771 {
1772 width = 16;
1773 height = 16;
1774 aiStyle = 27;
1775 hostile = true;
1776 magic = true;
1777 penetrate = -1;
1778 light = 0.5f;
1779 alpha = 255;
1780 }
1781 else if (type == 116)
1782 {
1783 width = 16;
1784 height = 16;
1785 aiStyle = 27;
1786 melee = true;
1787 penetrate = 1;
1788 light = 0.5f;
1789 alpha = 255;
1790 friendly = true;
1791 }
1792 else if (type == 117)
1793 {
1794 arrow = true;
1795 extraUpdates = 2;
1796 width = 10;
1797 height = 10;
1798 aiStyle = 1;
1799 friendly = true;
1800 ranged = true;
1801 timeLeft = 1200;
1802 }
1803 else if (type == 118)
1804 {
1805 width = 10;
1806 height = 10;
1807 aiStyle = 28;
1808 alpha = 255;
1809 melee = true;
1810 penetrate = 1;
1811 friendly = true;
1812 coldDamage = true;
1813 }
1814 else if (type == 119)
1815 {
1816 width = 14;
1817 height = 14;
1818 aiStyle = 28;
1819 alpha = 255;
1820 melee = true;
1821 penetrate = 3;
1822 friendly = true;
1823 coldDamage = true;
1826 }
1827 else if (type == 120)
1828 {
1829 arrow = true;
1830 width = 10;
1831 height = 10;
1832 aiStyle = 1;
1833 friendly = true;
1834 ranged = true;
1835 coldDamage = true;
1836 extraUpdates = 1;
1837 timeLeft = 1200;
1838 }
1839 else if (type == 121)
1840 {
1841 width = 10;
1842 height = 10;
1843 aiStyle = 29;
1844 alpha = 255;
1845 magic = true;
1846 penetrate = 1;
1847 friendly = true;
1848 }
1849 else if (type == 122)
1850 {
1851 width = 10;
1852 height = 10;
1853 aiStyle = 29;
1854 alpha = 255;
1855 magic = true;
1856 penetrate = 1;
1857 friendly = true;
1858 }
1859 else if (type == 123)
1860 {
1861 width = 10;
1862 height = 10;
1863 aiStyle = 29;
1864 alpha = 255;
1865 magic = true;
1866 penetrate = 1;
1867 friendly = true;
1868 }
1869 else if (type == 124)
1870 {
1871 width = 10;
1872 height = 10;
1873 aiStyle = 29;
1874 alpha = 255;
1875 magic = true;
1876 penetrate = 2;
1877 friendly = true;
1878 }
1879 else if (type == 125)
1880 {
1881 width = 10;
1882 height = 10;
1883 aiStyle = 29;
1884 alpha = 255;
1885 magic = true;
1886 penetrate = 2;
1887 friendly = true;
1888 }
1889 else if (type == 126)
1890 {
1891 width = 10;
1892 height = 10;
1893 aiStyle = 29;
1894 alpha = 255;
1895 magic = true;
1896 penetrate = 2;
1897 friendly = true;
1898 }
1899 else if (type == 127)
1900 {
1901 netImportant = true;
1902 width = 22;
1903 height = 22;
1904 aiStyle = 26;
1905 friendly = true;
1906 penetrate = -1;
1907 timeLeft *= 5;
1908 }
1909 else if (type == 128)
1910 {
1911 width = 14;
1912 height = 14;
1913 aiStyle = 28;
1914 alpha = 255;
1915 penetrate = -1;
1916 friendly = false;
1917 hostile = true;
1918 coldDamage = true;
1919 }
1920 else if (type == 129)
1921 {
1922 width = 14;
1923 height = 14;
1924 aiStyle = 28;
1925 alpha = 255;
1926 penetrate = -1;
1927 friendly = false;
1928 hostile = true;
1929 tileCollide = false;
1930 }
1931 else if (type == 130)
1932 {
1933 width = 22;
1934 height = 22;
1935 aiStyle = 19;
1936 friendly = true;
1937 penetrate = -1;
1938 tileCollide = false;
1939 scale = 1.2f;
1940 hide = true;
1941 ownerHitCheck = true;
1942 melee = true;
1943 }
1944 else if (type == 131)
1945 {
1946 width = 22;
1947 height = 22;
1948 aiStyle = 30;
1949 friendly = true;
1950 penetrate = 1;
1951 tileCollide = false;
1952 melee = true;
1953 light = 0.5f;
1954 }
1955 else if (type == 132)
1956 {
1957 width = 16;
1958 height = 16;
1959 aiStyle = 27;
1960 melee = true;
1961 penetrate = 3;
1962 light = 0.5f;
1963 alpha = 255;
1964 friendly = true;
1965 usesLocalNPCImmunity = true;
1967 }
1968 else if (type == 133)
1969 {
1970 width = 14;
1971 height = 14;
1972 aiStyle = 16;
1973 friendly = true;
1974 penetrate = -1;
1975 ranged = true;
1976 usesLocalNPCImmunity = true;
1978 }
1979 else if (type == 134)
1980 {
1981 width = 14;
1982 height = 14;
1983 aiStyle = 16;
1984 friendly = true;
1985 penetrate = -1;
1986 ranged = true;
1987 }
1988 else if (type == 135)
1989 {
1990 width = 14;
1991 height = 14;
1992 aiStyle = 16;
1993 friendly = true;
1994 penetrate = -1;
1995 ranged = true;
1996 }
1997 else if (type == 136)
1998 {
1999 width = 14;
2000 height = 14;
2001 aiStyle = 16;
2002 friendly = true;
2003 penetrate = -1;
2004 ranged = true;
2005 usesLocalNPCImmunity = true;
2007 }
2008 else if (type == 137)
2009 {
2010 width = 14;
2011 height = 14;
2012 aiStyle = 16;
2013 friendly = true;
2014 penetrate = -1;
2015 ranged = true;
2016 }
2017 else if (type == 138)
2018 {
2019 width = 14;
2020 height = 14;
2021 aiStyle = 16;
2022 friendly = true;
2023 penetrate = -1;
2024 ranged = true;
2025 }
2026 else if (type == 139)
2027 {
2028 width = 14;
2029 height = 14;
2030 aiStyle = 16;
2031 friendly = true;
2032 penetrate = -1;
2033 ranged = true;
2034 usesLocalNPCImmunity = true;
2036 }
2037 else if (type == 140)
2038 {
2039 width = 14;
2040 height = 14;
2041 aiStyle = 16;
2042 friendly = true;
2043 penetrate = -1;
2044 ranged = true;
2045 }
2046 else if (type == 141)
2047 {
2048 width = 14;
2049 height = 14;
2050 aiStyle = 16;
2051 friendly = true;
2052 penetrate = -1;
2053 ranged = true;
2054 }
2055 else if (type == 142)
2056 {
2057 width = 14;
2058 height = 14;
2059 aiStyle = 16;
2060 friendly = true;
2061 penetrate = -1;
2062 ranged = true;
2063 usesLocalNPCImmunity = true;
2065 }
2066 else if (type == 143)
2067 {
2068 width = 14;
2069 height = 14;
2070 aiStyle = 16;
2071 friendly = true;
2072 penetrate = -1;
2073 ranged = true;
2074 }
2075 else if (type == 144)
2076 {
2077 width = 14;
2078 height = 14;
2079 aiStyle = 16;
2080 friendly = true;
2081 penetrate = -1;
2082 ranged = true;
2083 }
2084 else if (type == 145)
2085 {
2086 width = 6;
2087 height = 6;
2088 aiStyle = 31;
2089 friendly = true;
2090 alpha = 255;
2091 penetrate = -1;
2092 extraUpdates = 2;
2093 tileCollide = false;
2094 ignoreWater = true;
2095 }
2096 else if (type == 146)
2097 {
2098 width = 6;
2099 height = 6;
2100 aiStyle = 31;
2101 friendly = true;
2102 alpha = 255;
2103 penetrate = -1;
2104 extraUpdates = 2;
2105 tileCollide = false;
2106 ignoreWater = true;
2107 }
2108 else if (type == 147)
2109 {
2110 width = 6;
2111 height = 6;
2112 aiStyle = 31;
2113 friendly = true;
2114 alpha = 255;
2115 penetrate = -1;
2116 extraUpdates = 2;
2117 tileCollide = false;
2118 ignoreWater = true;
2119 }
2120 else if (type == 148)
2121 {
2122 width = 6;
2123 height = 6;
2124 aiStyle = 31;
2125 friendly = true;
2126 alpha = 255;
2127 penetrate = -1;
2128 extraUpdates = 2;
2129 tileCollide = false;
2130 ignoreWater = true;
2131 }
2132 else if (type == 149)
2133 {
2134 width = 6;
2135 height = 6;
2136 aiStyle = 31;
2137 friendly = true;
2138 alpha = 255;
2139 penetrate = -1;
2140 extraUpdates = 2;
2141 tileCollide = false;
2142 ignoreWater = true;
2143 }
2144 else if (type == 150 || type == 151 || type == 152)
2145 {
2146 width = 28;
2147 height = 28;
2148 aiStyle = 4;
2149 friendly = true;
2150 penetrate = -1;
2151 tileCollide = false;
2152 alpha = 255;
2153 ignoreWater = true;
2154 magic = true;
2155 }
2156 else if (type == 153)
2157 {
2158 width = 18;
2159 height = 18;
2160 aiStyle = 19;
2161 friendly = true;
2162 penetrate = -1;
2163 tileCollide = false;
2164 scale = 1.1f;
2165 hide = true;
2166 ownerHitCheck = true;
2167 melee = true;
2168 }
2169 else if (type == 154)
2170 {
2171 netImportant = true;
2172 width = 22;
2173 height = 22;
2174 aiStyle = 15;
2175 friendly = true;
2176 penetrate = -1;
2177 melee = true;
2178 scale = 0.8f;
2179 usesLocalNPCImmunity = true;
2181 }
2182 else if (type == 155)
2183 {
2184 netImportant = true;
2185 width = 44;
2186 height = 44;
2187 aiStyle = 32;
2188 friendly = true;
2189 }
2190 else if (type == 156)
2191 {
2192 width = 16;
2193 height = 16;
2194 aiStyle = 27;
2195 melee = true;
2196 penetrate = 2;
2197 light = 0.5f;
2198 alpha = 255;
2199 friendly = true;
2200 usesLocalNPCImmunity = true;
2202 }
2203 else if (type == 157)
2204 {
2205 width = 32;
2206 height = 32;
2207 aiStyle = 27;
2208 melee = true;
2209 light = 0.5f;
2210 alpha = 255;
2211 friendly = true;
2212 scale = 1.2f;
2213 }
2214 else if (type == 158)
2215 {
2216 width = 4;
2217 height = 4;
2218 aiStyle = 1;
2219 friendly = true;
2220 penetrate = 1;
2221 alpha = 255;
2222 timeLeft = 600;
2223 ranged = true;
2224 extraUpdates = 1;
2225 }
2226 else if (type == 159)
2227 {
2228 width = 4;
2229 height = 4;
2230 aiStyle = 1;
2231 friendly = true;
2232 penetrate = 1;
2233 alpha = 255;
2234 timeLeft = 600;
2235 ranged = true;
2236 extraUpdates = 1;
2237 }
2238 else if (type == 160)
2239 {
2240 width = 4;
2241 height = 4;
2242 aiStyle = 1;
2243 friendly = true;
2244 penetrate = 1;
2245 alpha = 255;
2246 timeLeft = 600;
2247 ranged = true;
2248 extraUpdates = 1;
2249 }
2250 else if (type == 161)
2251 {
2252 width = 4;
2253 height = 4;
2254 aiStyle = 1;
2255 friendly = true;
2256 penetrate = 1;
2257 alpha = 255;
2258 timeLeft = 600;
2259 ranged = true;
2260 extraUpdates = 1;
2261 }
2262 else if (type == 162)
2263 {
2264 width = 16;
2265 height = 16;
2266 aiStyle = 2;
2267 friendly = true;
2268 penetrate = 4;
2269 alpha = 255;
2270 }
2271 else if (type == 163)
2272 {
2273 netImportant = true;
2274 width = 6;
2275 height = 6;
2276 aiStyle = 33;
2277 friendly = true;
2278 penetrate = -1;
2279 alpha = 255;
2280 timeLeft = 36000;
2281 }
2282 else if (type == 164)
2283 {
2284 width = 128;
2285 height = 128;
2286 aiStyle = 16;
2287 friendly = true;
2288 hostile = true;
2289 penetrate = -1;
2290 tileCollide = false;
2291 alpha = 255;
2292 timeLeft = 2;
2293 }
2294 else if (type == 165)
2295 {
2296 netImportant = true;
2297 width = 12;
2298 height = 12;
2299 aiStyle = 7;
2300 friendly = true;
2301 penetrate = -1;
2302 tileCollide = false;
2303 timeLeft *= 10;
2304 }
2305 else if (type == 166)
2306 {
2307 width = 14;
2308 height = 14;
2309 aiStyle = 2;
2310 friendly = true;
2311 ranged = true;
2312 coldDamage = true;
2313 }
2314 else if (type == 167 || type == 168 || type == 169 || type == 170)
2315 {
2316 width = 14;
2317 height = 14;
2318 aiStyle = 34;
2319 friendly = true;
2320 ranged = true;
2321 timeLeft = 45;
2325 }
2326 else if (type == 171 || type == 505 || type == 506)
2327 {
2328 width = 14;
2329 height = 14;
2330 aiStyle = 35;
2331 penetrate = -1;
2332 tileCollide = false;
2333 timeLeft = 400;
2334 }
2335 else if (type == 172)
2336 {
2337 arrow = true;
2338 width = 10;
2339 height = 10;
2340 aiStyle = 1;
2341 friendly = true;
2342 light = 1f;
2343 ranged = true;
2344 coldDamage = true;
2345 timeLeft = 1200;
2346 }
2347 else if (type == 173)
2348 {
2349 width = 16;
2350 height = 16;
2351 aiStyle = 27;
2352 melee = true;
2353 penetrate = 1;
2354 light = 0.2f;
2355 alpha = 255;
2356 friendly = true;
2357 }
2358 else if (type == 174)
2359 {
2360 alpha = 255;
2361 width = 6;
2362 height = 6;
2363 aiStyle = 1;
2364 hostile = true;
2365 penetrate = -1;
2366 coldDamage = true;
2367 }
2368 else if (type == 175)
2369 {
2370 width = 34;
2371 height = 34;
2372 aiStyle = 26;
2373 friendly = true;
2374 penetrate = -1;
2375 timeLeft *= 5;
2376 }
2377 else if (type == 176)
2378 {
2379 alpha = 255;
2380 width = 6;
2381 height = 6;
2382 aiStyle = 1;
2383 hostile = true;
2384 penetrate = -1;
2385 }
2386 else if (type == 177)
2387 {
2388 width = 10;
2389 height = 10;
2390 aiStyle = 28;
2391 alpha = 255;
2392 penetrate = -1;
2393 friendly = false;
2394 hostile = true;
2395 coldDamage = true;
2396 }
2397 else if (type == 178)
2398 {
2399 width = 10;
2400 height = 10;
2401 aiStyle = 1;
2402 alpha = 255;
2403 penetrate = -1;
2404 timeLeft = 2;
2405 }
2406 else if (type == 179)
2407 {
2408 knockBack = 6f;
2409 width = 10;
2410 height = 10;
2411 aiStyle = 10;
2412 friendly = true;
2413 hostile = true;
2414 penetrate = -1;
2415 }
2416 else if (type == 180)
2417 {
2418 width = 4;
2419 height = 4;
2420 aiStyle = 1;
2421 hostile = true;
2422 penetrate = -1;
2423 light = 0.5f;
2424 alpha = 255;
2425 scale = 1.2f;
2426 timeLeft = 600;
2427 extraUpdates = 1;
2428 }
2429 else if (type == 181)
2430 {
2431 width = 8;
2432 height = 8;
2433 aiStyle = 36;
2434 friendly = true;
2435 penetrate = 3;
2436 alpha = 255;
2437 timeLeft = 600;
2438 extraUpdates = 3;
2439 noEnchantmentVisuals = true;
2440 }
2441 else if (type == 182)
2442 {
2443 light = 0.15f;
2444 width = 30;
2445 height = 30;
2446 aiStyle = 3;
2447 friendly = true;
2448 penetrate = 10;
2449 melee = true;
2450 extraUpdates = 1;
2451 }
2452 else if (type == 183)
2453 {
2454 width = 14;
2455 height = 22;
2456 aiStyle = 14;
2457 penetrate = 1;
2458 timeLeft = 180;
2459 ranged = true;
2460 friendly = true;
2461 }
2462 else if (type == 184)
2463 {
2464 width = 10;
2465 height = 10;
2466 aiStyle = 1;
2467 friendly = true;
2468 hostile = true;
2469 penetrate = -1;
2470 trap = true;
2471 }
2472 else if (type == 185)
2473 {
2474 width = 14;
2475 height = 14;
2476 aiStyle = 14;
2477 friendly = true;
2478 hostile = true;
2479 penetrate = -1;
2480 timeLeft = 900;
2481 trap = true;
2482 }
2483 else if (type == 186)
2484 {
2485 width = 10;
2486 height = 14;
2487 aiStyle = 37;
2488 friendly = true;
2489 tileCollide = false;
2490 ignoreWater = true;
2491 hostile = true;
2492 penetrate = -1;
2493 timeLeft = 300;
2494 trap = true;
2495 }
2496 else if (type == 187)
2497 {
2498 width = 6;
2499 height = 6;
2500 aiStyle = 38;
2501 alpha = 255;
2502 tileCollide = false;
2503 ignoreWater = true;
2504 timeLeft = 60;
2505 trap = true;
2506 }
2507 else if (type == 188)
2508 {
2509 width = 6;
2510 height = 6;
2511 aiStyle = 23;
2512 friendly = true;
2513 hostile = true;
2514 alpha = 255;
2515 penetrate = -1;
2516 extraUpdates = 2;
2517 trap = true;
2518 }
2519 else if (type == 189)
2520 {
2521 width = 8;
2522 height = 8;
2523 aiStyle = 36;
2524 friendly = true;
2525 penetrate = 3;
2526 alpha = 255;
2527 timeLeft = 600;
2528 magic = true;
2529 extraUpdates = 3;
2532 }
2533 else if (type == 190)
2534 {
2535 width = 22;
2536 height = 22;
2537 aiStyle = 39;
2538 friendly = true;
2539 penetrate = -1;
2540 alpha = 255;
2541 ranged = true;
2542 usesLocalNPCImmunity = true;
2544 }
2545 else if (type >= 191 && type <= 194)
2546 {
2547 netImportant = true;
2548 width = 18;
2549 height = 18;
2550 aiStyle = 26;
2551 penetrate = -1;
2552 timeLeft *= 5;
2553 minion = true;
2554 minionSlots = 1f;
2555 if (type == 192)
2556 {
2557 scale = 1.025f;
2558 }
2559 if (type == 193)
2560 {
2561 scale = 1.05f;
2562 }
2563 if (type == 194)
2564 {
2565 scale = 1.075f;
2566 }
2567 }
2568 else if (type == 195)
2569 {
2570 tileCollide = false;
2571 width = 10;
2572 height = 10;
2573 aiStyle = 1;
2574 friendly = true;
2575 extraUpdates = 1;
2576 }
2577 else if (type == 196)
2578 {
2579 width = 16;
2580 height = 16;
2581 aiStyle = 14;
2582 penetrate = -1;
2583 scale = 0.8f;
2584 }
2585 else if (type == 197)
2586 {
2587 netImportant = true;
2588 width = 42;
2589 height = 42;
2590 aiStyle = 26;
2591 friendly = true;
2592 penetrate = -1;
2593 timeLeft *= 5;
2594 }
2595 else if (type == 198)
2596 {
2597 netImportant = true;
2598 width = 26;
2599 height = 26;
2600 aiStyle = 26;
2601 friendly = true;
2602 penetrate = -1;
2603 timeLeft *= 5;
2604 }
2605 else if (type == 199)
2606 {
2607 netImportant = true;
2608 width = 28;
2609 height = 28;
2610 aiStyle = 26;
2611 friendly = true;
2612 penetrate = -1;
2613 timeLeft *= 5;
2614 ignoreWater = true;
2615 }
2616 else if (type == 200)
2617 {
2618 netImportant = true;
2619 width = 28;
2620 height = 28;
2621 aiStyle = 26;
2622 friendly = true;
2623 penetrate = -1;
2624 timeLeft *= 5;
2625 }
2626 else if (type == 201)
2627 {
2628 knockBack = 12f;
2629 width = 24;
2630 height = 24;
2631 aiStyle = 17;
2632 penetrate = -1;
2633 if (Main.getGoodWorld)
2634 {
2635 friendly = true;
2636 hostile = true;
2637 }
2638 }
2639 else if (type == 202)
2640 {
2641 knockBack = 12f;
2642 width = 24;
2643 height = 24;
2644 aiStyle = 17;
2645 penetrate = -1;
2646 if (Main.getGoodWorld)
2647 {
2648 friendly = true;
2649 hostile = true;
2650 }
2651 }
2652 else if (type == 203)
2653 {
2654 knockBack = 12f;
2655 width = 24;
2656 height = 24;
2657 aiStyle = 17;
2658 penetrate = -1;
2659 if (Main.getGoodWorld)
2660 {
2661 friendly = true;
2662 hostile = true;
2663 }
2664 }
2665 else if (type == 204)
2666 {
2667 knockBack = 12f;
2668 width = 24;
2669 height = 24;
2670 aiStyle = 17;
2671 penetrate = -1;
2672 if (Main.getGoodWorld)
2673 {
2674 friendly = true;
2675 hostile = true;
2676 }
2677 }
2678 else if (type == 205)
2679 {
2680 knockBack = 12f;
2681 width = 24;
2682 height = 24;
2683 aiStyle = 17;
2684 penetrate = -1;
2685 if (Main.getGoodWorld)
2686 {
2687 friendly = true;
2688 hostile = true;
2689 }
2690 }
2691 else if (type == 206)
2692 {
2693 width = 14;
2694 height = 14;
2695 aiStyle = 40;
2696 friendly = true;
2697 penetrate = 1;
2698 alpha = 255;
2699 timeLeft = 600;
2700 magic = true;
2701 }
2702 else if (type == 207)
2703 {
2704 width = 4;
2705 height = 4;
2706 aiStyle = 1;
2707 friendly = true;
2708 penetrate = 1;
2709 light = 0.5f;
2710 alpha = 255;
2711 extraUpdates = 2;
2712 scale = 1.2f;
2713 timeLeft = 600;
2714 ranged = true;
2715 }
2716 else if (type == 208)
2717 {
2718 netImportant = true;
2719 width = 18;
2720 height = 36;
2721 aiStyle = 26;
2722 friendly = true;
2723 penetrate = -1;
2724 timeLeft *= 5;
2725 }
2726 else if (type == 209)
2727 {
2728 width = 12;
2729 height = 32;
2730 aiStyle = 26;
2731 friendly = true;
2732 penetrate = -1;
2733 timeLeft *= 5;
2734 light = 0.5f;
2735 }
2736 else if (type == 210)
2737 {
2738 netImportant = true;
2739 width = 14;
2740 height = 30;
2741 aiStyle = 26;
2742 friendly = true;
2743 penetrate = -1;
2744 timeLeft *= 5;
2745 }
2746 else if (type == 211)
2747 {
2748 netImportant = true;
2749 width = 24;
2750 height = 24;
2751 aiStyle = 26;
2752 friendly = true;
2753 penetrate = -1;
2754 timeLeft *= 5;
2755 light = 1f;
2756 ignoreWater = true;
2757 }
2758 else if (type == 212)
2759 {
2760 width = 18;
2761 height = 18;
2762 aiStyle = 19;
2763 friendly = true;
2764 penetrate = -1;
2765 tileCollide = false;
2766 scale = 1.12f;
2767 hide = true;
2768 ownerHitCheck = true;
2769 melee = true;
2770 }
2771 else if (type == 213)
2772 {
2773 width = 22;
2774 height = 22;
2775 aiStyle = 20;
2776 friendly = true;
2777 penetrate = -1;
2778 tileCollide = false;
2779 hide = true;
2780 ownerHitCheck = true;
2781 melee = true;
2782 scale = 0.92f;
2783 }
2784 else if (type == 214)
2785 {
2786 width = 18;
2787 height = 18;
2788 aiStyle = 20;
2789 friendly = true;
2790 penetrate = -1;
2791 tileCollide = false;
2792 hide = true;
2793 ownerHitCheck = true;
2794 melee = true;
2795 }
2796 else if (type == 215)
2797 {
2798 width = 18;
2799 height = 18;
2800 aiStyle = 19;
2801 friendly = true;
2802 penetrate = -1;
2803 tileCollide = false;
2804 scale = 1.27f;
2805 hide = true;
2806 ownerHitCheck = true;
2807 melee = true;
2808 }
2809 else if (type == 216)
2810 {
2811 width = 22;
2812 height = 22;
2813 aiStyle = 20;
2814 friendly = true;
2815 penetrate = -1;
2816 tileCollide = false;
2817 hide = true;
2818 ownerHitCheck = true;
2819 melee = true;
2820 scale = 0.93f;
2821 }
2822 else if (type == 217)
2823 {
2824 width = 18;
2825 height = 18;
2826 aiStyle = 20;
2827 friendly = true;
2828 penetrate = -1;
2829 tileCollide = false;
2830 hide = true;
2831 ownerHitCheck = true;
2832 melee = true;
2833 scale = 1.12f;
2834 }
2835 else if (type == 218)
2836 {
2837 width = 18;
2838 height = 18;
2839 aiStyle = 19;
2840 friendly = true;
2841 penetrate = -1;
2842 tileCollide = false;
2843 scale = 1.28f;
2844 hide = true;
2845 ownerHitCheck = true;
2846 melee = true;
2847 }
2848 else if (type == 219)
2849 {
2850 width = 22;
2851 height = 22;
2852 aiStyle = 20;
2853 friendly = true;
2854 penetrate = -1;
2855 tileCollide = false;
2856 hide = true;
2857 ownerHitCheck = true;
2858 melee = true;
2859 scale = 0.95f;
2860 }
2861 else if (type == 220)
2862 {
2863 width = 18;
2864 height = 18;
2865 aiStyle = 20;
2866 friendly = true;
2867 penetrate = -1;
2868 tileCollide = false;
2869 hide = true;
2870 ownerHitCheck = true;
2871 melee = true;
2872 scale = 1.2f;
2873 }
2874 else if (type == 221)
2875 {
2876 width = 20;
2877 height = 20;
2878 aiStyle = 41;
2879 friendly = true;
2880 tileCollide = false;
2881 ignoreWater = true;
2882 timeLeft = 120;
2883 penetrate = -1;
2884 scale = 1f + (float)Main.rand.Next(30) * 0.01f;
2885 extraUpdates = 2;
2886 }
2887 else if (type == 222)
2888 {
2889 width = 18;
2890 height = 18;
2891 aiStyle = 19;
2892 friendly = true;
2893 penetrate = -1;
2894 tileCollide = false;
2895 scale = 1.3f;
2896 hide = true;
2897 ownerHitCheck = true;
2898 melee = true;
2899 }
2900 else if (type == 223)
2901 {
2902 width = 22;
2903 height = 22;
2904 aiStyle = 20;
2905 friendly = true;
2906 penetrate = -1;
2907 tileCollide = false;
2908 hide = true;
2909 ownerHitCheck = true;
2910 melee = true;
2911 scale = 1f;
2912 }
2913 else if (type == 224)
2914 {
2915 width = 18;
2916 height = 18;
2917 aiStyle = 20;
2918 friendly = true;
2919 penetrate = -1;
2920 tileCollide = false;
2921 hide = true;
2922 ownerHitCheck = true;
2923 melee = true;
2924 scale = 1.1f;
2925 }
2926 else if (type == 225)
2927 {
2928 arrow = true;
2929 width = 10;
2930 height = 10;
2931 aiStyle = 1;
2932 friendly = true;
2933 ranged = true;
2934 extraUpdates = 1;
2935 timeLeft = 1200;
2936 }
2937 else if (type == 226)
2938 {
2939 netImportant = true;
2940 width = 22;
2941 height = 42;
2942 aiStyle = 42;
2943 friendly = true;
2944 tileCollide = false;
2945 penetrate = -1;
2946 timeLeft *= 5;
2947 light = 0.4f;
2948 ignoreWater = true;
2949 }
2950 else if (type == 227)
2951 {
2952 netImportant = true;
2953 tileCollide = false;
2954 width = 14;
2955 height = 14;
2956 aiStyle = 43;
2957 friendly = true;
2958 penetrate = 1;
2959 timeLeft = 180;
2960 extraUpdates = 180;
2961 hide = true;
2962 }
2963 else if (type == 228)
2964 {
2965 tileCollide = false;
2966 width = 30;
2967 height = 30;
2968 aiStyle = 44;
2969 friendly = true;
2970 melee = true;
2971 scale = 1.1f;
2972 penetrate = -1;
2973 noEnchantmentVisuals = true;
2976 }
2977 else if (type == 229)
2978 {
2979 width = 30;
2980 height = 30;
2981 aiStyle = 44;
2982 friendly = true;
2983 melee = true;
2984 penetrate = -1;
2985 light = 0.2f;
2986 noEnchantmentVisuals = true;
2989 }
2990 else if (type >= 230 && type <= 235)
2991 {
2992 netImportant = true;
2993 width = 18;
2994 height = 18;
2995 aiStyle = 7;
2996 friendly = true;
2997 penetrate = -1;
2998 tileCollide = false;
2999 timeLeft *= 10;
3000 }
3001 else if (type == 236)
3002 {
3003 netImportant = true;
3004 width = 34;
3005 height = 34;
3006 aiStyle = 26;
3007 friendly = true;
3008 penetrate = -1;
3009 timeLeft *= 5;
3010 }
3011 else if (type == 237)
3012 {
3013 netImportant = true;
3014 width = 28;
3015 height = 28;
3016 aiStyle = 45;
3017 penetrate = -1;
3018 }
3019 else if (type == 238)
3020 {
3021 netImportant = true;
3022 tileCollide = false;
3023 ignoreWater = true;
3024 width = 54;
3025 height = 28;
3026 aiStyle = 45;
3027 penetrate = -1;
3028 timeLeft = 18000;
3029 }
3030 else if (type == 239)
3031 {
3032 ignoreWater = true;
3033 width = 4;
3034 height = 40;
3035 aiStyle = 45;
3036 friendly = true;
3037 penetrate = 5;
3038 timeLeft = 300;
3039 scale = 1.1f;
3040 magic = true;
3041 extraUpdates = 1;
3044 }
3045 else if (type == 240)
3046 {
3047 width = 16;
3048 height = 16;
3049 aiStyle = 2;
3050 hostile = true;
3051 penetrate = -1;
3052 alpha = 255;
3053 }
3054 else if (type == 241)
3055 {
3056 knockBack = 6f;
3057 width = 10;
3058 height = 10;
3059 aiStyle = 10;
3060 friendly = true;
3061 hostile = true;
3062 penetrate = -1;
3063 }
3064 else if (type == 242)
3065 {
3066 width = 4;
3067 height = 4;
3068 aiStyle = 1;
3069 friendly = true;
3070 penetrate = 3;
3071 light = 0.5f;
3072 alpha = 255;
3073 extraUpdates = 7;
3074 scale = 1.18f;
3075 timeLeft = 600;
3076 ranged = true;
3077 ignoreWater = true;
3078 usesLocalNPCImmunity = true;
3080 }
3081 else if (type == 243)
3082 {
3083 netImportant = true;
3084 width = 28;
3085 height = 28;
3086 aiStyle = 45;
3087 penetrate = -1;
3088 }
3089 else if (type == 244)
3090 {
3091 netImportant = true;
3092 tileCollide = false;
3093 ignoreWater = true;
3094 width = 54;
3095 height = 28;
3096 aiStyle = 45;
3097 penetrate = -1;
3098 timeLeft = 18000;
3099 }
3100 else if (type == 245)
3101 {
3102 ignoreWater = true;
3103 width = 4;
3104 height = 40;
3105 aiStyle = 45;
3106 friendly = true;
3107 penetrate = 2;
3108 timeLeft = 300;
3109 scale = 1.1f;
3110 magic = true;
3111 extraUpdates = 1;
3114 }
3115 else if (type == 246)
3116 {
3117 width = 10;
3118 height = 10;
3119 aiStyle = 1;
3120 friendly = true;
3121 ranged = true;
3122 alpha = 255;
3123 extraUpdates = 1;
3124 }
3125 else if (type == 247)
3126 {
3127 netImportant = true;
3128 width = 34;
3129 height = 34;
3130 aiStyle = 15;
3131 friendly = true;
3132 penetrate = -1;
3133 melee = true;
3134 usesLocalNPCImmunity = true;
3136 }
3137 else if (type == 248)
3138 {
3139 width = 18;
3140 height = 18;
3141 aiStyle = 1;
3142 friendly = true;
3143 melee = true;
3144 }
3145 else if (type == 249)
3146 {
3147 width = 12;
3148 height = 12;
3149 aiStyle = 2;
3150 friendly = true;
3151 ranged = true;
3152 }
3153 else if (type == 250)
3154 {
3155 width = 12;
3156 height = 12;
3157 aiStyle = 46;
3158 penetrate = -1;
3159 magic = true;
3160 alpha = 255;
3161 ignoreWater = true;
3162 scale = 1.25f;
3165 }
3166 else if (type == 251)
3167 {
3168 width = 14;
3169 height = 14;
3170 aiStyle = 46;
3171 friendly = true;
3172 penetrate = -1;
3173 magic = true;
3174 alpha = 255;
3175 light = 0.3f;
3176 tileCollide = false;
3177 ignoreWater = true;
3178 scale = 1.25f;
3181 }
3182 else if (type == 252)
3183 {
3184 width = 18;
3185 height = 18;
3186 aiStyle = 20;
3187 friendly = true;
3188 penetrate = -1;
3189 tileCollide = false;
3190 hide = true;
3191 ownerHitCheck = true;
3192 melee = true;
3193 scale = 1.1f;
3194 }
3195 else if (type == 253)
3196 {
3197 width = 16;
3198 height = 16;
3199 aiStyle = 8;
3200 friendly = true;
3201 light = 0.8f;
3202 alpha = 100;
3203 magic = true;
3204 coldDamage = true;
3205 }
3206 else if (type == 254)
3207 {
3208 width = 38;
3209 height = 38;
3210 aiStyle = 47;
3211 magic = true;
3212 timeLeft = 900;
3213 light = 0.5f;
3214 }
3215 else if (type == 255)
3216 {
3217 width = 8;
3218 height = 8;
3219 aiStyle = 48;
3220 friendly = true;
3221 magic = true;
3222 extraUpdates = 100;
3223 timeLeft = 100;
3224 }
3225 else if (type == 256)
3226 {
3227 netImportant = true;
3228 tileCollide = false;
3229 width = 6;
3230 height = 6;
3231 aiStyle = 7;
3232 friendly = true;
3233 penetrate = -1;
3234 scale = 1f;
3235 timeLeft *= 10;
3236 }
3237 else if (type == 257)
3238 {
3239 ignoreWater = true;
3240 width = 4;
3241 height = 4;
3242 aiStyle = 1;
3243 hostile = true;
3244 penetrate = -1;
3245 light = 0.75f;
3246 alpha = 255;
3247 scale = 1.2f;
3248 timeLeft = 600;
3249 magic = true;
3250 coldDamage = true;
3251 extraUpdates = 1;
3252 }
3253 else if (type == 258)
3254 {
3255 width = 16;
3256 height = 16;
3257 aiStyle = 8;
3258 hostile = true;
3259 penetrate = -1;
3260 alpha = 100;
3261 timeLeft = 300;
3262 }
3263 else if (type == 259)
3264 {
3265 ignoreWater = true;
3266 tileCollide = false;
3267 width = 8;
3268 height = 8;
3269 aiStyle = 1;
3270 hostile = true;
3271 penetrate = -1;
3272 light = 0.3f;
3273 scale = 1.1f;
3274 magic = true;
3275 extraUpdates = 1;
3276 }
3277 else if (type == 260)
3278 {
3279 width = 8;
3280 height = 8;
3281 aiStyle = 48;
3282 friendly = true;
3283 magic = true;
3284 extraUpdates = 100;
3285 timeLeft = 200;
3286 penetrate = 1;
3287 }
3288 else if (type == 261)
3289 {
3290 width = 32;
3291 height = 34;
3292 aiStyle = 14;
3293 friendly = true;
3294 penetrate = 6;
3295 magic = true;
3296 ignoreWater = true;
3297 extraUpdates = 1;
3298 }
3299 else if (type == 262)
3300 {
3301 width = 30;
3302 height = 30;
3303 aiStyle = 13;
3304 friendly = true;
3305 penetrate = -1;
3306 alpha = 255;
3307 melee = true;
3308 extraUpdates = 1;
3309 }
3310 else if (type == 263)
3311 {
3312 width = 34;
3313 height = 34;
3314 alpha = 100;
3315 light = 0.5f;
3316 aiStyle = 18;
3317 friendly = true;
3318 penetrate = 4;
3319 tileCollide = true;
3320 scale = 1f;
3321 melee = true;
3322 timeLeft = 180;
3323 coldDamage = true;
3326 }
3327 else if (type == 264)
3328 {
3329 ignoreWater = true;
3330 width = 4;
3331 height = 40;
3332 aiStyle = 45;
3333 hostile = true;
3334 penetrate = -1;
3335 timeLeft = 120;
3336 scale = 1.1f;
3337 extraUpdates = 1;
3338 }
3339 else if (type == 265)
3340 {
3341 width = 12;
3342 height = 12;
3343 aiStyle = 1;
3344 alpha = 255;
3345 friendly = true;
3346 magic = true;
3347 penetrate = 3;
3348 usesLocalNPCImmunity = true;
3350 timeLeft = 37;
3351 }
3352 else if (type == 266)
3353 {
3354 netImportant = true;
3355 alpha = 75;
3356 width = 24;
3357 height = 16;
3358 aiStyle = 26;
3359 penetrate = -1;
3360 timeLeft *= 5;
3361 minion = true;
3362 minionSlots = 1f;
3365 }
3366 else if (type == 267)
3367 {
3368 alpha = 255;
3369 width = 14;
3370 height = 14;
3371 aiStyle = 1;
3372 friendly = true;
3373 ranged = true;
3374 }
3375 else if (type == 268)
3376 {
3377 netImportant = true;
3378 width = 18;
3379 height = 32;
3380 aiStyle = 26;
3381 friendly = true;
3382 penetrate = -1;
3383 timeLeft *= 5;
3384 }
3385 else if (type == 269)
3386 {
3387 netImportant = true;
3388 width = 20;
3389 height = 26;
3390 aiStyle = 26;
3391 friendly = true;
3392 penetrate = -1;
3393 timeLeft *= 5;
3394 }
3395 else if (type == 270)
3396 {
3397 width = 26;
3398 height = 26;
3399 aiStyle = 1;
3400 alpha = 255;
3401 hostile = true;
3402 penetrate = 3;
3403 }
3404 else if (type == 271)
3405 {
3406 width = 20;
3407 height = 20;
3408 aiStyle = 13;
3409 friendly = true;
3410 penetrate = -1;
3411 alpha = 255;
3412 melee = true;
3413 scale = 1.2f;
3414 }
3415 else if (type == 272)
3416 {
3417 width = 32;
3418 height = 32;
3419 aiStyle = 3;
3420 friendly = true;
3421 scale = 0.9f;
3422 penetrate = -1;
3423 melee = true;
3424 }
3425 else if (type == 273)
3426 {
3427 width = 26;
3428 height = 26;
3429 aiStyle = 13;
3430 friendly = true;
3431 penetrate = -1;
3432 alpha = 255;
3433 melee = true;
3434 }
3435 else if (type == 274)
3436 {
3437 width = 42;
3438 height = 42;
3439 alpha = 100;
3440 light = 0.5f;
3441 aiStyle = 18;
3442 friendly = true;
3443 penetrate = 5;
3444 tileCollide = false;
3445 scale = 1.1f;
3446 melee = true;
3447 timeLeft = 180;
3450 }
3451 else if (type == 275)
3452 {
3453 alpha = 255;
3454 width = 14;
3455 height = 14;
3456 aiStyle = 1;
3457 hostile = true;
3458 }
3459 else if (type == 276)
3460 {
3461 alpha = 255;
3462 width = 14;
3463 height = 14;
3464 aiStyle = 1;
3465 hostile = true;
3466 }
3467 else if (type == 277)
3468 {
3469 alpha = 255;
3470 width = 38;
3471 height = 38;
3472 aiStyle = 14;
3473 hostile = true;
3474 }
3475 else if (type == 278)
3476 {
3477 arrow = true;
3478 width = 10;
3479 height = 10;
3480 aiStyle = 1;
3481 friendly = true;
3482 light = 1f;
3483 ranged = true;
3484 extraUpdates = 1;
3485 timeLeft = 1200;
3486 }
3487 else if (type == 279)
3488 {
3489 width = 4;
3490 height = 4;
3491 aiStyle = 1;
3492 friendly = true;
3493 penetrate = 1;
3494 light = 0.5f;
3495 alpha = 255;
3496 extraUpdates = 2;
3497 scale = 1.25f;
3498 timeLeft = 600;
3499 ranged = true;
3500 }
3501 else if (type == 280)
3502 {
3503 width = 32;
3504 height = 32;
3505 aiStyle = 12;
3506 friendly = true;
3507 alpha = 255;
3508 penetrate = 5;
3509 extraUpdates = 2;
3510 ignoreWater = true;
3511 magic = true;
3512 }
3513 else if (type == 281)
3514 {
3515 width = 28;
3516 height = 28;
3517 aiStyle = 49;
3518 friendly = true;
3519 alpha = 255;
3520 timeLeft = 600;
3523 penetrate = -1;
3524 }
3525 else if (type == 282)
3526 {
3527 arrow = true;
3528 width = 10;
3529 height = 10;
3530 aiStyle = 1;
3531 friendly = true;
3532 ranged = true;
3533 extraUpdates = 1;
3534 timeLeft = 1200;
3535 }
3536 else if (type == 283)
3537 {
3538 width = 4;
3539 height = 4;
3540 aiStyle = 1;
3541 friendly = true;
3542 penetrate = 1;
3543 light = 0.5f;
3544 alpha = 255;
3545 extraUpdates = 2;
3546 scale = 1.25f;
3547 timeLeft = 600;
3548 ranged = true;
3549 }
3550 else if (type == 284)
3551 {
3552 width = 4;
3553 height = 4;
3554 aiStyle = 1;
3555 friendly = true;
3556 penetrate = 1;
3557 light = 0.5f;
3558 alpha = 255;
3559 extraUpdates = 2;
3560 scale = 1.3f;
3561 timeLeft = 600;
3562 ranged = true;
3563 }
3564 else if (type == 285)
3565 {
3566 width = 4;
3567 height = 4;
3568 aiStyle = 1;
3569 friendly = true;
3570 penetrate = 1;
3571 light = 0.5f;
3572 alpha = 255;
3573 extraUpdates = 2;
3574 scale = 1.3f;
3575 timeLeft = 600;
3576 ranged = true;
3577 }
3578 else if (type == 286)
3579 {
3580 width = 4;
3581 height = 4;
3582 aiStyle = 1;
3583 friendly = true;
3584 penetrate = 1;
3585 light = 0.5f;
3586 alpha = 255;
3587 extraUpdates = 2;
3588 scale = 1.3f;
3589 timeLeft = 600;
3590 ranged = true;
3591 }
3592 else if (type == 287)
3593 {
3594 width = 4;
3595 height = 4;
3596 aiStyle = 1;
3597 friendly = true;
3598 penetrate = 1;
3599 light = 0.5f;
3600 alpha = 255;
3601 extraUpdates = 2;
3602 scale = 1.3f;
3603 timeLeft = 600;
3604 ranged = true;
3605 }
3606 else if (type == 288)
3607 {
3608 width = 32;
3609 height = 32;
3610 aiStyle = 12;
3611 hostile = true;
3612 alpha = 255;
3613 penetrate = -1;
3614 extraUpdates = 2;
3615 ignoreWater = true;
3616 magic = true;
3617 }
3618 else if (type == 289)
3619 {
3620 width = 10;
3621 height = 10;
3622 aiStyle = 1;
3623 alpha = 255;
3624 penetrate = -1;
3625 timeLeft = 2;
3626 }
3627 else if (type == 290)
3628 {
3629 width = 4;
3630 height = 4;
3631 aiStyle = 48;
3632 hostile = true;
3633 magic = true;
3634 extraUpdates = 100;
3635 timeLeft = 100;
3636 penetrate = -1;
3637 }
3638 else if (type == 291)
3639 {
3640 width = 12;
3641 height = 12;
3642 aiStyle = 50;
3643 hostile = true;
3644 alpha = 255;
3645 magic = true;
3646 tileCollide = false;
3647 penetrate = -1;
3648 }
3649 else if (type == 292)
3650 {
3651 width = 130;
3652 height = 130;
3653 aiStyle = 50;
3654 hostile = true;
3655 alpha = 255;
3656 magic = true;
3657 tileCollide = false;
3658 penetrate = -1;
3659 }
3660 else if (type == 293)
3661 {
3662 width = 12;
3663 height = 12;
3664 aiStyle = 51;
3665 hostile = true;
3666 alpha = 255;
3667 magic = true;
3668 tileCollide = false;
3669 penetrate = -1;
3670 extraUpdates = 1;
3671 }
3672 else if (type == 294)
3673 {
3674 width = 4;
3675 height = 4;
3676 aiStyle = 48;
3677 friendly = true;
3678 magic = true;
3679 extraUpdates = 100;
3680 timeLeft = 300;
3681 penetrate = -1;
3682 }
3683 else if (type == 295)
3684 {
3685 width = 12;
3686 height = 12;
3687 aiStyle = 50;
3688 friendly = true;
3689 alpha = 255;
3690 magic = true;
3691 tileCollide = true;
3692 }
3693 else if (type == 296)
3694 {
3695 width = 150;
3696 height = 150;
3697 aiStyle = 50;
3698 friendly = true;
3699 alpha = 255;
3700 magic = true;
3701 tileCollide = false;
3702 penetrate = -1;
3703 }
3704 else if (type == 297)
3705 {
3706 width = 12;
3707 height = 12;
3708 aiStyle = 51;
3709 friendly = true;
3710 alpha = 255;
3711 magic = true;
3712 extraUpdates = 1;
3713 penetrate = 3;
3716 }
3717 else if (type == 298)
3718 {
3719 width = 6;
3720 height = 6;
3721 aiStyle = 52;
3722 alpha = 255;
3723 magic = true;
3724 tileCollide = false;
3725 extraUpdates = 3;
3726 }
3727 else if (type == 299)
3728 {
3729 width = 6;
3730 height = 6;
3731 aiStyle = 1;
3732 hostile = true;
3733 alpha = 255;
3734 penetrate = -1;
3735 extraUpdates = 2;
3736 magic = true;
3737 ignoreWater = true;
3738 tileCollide = false;
3739 }
3740 else if (type == 300)
3741 {
3742 width = 38;
3743 height = 38;
3744 aiStyle = 2;
3745 hostile = true;
3746 penetrate = -1;
3747 ignoreWater = true;
3748 tileCollide = false;
3749 }
3750 else if (type == 301)
3751 {
3752 width = 38;
3753 height = 38;
3754 aiStyle = 3;
3755 friendly = true;
3756 penetrate = -1;
3757 melee = true;
3758 extraUpdates = 2;
3759 }
3760 else if (type == 302)
3761 {
3762 width = 4;
3763 height = 4;
3764 aiStyle = 1;
3765 hostile = true;
3766 penetrate = -1;
3767 light = 0.3f;
3768 alpha = 255;
3769 extraUpdates = 7;
3770 scale = 1.18f;
3771 timeLeft = 300;
3772 ranged = true;
3773 ignoreWater = true;
3774 }
3775 else if (type == 303)
3776 {
3777 width = 14;
3778 height = 14;
3779 aiStyle = 16;
3780 hostile = true;
3781 penetrate = -1;
3782 ranged = true;
3783 }
3784 else if (type == 304)
3785 {
3786 alpha = 255;
3787 width = 30;
3788 height = 30;
3789 aiStyle = 2;
3790 friendly = true;
3791 penetrate = 1;
3792 melee = true;
3793 light = 0.2f;
3794 ignoreWater = true;
3795 extraUpdates = 0;
3796 }
3797 else if (type == 305)
3798 {
3799 width = 6;
3800 height = 6;
3801 aiStyle = 52;
3802 alpha = 255;
3803 tileCollide = false;
3804 extraUpdates = 10;
3805 }
3806 else if (type == 306)
3807 {
3808 alpha = 255;
3809 width = 14;
3810 height = 14;
3811 aiStyle = 2;
3812 friendly = true;
3813 penetrate = 1;
3814 melee = true;
3815 ignoreWater = true;
3816 extraUpdates = 1;
3817 }
3818 else if (type == 307)
3819 {
3820 width = 16;
3821 height = 16;
3822 aiStyle = 36;
3823 penetrate = 1;
3824 alpha = 255;
3825 timeLeft = 600;
3826 melee = true;
3827 extraUpdates = 3;
3828 }
3829 else if (type == 308)
3830 {
3831 width = 80;
3832 height = 74;
3833 aiStyle = 53;
3834 timeLeft = 36000;
3835 light = 0.25f;
3836 ignoreWater = true;
3837 coldDamage = true;
3838 sentry = true;
3839 netImportant = true;
3840 }
3841 else if (type == 309)
3842 {
3843 width = 14;
3844 height = 14;
3845 aiStyle = 28;
3846 alpha = 255;
3847 penetrate = 3;
3848 friendly = true;
3849 extraUpdates = 3;
3850 coldDamage = true;
3853 }
3854 else if (type == 310)
3855 {
3856 netImportant = true;
3857 width = 6;
3858 height = 6;
3859 aiStyle = 33;
3860 friendly = true;
3861 penetrate = -1;
3862 alpha = 255;
3863 timeLeft = 36000;
3864 }
3865 else if (type == 311)
3866 {
3867 width = 10;
3868 height = 12;
3869 aiStyle = 1;
3870 friendly = true;
3871 penetrate = 3;
3872 alpha = 255;
3873 timeLeft = 600;
3874 ranged = true;
3875 }
3876 else if (type == 312)
3877 {
3878 alpha = 255;
3879 width = 32;
3880 height = 32;
3881 aiStyle = 1;
3882 friendly = true;
3883 ranged = true;
3884 timeLeft = 300;
3885 glowMask = 257;
3886 }
3887 else if (type == 313)
3888 {
3889 netImportant = true;
3890 width = 30;
3891 height = 30;
3892 aiStyle = 26;
3893 friendly = true;
3894 penetrate = -1;
3895 timeLeft *= 5;
3896 }
3897 else if (type == 314)
3898 {
3899 netImportant = true;
3900 width = 24;
3901 height = 40;
3902 aiStyle = 26;
3903 friendly = true;
3904 penetrate = -1;
3905 timeLeft *= 5;
3906 }
3907 else if (type == 315)
3908 {
3909 netImportant = true;
3910 width = 14;
3911 height = 14;
3912 aiStyle = 7;
3913 friendly = true;
3914 penetrate = -1;
3915 tileCollide = false;
3916 timeLeft *= 10;
3917 }
3918 else if (type == 316)
3919 {
3920 alpha = 255;
3921 width = 16;
3922 height = 16;
3923 aiStyle = 36;
3924 friendly = true;
3925 penetrate = 1;
3926 timeLeft = 600;
3927 magic = true;
3928 }
3929 else if (type == 317)
3930 {
3931 netImportant = true;
3932 width = 28;
3933 height = 28;
3934 aiStyle = 54;
3935 penetrate = 1;
3936 timeLeft *= 5;
3937 minion = true;
3938 minionSlots = 1f;
3939 usesLocalNPCImmunity = true;
3941 }
3942 else if (type == 318)
3943 {
3944 width = 12;
3945 height = 14;
3946 aiStyle = 2;
3947 friendly = true;
3948 ranged = true;
3949 }
3950 else if (type == 319)
3951 {
3952 netImportant = true;
3953 width = 36;
3954 height = 30;
3955 aiStyle = 26;
3956 friendly = true;
3957 penetrate = -1;
3958 timeLeft *= 5;
3959 }
3960 else if (type == 320)
3961 {
3962 width = 34;
3963 height = 34;
3964 aiStyle = 3;
3965 friendly = true;
3966 penetrate = -1;
3967 melee = true;
3968 }
3969 else if (type == 321)
3970 {
3971 width = 30;
3972 height = 30;
3973 aiStyle = 55;
3974 friendly = true;
3975 melee = true;
3976 tileCollide = false;
3977 ignoreWater = true;
3978 }
3979 else if (type == 322)
3980 {
3981 netImportant = true;
3982 width = 14;
3983 height = 14;
3984 aiStyle = 7;
3985 friendly = true;
3986 penetrate = -1;
3987 tileCollide = false;
3988 timeLeft *= 10;
3989 }
3990 else if (type == 323)
3991 {
3992 penetrate = 10;
3993 extraUpdates = 3;
3994 width = 14;
3995 height = 14;
3996 aiStyle = 1;
3997 alpha = 255;
3998 friendly = true;
3999 ranged = true;
4000 scale = 0.8f;
4001 }
4002 else if (type == 324)
4003 {
4004 netImportant = true;
4005 width = 26;
4006 height = 38;
4007 aiStyle = 26;
4008 friendly = true;
4009 penetrate = -1;
4010 timeLeft *= 5;
4011 }
4012 else if (type == 325)
4013 {
4014 alpha = 255;
4015 penetrate = -1;
4016 width = 14;
4017 height = 14;
4018 aiStyle = 1;
4019 hostile = true;
4020 tileCollide = false;
4021 timeLeft = 420;
4022 }
4023 else if (type >= 326 && type <= 328)
4024 {
4025 if (type == 326)
4026 {
4027 width = 14;
4028 height = 16;
4029 }
4030 else if (type == 327)
4031 {
4032 width = 12;
4033 height = 14;
4034 }
4035 else
4036 {
4037 width = 6;
4038 height = 12;
4039 }
4040 aiStyle = 14;
4041 hostile = true;
4042 penetrate = -1;
4043 timeLeft = 360;
4044 }
4045 else if (type == 329)
4046 {
4047 width = 80;
4048 height = 80;
4049 light = 0.25f;
4050 aiStyle = 56;
4051 hostile = true;
4052 penetrate = -1;
4053 tileCollide = false;
4054 timeLeft = 420;
4055 }
4056 else if (type == 330)
4057 {
4058 width = 22;
4059 height = 22;
4060 aiStyle = 2;
4061 friendly = true;
4062 penetrate = 6;
4063 ranged = true;
4064 }
4065 else if (type == 331)
4066 {
4067 netImportant = true;
4068 width = 18;
4069 height = 18;
4070 aiStyle = 7;
4071 friendly = true;
4072 penetrate = -1;
4073 tileCollide = false;
4074 timeLeft *= 10;
4075 }
4076 else if (type == 332)
4077 {
4078 netImportant = true;
4079 width = 18;
4080 height = 18;
4081 aiStyle = 7;
4082 friendly = true;
4083 penetrate = -1;
4084 tileCollide = false;
4085 timeLeft *= 10;
4086 light = 0.5f;
4087 }
4088 else if (type == 333)
4089 {
4090 width = 38;
4091 height = 38;
4092 aiStyle = 3;
4093 friendly = true;
4094 scale = 0.9f;
4095 penetrate = -1;
4096 melee = true;
4097 }
4098 else if (type == 334)
4099 {
4100 netImportant = true;
4101 width = 28;
4102 height = 28;
4103 aiStyle = 26;
4104 friendly = true;
4105 penetrate = -1;
4106 timeLeft *= 5;
4107 }
4108 else if (type == 335)
4109 {
4110 width = 22;
4111 height = 22;
4112 aiStyle = 30;
4113 friendly = true;
4114 penetrate = 1;
4115 melee = true;
4116 }
4117 else if (type == 336)
4118 {
4119 width = 4;
4120 height = 4;
4121 aiStyle = 1;
4122 friendly = true;
4123 magic = true;
4124 scale = 0.8f;
4125 extraUpdates = 1;
4126 }
4127 else if (type == 337)
4128 {
4129 width = 10;
4130 height = 10;
4131 aiStyle = 1;
4132 friendly = true;
4133 magic = true;
4134 tileCollide = false;
4135 coldDamage = true;
4136 extraUpdates = 1;
4137 }
4138 else if (type == 338 || type == 339 || type == 340 || type == 341)
4139 {
4140 width = 14;
4141 height = 14;
4142 aiStyle = 16;
4143 penetrate = -1;
4144 friendly = true;
4145 ranged = true;
4146 scale = 0.9f;
4147 }
4148 else if (type == 342)
4149 {
4150 width = 22;
4151 height = 2;
4152 aiStyle = 19;
4153 friendly = true;
4154 penetrate = -1;
4155 tileCollide = false;
4156 scale = 1.1f;
4157 hide = true;
4158 ownerHitCheck = true;
4159 melee = true;
4160 coldDamage = true;
4161 }
4162 else if (type == 343)
4163 {
4164 alpha = 255;
4165 width = 10;
4166 height = 10;
4167 aiStyle = 57;
4168 friendly = true;
4169 melee = true;
4170 scale = 1.1f;
4171 penetrate = 3;
4172 coldDamage = true;
4173 timeLeft = 120;
4174 }
4175 else if (type == 344)
4176 {
4177 width = 26;
4178 height = 26;
4179 aiStyle = 1;
4180 friendly = true;
4181 scale = 0.9f;
4182 alpha = 255;
4183 melee = true;
4184 coldDamage = true;
4185 tileCollide = false;
4186 noEnchantmentVisuals = true;
4187 timeLeft = 240;
4188 }
4189 else if (type == 345)
4190 {
4191 width = 4;
4192 height = 4;
4193 aiStyle = 1;
4194 hostile = true;
4195 scale = 0.8f;
4196 }
4197 else if (type == 346)
4198 {
4199 width = 18;
4200 height = 18;
4201 aiStyle = 14;
4202 hostile = true;
4203 penetrate = -1;
4204 timeLeft = 300;
4205 }
4206 else if (type == 347)
4207 {
4208 width = 6;
4209 height = 6;
4210 aiStyle = 2;
4211 hostile = true;
4212 penetrate = -1;
4213 }
4214 else if (type == 348)
4215 {
4216 aiStyle = 1;
4217 width = 48;
4218 height = 48;
4219 hostile = true;
4220 penetrate = -1;
4221 tileCollide = false;
4222 coldDamage = true;
4223 extraUpdates = 1;
4224 timeLeft = 900;
4225 }
4226 else if (type == 349)
4227 {
4228 aiStyle = 1;
4229 width = 12;
4230 height = 12;
4231 hostile = true;
4232 penetrate = -1;
4233 coldDamage = true;
4234 timeLeft = 900;
4235 }
4236 else if (type == 350)
4237 {
4238 alpha = 255;
4239 penetrate = -1;
4240 width = 14;
4241 height = 14;
4242 aiStyle = 1;
4243 hostile = true;
4244 tileCollide = false;
4245 timeLeft /= 2;
4246 }
4247 else if (type == 351)
4248 {
4249 alpha = 255;
4250 penetrate = -1;
4251 width = 24;
4252 height = 24;
4253 aiStyle = 58;
4254 hostile = true;
4255 tileCollide = false;
4256 }
4257 else if (type == 352)
4258 {
4259 width = 30;
4260 height = 30;
4261 aiStyle = 14;
4262 hostile = true;
4263 penetrate = -1;
4264 timeLeft /= 3;
4265 }
4266 else if (type == 353)
4267 {
4268 netImportant = true;
4269 width = 18;
4270 height = 28;
4271 aiStyle = 26;
4272 friendly = true;
4273 penetrate = -1;
4274 timeLeft *= 5;
4275 }
4276 else if (type == 354)
4277 {
4278 knockBack = 6f;
4279 width = 10;
4280 height = 10;
4281 aiStyle = 10;
4282 friendly = true;
4283 ranged = true;
4284 penetrate = -1;
4285 extraUpdates = 1;
4286 }
4287 else if (type == 355)
4288 {
4289 width = 12;
4290 height = 12;
4291 aiStyle = 1;
4292 alpha = 255;
4293 friendly = true;
4294 magic = true;
4295 penetrate = 5;
4296 usesLocalNPCImmunity = true;
4298 timeLeft = 58;
4299 }
4300 else if (type == 356)
4301 {
4302 width = 6;
4303 height = 6;
4304 aiStyle = 59;
4305 alpha = 255;
4306 magic = true;
4307 tileCollide = false;
4308 extraUpdates = 3;
4309 }
4310 else if (type == 357)
4311 {
4312 width = 4;
4313 height = 4;
4314 aiStyle = 1;
4315 friendly = true;
4316 penetrate = 6;
4317 alpha = 255;
4318 extraUpdates = 2;
4319 scale = 1.2f;
4320 timeLeft = 600;
4321 ranged = true;
4322 }
4323 else if (type == 358)
4324 {
4325 width = 18;
4326 height = 18;
4327 aiStyle = 60;
4328 alpha = 255;
4329 penetrate = -1;
4330 extraUpdates = 2;
4331 ignoreWater = true;
4332 }
4333 else if (type == 359)
4334 {
4335 width = 14;
4336 height = 14;
4337 aiStyle = 28;
4338 alpha = 255;
4339 magic = true;
4340 penetrate = 2;
4341 friendly = true;
4342 coldDamage = true;
4343 }
4344 else if ((type >= 360 && type <= 366) || type == 381 || type == 382 || type == 760 || type == 775)
4345 {
4346 width = 14;
4347 height = 14;
4348 aiStyle = 61;
4349 penetrate = -1;
4350 netImportant = true;
4351 bobber = true;
4352 }
4353 else if (type == 367)
4354 {
4355 width = 18;
4356 height = 18;
4357 aiStyle = 19;
4358 friendly = true;
4359 penetrate = -1;
4360 tileCollide = false;
4361 scale = 1.1f;
4362 hide = true;
4363 ownerHitCheck = true;
4364 melee = true;
4365 }
4366 else if (type == 368)
4367 {
4368 width = 18;
4369 height = 18;
4370 aiStyle = 19;
4371 friendly = true;
4372 penetrate = -1;
4373 tileCollide = false;
4374 hide = true;
4375 ownerHitCheck = true;
4376 melee = true;
4377 }
4378 else if (type == 369)
4379 {
4380 width = 22;
4381 height = 22;
4382 aiStyle = 20;
4383 friendly = true;
4384 penetrate = -1;
4385 tileCollide = false;
4386 hide = true;
4387 ownerHitCheck = true;
4388 melee = true;
4389 }
4390 else if (type == 370)
4391 {
4392 width = 14;
4393 height = 14;
4394 aiStyle = 2;
4395 friendly = true;
4396 penetrate = 1;
4397 }
4398 else if (type == 371)
4399 {
4400 width = 14;
4401 height = 14;
4402 aiStyle = 2;
4403 friendly = true;
4404 penetrate = 1;
4405 }
4406 else if (type == 372)
4407 {
4408 netImportant = true;
4409 width = 18;
4410 height = 18;
4411 aiStyle = 7;
4412 friendly = true;
4413 penetrate = -1;
4414 tileCollide = false;
4415 timeLeft *= 10;
4416 }
4417 else if (type == 373)
4418 {
4419 netImportant = true;
4420 width = 24;
4421 height = 26;
4422 aiStyle = 62;
4423 penetrate = -1;
4424 timeLeft *= 5;
4425 minion = true;
4426 minionSlots = 1f;
4427 tileCollide = false;
4428 ignoreWater = true;
4429 }
4430 else if (type == 374)
4431 {
4432 width = 10;
4433 height = 10;
4434 aiStyle = 0;
4435 friendly = true;
4436 penetrate = 1;
4437 aiStyle = 1;
4438 tileCollide = true;
4439 scale *= 0.9f;
4440 }
4441 else if (type == 375)
4442 {
4443 netImportant = true;
4444 width = 34;
4445 height = 26;
4446 aiStyle = 62;
4447 penetrate = -1;
4448 timeLeft *= 5;
4449 minion = true;
4450 minionSlots = 1f;
4451 tileCollide = false;
4452 ignoreWater = true;
4453 }
4454 else if (type == 376)
4455 {
4456 width = 12;
4457 height = 12;
4458 aiStyle = 0;
4459 friendly = true;
4460 penetrate = 5;
4461 aiStyle = 1;
4462 tileCollide = true;
4463 timeLeft = 100;
4464 alpha = 255;
4465 extraUpdates = 1;
4468 }
4469 else if (type == 377)
4470 {
4471 width = 66;
4472 height = 50;
4473 aiStyle = 53;
4474 timeLeft = 36000;
4475 ignoreWater = true;
4476 sentry = true;
4477 netImportant = true;
4478 }
4479 else if (type == 378)
4480 {
4481 width = 16;
4482 height = 16;
4483 aiStyle = 14;
4484 friendly = true;
4485 penetrate = -1;
4486 timeLeft = 60;
4487 scale = 0.9f;
4488 }
4489 else if (type == 379)
4490 {
4491 width = 14;
4492 height = 10;
4493 aiStyle = 63;
4494 friendly = true;
4495 timeLeft = 300;
4496 penetrate = 1;
4497 }
4498 else if (type == 380)
4499 {
4500 netImportant = true;
4501 width = 26;
4502 height = 26;
4503 aiStyle = 26;
4504 friendly = true;
4505 penetrate = -1;
4506 timeLeft *= 5;
4507 }
4508 else if (type == 383)
4509 {
4510 width = 34;
4511 height = 34;
4512 aiStyle = 3;
4513 friendly = true;
4514 penetrate = -1;
4515 melee = true;
4516 }
4517 else if (type == 384)
4518 {
4519 width = 150;
4520 height = 42;
4521 hostile = true;
4522 penetrate = -1;
4523 aiStyle = 64;
4524 tileCollide = false;
4525 ignoreWater = true;
4526 alpha = 255;
4527 timeLeft = 540;
4528 }
4529 else if (type == 385)
4530 {
4531 width = 30;
4532 height = 30;
4533 hostile = true;
4534 penetrate = -1;
4535 aiStyle = 65;
4536 alpha = 255;
4537 timeLeft = 300;
4538 }
4539 else if (type == 386)
4540 {
4541 width = 150;
4542 height = 42;
4543 hostile = true;
4544 penetrate = -1;
4545 aiStyle = 64;
4546 tileCollide = false;
4547 ignoreWater = true;
4548 alpha = 255;
4549 timeLeft = 840;
4550 }
4551 else if (type == 387)
4552 {
4553 netImportant = true;
4554 width = 40;
4555 height = 20;
4556 aiStyle = 66;
4557 penetrate = -1;
4558 timeLeft *= 5;
4559 minion = true;
4560 minionSlots = 0.5f;
4561 tileCollide = false;
4562 ignoreWater = true;
4563 friendly = true;
4566 }
4567 else if (type == 388)
4568 {
4569 netImportant = true;
4570 width = 40;
4571 height = 20;
4572 aiStyle = 66;
4573 penetrate = -1;
4574 timeLeft *= 5;
4575 minion = true;
4576 minionSlots = 0.5f;
4577 tileCollide = false;
4578 ignoreWater = true;
4579 friendly = true;
4582 }
4583 else if (type == 389)
4584 {
4585 width = 4;
4586 height = 4;
4587 aiStyle = 1;
4588 friendly = true;
4589 light = 0.75f;
4590 alpha = 255;
4591 extraUpdates = 2;
4592 scale = 1.2f;
4593 timeLeft = 600;
4594 }
4595 else if (type == 390 || type == 391 || type == 392)
4596 {
4597 width = 18;
4598 height = 18;
4599 aiStyle = 26;
4600 penetrate = -1;
4601 netImportant = true;
4602 timeLeft *= 5;
4603 minion = true;
4604 minionSlots = 1f;
4607 }
4608 else if (type == 393 || type == 394 || type == 395)
4609 {
4610 width = 20;
4611 height = 30;
4612 aiStyle = 67;
4613 penetrate = -1;
4614 netImportant = true;
4615 timeLeft *= 5;
4616 minion = true;
4617 minionSlots = 1f;
4618 usesLocalNPCImmunity = true;
4621 }
4622 else if (type == 396)
4623 {
4624 netImportant = true;
4625 width = 18;
4626 height = 18;
4627 aiStyle = 7;
4628 friendly = true;
4629 penetrate = -1;
4630 tileCollide = false;
4631 timeLeft *= 10;
4632 alpha = 100;
4633 }
4634 else if (type == 397)
4635 {
4636 width = 14;
4637 height = 14;
4638 aiStyle = 16;
4639 friendly = true;
4640 penetrate = -1;
4641 ranged = true;
4642 tileCollide = false;
4643 }
4644 else if (type == 398)
4645 {
4646 netImportant = true;
4647 width = 18;
4648 height = 38;
4649 aiStyle = 26;
4650 friendly = true;
4651 penetrate = -1;
4652 timeLeft *= 5;
4653 }
4654 else if (type == 399)
4655 {
4656 width = 14;
4657 height = 14;
4658 aiStyle = 68;
4659 friendly = true;
4660 penetrate = 1;
4661 alpha = 255;
4662 ranged = true;
4663 noEnchantmentVisuals = true;
4664 }
4665 else if (type >= 400 && type <= 402)
4666 {
4667 if (type == 400)
4668 {
4669 width = 14;
4670 height = 16;
4671 }
4672 else if (type == 401)
4673 {
4674 width = 12;
4675 height = 14;
4676 }
4677 else
4678 {
4679 width = 6;
4680 height = 12;
4681 }
4682 penetrate = 3;
4683 aiStyle = 14;
4684 friendly = true;
4685 timeLeft = 360;
4686 ranged = true;
4687 noEnchantmentVisuals = true;
4688 }
4689 else if (type == 403)
4690 {
4691 netImportant = true;
4692 width = 18;
4693 height = 18;
4694 aiStyle = 7;
4695 friendly = true;
4696 penetrate = -1;
4697 tileCollide = false;
4698 timeLeft *= 10;
4699 }
4700 else if (type == 404)
4701 {
4702 width = 26;
4703 height = 26;
4704 aiStyle = 69;
4705 friendly = true;
4706 penetrate = -1;
4707 alpha = 255;
4708 melee = true;
4709 }
4710 else if (type == 405)
4711 {
4712 width = 14;
4713 height = 14;
4714 aiStyle = 70;
4715 friendly = true;
4716 penetrate = 1;
4717 alpha = 255;
4718 timeLeft = 120;
4719 melee = true;
4720 noEnchantments = true;
4721 }
4722 else if (type == 406)
4723 {
4724 width = 14;
4725 height = 14;
4726 aiStyle = 60;
4727 alpha = 255;
4728 penetrate = -1;
4729 extraUpdates = 2;
4730 ignoreWater = true;
4731 }
4732 else if (type == 407)
4733 {
4734 netImportant = true;
4735 width = 28;
4736 height = 40;
4737 aiStyle = 62;
4738 penetrate = -1;
4739 timeLeft *= 5;
4740 minion = true;
4741 friendly = true;
4742 minionSlots = 1f;
4743 tileCollide = false;
4744 ignoreWater = true;
4747 }
4748 else if (type == 408)
4749 {
4750 width = 10;
4751 height = 10;
4752 aiStyle = 1;
4753 friendly = true;
4754 alpha = 255;
4755 ignoreWater = true;
4756 }
4757 else if (type == 409)
4758 {
4759 width = 30;
4760 height = 30;
4761 penetrate = -1;
4762 aiStyle = 71;
4763 alpha = 255;
4764 timeLeft = 300;
4765 friendly = true;
4766 tileCollide = true;
4767 extraUpdates = 2;
4768 magic = true;
4769 ignoreWater = true;
4770 }
4771 else if (type == 410)
4772 {
4773 width = 14;
4774 height = 14;
4775 aiStyle = 72;
4776 friendly = true;
4777 penetrate = 1;
4778 alpha = 255;
4779 timeLeft = 100;
4780 magic = true;
4781 ignoreWater = true;
4782 }
4783 else if (type >= 411 && type <= 414)
4784 {
4785 switch (type)
4786 {
4787 }
4788 width = 10;
4789 height = 10;
4790 aiStyle = 10;
4791 }
4792 else if (type == 415 || type == 416 || type == 417 || type == 418)
4793 {
4794 width = 14;
4795 height = 14;
4796 aiStyle = 34;
4797 friendly = true;
4798 ranged = true;
4799 timeLeft = 45;
4800 }
4801 else if (type >= 419 && type <= 422)
4802 {
4803 width = 4;
4804 height = 4;
4805 aiStyle = 73;
4806 friendly = true;
4809 }
4810 else if (type == 423)
4811 {
4812 netImportant = true;
4813 width = 28;
4814 height = 28;
4815 aiStyle = 62;
4816 penetrate = -1;
4817 timeLeft *= 5;
4818 minion = true;
4819 friendly = true;
4820 minionSlots = 1f;
4821 ignoreWater = true;
4822 }
4823 else if (type >= 424 && type <= 426)
4824 {
4825 width = 24;
4826 height = 24;
4827 aiStyle = 1;
4828 friendly = true;
4829 magic = true;
4830 tileCollide = false;
4831 extraUpdates = 2;
4832 }
4833 else if (type == 427)
4834 {
4835 width = 22;
4836 height = 56;
4837 aiStyle = 20;
4838 friendly = true;
4839 penetrate = -1;
4840 tileCollide = false;
4841 hide = true;
4842 ownerHitCheck = true;
4843 melee = true;
4844 glowMask = 2;
4845 }
4846 else if (type == 428)
4847 {
4848 width = 26;
4849 height = 54;
4850 aiStyle = 20;
4851 friendly = true;
4852 penetrate = -1;
4853 tileCollide = false;
4854 hide = true;
4855 ownerHitCheck = true;
4856 melee = true;
4857 glowMask = 3;
4858 }
4859 else if (type == 429)
4860 {
4861 width = 18;
4862 height = 56;
4863 aiStyle = 20;
4864 friendly = true;
4865 penetrate = -1;
4866 tileCollide = false;
4867 hide = true;
4868 ownerHitCheck = true;
4869 melee = true;
4870 glowMask = 7;
4871 }
4872 else if (type == 430)
4873 {
4874 width = 30;
4875 height = 54;
4876 aiStyle = 20;
4877 friendly = true;
4878 penetrate = -1;
4879 tileCollide = false;
4880 hide = true;
4881 ownerHitCheck = true;
4882 melee = true;
4883 glowMask = 8;
4884 }
4885 else if (type == 431)
4886 {
4887 width = 28;
4888 height = 64;
4889 aiStyle = 20;
4890 friendly = true;
4891 penetrate = -1;
4892 tileCollide = false;
4893 hide = true;
4894 ownerHitCheck = true;
4895 melee = true;
4896 }
4897 else if (type == 432)
4898 {
4899 width = 30;
4900 height = 54;
4901 aiStyle = 20;
4902 friendly = true;
4903 penetrate = -1;
4904 tileCollide = false;
4905 hide = true;
4906 ownerHitCheck = true;
4907 melee = true;
4908 }
4909 else if (type == 610)
4910 {
4911 width = 28;
4912 height = 64;
4913 aiStyle = 20;
4914 friendly = true;
4915 penetrate = -1;
4916 tileCollide = false;
4917 hide = true;
4918 ownerHitCheck = true;
4919 melee = true;
4920 glowMask = 179;
4921 }
4922 else if (type == 609)
4923 {
4924 width = 30;
4925 height = 54;
4926 aiStyle = 20;
4927 friendly = true;
4928 penetrate = -1;
4929 tileCollide = false;
4930 hide = true;
4931 ownerHitCheck = true;
4932 melee = true;
4933 glowMask = 180;
4934 }
4935 else if (type == 433)
4936 {
4937 width = 8;
4938 height = 8;
4939 aiStyle = 48;
4940 friendly = true;
4941 extraUpdates = 100;
4942 timeLeft = 100;
4943 ignoreWater = true;
4944 }
4945 else if (type == 434)
4946 {
4947 width = 1;
4948 height = 1;
4949 aiStyle = 74;
4950 friendly = true;
4951 extraUpdates = 100;
4952 penetrate = -1;
4953 }
4954 else if (type == 435)
4955 {
4956 width = 10;
4957 height = 10;
4958 aiStyle = 1;
4959 hostile = true;
4960 ignoreWater = true;
4961 }
4962 else if (type == 436)
4963 {
4964 width = 10;
4965 height = 10;
4966 aiStyle = 1;
4967 hostile = true;
4968 ignoreWater = true;
4969 }
4970 else if (type == 437)
4971 {
4972 width = 10;
4973 height = 10;
4974 aiStyle = 1;
4975 hostile = true;
4976 extraUpdates = 2;
4977 ignoreWater = true;
4978 }
4979 else if (type == 438)
4980 {
4981 width = 8;
4982 height = 8;
4983 aiStyle = 1;
4984 hostile = true;
4985 alpha = 255;
4986 extraUpdates = 3;
4987 ignoreWater = true;
4988 }
4989 else if (type == 439)
4990 {
4991 width = 22;
4992 height = 22;
4993 aiStyle = 75;
4994 friendly = true;
4995 penetrate = -1;
4996 tileCollide = false;
4997 hide = true;
4998 magic = true;
4999 ignoreWater = true;
5000 }
5001 else if (type == 440)
5002 {
5003 width = 5;
5004 height = 5;
5005 aiStyle = 1;
5006 friendly = true;
5007 alpha = 255;
5008 extraUpdates = 2;
5009 scale = 1f;
5010 timeLeft = 600;
5011 magic = true;
5012 ignoreWater = true;
5013 }
5014 else if (type == 441)
5015 {
5016 width = 1;
5017 height = 1;
5018 aiStyle = 76;
5019 ignoreWater = true;
5020 tileCollide = false;
5021 }
5022 else if (type == 442)
5023 {
5024 width = 14;
5025 height = 14;
5026 aiStyle = 1;
5027 friendly = true;
5028 alpha = 255;
5029 scale = 1f;
5030 timeLeft = 600;
5031 ranged = true;
5032 }
5033 else if (type == 443)
5034 {
5035 width = 80;
5036 height = 80;
5037 aiStyle = 77;
5038 friendly = true;
5039 alpha = 255;
5040 scale = 1f;
5041 ranged = true;
5042 ignoreWater = true;
5043 tileCollide = false;
5044 penetrate = -1;
5045 }
5046 else if (type == 444)
5047 {
5048 width = 10;
5049 height = 10;
5050 aiStyle = 78;
5051 friendly = true;
5052 alpha = 255;
5053 scale = 1f;
5054 ranged = true;
5055 ignoreWater = true;
5056 extraUpdates = 1;
5057 }
5058 else if (type == 445)
5059 {
5060 width = 10;
5061 height = 10;
5062 aiStyle = 75;
5063 friendly = true;
5064 penetrate = -1;
5065 tileCollide = false;
5066 hide = true;
5067 melee = true;
5068 ignoreWater = true;
5069 ownerHitCheck = true;
5070 }
5071 else if (type == 446)
5072 {
5073 netImportant = true;
5074 width = 14;
5075 height = 14;
5076 aiStyle = 7;
5077 friendly = true;
5078 penetrate = -1;
5079 tileCollide = false;
5080 timeLeft *= 10;
5081 light = 0.7f;
5082 }
5083 else if (type == 447)
5084 {
5085 width = 30;
5086 height = 30;
5087 aiStyle = 79;
5088 hostile = true;
5089 penetrate = -1;
5090 tileCollide = false;
5091 ignoreWater = true;
5092 timeLeft = 240;
5093 }
5094 else if (type == 448)
5095 {
5096 width = 14;
5097 height = 14;
5098 aiStyle = 80;
5099 hostile = true;
5100 penetrate = -1;
5101 tileCollide = false;
5102 }
5103 else if (type == 449)
5104 {
5105 width = 5;
5106 height = 5;
5107 aiStyle = 1;
5108 hostile = true;
5109 alpha = 255;
5110 extraUpdates = 1;
5111 scale = 1f;
5112 timeLeft = 600;
5113 ignoreWater = true;
5114 }
5115 else if (type == 450)
5116 {
5117 width = 14;
5118 height = 14;
5119 aiStyle = 14;
5120 hostile = true;
5121 penetrate = -1;
5122 timeLeft = 360;
5123 }
5124 else if (type == 451)
5125 {
5126 width = 16;
5127 height = 16;
5128 aiStyle = 81;
5129 melee = true;
5130 penetrate = 3;
5131 light = 0.2f;
5132 alpha = 255;
5133 friendly = true;
5134 }
5135 else if (type == 452)
5136 {
5137 width = 14;
5138 height = 14;
5139 aiStyle = 82;
5140 hostile = true;
5141 penetrate = -1;
5142 alpha = 255;
5143 timeLeft = 600;
5144 }
5145 else if (type == 453)
5146 {
5147 width = 1;
5148 height = 1;
5149 aiStyle = 76;
5150 ignoreWater = true;
5151 tileCollide = false;
5152 }
5153 else if (type == 454)
5154 {
5155 width = 40;
5156 height = 40;
5157 aiStyle = 83;
5158 hostile = true;
5159 penetrate = -1;
5160 alpha = 255;
5161 timeLeft = 600;
5162 tileCollide = false;
5163 }
5164 else if (type == 455)
5165 {
5166 width = 36;
5167 height = 36;
5168 aiStyle = 84;
5169 hostile = true;
5170 penetrate = -1;
5171 alpha = 255;
5172 timeLeft = 600;
5173 tileCollide = false;
5174 }
5175 else if (type == 456)
5176 {
5177 width = 16;
5178 height = 16;
5179 aiStyle = 85;
5180 hostile = true;
5181 penetrate = -1;
5182 alpha = 255;
5183 timeLeft = 600;
5184 tileCollide = false;
5185 }
5186 else if (type == 459)
5187 {
5188 width = 22;
5189 height = 22;
5190 aiStyle = 1;
5191 friendly = true;
5192 magic = true;
5193 alpha = 255;
5194 scale = 1f;
5195 ignoreWater = true;
5196 extraUpdates = 1;
5197 }
5198 else if (type == 460)
5199 {
5200 width = 14;
5201 height = 18;
5202 aiStyle = 75;
5203 friendly = true;
5204 penetrate = -1;
5205 tileCollide = false;
5206 hide = true;
5207 magic = true;
5208 ignoreWater = true;
5209 }
5210 else if (type == 461)
5211 {
5212 width = 18;
5213 height = 18;
5214 aiStyle = 84;
5215 friendly = true;
5216 magic = true;
5217 penetrate = -1;
5218 alpha = 255;
5219 tileCollide = false;
5220 hide = true;
5221 }
5222 else if (type == 462)
5223 {
5224 width = 8;
5225 height = 8;
5226 aiStyle = 1;
5227 hostile = true;
5228 alpha = 255;
5229 extraUpdates = 3;
5230 ignoreWater = true;
5231 tileCollide = false;
5232 }
5233 else if (type == 463)
5234 {
5235 width = 48;
5236 height = 48;
5237 aiStyle = 6;
5238 friendly = true;
5239 tileCollide = false;
5240 penetrate = -1;
5241 alpha = 255;
5242 ignoreWater = true;
5243 }
5244 else if (type == 464)
5245 {
5246 width = 60;
5247 height = 60;
5248 aiStyle = 86;
5249 hostile = true;
5250 tileCollide = false;
5251 penetrate = -1;
5252 alpha = 255;
5253 ignoreWater = true;
5254 }
5255 else if (type == 467)
5256 {
5257 width = 40;
5258 height = 40;
5259 aiStyle = 1;
5260 hostile = true;
5261 alpha = 255;
5262 ignoreWater = true;
5263 extraUpdates = 1;
5264 }
5265 else if (type == 468)
5266 {
5267 width = 40;
5268 height = 40;
5269 aiStyle = 1;
5270 hostile = true;
5271 alpha = 255;
5272 ignoreWater = true;
5273 extraUpdates = 1;
5274 }
5275 else if (type == 465)
5276 {
5277 width = 80;
5278 height = 80;
5279 aiStyle = 88;
5280 hostile = true;
5281 alpha = 255;
5282 ignoreWater = true;
5283 tileCollide = false;
5284 }
5285 else if (type == 466)
5286 {
5287 width = 14;
5288 height = 14;
5289 aiStyle = 88;
5290 hostile = true;
5291 alpha = 255;
5292 ignoreWater = true;
5293 tileCollide = true;
5294 extraUpdates = 4;
5295 timeLeft = 120 * (extraUpdates + 1);
5296 }
5297 else if (type == 491)
5298 {
5299 width = 26;
5300 height = 26;
5301 aiStyle = 9;
5302 friendly = true;
5303 melee = true;
5304 penetrate = -1;
5305 }
5306 else if (type == 500)
5307 {
5308 width = 20;
5309 height = 20;
5310 aiStyle = 67;
5311 penetrate = -1;
5312 netImportant = true;
5313 timeLeft *= 5;
5314 friendly = true;
5315 ignoreWater = true;
5316 scale = 0.8f;
5317 }
5318 else if (type == 499)
5319 {
5320 netImportant = true;
5321 width = 34;
5322 height = 34;
5323 aiStyle = 26;
5324 friendly = true;
5325 penetrate = -1;
5326 timeLeft *= 5;
5327 }
5328 else if (type == 469)
5329 {
5330 alpha = 255;
5331 arrow = true;
5332 width = 10;
5333 height = 10;
5334 aiStyle = 1;
5335 friendly = true;
5336 ranged = true;
5337 timeLeft = 1200;
5338 }
5339 else if (type == 470)
5340 {
5341 width = 10;
5342 height = 10;
5343 aiStyle = 16;
5344 friendly = true;
5345 penetrate = -1;
5346 tileCollide = false;
5347 }
5348 else if (type == 471)
5349 {
5350 width = 16;
5351 height = 16;
5352 aiStyle = 2;
5353 scale = 1.2f;
5354 hostile = true;
5355 ranged = true;
5356 }
5357 else if (type == 472)
5358 {
5359 width = 8;
5360 height = 8;
5361 aiStyle = 0;
5362 hostile = true;
5363 penetrate = -1;
5364 aiStyle = 1;
5365 tileCollide = true;
5366 timeLeft = 60;
5367 }
5368 else if (type == 474)
5369 {
5370 arrow = true;
5371 width = 10;
5372 height = 10;
5373 aiStyle = 1;
5374 friendly = true;
5375 ranged = true;
5376 timeLeft = 1200;
5377 penetrate = 2;
5378 }
5379 else if (type == 473)
5380 {
5381 netImportant = true;
5382 width = 8;
5383 height = 8;
5384 aiStyle = 14;
5385 penetrate = -1;
5386 alpha = 75;
5387 light = 1f;
5388 timeLeft *= 2;
5389 }
5390 else if (type == 475)
5391 {
5392 width = 14;
5393 height = 14;
5394 aiStyle = 35;
5395 penetrate = -1;
5396 tileCollide = false;
5397 timeLeft = 400;
5398 }
5399 else if (type == 476)
5400 {
5401 width = 200;
5402 height = 200;
5403 aiStyle = 185;
5404 friendly = true;
5405 tileCollide = false;
5406 penetrate = -1;
5407 alpha = 255;
5408 ignoreWater = true;
5409 timeLeft = 3;
5410 magic = true;
5411 }
5412 else if (type == 477)
5413 {
5414 alpha = 255;
5415 width = 14;
5416 height = 14;
5417 aiStyle = 1;
5418 friendly = true;
5419 penetrate = 7;
5420 extraUpdates = 1;
5421 ranged = true;
5422 }
5423 else if (type == 478)
5424 {
5425 alpha = 255;
5426 width = 14;
5427 height = 14;
5428 aiStyle = 1;
5429 friendly = true;
5430 timeLeft = 300;
5431 ranged = true;
5432 }
5433 else if (type == 479)
5434 {
5435 alpha = 255;
5436 width = 14;
5437 height = 14;
5438 aiStyle = 1;
5439 friendly = true;
5440 ranged = true;
5441 }
5442 else if (type == 480)
5443 {
5444 alpha = 255;
5445 width = 12;
5446 height = 12;
5447 penetrate = 3;
5448 aiStyle = 14;
5449 friendly = true;
5450 timeLeft = 120;
5451 ranged = true;
5452 noEnchantments = true;
5453 }
5454 else if (type == 481)
5455 {
5456 width = 22;
5457 height = 22;
5458 aiStyle = 13;
5459 friendly = true;
5460 penetrate = -1;
5461 alpha = 255;
5462 melee = true;
5463 extraUpdates = 0;
5464 }
5465 else if (type == 482)
5466 {
5467 width = 16;
5468 height = 200;
5469 aiStyle = 87;
5470 friendly = true;
5471 tileCollide = false;
5472 penetrate = -1;
5473 alpha = 255;
5474 ignoreWater = true;
5475 timeLeft = 18000;
5476 magic = true;
5479 }
5480 else if (type == 483)
5481 {
5482 width = 14;
5483 height = 14;
5484 aiStyle = 14;
5485 friendly = true;
5486 melee = true;
5487 }
5488 else if (type == 484)
5489 {
5490 width = 10;
5491 height = 10;
5492 aiStyle = 1;
5493 friendly = true;
5494 melee = true;
5495 extraUpdates = 1;
5496 }
5497 else if (type == 485)
5498 {
5499 arrow = true;
5500 width = 24;
5501 height = 24;
5502 aiStyle = 1;
5503 friendly = true;
5504 ranged = true;
5505 penetrate = -1;
5506 timeLeft = 1200;
5507 }
5508 else if (type >= 486 && type <= 489)
5509 {
5510 if (type == 486)
5511 {
5512 width = 12;
5513 height = 12;
5514 }
5515 else if (type == 487)
5516 {
5517 width = 22;
5518 height = 22;
5519 }
5520 else if (type == 488)
5521 {
5522 width = 12;
5523 height = 12;
5524 light = 0.3f;
5525 }
5526 else if (type == 489)
5527 {
5528 width = 20;
5529 height = 16;
5530 }
5531 netImportant = true;
5532 aiStyle = 7;
5533 friendly = true;
5534 penetrate = -1;
5535 tileCollide = false;
5536 timeLeft *= 10;
5537 }
5538 else if (type == 492)
5539 {
5540 netImportant = true;
5541 width = 18;
5542 height = 32;
5543 aiStyle = 90;
5544 friendly = true;
5545 penetrate = -1;
5546 timeLeft *= 5;
5547 }
5548 else if (type == 490)
5549 {
5550 width = 14;
5551 height = 14;
5552 aiStyle = 89;
5553 hostile = true;
5554 alpha = 255;
5555 ignoreWater = true;
5556 tileCollide = false;
5557 timeLeft = 600;
5558 netImportant = true;
5559 }
5560 else if (type == 493 || type == 494)
5561 {
5562 width = 32;
5563 height = 32;
5564 aiStyle = 4;
5565 friendly = true;
5566 penetrate = -1;
5567 tileCollide = false;
5568 alpha = 255;
5569 ignoreWater = true;
5570 magic = true;
5571 light = 0.2f;
5572 }
5573 else if (type == 495)
5574 {
5575 arrow = true;
5576 width = 10;
5577 height = 10;
5578 aiStyle = 1;
5579 friendly = true;
5580 ranged = true;
5581 penetrate = 3;
5582 timeLeft = 1200;
5583 }
5584 else if (type == 496)
5585 {
5586 alpha = 255;
5587 width = 40;
5588 height = 40;
5589 aiStyle = 91;
5590 friendly = true;
5591 magic = true;
5592 MaxUpdates = 3;
5593 penetrate = 3;
5594 usesLocalNPCImmunity = true;
5596 }
5597 else if (type == 497)
5598 {
5599 width = 30;
5600 height = 30;
5601 aiStyle = 2;
5602 friendly = true;
5603 penetrate = 3;
5604 melee = true;
5605 }
5606 else if (type == 498)
5607 {
5608 width = 6;
5609 height = 6;
5610 aiStyle = 1;
5611 hostile = true;
5612 penetrate = -1;
5613 timeLeft = 180;
5614 }
5615 else if (type == 501)
5616 {
5617 width = 14;
5618 height = 14;
5619 aiStyle = 2;
5620 scale = 1.1f;
5621 hostile = true;
5622 ranged = true;
5623 }
5624 else if (type == 502)
5625 {
5626 width = 16;
5627 height = 16;
5628 aiStyle = 8;
5629 friendly = true;
5630 melee = true;
5631 penetrate = 5;
5632 usesLocalNPCImmunity = true;
5634 }
5635 else if (type == 503)
5636 {
5637 width = 24;
5638 height = 24;
5639 aiStyle = 5;
5640 friendly = true;
5641 penetrate = 2;
5642 alpha = 255;
5643 tileCollide = false;
5644 melee = true;
5645 extraUpdates = 1;
5646 usesLocalNPCImmunity = true;
5648 }
5649 else if (type == 504)
5650 {
5651 width = 10;
5652 height = 10;
5653 aiStyle = 2;
5654 friendly = true;
5655 melee = true;
5656 alpha = 255;
5657 penetrate = 2;
5658 noEnchantmentVisuals = true;
5661 }
5662 else if (type == 507)
5663 {
5664 width = 16;
5665 height = 16;
5666 aiStyle = 1;
5667 friendly = true;
5668 ranged = true;
5669 penetrate = 3;
5670 }
5671 else if (type == 508)
5672 {
5673 width = 16;
5674 height = 16;
5675 aiStyle = 1;
5676 hostile = true;
5677 penetrate = -1;
5678 }
5679 else if (type == 509)
5680 {
5681 width = 22;
5682 height = 22;
5683 aiStyle = 20;
5684 friendly = true;
5685 penetrate = -1;
5686 tileCollide = false;
5687 hide = true;
5688 ownerHitCheck = true;
5689 melee = true;
5690 scale = 1.2f;
5693 }
5694 else if (type == 510)
5695 {
5696 width = 18;
5697 height = 18;
5698 aiStyle = 2;
5699 friendly = true;
5700 penetrate = 1;
5701 magic = true;
5702 }
5703 else if (type == 511)
5704 {
5705 width = 32;
5706 height = 32;
5707 aiStyle = 92;
5708 friendly = true;
5709 penetrate = -1;
5710 scale = 1.1f;
5711 magic = true;
5712 }
5713 else if (type == 512)
5714 {
5715 width = 40;
5716 height = 38;
5717 aiStyle = 92;
5718 friendly = true;
5719 penetrate = -1;
5720 scale = 1.1f;
5721 magic = true;
5722 }
5723 else if (type == 513)
5724 {
5725 width = 30;
5726 height = 28;
5727 aiStyle = 92;
5728 friendly = true;
5729 penetrate = -1;
5730 scale = 1.1f;
5731 magic = true;
5732 }
5733 else if (type == 514)
5734 {
5735 width = 10;
5736 height = 10;
5737 aiStyle = 93;
5738 friendly = true;
5739 penetrate = 3;
5740 alpha = 255;
5741 ranged = true;
5742 }
5743 else if (type == 515)
5744 {
5745 netImportant = true;
5746 width = 6;
5747 height = 6;
5748 aiStyle = 14;
5749 penetrate = -1;
5750 alpha = 75;
5751 light = 1f;
5752 timeLeft *= 5;
5753 }
5754 else if (type == 516)
5755 {
5756 width = 22;
5757 height = 22;
5758 aiStyle = 16;
5759 friendly = true;
5760 penetrate = -1;
5761 }
5762 else if (type == 517)
5763 {
5764 width = 14;
5765 height = 14;
5766 aiStyle = 16;
5767 friendly = true;
5768 penetrate = -1;
5769 ranged = true;
5770 }
5771 else if (type == 518)
5772 {
5773 width = 32;
5774 height = 32;
5775 aiStyle = 94;
5776 friendly = true;
5777 alpha = 255;
5778 tileCollide = false;
5779 ignoreWater = true;
5780 }
5781 else if (type == 519)
5782 {
5783 width = 24;
5784 height = 24;
5785 aiStyle = 16;
5786 friendly = true;
5787 penetrate = -1;
5788 tileCollide = false;
5789 }
5790 else if (type == 520)
5791 {
5792 width = 22;
5793 height = 22;
5794 aiStyle = 2;
5795 friendly = true;
5796 penetrate = 3;
5797 ranged = true;
5798 coldDamage = true;
5799 }
5800 else if (type == 521)
5801 {
5802 width = 14;
5803 height = 14;
5804 aiStyle = 29;
5805 alpha = 255;
5806 magic = true;
5807 penetrate = 1;
5808 friendly = true;
5809 }
5810 else if (type == 522)
5811 {
5812 width = 8;
5813 height = 8;
5814 aiStyle = 29;
5815 alpha = 255;
5816 magic = true;
5817 penetrate = 1;
5818 friendly = true;
5819 }
5820 else if (type == 523)
5821 {
5822 width = 32;
5823 height = 32;
5824 aiStyle = 95;
5825 alpha = 255;
5826 ranged = true;
5827 penetrate = 1;
5828 friendly = true;
5829 }
5830 else if (type == 524)
5831 {
5832 width = 10;
5833 height = 10;
5834 aiStyle = 96;
5835 friendly = true;
5836 alpha = 255;
5837 penetrate = 5;
5838 ignoreWater = true;
5839 melee = true;
5840 extraUpdates = 5;
5843 }
5844 else if (type == 525)
5845 {
5846 width = 30;
5847 height = 24;
5848 aiStyle = 97;
5849 tileCollide = false;
5850 timeLeft = 10800;
5851 hide = true;
5852 }
5853 else if (type == 526)
5854 {
5855 width = 8;
5856 height = 8;
5857 aiStyle = 98;
5858 tileCollide = false;
5859 timeLeft = 120;
5860 alpha = 255;
5861 }
5862 else if (type >= 527 && type <= 531)
5863 {
5864 knockBack = 12f;
5865 width = 24;
5866 height = 24;
5867 aiStyle = 17;
5868 penetrate = -1;
5869 if (Main.getGoodWorld)
5870 {
5871 friendly = true;
5872 hostile = true;
5873 }
5874 }
5875 else if (type == 532)
5876 {
5877 width = 16;
5878 height = 16;
5879 aiStyle = 1;
5880 scale = 1f;
5881 friendly = true;
5882 penetrate = 3;
5883 extraUpdates = 1;
5884 usesLocalNPCImmunity = true;
5886 }
5887 else if (type == 533)
5888 {
5889 netImportant = true;
5890 width = 20;
5891 height = 20;
5892 aiStyle = 66;
5893 penetrate = -1;
5894 timeLeft *= 5;
5895 minion = true;
5896 minionSlots = 1f;
5897 tileCollide = false;
5898 ignoreWater = true;
5899 friendly = true;
5900 usesLocalNPCImmunity = true;
5902 }
5903 else if (type == 534)
5904 {
5905 extraUpdates = 0;
5906 width = 16;
5907 height = 16;
5908 aiStyle = 99;
5909 friendly = true;
5910 penetrate = -1;
5911 melee = true;
5912 scale = 1f;
5913 }
5914 else if (type >= 541 && type <= 555)
5915 {
5916 extraUpdates = 0;
5917 width = 16;
5918 height = 16;
5919 aiStyle = 99;
5920 friendly = true;
5921 penetrate = -1;
5922 melee = true;
5923 scale = 1f;
5924 if (type == 547)
5925 {
5926 scale = 1.1f;
5927 }
5928 if (type == 554)
5929 {
5930 scale = 1.2f;
5931 }
5932 if (type == 555)
5933 {
5934 scale = 1.15f;
5935 }
5936 if (type == 551 || type == 550)
5937 {
5938 scale = 1.1f;
5939 }
5940 }
5941 else if (type >= 562 && type <= 564)
5942 {
5943 extraUpdates = 0;
5944 width = 16;
5945 height = 16;
5946 aiStyle = 99;
5947 friendly = true;
5948 penetrate = -1;
5949 melee = true;
5950 scale = 1f;
5951 if (type == 563)
5952 {
5953 scale = 1.05f;
5954 }
5955 if (type == 564)
5956 {
5957 scale = 1.075f;
5958 }
5959 }
5960 else if (type == 603)
5961 {
5962 extraUpdates = 0;
5963 width = 16;
5964 height = 16;
5965 aiStyle = 99;
5966 friendly = true;
5967 penetrate = -1;
5968 melee = true;
5969 scale = 1.15f;
5972 }
5973 else if (type == 604)
5974 {
5975 extraUpdates = 0;
5976 width = 14;
5977 height = 14;
5978 aiStyle = 115;
5979 friendly = true;
5980 penetrate = -1;
5981 melee = true;
5982 scale = 1.2f;
5985 }
5986 else if (type >= 556 && type <= 561)
5987 {
5988 extraUpdates = 0;
5989 width = 10;
5990 height = 10;
5991 aiStyle = 99;
5992 friendly = true;
5993 penetrate = -1;
5994 melee = true;
5995 scale = 1f;
5996 counterweight = true;
5997 }
5998 else if (type == 535)
5999 {
6000 width = 18;
6001 height = 18;
6002 aiStyle = 100;
6003 friendly = true;
6004 penetrate = -1;
6005 tileCollide = false;
6006 hide = true;
6007 magic = true;
6008 ignoreWater = true;
6009 }
6010 else if (type == 536)
6011 {
6012 width = 10;
6013 height = 10;
6014 aiStyle = 101;
6015 friendly = true;
6016 penetrate = -1;
6017 tileCollide = false;
6018 hide = true;
6019 magic = true;
6020 ignoreWater = true;
6021 }
6022 else if (type == 537)
6023 {
6024 width = 22;
6025 height = 22;
6026 aiStyle = 84;
6027 hostile = true;
6028 penetrate = -1;
6029 alpha = 255;
6030 timeLeft = 240;
6031 tileCollide = false;
6032 }
6033 else if (type == 538)
6034 {
6035 width = 12;
6036 height = 12;
6037 aiStyle = 14;
6038 hostile = true;
6039 penetrate = -1;
6040 timeLeft = 120;
6041 extraUpdates = 1;
6042 alpha = 255;
6043 }
6044 else if (type == 539)
6045 {
6046 width = 18;
6047 height = 30;
6048 aiStyle = 102;
6049 hostile = true;
6050 penetrate = -1;
6051 timeLeft = 600;
6052 }
6053 else if (type == 540)
6054 {
6055 width = 20;
6056 height = 20;
6057 aiStyle = 103;
6058 hostile = true;
6059 penetrate = -1;
6060 timeLeft = 300;
6061 alpha = 255;
6062 }
6063 else if (type == 565)
6064 {
6065 width = 28;
6066 height = 28;
6067 aiStyle = 104;
6068 penetrate = -1;
6069 tileCollide = false;
6070 ignoreWater = true;
6071 alpha = 255;
6072 scale = 0.8f;
6073 }
6074 else if (type == 566)
6075 {
6076 width = 16;
6077 height = 16;
6078 aiStyle = 36;
6079 friendly = true;
6080 penetrate = 4;
6081 alpha = 255;
6082 timeLeft = 660;
6083 extraUpdates = 3;
6084 noEnchantmentVisuals = true;
6085 }
6086 else if (type == 567 || type == 568)
6087 {
6088 if (type == 567)
6089 {
6090 width = 14;
6091 height = 14;
6092 }
6093 else
6094 {
6095 width = 16;
6096 height = 16;
6097 }
6098 aiStyle = 105;
6099 friendly = true;
6100 penetrate = 1;
6101 alpha = 255;
6102 timeLeft = 3600;
6103 tileCollide = false;
6104 ignoreWater = true;
6105 }
6106 else if (type >= 569 && type <= 571)
6107 {
6108 width = 32;
6109 height = 32;
6110 aiStyle = 106;
6111 friendly = true;
6112 penetrate = -1;
6113 alpha = 255;
6114 timeLeft = 3600;
6115 tileCollide = false;
6116 ignoreWater = true;
6117 }
6118 else if (type == 575)
6119 {
6120 width = 24;
6121 height = 24;
6122 aiStyle = 107;
6123 hostile = true;
6124 penetrate = -1;
6125 tileCollide = false;
6126 timeLeft = 420;
6127 alpha = 255;
6128 }
6129 else if (type == 573)
6130 {
6131 width = 18;
6132 height = 30;
6133 aiStyle = 102;
6134 hostile = true;
6135 penetrate = -1;
6136 timeLeft = 600;
6137 }
6138 else if (type == 574)
6139 {
6140 width = 18;
6141 height = 18;
6142 aiStyle = 102;
6143 hostile = true;
6144 timeLeft = 600;
6145 tileCollide = false;
6146 }
6147 else if (type == 572)
6148 {
6149 width = 10;
6150 height = 10;
6151 aiStyle = 1;
6152 alpha = 255;
6153 penetrate = -1;
6154 friendly = false;
6155 hostile = true;
6156 }
6157 else if (type == 576)
6158 {
6159 width = 4;
6160 height = 4;
6161 aiStyle = 1;
6162 hostile = true;
6163 penetrate = -1;
6164 alpha = 255;
6165 extraUpdates = 2;
6166 scale = 1.2f;
6167 timeLeft = 600;
6168 }
6169 else if (type == 577)
6170 {
6171 width = 4;
6172 height = 4;
6173 aiStyle = 1;
6174 hostile = true;
6175 penetrate = -1;
6176 alpha = 255;
6177 extraUpdates = 2;
6178 scale = 1.2f;
6179 timeLeft = 600;
6180 }
6181 else if (type == 578 || type == 579 || type == 813)
6182 {
6183 width = 32;
6184 height = 32;
6185 aiStyle = 108;
6186 friendly = true;
6187 alpha = 255;
6188 tileCollide = false;
6189 ignoreWater = true;
6190 hostile = true;
6191 hide = true;
6192 }
6193 else if (type == 580)
6194 {
6195 width = 14;
6196 height = 14;
6197 aiStyle = 88;
6198 hostile = true;
6199 alpha = 255;
6200 ignoreWater = true;
6201 tileCollide = true;
6202 extraUpdates = 4;
6203 timeLeft = 600;
6204 }
6205 else if (type == 581)
6206 {
6207 width = 10;
6208 height = 10;
6209 aiStyle = 1;
6210 alpha = 255;
6211 penetrate = -1;
6212 friendly = false;
6213 hostile = true;
6214 }
6215 else if (type == 582)
6216 {
6217 width = 20;
6218 height = 20;
6219 aiStyle = 109;
6220 friendly = true;
6221 penetrate = -1;
6222 MaxUpdates = 2;
6223 }
6224 else if (type == 583)
6225 {
6226 width = 10;
6227 height = 10;
6228 aiStyle = 2;
6229 friendly = true;
6230 scale = 0.8f;
6231 }
6232 else if (type == 589)
6233 {
6234 width = 10;
6235 height = 10;
6236 aiStyle = 2;
6237 friendly = true;
6238 }
6239 else if (type == 584)
6240 {
6241 width = 10;
6242 height = 10;
6243 aiStyle = 110;
6244 friendly = true;
6245 scale = 0.8f;
6246 penetrate = 3;
6247 }
6248 else if (type == 585)
6249 {
6250 width = 26;
6251 height = 26;
6252 aiStyle = 1;
6253 alpha = 255;
6254 friendly = true;
6255 penetrate = 3;
6256 }
6257 else if (type == 586)
6258 {
6259 width = 26;
6260 height = 26;
6261 aiStyle = 111;
6262 alpha = 255;
6263 friendly = true;
6264 penetrate = -1;
6265 }
6266 else if (type == 587)
6267 {
6268 width = 10;
6269 height = 10;
6270 aiStyle = 1;
6271 alpha = 255;
6272 friendly = true;
6273 ranged = true;
6274 }
6275 else if (type == 588)
6276 {
6277 width = 14;
6278 height = 14;
6279 aiStyle = 16;
6280 friendly = true;
6281 penetrate = -1;
6282 ranged = true;
6283 }
6284 else if (type == 590)
6285 {
6286 width = 14;
6287 height = 14;
6288 aiStyle = 112;
6289 friendly = true;
6290 penetrate = 1;
6291 alpha = 255;
6292 timeLeft = 900;
6293 tileCollide = false;
6294 ignoreWater = true;
6295 }
6296 else if (type == 591)
6297 {
6298 width = 8;
6299 height = 8;
6300 aiStyle = 101;
6301 friendly = true;
6302 penetrate = -1;
6303 tileCollide = false;
6304 hide = true;
6305 ignoreWater = true;
6306 }
6307 else if (type == 592)
6308 {
6309 width = 8;
6310 height = 8;
6311 aiStyle = 1;
6312 hostile = true;
6313 alpha = 255;
6314 extraUpdates = 3;
6315 ignoreWater = true;
6316 }
6317 else if (type == 593)
6318 {
6319 width = 16;
6320 height = 16;
6321 aiStyle = 1;
6322 hostile = true;
6323 alpha = 255;
6324 extraUpdates = 1;
6325 ignoreWater = true;
6326 }
6327 else if (type == 594)
6328 {
6329 width = 40;
6330 height = 40;
6331 aiStyle = 1;
6332 alpha = 255;
6333 extraUpdates = 2;
6334 }
6335 else if (type == 595)
6336 {
6337 width = 68;
6338 height = 64;
6339 aiStyle = 75;
6340 friendly = true;
6341 tileCollide = false;
6342 melee = true;
6343 penetrate = -1;
6344 ownerHitCheck = true;
6345 }
6346 else if (type == 596)
6347 {
6348 width = 8;
6349 height = 8;
6350 aiStyle = 107;
6351 hostile = true;
6352 alpha = 255;
6353 ignoreWater = true;
6354 timeLeft = 180;
6355 tileCollide = false;
6356 }
6357 else if (type == 597)
6358 {
6359 width = 10;
6360 height = 10;
6361 aiStyle = 29;
6362 alpha = 255;
6363 magic = true;
6364 penetrate = 2;
6365 friendly = true;
6366 }
6367 else if (type == 598)
6368 {
6369 width = 16;
6370 height = 16;
6371 aiStyle = 113;
6372 friendly = true;
6373 ranged = true;
6374 penetrate = -1;
6375 alpha = 255;
6376 hide = true;
6377 }
6378 else if (type == 599)
6379 {
6380 width = 22;
6381 height = 22;
6382 aiStyle = 2;
6383 friendly = true;
6384 penetrate = 6;
6385 ranged = true;
6386 }
6387 else if (type == 600)
6388 {
6389 width = 14;
6390 height = 14;
6391 aiStyle = 75;
6392 friendly = true;
6393 penetrate = -1;
6394 tileCollide = false;
6395 hide = true;
6396 ignoreWater = true;
6397 }
6398 else if (type == 601)
6399 {
6400 width = 10;
6401 height = 10;
6402 aiStyle = 1;
6403 alpha = 255;
6404 friendly = true;
6405 extraUpdates = 30;
6406 }
6407 else if (type == 602)
6408 {
6409 width = 10;
6410 height = 10;
6411 aiStyle = 114;
6412 alpha = 255;
6413 friendly = true;
6414 tileCollide = false;
6415 netImportant = true;
6416 }
6417 else if (type == 605)
6418 {
6419 alpha = 255;
6420 width = 6;
6421 height = 6;
6422 aiStyle = 1;
6423 hostile = true;
6424 penetrate = -1;
6425 }
6426 else if (type == 606)
6427 {
6428 width = 5;
6429 height = 5;
6430 aiStyle = 1;
6431 friendly = true;
6432 alpha = 255;
6433 extraUpdates = 2;
6434 scale = 1f;
6435 timeLeft = 600;
6436 ignoreWater = true;
6437 }
6438 else if (type == 607)
6439 {
6440 width = 10;
6441 height = 10;
6442 aiStyle = 116;
6443 friendly = true;
6444 alpha = 255;
6445 timeLeft = 600;
6446 ignoreWater = true;
6447 tileCollide = false;
6448 penetrate = -1;
6449 }
6450 else if (type == 608)
6451 {
6452 width = 160;
6453 height = 160;
6454 aiStyle = 117;
6455 friendly = true;
6456 alpha = 255;
6457 timeLeft = 3;
6458 ignoreWater = true;
6459 tileCollide = false;
6460 penetrate = -1;
6461 hide = true;
6462 }
6463 else if (type == 611)
6464 {
6465 width = 16;
6466 height = 16;
6467 aiStyle = 75;
6468 friendly = true;
6469 melee = true;
6470 penetrate = -1;
6471 alpha = 255;
6472 hide = true;
6473 tileCollide = false;
6474 ignoreWater = true;
6475 usesLocalNPCImmunity = true;
6476 noEnchantmentVisuals = true;
6477 }
6478 else if (type == 612)
6479 {
6480 width = 8;
6481 height = 8;
6482 aiStyle = 117;
6483 friendly = true;
6484 alpha = 255;
6485 ignoreWater = true;
6486 timeLeft = 60;
6487 tileCollide = false;
6488 penetrate = -1;
6489 usesLocalNPCImmunity = true;
6490 }
6491 else if (type == 613)
6492 {
6493 netImportant = true;
6494 width = 24;
6495 height = 24;
6496 aiStyle = 62;
6497 penetrate = -1;
6498 timeLeft *= 5;
6499 minion = true;
6500 friendly = true;
6501 minionSlots = 1f;
6502 ignoreWater = true;
6503 }
6504 else if (type == 614)
6505 {
6506 width = 16;
6507 height = 16;
6508 aiStyle = 113;
6509 friendly = true;
6510 penetrate = -1;
6511 alpha = 255;
6512 }
6513 else if (type == 615)
6514 {
6515 width = 22;
6516 height = 22;
6517 aiStyle = 75;
6518 friendly = true;
6519 penetrate = -1;
6520 tileCollide = false;
6521 hide = true;
6522 ranged = true;
6523 ignoreWater = true;
6524 }
6525 else if (type == 616)
6526 {
6527 width = 14;
6528 height = 14;
6529 aiStyle = 1;
6530 friendly = true;
6531 penetrate = 1;
6532 alpha = 255;
6533 ranged = true;
6534 extraUpdates = 2;
6535 timeLeft = 90 * MaxUpdates;
6536 }
6537 else if (type == 617)
6538 {
6539 width = 32;
6540 height = 32;
6541 aiStyle = 118;
6542 friendly = true;
6543 alpha = 255;
6544 ignoreWater = true;
6545 hide = true;
6546 magic = true;
6547 penetrate = 3;
6548 usesLocalNPCImmunity = true;
6549 }
6550 else if (type == 618)
6551 {
6552 tileCollide = false;
6553 width = 18;
6554 height = 30;
6555 aiStyle = 119;
6556 penetrate = -1;
6557 timeLeft = 420;
6558 magic = true;
6559 friendly = true;
6560 usesLocalNPCImmunity = true;
6561 }
6562 else if (type == 619)
6563 {
6564 width = 14;
6565 height = 14;
6566 aiStyle = 29;
6567 alpha = 255;
6568 magic = true;
6569 penetrate = 1;
6570 friendly = true;
6571 }
6572 else if (type == 620)
6573 {
6574 width = 8;
6575 height = 8;
6576 aiStyle = 29;
6577 alpha = 255;
6578 magic = true;
6579 penetrate = 1;
6580 friendly = true;
6581 }
6582 else if (type == 622)
6583 {
6584 width = 10;
6585 height = 10;
6586 aiStyle = 1;
6587 alpha = 255;
6588 extraUpdates = 2;
6589 }
6590 else if (type == 623)
6591 {
6592 netImportant = true;
6593 width = 50;
6594 height = 80;
6595 aiStyle = 120;
6596 penetrate = -1;
6597 timeLeft *= 5;
6598 minion = true;
6599 friendly = true;
6600 minionSlots = 0f;
6601 ignoreWater = true;
6602 tileCollide = false;
6603 netImportant = true;
6604 manualDirectionChange = true;
6605 usesLocalNPCImmunity = true;
6607 }
6608 else if (type == 624)
6609 {
6610 width = 8;
6611 height = 8;
6612 aiStyle = 117;
6613 friendly = true;
6614 alpha = 255;
6615 ignoreWater = true;
6616 timeLeft = 60;
6617 tileCollide = false;
6618 penetrate = -1;
6619 }
6620 else if (type >= 625 && type <= 628)
6621 {
6622 if (type == 625 || type == 628)
6623 {
6624 netImportant = true;
6625 }
6626 if (type == 626 || type == 627)
6627 {
6628 minionSlots = 0.5f;
6629 }
6630 width = 24;
6631 height = 24;
6632 aiStyle = 121;
6633 penetrate = -1;
6634 timeLeft *= 5;
6635 minion = true;
6636 friendly = true;
6637 ignoreWater = true;
6638 tileCollide = false;
6639 alpha = 255;
6640 hide = true;
6641 netImportant = true;
6642 usesLocalNPCImmunity = true;
6644 }
6645 else if (type == 629)
6646 {
6647 width = 8;
6648 height = 8;
6649 aiStyle = 122;
6650 hostile = true;
6651 alpha = 255;
6652 ignoreWater = true;
6653 timeLeft = 3600;
6654 tileCollide = false;
6655 penetrate = -1;
6656 extraUpdates = 2;
6657 }
6658 else if (type == 630 || type == 705)
6659 {
6660 width = 22;
6661 height = 22;
6662 aiStyle = 75;
6663 friendly = true;
6664 penetrate = -1;
6665 tileCollide = false;
6666 hide = true;
6667 ranged = true;
6668 ignoreWater = true;
6669 }
6670 else if (type == 631)
6671 {
6672 arrow = true;
6673 width = 10;
6674 height = 10;
6675 aiStyle = 122;
6676 friendly = true;
6677 ranged = true;
6678 tileCollide = false;
6679 alpha = 255;
6680 ignoreWater = true;
6681 extraUpdates = 1;
6682 timeLeft = 1200;
6683 }
6684 else if (type == 633)
6685 {
6686 width = 14;
6687 height = 18;
6688 aiStyle = 75;
6689 friendly = true;
6690 penetrate = -1;
6691 tileCollide = false;
6692 magic = true;
6693 ignoreWater = true;
6694 }
6695 else if (type == 632)
6696 {
6697 width = 18;
6698 height = 18;
6699 aiStyle = 84;
6700 friendly = true;
6701 magic = true;
6702 penetrate = -1;
6703 alpha = 255;
6704 tileCollide = false;
6705 }
6706 else if (type == 634)
6707 {
6708 width = 40;
6709 height = 40;
6710 aiStyle = 1;
6711 friendly = true;
6712 alpha = 255;
6713 ignoreWater = true;
6714 extraUpdates = 2;
6715 magic = true;
6716 }
6717 else if (type == 635)
6718 {
6719 width = 40;
6720 height = 40;
6721 aiStyle = 1;
6722 friendly = true;
6723 alpha = 255;
6724 friendly = true;
6725 extraUpdates = 3;
6726 magic = true;
6727 }
6728 else if (type == 636)
6729 {
6730 width = 16;
6731 height = 16;
6732 aiStyle = 113;
6733 friendly = true;
6734 melee = true;
6735 penetrate = -1;
6736 alpha = 255;
6737 hide = true;
6738 MaxUpdates = 2;
6739 }
6740 else if (type == 637)
6741 {
6742 width = 10;
6743 height = 10;
6744 aiStyle = 16;
6745 friendly = true;
6746 penetrate = -1;
6747 }
6748 else if (type == 638)
6749 {
6750 width = 4;
6751 height = 4;
6752 aiStyle = 1;
6753 friendly = true;
6754 alpha = 255;
6755 extraUpdates = 5;
6756 timeLeft = 600;
6757 ranged = true;
6758 ignoreWater = true;
6759 usesLocalNPCImmunity = true;
6760 penetrate = -1;
6761 }
6762 else if (type == 639)
6763 {
6764 arrow = true;
6765 width = 10;
6766 height = 10;
6767 aiStyle = 1;
6768 friendly = true;
6769 ranged = true;
6770 MaxUpdates = 2;
6771 timeLeft = MaxUpdates * 45;
6772 ignoreWater = true;
6773 usesLocalNPCImmunity = true;
6774 alpha = 255;
6775 penetrate = 4;
6776 }
6777 else if (type == 640)
6778 {
6779 width = 10;
6780 height = 10;
6781 aiStyle = 1;
6782 friendly = true;
6783 ranged = true;
6784 MaxUpdates = 3;
6785 timeLeft = 90;
6786 ignoreWater = true;
6787 usesLocalNPCImmunity = true;
6788 alpha = 255;
6789 penetrate = 4;
6790 }
6791 else if (type == 642)
6792 {
6793 width = 18;
6794 height = 18;
6795 aiStyle = 84;
6796 friendly = true;
6797 penetrate = -1;
6798 alpha = 255;
6799 tileCollide = false;
6800 usesLocalNPCImmunity = true;
6801 }
6802 else if (type == 641)
6803 {
6804 width = 32;
6805 height = 32;
6806 aiStyle = 123;
6807 timeLeft = 36000;
6808 ignoreWater = true;
6809 tileCollide = false;
6810 alpha = 255;
6811 hide = true;
6812 sentry = true;
6813 netImportant = true;
6814 }
6815 else if (type == 643)
6816 {
6817 width = 32;
6818 height = 32;
6819 aiStyle = 123;
6820 timeLeft = 36000;
6821 ignoreWater = true;
6822 tileCollide = false;
6823 alpha = 255;
6824 sentry = true;
6825 netImportant = true;
6826 }
6827 else if (type == 644)
6828 {
6829 width = 14;
6830 height = 14;
6831 aiStyle = 112;
6832 penetrate = 1;
6833 timeLeft = 900;
6834 tileCollide = false;
6835 ignoreWater = true;
6836 alpha = 255;
6838 }
6839 else if (type == 645)
6840 {
6841 width = 10;
6842 height = 10;
6843 aiStyle = 1;
6844 friendly = true;
6845 magic = true;
6846 tileCollide = false;
6847 extraUpdates = 5;
6848 penetrate = -1;
6849 usesLocalNPCImmunity = true;
6850 }
6851 else if (type >= 646 && type <= 649)
6852 {
6853 netImportant = true;
6854 width = 18;
6855 height = 18;
6856 aiStyle = 7;
6857 friendly = true;
6858 penetrate = -1;
6859 tileCollide = false;
6860 timeLeft *= 10;
6861 }
6862 else if (type == 650)
6863 {
6864 width = 20;
6865 height = 20;
6866 aiStyle = 124;
6867 penetrate = -1;
6868 netImportant = true;
6869 timeLeft *= 5;
6870 friendly = true;
6871 ignoreWater = true;
6872 tileCollide = false;
6873 manualDirectionChange = true;
6874 }
6875 else if (type == 651)
6876 {
6877 width = 10;
6878 height = 10;
6879 aiStyle = 125;
6880 friendly = true;
6881 ignoreWater = true;
6882 tileCollide = false;
6883 penetrate = -1;
6884 }
6885 else if (type == 652)
6886 {
6887 netImportant = true;
6888 width = 18;
6889 height = 18;
6890 aiStyle = 7;
6891 friendly = true;
6892 penetrate = -1;
6893 tileCollide = false;
6894 timeLeft *= 10;
6895 }
6896 else if (type == 653)
6897 {
6898 width = 30;
6899 height = 30;
6900 aiStyle = 67;
6901 penetrate = -1;
6902 netImportant = true;
6903 timeLeft *= 5;
6904 friendly = true;
6905 ignoreWater = true;
6906 scale = 0.8f;
6907 }
6908 else if (type == 654)
6909 {
6910 width = 30;
6911 height = 30;
6912 aiStyle = 126;
6913 alpha = 255;
6914 tileCollide = false;
6915 ignoreWater = true;
6916 timeLeft = 120;
6917 friendly = true;
6918 hostile = true;
6919 penetrate = -1;
6920 trap = true;
6921 }
6922 else if (type == 655)
6923 {
6924 width = 31;
6925 height = 31;
6926 aiStyle = 25;
6927 friendly = true;
6928 hostile = true;
6929 penetrate = -1;
6930 trap = true;
6931 }
6932 else if (type == 656)
6933 {
6934 width = 10;
6935 height = 10;
6936 aiStyle = 127;
6937 friendly = true;
6938 magic = true;
6939 tileCollide = false;
6940 penetrate = -1;
6941 usesLocalNPCImmunity = true;
6942 timeLeft = 1200;
6943 }
6944 else if (type == 657)
6945 {
6946 width = 10;
6947 height = 10;
6948 aiStyle = 127;
6949 hostile = true;
6950 tileCollide = false;
6951 penetrate = -1;
6952 timeLeft = 1200;
6953 }
6954 else if (type == 658)
6955 {
6956 width = 14;
6957 height = 14;
6958 aiStyle = 128;
6959 penetrate = 1;
6960 timeLeft = 900;
6961 tileCollide = false;
6962 ignoreWater = true;
6963 alpha = 255;
6964 hostile = true;
6965 }
6966 else if (type == 659)
6967 {
6968 width = 8;
6969 height = 8;
6970 aiStyle = 129;
6971 friendly = true;
6972 magic = true;
6973 alpha = 255;
6974 ignoreWater = true;
6975 timeLeft = 240;
6976 tileCollide = false;
6977 penetrate = -1;
6978 }
6979 else if (type == 660)
6980 {
6981 width = 10;
6982 height = 10;
6983 aiStyle = 1;
6984 friendly = true;
6985 alpha = 255;
6986 timeLeft = 600;
6987 magic = true;
6988 ignoreWater = true;
6989 }
6990 else if (type == 661)
6991 {
6992 width = 10;
6993 height = 10;
6994 aiStyle = 1;
6995 friendly = true;
6996 alpha = 255;
6997 timeLeft = 40;
6998 extraUpdates = 1;
6999 ranged = true;
7000 ignoreWater = true;
7001 usesLocalNPCImmunity = true;
7002 }
7003 else if (type == 662 || type == 685)
7004 {
7005 width = 16;
7006 height = 16;
7007 aiStyle = 1;
7008 hostile = true;
7009 penetrate = -1;
7010 }
7011 else if (type == 663 || type == 665 || type == 667)
7012 {
7013 width = 30;
7014 height = 54;
7015 aiStyle = 130;
7016 timeLeft = 36000;
7017 ignoreWater = true;
7018 tileCollide = false;
7019 manualDirectionChange = true;
7020 switch (type)
7021 {
7022 case 665:
7023 height = 58;
7024 width = 28;
7025 break;
7026 case 667:
7027 height = 60;
7028 width = 28;
7029 break;
7030 }
7031 sentry = true;
7032 netImportant = true;
7033 }
7034 else if (type == 664 || type == 666 || type == 668)
7035 {
7036 width = 16;
7037 height = 16;
7038 aiStyle = 131;
7039 friendly = true;
7040 alpha = 255;
7041 usesLocalNPCImmunity = true;
7043 }
7044 else if (type == 669)
7045 {
7046 width = 14;
7047 height = 14;
7048 aiStyle = 68;
7049 friendly = true;
7050 penetrate = 1;
7051 alpha = 255;
7052 ranged = true;
7053 noEnchantmentVisuals = true;
7054 }
7055 else if (type == 670)
7056 {
7057 width = 30;
7058 height = 30;
7059 aiStyle = 126;
7060 alpha = 255;
7061 tileCollide = false;
7062 ignoreWater = true;
7063 timeLeft = 120;
7064 hostile = true;
7065 penetrate = -1;
7066 }
7067 else if (type == 671)
7068 {
7069 width = 10;
7070 height = 10;
7071 aiStyle = 1;
7072 alpha = 255;
7073 penetrate = -1;
7074 friendly = false;
7075 hostile = true;
7076 }
7077 else if (type == 672)
7078 {
7079 width = 10;
7080 height = 10;
7081 aiStyle = 132;
7082 alpha = 255;
7083 tileCollide = false;
7084 ignoreWater = true;
7085 timeLeft = 900;
7086 hostile = true;
7087 penetrate = -1;
7088 }
7089 else if (type == 674 || type == 673)
7090 {
7091 width = 10;
7092 height = 10;
7093 aiStyle = 133;
7094 alpha = 255;
7095 tileCollide = false;
7096 ignoreWater = true;
7097 timeLeft = 900;
7098 hostile = true;
7099 penetrate = -1;
7100 hide = true;
7101 }
7102 else if (type == 675)
7103 {
7104 width = 10;
7105 height = 10;
7106 aiStyle = 1;
7107 alpha = 255;
7108 penetrate = -1;
7109 friendly = false;
7110 hostile = true;
7111 }
7112 else if (type == 676)
7113 {
7114 width = 10;
7115 height = 10;
7116 aiStyle = 1;
7117 alpha = 255;
7118 penetrate = -1;
7119 friendly = false;
7120 hostile = true;
7121 }
7122 else if (type == 677 || type == 678 || type == 679)
7123 {
7124 width = 26;
7125 height = 54;
7126 aiStyle = 134;
7127 timeLeft = 36000;
7128 ignoreWater = true;
7129 tileCollide = false;
7130 manualDirectionChange = true;
7131 sentry = true;
7132 netImportant = true;
7133 }
7134 else if (type == 680)
7135 {
7136 width = 16;
7137 height = 16;
7138 aiStyle = 1;
7139 friendly = true;
7140 penetrate = 4;
7141 usesLocalNPCImmunity = true;
7143 }
7144 else if (type == 681)
7145 {
7146 width = 14;
7147 height = 14;
7148 aiStyle = 16;
7149 hostile = true;
7150 penetrate = -1;
7151 ranged = true;
7152 }
7153 else if (type == 682)
7154 {
7155 width = 10;
7156 height = 10;
7157 aiStyle = 1;
7158 hostile = true;
7159 ignoreWater = true;
7160 timeLeft = 30;
7161 scale = 1.2f;
7162 }
7163 else if (type == 683)
7164 {
7165 width = 30;
7166 height = 30;
7167 aiStyle = 135;
7168 alpha = 255;
7169 tileCollide = false;
7170 ignoreWater = true;
7171 timeLeft = 120;
7172 hostile = true;
7173 penetrate = -1;
7174 }
7175 else if (type == 684)
7176 {
7177 width = 16;
7178 height = 16;
7179 aiStyle = 1;
7180 melee = true;
7181 penetrate = 5;
7182 alpha = 255;
7183 friendly = true;
7184 tileCollide = false;
7185 }
7186 else if (type == 686)
7187 {
7188 width = 30;
7189 height = 30;
7190 aiStyle = 1;
7191 alpha = 255;
7192 penetrate = -1;
7193 friendly = false;
7194 hostile = true;
7195 }
7196 else if (type == 687)
7197 {
7198 width = 30;
7199 height = 30;
7200 aiStyle = 136;
7201 alpha = 255;
7202 penetrate = -1;
7203 friendly = false;
7204 hostile = true;
7205 }
7206 else if (type == 688 || type == 689 || type == 690)
7207 {
7208 width = 16;
7209 height = 16;
7210 aiStyle = 137;
7211 friendly = true;
7212 ignoreWater = true;
7213 usesLocalNPCImmunity = true;
7214 timeLeft = 36000;
7216 tileCollide = false;
7217 penetrate = -1;
7218 sentry = true;
7219 netImportant = true;
7220 }
7221 else if (type == 691 || type == 692 || type == 693)
7222 {
7223 width = 16;
7224 height = 16;
7225 aiStyle = 138;
7226 ignoreWater = true;
7227 friendly = true;
7228 timeLeft = 36000;
7229 tileCollide = false;
7230 penetrate = -1;
7231 hide = true;
7232 sentry = true;
7233 netImportant = true;
7234 }
7235 else if (type == 694 || type == 695 || type == 696)
7236 {
7237 aiStyle = 139;
7238 friendly = true;
7239 tileCollide = false;
7240 penetrate = -1;
7241 usesLocalNPCImmunity = true;
7243 alpha = 255;
7244 width = 144;
7245 height = 144;
7246 }
7247 else if (type == 697)
7248 {
7249 width = 16;
7250 height = 16;
7251 aiStyle = 140;
7252 friendly = true;
7253 melee = true;
7254 scale = 1.35f;
7255 penetrate = -1;
7256 alpha = 255;
7257 hide = true;
7258 tileCollide = false;
7259 ignoreWater = true;
7260 usesLocalNPCImmunity = true;
7262 ownerHitCheck = true;
7263 }
7264 else if (type == 698)
7265 {
7266 width = 50;
7267 height = 200;
7268 aiStyle = 141;
7269 alpha = 255;
7270 tileCollide = false;
7271 ignoreWater = true;
7272 timeLeft = 120;
7273 friendly = true;
7274 penetrate = -1;
7275 usesLocalNPCImmunity = true;
7277 melee = true;
7278 }
7279 else if (type == 699)
7280 {
7281 width = 24;
7282 height = 24;
7283 aiStyle = 142;
7284 friendly = true;
7285 melee = true;
7286 penetrate = -1;
7287 alpha = 255;
7288 hide = true;
7289 tileCollide = false;
7290 ignoreWater = true;
7293 ownerHitCheck = true;
7294 }
7295 else if (type == 700)
7296 {
7297 width = 40;
7298 height = 40;
7299 aiStyle = 143;
7300 alpha = 255;
7301 penetrate = -1;
7302 friendly = true;
7303 melee = true;
7304 usesLocalNPCImmunity = true;
7306 ignoreWater = true;
7307 tileCollide = false;
7308 }
7309 else if (type == 703 || type == 701 || type == 702)
7310 {
7311 width = 20;
7312 height = 20;
7313 aiStyle = 144;
7314 penetrate = -1;
7315 netImportant = true;
7316 timeLeft *= 5;
7317 scale = 1f;
7318 friendly = true;
7319 ignoreWater = true;
7320 tileCollide = false;
7321 manualDirectionChange = true;
7322 }
7323 else if (type == 704)
7324 {
7325 width = 60;
7326 height = 210;
7327 aiStyle = 145;
7328 friendly = true;
7329 magic = true;
7330 tileCollide = false;
7331 penetrate = -1;
7332 usesLocalNPCImmunity = true;
7333 timeLeft = 600;
7335 ignoreWater = true;
7336 }
7337 else if (type == 706)
7338 {
7339 width = 66;
7340 height = 66;
7341 aiStyle = 1;
7342 friendly = true;
7343 alpha = 255;
7344 timeLeft = 300;
7345 ranged = true;
7346 usesLocalNPCImmunity = true;
7347 penetrate = -1;
7349 }
7350 else if (type == 707)
7351 {
7352 width = 16;
7353 height = 16;
7354 aiStyle = 140;
7355 friendly = true;
7356 melee = true;
7357 penetrate = -1;
7358 alpha = 255;
7359 hide = true;
7360 tileCollide = false;
7361 ignoreWater = true;
7362 usesLocalNPCImmunity = true;
7364 ownerHitCheck = true;
7365 }
7366 else if (type == 708)
7367 {
7368 width = 24;
7369 height = 24;
7370 aiStyle = 142;
7371 friendly = true;
7372 melee = true;
7373 penetrate = -1;
7374 alpha = 255;
7375 hide = true;
7376 tileCollide = false;
7377 ignoreWater = true;
7378 usesLocalNPCImmunity = true;
7380 ownerHitCheck = true;
7381 }
7382 else if (type == 709)
7383 {
7384 width = 12;
7385 height = 12;
7386 aiStyle = 1;
7387 friendly = true;
7388 melee = true;
7389 alpha = 255;
7390 ignoreWater = true;
7391 extraUpdates = 1;
7392 noEnchantmentVisuals = true;
7393 scale = 0.6f;
7394 }
7395 else if (type == 710)
7396 {
7397 arrow = true;
7398 width = 10;
7399 height = 10;
7400 aiStyle = 1;
7401 friendly = true;
7402 ranged = true;
7403 ignoreWater = true;
7404 extraUpdates = 1;
7405 timeLeft = extraUpdates * 60 * 5;
7406 usesLocalNPCImmunity = true;
7407 alpha = 255;
7409 }
7410 else if (type == 711)
7411 {
7412 width = 30;
7413 height = 30;
7414 aiStyle = 1;
7415 alpha = 255;
7416 friendly = true;
7417 magic = true;
7418 extraUpdates = 1;
7419 scale = 0.7f;
7420 usesLocalNPCImmunity = true;
7422 }
7423 else if (type == 712)
7424 {
7425 width = 10;
7426 height = 10;
7427 aiStyle = 1;
7428 friendly = true;
7429 alpha = 255;
7430 timeLeft = 600;
7431 magic = true;
7432 extraUpdates = 1;
7433 }
7434 else if (type == 713)
7435 {
7436 width = 10;
7437 height = 10;
7438 aiStyle = 146;
7439 alpha = 255;
7440 tileCollide = false;
7441 ignoreWater = true;
7442 timeLeft = 900;
7443 hostile = true;
7444 penetrate = -1;
7445 }
7446 else if (type == 714)
7447 {
7448 width = 22;
7449 height = 22;
7450 aiStyle = 75;
7451 friendly = true;
7452 penetrate = -1;
7453 tileCollide = false;
7454 hide = true;
7455 ranged = true;
7456 ignoreWater = true;
7457 }
7458 else if (type == 715 || type == 717)
7459 {
7460 width = 14;
7461 height = 14;
7462 aiStyle = 147;
7463 friendly = true;
7464 penetrate = 1;
7465 alpha = 255;
7466 ranged = true;
7467 extraUpdates = 2;
7468 timeLeft = 360 * MaxUpdates;
7469 }
7470 else if (type == 716 || type == 718)
7471 {
7472 width = 14;
7473 height = 14;
7474 aiStyle = 147;
7475 friendly = true;
7476 penetrate = 1;
7477 alpha = 255;
7478 ranged = true;
7479 extraUpdates = 2;
7480 timeLeft = 360 * MaxUpdates;
7481 }
7482 else if (type == 719)
7483 {
7484 width = 10;
7485 height = 10;
7486 hostile = true;
7487 penetrate = -1;
7488 aiStyle = 1;
7489 tileCollide = true;
7490 }
7491 else if (type == 720)
7492 {
7493 width = 16;
7494 height = 16;
7495 aiStyle = 148;
7496 tileCollide = false;
7497 penetrate = -1;
7498 alpha = 255;
7499 }
7500 else if (type == 721 || type == 739 || type == 740 || type == 741 || type == 742 || type == 743 || type == 744 || type == 745 || type == 746 || type == 747 || type == 748 || type == 749 || type == 750 || type == 751 || type == 752)
7501 {
7502 netImportant = true;
7503 width = 7;
7504 height = 7;
7505 friendly = true;
7506 penetrate = -1;
7507 aiStyle = 149;
7508 tileCollide = false;
7509 }
7510 else if (type == 722)
7511 {
7512 width = 2;
7513 height = 2;
7514 aiStyle = 150;
7515 tileCollide = false;
7516 ignoreWater = true;
7517 penetrate = -1;
7518 hide = true;
7519 }
7520 else if (type == 723 || type == 724 || type == 725 || type == 726)
7521 {
7522 width = 24;
7523 height = 24;
7524 aiStyle = 5;
7525 friendly = true;
7526 penetrate = 2;
7527 alpha = 50;
7528 tileCollide = false;
7529 usesLocalNPCImmunity = true;
7531 }
7532 else if (type == 728)
7533 {
7534 width = 24;
7535 height = 24;
7536 aiStyle = 151;
7537 alpha = 255;
7538 tileCollide = true;
7539 ranged = true;
7540 friendly = true;
7541 penetrate = -1;
7542 usesLocalNPCImmunity = true;
7544 }
7545 else if (type == 729)
7546 {
7547 width = 20;
7548 height = 20;
7549 aiStyle = 152;
7550 friendly = true;
7551 tileCollide = false;
7552 ignoreWater = true;
7553 ranged = true;
7554 penetrate = -1;
7555 scale = 1f + (float)Main.rand.Next(30) * 0.01f;
7556 extraUpdates = 2;
7557 timeLeft = 10 * MaxUpdates;
7560 }
7561 else if (type == 730)
7562 {
7563 width = 18;
7564 height = 18;
7565 aiStyle = 19;
7566 friendly = true;
7567 penetrate = -1;
7568 tileCollide = false;
7569 scale = 1f;
7570 hide = true;
7571 ownerHitCheck = true;
7572 melee = true;
7573 }
7574 else if (type == 731)
7575 {
7576 width = 10;
7577 height = 10;
7578 aiStyle = 29;
7579 alpha = 255;
7580 magic = true;
7581 friendly = true;
7582 extraUpdates = 1;
7583 timeLeft = 90;
7584 }
7585 else if (type == 732)
7586 {
7587 tileCollide = true;
7588 width = 15;
7589 height = 15;
7590 aiStyle = 44;
7591 friendly = true;
7592 penetrate = 1;
7593 melee = true;
7594 noEnchantmentVisuals = true;
7595 }
7596 else if (type == 733)
7597 {
7598 width = 2;
7599 height = 2;
7600 aiStyle = 153;
7601 tileCollide = false;
7602 ignoreWater = true;
7603 penetrate = -1;
7604 alpha = 255;
7605 }
7606 else if (type == 734)
7607 {
7608 width = 30;
7609 height = 24;
7610 aiStyle = 154;
7611 tileCollide = false;
7612 timeLeft = 10800;
7613 alpha = 255;
7614 hide = true;
7615 }
7616 else if (type == 735)
7617 {
7618 width = 68;
7619 height = 64;
7620 aiStyle = 75;
7621 friendly = true;
7622 tileCollide = false;
7623 melee = true;
7624 penetrate = -1;
7625 ownerHitCheck = true;
7626 }
7627 else if (type == 736 || type == 737 || type == 738)
7628 {
7629 knockBack = 6f;
7630 width = 10;
7631 height = 10;
7632 aiStyle = 10;
7633 penetrate = -1;
7634 }
7635 else if (type == 753)
7636 {
7637 netImportant = true;
7638 width = 18;
7639 height = 18;
7640 aiStyle = 7;
7641 friendly = true;
7642 penetrate = -1;
7643 tileCollide = false;
7644 timeLeft *= 10;
7645 }
7646 else if (type == 754)
7647 {
7648 width = 16;
7649 height = 16;
7650 aiStyle = 155;
7651 tileCollide = false;
7652 ignoreWater = true;
7653 penetrate = -1;
7654 alpha = 255;
7655 }
7656 else if (type == 755)
7657 {
7658 netImportant = true;
7659 width = 10;
7660 height = 10;
7661 penetrate = -1;
7662 ignoreWater = true;
7663 tileCollide = false;
7664 friendly = true;
7665 minion = true;
7666 minionSlots = 1f;
7667 timeLeft *= 5;
7668 usesLocalNPCImmunity = true;
7670 aiStyle = 156;
7671 }
7672 else if (type == 756)
7673 {
7674 width = 32;
7675 height = 32;
7676 aiStyle = 157;
7677 friendly = true;
7678 alpha = 255;
7679 magic = true;
7680 tileCollide = false;
7681 ignoreWater = true;
7682 penetrate = 4;
7683 usesLocalNPCImmunity = true;
7685 }
7686 else if (type == 757)
7687 {
7688 netImportant = true;
7689 width = 34;
7690 height = 34;
7691 aiStyle = 15;
7692 friendly = true;
7693 penetrate = -1;
7694 melee = true;
7695 usesLocalNPCImmunity = true;
7697 }
7698 else if (type == 758)
7699 {
7700 width = 20;
7701 height = 30;
7702 aiStyle = 67;
7703 penetrate = -1;
7704 netImportant = true;
7705 timeLeft *= 5;
7706 minion = true;
7707 minionSlots = 1f;
7708 friendly = true;
7712 }
7713 else if (type == 759)
7714 {
7715 netImportant = true;
7716 width = 10;
7717 height = 10;
7718 penetrate = -1;
7719 ignoreWater = true;
7720 tileCollide = true;
7721 friendly = true;
7722 minion = true;
7723 minionSlots = 1f;
7724 timeLeft *= 5;
7725 usesLocalNPCImmunity = true;
7727 aiStyle = 158;
7728 hide = true;
7729 }
7730 else if (type == 761 || type == 762)
7731 {
7732 width = 10;
7733 height = 10;
7734 aiStyle = 159;
7735 friendly = true;
7736 ranged = true;
7737 manualDirectionChange = true;
7738 }
7739 else if (type == 763)
7740 {
7741 width = 10;
7742 height = 10;
7743 hostile = true;
7744 friendly = true;
7745 penetrate = -1;
7746 aiStyle = 1;
7747 tileCollide = true;
7748 extraUpdates = 1;
7749 }
7750 else if (type == 764)
7751 {
7752 width = 20;
7753 height = 20;
7754 aiStyle = 144;
7755 penetrate = -1;
7756 netImportant = true;
7757 timeLeft *= 5;
7758 friendly = true;
7759 ignoreWater = true;
7760 tileCollide = false;
7761 manualDirectionChange = true;
7762 }
7763 else if (type == 765)
7764 {
7765 netImportant = true;
7766 width = 18;
7767 height = 18;
7768 aiStyle = 26;
7769 friendly = true;
7770 penetrate = -1;
7771 timeLeft *= 5;
7772 }
7773 else if ((type >= 766 && type <= 770) || type == 771)
7774 {
7775 width = 4;
7776 height = 4;
7777 aiStyle = 160;
7778 penetrate = -1;
7779 extraUpdates = 60;
7780 }
7781 else if (type == 772)
7782 {
7783 width = 22;
7784 height = 22;
7785 friendly = true;
7786 aiStyle = 1;
7787 tileCollide = true;
7788 extraUpdates = 1;
7789 }
7790 else if (type == 773)
7791 {
7792 width = 22;
7793 height = 22;
7794 aiStyle = 16;
7795 friendly = true;
7796 penetrate = -1;
7797 tileCollide = false;
7798 }
7799 else if (type == 774)
7800 {
7801 netImportant = true;
7802 width = 26;
7803 height = 26;
7804 aiStyle = 26;
7805 friendly = true;
7806 penetrate = -1;
7807 timeLeft *= 5;
7808 }
7809 else if (type == 802)
7810 {
7811 width = 18;
7812 height = 18;
7813 aiStyle = 161;
7814 friendly = true;
7815 penetrate = -1;
7816 tileCollide = false;
7817 scale = 1f;
7818 ownerHitCheck = true;
7819 melee = true;
7820 extraUpdates = 1;
7821 hide = true;
7822 }
7823 else if (type == 811 || type == 814)
7824 {
7825 width = 10;
7826 height = 10;
7827 aiStyle = 1;
7828 alpha = 255;
7829 penetrate = -1;
7830 friendly = false;
7831 hostile = true;
7832 if (type == 814)
7833 {
7834 tileCollide = false;
7835 }
7836 }
7837 else if ((type >= 776 && type <= 801) || (type >= 803 && type <= 810))
7838 {
7839 width = 14;
7840 height = 14;
7841 aiStyle = 16;
7842 friendly = true;
7843 penetrate = -1;
7844 ranged = true;
7845 if (type == 777 || type == 781 || type == 794 || type == 797 || type == 800 || type == 785 || type == 788 || type == 800)
7846 {
7847 usesLocalNPCImmunity = true;
7849 }
7850 }
7851 else if (type == 812)
7852 {
7853 knockBack = 6f;
7854 width = 10;
7855 height = 10;
7856 aiStyle = 10;
7857 friendly = true;
7858 hostile = true;
7859 penetrate = -1;
7860 }
7861 else if (type == 815)
7862 {
7863 netImportant = true;
7864 width = 26;
7865 height = 26;
7866 aiStyle = 26;
7867 friendly = true;
7868 penetrate = -1;
7869 timeLeft *= 5;
7870 }
7871 else if (type == 816)
7872 {
7873 netImportant = true;
7874 width = 26;
7875 height = 32;
7876 aiStyle = 26;
7877 friendly = true;
7878 penetrate = -1;
7879 timeLeft *= 5;
7880 }
7881 else if (type == 817)
7882 {
7883 netImportant = true;
7884 width = 26;
7885 height = 26;
7886 aiStyle = 26;
7887 friendly = true;
7888 penetrate = -1;
7889 timeLeft *= 5;
7890 }
7891 else if (type == 819)
7892 {
7893 arrow = true;
7894 width = 10;
7895 height = 10;
7896 aiStyle = 1;
7897 alpha = 255;
7898 extraUpdates = 1;
7899 hide = true;
7900 friendly = true;
7901 ranged = true;
7902 }
7903 else if (type == 818)
7904 {
7905 width = 132;
7906 height = 132;
7907 aiStyle = 162;
7908 friendly = true;
7909 alpha = 255;
7910 tileCollide = false;
7911 ignoreWater = true;
7912 penetrate = -1;
7913 extraUpdates = 3;
7914 usesLocalNPCImmunity = true;
7916 }
7917 else if (type == 820)
7918 {
7919 width = 12;
7920 height = 12;
7921 friendly = true;
7922 aiStyle = 163;
7923 tileCollide = true;
7924 netImportant = true;
7925 penetrate = -1;
7926 timeLeft = 86400;
7927 }
7928 else if (type == 821)
7929 {
7930 netImportant = true;
7931 width = 20;
7932 height = 36;
7933 aiStyle = 26;
7934 friendly = true;
7935 penetrate = -1;
7936 timeLeft *= 5;
7937 }
7938 else if (type >= 822 && type <= 824)
7939 {
7940 netImportant = true;
7941 width = 4;
7942 height = 4;
7943 aiStyle = 160;
7944 penetrate = -1;
7945 extraUpdates = 60;
7946 }
7947 else if (type == 825)
7948 {
7949 netImportant = true;
7950 width = 26;
7951 height = 32;
7952 aiStyle = 26;
7953 friendly = true;
7954 penetrate = -1;
7955 timeLeft *= 5;
7956 }
7957 else if (type >= 826 && type <= 830)
7958 {
7959 netImportant = true;
7960 width = 4;
7961 height = 4;
7962 aiStyle = 160;
7963 penetrate = -1;
7964 extraUpdates = 60;
7965 }
7966 else if (type == 836)
7967 {
7968 width = 4;
7969 height = 4;
7970 aiStyle = 112;
7971 hostile = true;
7972 }
7973 else if (type == 831)
7974 {
7975 netImportant = true;
7976 width = 10;
7977 height = 10;
7978 penetrate = -1;
7979 ignoreWater = true;
7980 tileCollide = false;
7981 friendly = true;
7982 minion = true;
7983 minionSlots = 1f;
7984 timeLeft = 60;
7985 aiStyle = 164;
7986 hide = true;
7987 }
7988 else if (type == 833)
7989 {
7990 width = 26;
7991 height = 20;
7992 aiStyle = 67;
7993 penetrate = -1;
7994 netImportant = true;
7995 timeLeft *= 5;
7996 minion = true;
7997 minionSlots = 0f;
7999 usesLocalNPCImmunity = true;
8001 }
8002 else if (type == 834)
8003 {
8004 width = 20;
8005 height = 30;
8006 aiStyle = 67;
8007 penetrate = -1;
8008 netImportant = true;
8009 timeLeft *= 5;
8010 minion = true;
8011 minionSlots = 0f;
8013 usesLocalNPCImmunity = true;
8015 }
8016 else if (type == 835)
8017 {
8018 width = 20;
8019 height = 30;
8020 aiStyle = 67;
8021 penetrate = -1;
8022 netImportant = true;
8023 timeLeft *= 5;
8024 minion = true;
8025 minionSlots = 0f;
8027 usesLocalNPCImmunity = true;
8029 }
8030 else if (type == 837)
8031 {
8032 width = 26;
8033 height = 26;
8034 aiStyle = 1;
8035 alpha = 255;
8036 friendly = true;
8037 magic = true;
8038 penetrate = 3;
8039 }
8040 else if (type >= 838 && type <= 840)
8041 {
8042 netImportant = true;
8043 width = 4;
8044 height = 4;
8045 aiStyle = 160;
8046 penetrate = -1;
8047 extraUpdates = 60;
8048 }
8049 else if (type == 841)
8050 {
8051 DefaultToWhip();
8052 }
8053 else if (type == 842)
8054 {
8055 width = 18;
8056 height = 18;
8057 aiStyle = 161;
8058 friendly = true;
8059 penetrate = -1;
8060 tileCollide = false;
8061 scale = 1f;
8062 ownerHitCheck = true;
8063 melee = true;
8064 extraUpdates = 1;
8065 hide = true;
8066 }
8067 else if (type >= 843 && type <= 846)
8068 {
8069 netImportant = true;
8070 width = 4;
8071 height = 4;
8072 aiStyle = 160;
8073 penetrate = -1;
8074 extraUpdates = 60;
8075 }
8076 else if (type == 847)
8077 {
8078 DefaultToWhip();
8079 extraUpdates = 2;
8080 }
8081 else if (type == 848)
8082 {
8083 DefaultToWhip();
8084 }
8085 else if (type == 849)
8086 {
8087 DefaultToWhip();
8088 extraUpdates = 2;
8089 }
8090 else if (type == 850)
8091 {
8092 netImportant = true;
8093 width = 4;
8094 height = 4;
8095 aiStyle = 160;
8096 penetrate = -1;
8097 extraUpdates = 60;
8098 }
8099 else if (type == 851)
8100 {
8101 netImportant = true;
8102 width = 4;
8103 height = 4;
8104 aiStyle = 166;
8105 penetrate = -1;
8106 timeLeft = 300;
8107 }
8108 else if (type >= 852 && type <= 853)
8109 {
8110 netImportant = true;
8111 width = 4;
8112 height = 4;
8113 aiStyle = 160;
8114 penetrate = -1;
8115 extraUpdates = 60;
8116 }
8117 else if (type == 854)
8118 {
8119 netImportant = true;
8120 width = 26;
8121 height = 32;
8122 aiStyle = 26;
8123 friendly = true;
8124 penetrate = -1;
8125 timeLeft *= 5;
8126 }
8127 else if (type == 855)
8128 {
8129 netImportant = true;
8130 width = 12;
8131 height = 12;
8132 aiStyle = 166;
8133 penetrate = -1;
8134 timeLeft = 1000;
8135 }
8136 else if (type == 856)
8137 {
8138 width = 32;
8139 height = 32;
8140 aiStyle = 167;
8141 friendly = true;
8142 alpha = 255;
8143 magic = true;
8144 tileCollide = false;
8145 ignoreWater = true;
8146 extraUpdates = 2;
8147 usesLocalNPCImmunity = true;
8148 }
8149 else if (type == 857)
8150 {
8151 width = 32;
8152 height = 32;
8153 aiStyle = 168;
8154 friendly = true;
8155 alpha = 255;
8156 melee = true;
8157 tileCollide = false;
8158 ignoreWater = true;
8159 extraUpdates = 1;
8160 usesLocalNPCImmunity = true;
8161 manualDirectionChange = true;
8162 penetrate = -1;
8163 hide = true;
8164 }
8165 else if (type == 858)
8166 {
8167 netImportant = true;
8168 width = 26;
8169 height = 20;
8170 aiStyle = 26;
8171 friendly = true;
8172 penetrate = -1;
8173 timeLeft *= 5;
8174 }
8175 else if (type == 859)
8176 {
8177 netImportant = true;
8178 width = 20;
8179 height = 32;
8180 aiStyle = 26;
8181 friendly = true;
8182 penetrate = -1;
8183 timeLeft *= 5;
8184 }
8185 else if (type == 860)
8186 {
8187 netImportant = true;
8188 width = 20;
8189 height = 20;
8190 aiStyle = 26;
8191 friendly = true;
8192 penetrate = -1;
8193 timeLeft *= 5;
8194 }
8195 else if (type == 861)
8196 {
8197 netImportant = true;
8198 width = 10;
8199 height = 10;
8200 aiStyle = 2;
8201 friendly = true;
8202 }
8203 else if (type == 862 || type == 863)
8204 {
8205 width = 14;
8206 height = 14;
8207 aiStyle = 16;
8208 friendly = true;
8209 penetrate = -1;
8210 ranged = true;
8211 }
8212 else if (type == 864)
8213 {
8214 netImportant = true;
8215 width = 10;
8216 height = 10;
8217 penetrate = -1;
8218 usesLocalNPCImmunity = true;
8219 ignoreWater = true;
8220 tileCollide = false;
8221 friendly = true;
8222 minion = true;
8223 minionSlots = 1f;
8224 timeLeft = 60;
8225 aiStyle = 169;
8227 }
8228 else if (type == 865)
8229 {
8230 netImportant = true;
8231 width = 18;
8232 height = 18;
8233 aiStyle = 7;
8234 friendly = true;
8235 penetrate = -1;
8236 tileCollide = false;
8237 timeLeft *= 10;
8238 }
8239 else if (type == 866)
8240 {
8241 light = 0.15f;
8242 width = 30;
8243 height = 30;
8244 aiStyle = 3;
8245 friendly = true;
8246 penetrate = 5;
8247 melee = true;
8248 extraUpdates = 1;
8249 usesLocalNPCImmunity = true;
8250 }
8251 else if (type == 867)
8252 {
8253 width = 22;
8254 height = 22;
8255 aiStyle = 3;
8256 friendly = true;
8257 penetrate = -1;
8258 melee = true;
8259 light = 0.6f;
8260 }
8261 else if (type == 868 || type == 869)
8262 {
8263 width = 18;
8264 height = 18;
8265 aiStyle = 2;
8266 friendly = true;
8267 penetrate = 1;
8268 }
8269 else if (type == 870)
8270 {
8271 netImportant = true;
8272 width = 6;
8273 height = 6;
8274 aiStyle = 14;
8275 penetrate = -1;
8276 alpha = 75;
8277 light = 1f;
8278 timeLeft *= 5;
8279 }
8280 else if (type == 873)
8281 {
8282 width = 30;
8283 height = 30;
8284 aiStyle = 171;
8285 alpha = 255;
8286 penetrate = -1;
8287 friendly = false;
8288 hostile = true;
8289 timeLeft = 200;
8290 tileCollide = false;
8291 ignoreWater = true;
8292 }
8293 else if (type == 874)
8294 {
8295 width = 30;
8296 height = 30;
8297 aiStyle = 0;
8298 alpha = 255;
8299 penetrate = -1;
8300 friendly = false;
8301 hostile = true;
8302 timeLeft = 210;
8303 tileCollide = false;
8304 ignoreWater = true;
8305 }
8306 else if (type == 871)
8307 {
8308 width = 30;
8309 height = 30;
8310 aiStyle = 172;
8311 alpha = 255;
8312 penetrate = -1;
8313 friendly = false;
8314 hostile = true;
8315 timeLeft = 240;
8316 tileCollide = false;
8317 ignoreWater = true;
8318 }
8319 else if (type == 875)
8320 {
8321 netImportant = true;
8322 width = 20;
8323 height = 20;
8324 aiStyle = 26;
8325 friendly = true;
8326 penetrate = -1;
8327 timeLeft *= 5;
8328 }
8329 else if (type == 872)
8330 {
8331 width = 30;
8332 height = 30;
8333 aiStyle = 173;
8334 alpha = 255;
8335 penetrate = -1;
8336 friendly = false;
8337 hostile = true;
8338 timeLeft = 660;
8339 tileCollide = false;
8340 ignoreWater = true;
8341 }
8342 else if (type == 876)
8343 {
8344 width = 4;
8345 height = 4;
8346 aiStyle = 1;
8347 friendly = true;
8348 penetrate = 8;
8349 light = 0.75f;
8350 alpha = 255;
8351 extraUpdates = 3;
8352 scale = 1.4f;
8353 timeLeft = 3600;
8354 magic = true;
8355 }
8356 else if (type >= 877 && type <= 879)
8357 {
8358 netImportant = true;
8359 width = 25;
8360 height = 25;
8361 aiStyle = 19;
8362 alpha = 255;
8363 friendly = true;
8364 penetrate = -1;
8365 tileCollide = false;
8366 scale = 1f;
8367 hide = true;
8368 ownerHitCheck = true;
8369 melee = true;
8370 }
8371 else if (type == 880)
8372 {
8373 width = 32;
8374 height = 32;
8375 aiStyle = 183;
8376 penetrate = -1;
8377 timeLeft = 18;
8378 ignoreWater = true;
8379 tileCollide = false;
8380 friendly = true;
8381 hostile = false;
8382 manualDirectionChange = true;
8383 }
8384 else if (type == 881)
8385 {
8386 netImportant = true;
8387 width = 20;
8388 height = 20;
8389 aiStyle = 26;
8390 friendly = true;
8391 penetrate = -1;
8392 timeLeft *= 5;
8393 }
8394 else if (type == 882)
8395 {
8396 width = 20;
8397 height = 20;
8398 aiStyle = 124;
8399 penetrate = -1;
8400 netImportant = true;
8401 timeLeft *= 5;
8402 friendly = true;
8403 ignoreWater = true;
8404 tileCollide = false;
8405 manualDirectionChange = true;
8406 }
8407 else if (type == 883)
8408 {
8409 width = 20;
8410 height = 20;
8411 aiStyle = 174;
8412 penetrate = -1;
8413 timeLeft *= 5;
8414 friendly = true;
8415 ignoreWater = true;
8416 tileCollide = false;
8417 netImportant = true;
8418 }
8419 else if (type >= 884 && type <= 886)
8420 {
8421 netImportant = true;
8422 width = 20;
8423 height = 20;
8424 aiStyle = 26;
8425 friendly = true;
8426 penetrate = -1;
8427 timeLeft *= 5;
8428 }
8429 else if (type == 887)
8430 {
8431 width = 20;
8432 height = 20;
8433 aiStyle = 174;
8434 penetrate = -1;
8435 timeLeft *= 5;
8436 friendly = true;
8437 ignoreWater = true;
8438 tileCollide = false;
8439 netImportant = true;
8440 }
8441 else if (type == 888)
8442 {
8443 width = 20;
8444 height = 20;
8445 aiStyle = 124;
8446 penetrate = -1;
8447 netImportant = true;
8448 timeLeft *= 5;
8449 friendly = true;
8450 ignoreWater = true;
8451 tileCollide = false;
8452 manualDirectionChange = true;
8453 }
8454 else if (type >= 889 && type <= 892)
8455 {
8456 netImportant = true;
8457 width = 20;
8458 height = 20;
8459 aiStyle = 26;
8460 friendly = true;
8461 penetrate = -1;
8462 timeLeft *= 5;
8463 }
8464 else if (type == 893)
8465 {
8466 width = 20;
8467 height = 20;
8468 aiStyle = 174;
8469 penetrate = -1;
8470 timeLeft *= 5;
8471 friendly = true;
8472 ignoreWater = true;
8473 tileCollide = false;
8474 netImportant = true;
8475 }
8476 else if (type == 894)
8477 {
8478 netImportant = true;
8479 width = 20;
8480 height = 20;
8481 aiStyle = 26;
8482 friendly = true;
8483 penetrate = -1;
8484 timeLeft *= 5;
8485 }
8486 else if (type >= 895 && type <= 896)
8487 {
8488 width = 20;
8489 height = 20;
8490 aiStyle = 124;
8491 penetrate = -1;
8492 netImportant = true;
8493 timeLeft *= 5;
8494 friendly = true;
8495 ignoreWater = true;
8496 tileCollide = false;
8497 manualDirectionChange = true;
8498 }
8499 else if (type == 897)
8500 {
8501 netImportant = true;
8502 width = 20;
8503 height = 20;
8504 aiStyle = 26;
8505 friendly = true;
8506 penetrate = -1;
8507 timeLeft *= 5;
8508 }
8509 else if (type == 898)
8510 {
8511 width = 20;
8512 height = 20;
8513 aiStyle = 124;
8514 penetrate = -1;
8515 netImportant = true;
8516 timeLeft *= 5;
8517 friendly = true;
8518 ignoreWater = true;
8519 tileCollide = false;
8520 manualDirectionChange = true;
8521 }
8522 else if (type >= 899 && type <= 901)
8523 {
8524 netImportant = true;
8525 width = 20;
8526 height = 20;
8527 aiStyle = 26;
8528 friendly = true;
8529 penetrate = -1;
8530 timeLeft *= 5;
8531 }
8532 else if (type == 902)
8533 {
8534 width = 20;
8535 height = 20;
8536 aiStyle = 3;
8537 friendly = true;
8538 penetrate = -1;
8539 melee = true;
8540 MaxUpdates = 2;
8541 }
8542 else if (type >= 903 && type <= 906)
8543 {
8544 width = 22;
8545 height = 22;
8546 aiStyle = 16;
8547 friendly = true;
8548 penetrate = -1;
8549 }
8550 else if (type == 907)
8551 {
8552 width = 22;
8553 height = 22;
8554 aiStyle = 30;
8555 friendly = true;
8556 penetrate = 2;
8557 melee = true;
8558 }
8559 else if (type == 908)
8560 {
8561 tileCollide = false;
8562 ignoreWater = true;
8563 width = 14;
8564 height = 14;
8565 aiStyle = 175;
8566 friendly = true;
8567 penetrate = 1;
8568 timeLeft = 3600;
8569 hide = true;
8570 }
8571 else if (type == 909)
8572 {
8573 width = 12;
8574 height = 12;
8575 aiStyle = 2;
8576 friendly = false;
8577 hostile = true;
8578 penetrate = 1;
8579 }
8580 else if (type == 910)
8581 {
8582 width = 22;
8583 height = 22;
8584 aiStyle = 16;
8585 friendly = true;
8586 penetrate = -1;
8587 }
8588 else if (type == 911)
8589 {
8590 width = 22;
8591 height = 22;
8592 aiStyle = 16;
8593 friendly = true;
8594 penetrate = -1;
8595 tileCollide = false;
8596 }
8597 else if (type >= 912 && type <= 915)
8598 {
8599 DefaultToWhip();
8600 if (type == 915)
8601 {
8602 extraUpdates = 2;
8603 }
8604 if (type == 912)
8605 {
8606 coldDamage = true;
8607 }
8608 }
8609 else if (type == 916)
8610 {
8611 width = 18;
8612 height = 18;
8613 aiStyle = 176;
8614 friendly = true;
8615 tileCollide = false;
8616 penetrate = 3;
8617 usesLocalNPCImmunity = true;
8619 extraUpdates = 2;
8620 }
8621 else if (type == 918)
8622 {
8623 aiStyle = 178;
8624 friendly = true;
8625 tileCollide = false;
8626 penetrate = -1;
8627 usesLocalNPCImmunity = true;
8629 alpha = 255;
8630 width = 96;
8631 height = 96;
8632 }
8633 else if (type == 917)
8634 {
8635 width = 30;
8636 height = 30;
8637 aiStyle = 177;
8638 friendly = true;
8639 tileCollide = false;
8640 penetrate = -1;
8641 usesLocalNPCImmunity = true;
8642 coldDamage = true;
8644 }
8645 else if (type == 919)
8646 {
8647 width = 8;
8648 height = 8;
8649 aiStyle = 179;
8650 alpha = 255;
8651 penetrate = -1;
8652 friendly = false;
8653 hostile = true;
8654 timeLeft = 240;
8655 tileCollide = false;
8656 ignoreWater = true;
8657 }
8658 else if (type == 920)
8659 {
8660 alpha = 255;
8661 width = 6;
8662 height = 6;
8663 aiStyle = 1;
8664 hostile = true;
8665 penetrate = 1;
8666 }
8667 else if (type == 921)
8668 {
8669 alpha = 255;
8670 width = 6;
8671 height = 6;
8672 aiStyle = 1;
8673 hostile = true;
8674 penetrate = 3;
8675 }
8676 else if (type == 922)
8677 {
8678 width = 30;
8679 height = 30;
8680 aiStyle = 135;
8681 alpha = 255;
8682 tileCollide = false;
8683 ignoreWater = true;
8684 timeLeft = 120;
8685 hostile = true;
8686 penetrate = -1;
8687 }
8688 else if (type == 923)
8689 {
8690 width = 30;
8691 height = 30;
8692 aiStyle = 180;
8693 alpha = 255;
8694 penetrate = -1;
8695 friendly = false;
8696 hostile = true;
8697 timeLeft = 180;
8698 tileCollide = false;
8699 ignoreWater = true;
8700 hide = true;
8701 }
8702 else if (type == 926)
8703 {
8704 alpha = 255;
8705 width = 12;
8706 height = 12;
8707 scale = 1f;
8708 aiStyle = 1;
8709 hostile = true;
8710 penetrate = 2;
8711 }
8712 else if (type == 927)
8713 {
8714 width = 40;
8715 height = 40;
8716 aiStyle = 75;
8717 friendly = true;
8718 tileCollide = false;
8719 melee = true;
8720 penetrate = -1;
8721 ownerHitCheck = true;
8722 }
8723 else if (type == 928)
8724 {
8725 netImportant = true;
8726 width = 34;
8727 height = 34;
8728 aiStyle = 14;
8729 friendly = true;
8730 penetrate = 2;
8731 melee = true;
8732 timeLeft = 250;
8733 }
8734 else if (type == 929)
8735 {
8736 width = 32;
8737 height = 32;
8738 aiStyle = 183;
8739 penetrate = -1;
8740 timeLeft = 18;
8741 ignoreWater = true;
8742 tileCollide = false;
8743 friendly = true;
8744 hostile = false;
8745 manualDirectionChange = true;
8746 }
8747 else if (type == 930)
8748 {
8749 width = 14;
8750 height = 14;
8751 aiStyle = 16;
8752 friendly = true;
8753 penetrate = -1;
8754 ranged = true;
8755 }
8756 else if (type == 931)
8757 {
8758 width = 30;
8759 height = 30;
8760 aiStyle = 171;
8761 alpha = 255;
8762 penetrate = 3;
8763 friendly = true;
8764 timeLeft = 240;
8765 magic = true;
8766 tileCollide = true;
8767 ignoreWater = true;
8768 extraUpdates = 1;
8769 usesLocalNPCImmunity = true;
8771 }
8772 else if (type == 932)
8773 {
8774 ranged = true;
8775 arrow = true;
8776 width = 10;
8777 height = 10;
8778 aiStyle = 181;
8779 penetrate = 5;
8780 friendly = true;
8781 usesLocalNPCImmunity = true;
8783 timeLeft = 120;
8784 alpha = 0;
8785 ignoreWater = true;
8786 usesLocalNPCImmunity = true;
8788 }
8789 else if (type == 933)
8790 {
8791 width = 32;
8792 height = 32;
8793 aiStyle = 182;
8794 friendly = true;
8795 melee = true;
8796 tileCollide = false;
8797 ignoreWater = true;
8798 alpha = 255;
8799 extraUpdates = 1;
8800 usesLocalNPCImmunity = true;
8801 manualDirectionChange = true;
8803 penetrate = -1;
8804 noEnchantmentVisuals = true;
8805 }
8806 else if (type == 934)
8807 {
8808 netImportant = true;
8809 width = 20;
8810 height = 20;
8811 aiStyle = 26;
8812 friendly = true;
8813 penetrate = -1;
8814 timeLeft *= 5;
8815 }
8816 else if (type == 935)
8817 {
8818 netImportant = true;
8819 width = 18;
8820 height = 18;
8821 aiStyle = 7;
8822 friendly = true;
8823 penetrate = -1;
8824 tileCollide = false;
8825 timeLeft *= 10;
8826 extraUpdates = 3;
8827 }
8828 else if (type == 936)
8829 {
8830 width = 14;
8831 height = 14;
8832 aiStyle = 2;
8833 friendly = true;
8834 penetrate = 1;
8835 Opacity = 0.6f;
8836 }
8837 else if (type == 937)
8838 {
8839 alpha = 255;
8840 width = 10;
8841 height = 10;
8842 aiStyle = 1;
8843 hostile = false;
8844 friendly = true;
8845 penetrate = 3;
8848 }
8849 else if (type >= 938 && type <= 945)
8850 {
8851 width = 18;
8852 height = 18;
8853 aiStyle = 161;
8854 friendly = true;
8855 penetrate = -1;
8856 tileCollide = false;
8857 scale = 1f;
8858 ownerHitCheck = true;
8859 melee = true;
8860 extraUpdates = 1;
8861 timeLeft = 360;
8862 hide = true;
8863 }
8864 else if (type == 946)
8865 {
8866 netImportant = true;
8867 width = 10;
8868 height = 10;
8869 penetrate = -1;
8870 ignoreWater = true;
8871 tileCollide = false;
8872 friendly = true;
8873 minion = true;
8874 minionSlots = 1f;
8875 timeLeft *= 5;
8876 usesLocalNPCImmunity = true;
8878 aiStyle = 156;
8879 scale = 0.75f;
8880 manualDirectionChange = true;
8881 hide = true;
8882 }
8883 else if (type == 947 || type == 948)
8884 {
8885 netImportant = true;
8886 width = 20;
8887 height = 20;
8888 aiStyle = 15;
8889 friendly = true;
8890 penetrate = -1;
8891 melee = true;
8892 scale = 1f;
8893 usesLocalNPCImmunity = true;
8895 }
8896 else if (type == 949)
8897 {
8898 width = 4;
8899 height = 4;
8900 aiStyle = 184;
8901 penetrate = -1;
8902 hostile = true;
8903 tileCollide = false;
8904 }
8905 else if (type == 950)
8906 {
8907 width = 104;
8908 height = 104;
8909 aiStyle = 186;
8910 friendly = true;
8911 magic = true;
8912 alpha = 255;
8913 ignoreWater = true;
8914 timeLeft = 180;
8915 tileCollide = false;
8916 penetrate = -1;
8917 }
8918 else if (type == 951)
8919 {
8920 width = 26;
8921 height = 26;
8922 aiStyle = 67;
8923 penetrate = -1;
8924 netImportant = true;
8925 timeLeft *= 5;
8926 minion = true;
8927 minionSlots = 1f;
8928 friendly = true;
8932 }
8933 else if (type == 952)
8934 {
8935 DefaultToWhip();
8936 }
8937 else if (type == 953)
8938 {
8939 width = 8;
8940 height = 8;
8941 aiStyle = 117;
8942 friendly = true;
8943 alpha = 255;
8944 ignoreWater = true;
8945 timeLeft = 60;
8946 tileCollide = false;
8947 penetrate = -1;
8948 usesLocalNPCImmunity = true;
8950 }
8951 else if (type == 954)
8952 {
8953 width = 10;
8954 height = 10;
8955 aiStyle = 2;
8956 friendly = true;
8957 magic = true;
8958 alpha = 255;
8959 penetrate = 2;
8960 noEnchantmentVisuals = true;
8961 }
8962 else if (type == 955)
8963 {
8964 width = 18;
8965 height = 18;
8966 aiStyle = 5;
8967 friendly = true;
8968 penetrate = -1;
8969 alpha = 50;
8970 light = 1f;
8971 ranged = true;
8972 }
8973 else if (type == 956)
8974 {
8975 netImportant = true;
8976 width = 20;
8977 height = 28;
8978 aiStyle = 26;
8979 friendly = true;
8980 penetrate = -1;
8981 timeLeft *= 5;
8982 }
8983 else if (type == 957)
8984 {
8985 netImportant = true;
8986 width = 20;
8987 height = 20;
8988 aiStyle = 124;
8989 friendly = true;
8990 penetrate = -1;
8991 timeLeft *= 5;
8992 ignoreWater = true;
8993 tileCollide = false;
8994 manualDirectionChange = true;
8995 }
8996 else if (type == 958)
8997 {
8998 netImportant = true;
8999 width = 20;
9000 height = 20;
9001 aiStyle = 26;
9002 friendly = true;
9003 penetrate = -1;
9004 timeLeft *= 5;
9005 }
9006 else if (type == 959)
9007 {
9008 netImportant = true;
9009 width = 20;
9010 height = 20;
9011 aiStyle = 26;
9012 friendly = true;
9013 penetrate = -1;
9014 timeLeft *= 5;
9015 }
9016 else if (type == 960)
9017 {
9018 netImportant = true;
9019 width = 20;
9020 height = 20;
9021 aiStyle = 26;
9022 friendly = true;
9023 penetrate = -1;
9024 timeLeft *= 5;
9025 hide = true;
9026 }
9027 else if (type == 961)
9028 {
9029 width = 32;
9030 height = 32;
9031 aiStyle = 157;
9032 hostile = true;
9033 alpha = 255;
9034 tileCollide = false;
9035 ignoreWater = true;
9036 coldDamage = true;
9037 }
9038 else if (type == 962)
9039 {
9040 width = 32;
9041 height = 32;
9042 aiStyle = 1;
9043 hostile = true;
9044 tileCollide = false;
9045 ignoreWater = true;
9046 timeLeft = 220;
9047 coldDamage = true;
9048 }
9049 else if (type == 963)
9050 {
9051 netImportant = true;
9052 width = 30;
9053 height = 48;
9054 penetrate = -1;
9055 ignoreWater = true;
9056 tileCollide = false;
9057 friendly = true;
9058 minion = true;
9059 minionSlots = 0f;
9060 timeLeft *= 5;
9061 aiStyle = 62;
9062 usesLocalNPCImmunity = true;
9064 }
9065 else if (type == 965)
9066 {
9067 width = 40;
9068 height = 40;
9069 aiStyle = 187;
9070 hostile = true;
9071 tileCollide = false;
9072 ignoreWater = true;
9073 timeLeft = 300;
9074 alpha = 255;
9075 }
9076 else if (type == 964)
9077 {
9078 width = 40;
9079 height = 40;
9080 aiStyle = 187;
9081 alpha = 255;
9082 penetrate = 3;
9083 friendly = true;
9084 usesLocalNPCImmunity = true;
9086 ignoreWater = true;
9087 tileCollide = false;
9088 extraUpdates = 1;
9089 scale = 0.7f;
9090 }
9091 else if (type == 966)
9092 {
9093 width = 18;
9094 height = 60;
9095 aiStyle = 53;
9096 timeLeft = 36000;
9097 ignoreWater = true;
9098 sentry = true;
9099 netImportant = true;
9100 }
9101 else if (type == 967)
9102 {
9103 width = 14;
9104 height = 14;
9105 aiStyle = 28;
9106 friendly = true;
9107 }
9108 else if (type == 968)
9109 {
9110 width = 14;
9111 height = 14;
9112 aiStyle = 2;
9113 friendly = true;
9114 ranged = true;
9115 alpha = 255;
9116 }
9117 else if (type == 969)
9118 {
9119 width = 56;
9120 height = 64;
9121 aiStyle = 177;
9122 friendly = true;
9123 magic = true;
9124 tileCollide = true;
9125 penetrate = 15;
9128 }
9129 else if (type == 970)
9130 {
9131 netImportant = true;
9132 width = 10;
9133 height = 10;
9134 penetrate = -1;
9135 ignoreWater = true;
9136 tileCollide = false;
9137 friendly = true;
9138 minion = true;
9139 minionSlots = 1f;
9140 timeLeft = 60;
9141 aiStyle = 164;
9142 hide = true;
9143 }
9144 else if (type == 971)
9145 {
9146 width = 16;
9147 height = 16;
9148 aiStyle = 113;
9149 friendly = true;
9150 melee = true;
9151 penetrate = -1;
9152 alpha = 255;
9153 hide = true;
9154 }
9155 else if (type == 977)
9156 {
9157 width = 20;
9158 height = 20;
9159 aiStyle = 152;
9160 friendly = true;
9161 tileCollide = false;
9162 ignoreWater = true;
9163 melee = true;
9164 penetrate = 1;
9165 usesLocalNPCImmunity = true;
9167 scale = 1f + (float)Main.rand.Next(30) * 0.01f;
9168 extraUpdates = 2;
9169 timeLeft = 10 * MaxUpdates;
9170 }
9171 else if (type == 979)
9172 {
9173 width = 10;
9174 height = 10;
9175 aiStyle = 2;
9176 friendly = true;
9177 magic = true;
9178 alpha = 255;
9179 penetrate = 2;
9180 noEnchantmentVisuals = true;
9181 coldDamage = true;
9182 }
9183 else if (type == 974)
9184 {
9185 width = 20;
9186 height = 20;
9187 aiStyle = 188;
9188 friendly = true;
9189 tileCollide = false;
9190 ignoreWater = true;
9191 melee = true;
9192 penetrate = 2;
9193 usesLocalNPCImmunity = true;
9195 timeLeft = 30;
9197 }
9198 else if (type == 978)
9199 {
9200 width = 160;
9201 height = 160;
9202 aiStyle = 189;
9203 friendly = true;
9204 alpha = 255;
9205 ignoreWater = true;
9206 timeLeft = 60;
9207 tileCollide = false;
9208 ownerHitCheck = true;
9209 penetrate = 3;
9210 usesLocalNPCImmunity = true;
9211 melee = true;
9212 timeLeft = 30;
9213 }
9214 else if (type == 976)
9215 {
9216 width = 20;
9217 height = 20;
9218 aiStyle = 152;
9219 friendly = true;
9220 tileCollide = false;
9221 ignoreWater = true;
9222 melee = true;
9223 penetrate = 2;
9224 usesLocalNPCImmunity = true;
9226 scale = 1f + (float)Main.rand.Next(30) * 0.01f;
9227 extraUpdates = 0;
9228 timeLeft = 60 * MaxUpdates;
9229 }
9230 else if (type == 975)
9231 {
9232 width = 16;
9233 height = 16;
9234 aiStyle = 113;
9235 friendly = true;
9236 melee = true;
9237 penetrate = -1;
9238 alpha = 0;
9239 hide = true;
9240 }
9241 else if (type == 972)
9242 {
9243 width = 16;
9244 height = 16;
9245 aiStyle = 190;
9246 friendly = true;
9247 melee = true;
9248 penetrate = 2;
9249 usesLocalNPCImmunity = true;
9250 tileCollide = false;
9251 ignoreWater = true;
9253 ownerHitCheck = true;
9254 ownerHitCheckDistance = 300f;
9255 usesOwnerMeleeHitCD = true;
9257 }
9258 else if (type == 973)
9259 {
9260 width = 30;
9261 height = 30;
9262 aiStyle = 191;
9263 friendly = true;
9264 melee = true;
9265 penetrate = 3;
9266 usesLocalNPCImmunity = true;
9267 tileCollide = false;
9268 ignoreWater = true;
9270 alpha = 255;
9271 timeLeft = 90;
9272 }
9273 else if (type == 980)
9274 {
9275 width = 10;
9276 height = 10;
9277 aiStyle = 1;
9278 friendly = true;
9279 hostile = true;
9280 penetrate = -1;
9281 trap = true;
9282 }
9283 else if (type == 981)
9284 {
9285 width = 4;
9286 height = 4;
9287 aiStyle = 1;
9288 friendly = true;
9289 penetrate = 1;
9290 light = 0.5f;
9291 alpha = 255;
9292 scale = 1.2f;
9293 timeLeft = 600;
9294 ranged = true;
9295 extraUpdates = 1;
9296 }
9297 else if (type == 982)
9298 {
9299 width = 16;
9300 height = 16;
9301 aiStyle = 190;
9302 friendly = true;
9303 melee = true;
9304 penetrate = 3;
9305 usesLocalNPCImmunity = true;
9306 tileCollide = false;
9307 ignoreWater = true;
9309 ownerHitCheck = true;
9310 ownerHitCheckDistance = 300f;
9311 usesOwnerMeleeHitCD = true;
9313 }
9314 else if (type == 983)
9315 {
9316 width = 16;
9317 height = 16;
9318 aiStyle = 190;
9319 friendly = true;
9320 melee = true;
9321 penetrate = 6;
9322 usesLocalNPCImmunity = true;
9323 tileCollide = false;
9324 ignoreWater = true;
9326 ownerHitCheck = true;
9327 ownerHitCheckDistance = 300f;
9328 usesOwnerMeleeHitCD = true;
9330 }
9331 else if (type == 984)
9332 {
9333 width = 16;
9334 height = 16;
9335 aiStyle = 190;
9336 friendly = true;
9337 melee = true;
9338 penetrate = 3;
9339 usesLocalNPCImmunity = true;
9340 tileCollide = false;
9341 ignoreWater = true;
9343 ownerHitCheck = true;
9344 ownerHitCheckDistance = 300f;
9345 usesOwnerMeleeHitCD = true;
9347 }
9348 else if (type == 985)
9349 {
9350 width = 8;
9351 height = 8;
9352 aiStyle = 191;
9353 friendly = true;
9354 melee = true;
9355 penetrate = -1;
9356 usesLocalNPCImmunity = true;
9357 tileCollide = true;
9358 ignoreWater = true;
9360 alpha = 255;
9361 timeLeft = 90;
9362 ownerHitCheck = true;
9363 ownerHitCheckDistance = 300f;
9364 }
9365 else if (type >= 986 && type <= 993)
9366 {
9367 width = 14;
9368 height = 14;
9369 aiStyle = 61;
9370 penetrate = -1;
9371 netImportant = true;
9372 bobber = true;
9373 if (type >= 987 && type <= 993)
9374 {
9375 glowMask = (short)(318 + (type - 987));
9376 light = 1f;
9377 }
9378 }
9379 else if (type == 994)
9380 {
9381 netImportant = true;
9382 width = 20;
9383 height = 20;
9384 aiStyle = 26;
9385 friendly = true;
9386 penetrate = -1;
9387 timeLeft *= 5;
9388 }
9389 else if (type == 995)
9390 {
9391 netImportant = true;
9392 width = 240;
9393 height = 104;
9394 aiStyle = 192;
9395 friendly = true;
9396 penetrate = -1;
9397 tileCollide = false;
9398 ignoreWater = true;
9399 timeLeft *= 5;
9400 }
9401 else if (type == 996)
9402 {
9403 width = 18;
9404 height = 18;
9405 aiStyle = 2;
9406 friendly = true;
9407 penetrate = 1;
9408 }
9409 else if (type == 997)
9410 {
9411 width = 16;
9412 height = 16;
9413 aiStyle = 190;
9414 friendly = true;
9415 melee = true;
9416 penetrate = 3;
9417 usesLocalNPCImmunity = true;
9418 tileCollide = false;
9419 ignoreWater = true;
9421 ownerHitCheck = true;
9422 ownerHitCheckDistance = 300f;
9423 usesOwnerMeleeHitCD = true;
9425 }
9426 else if (type == 999)
9427 {
9428 extraUpdates = 0;
9429 width = 16;
9430 height = 16;
9431 aiStyle = 99;
9432 friendly = true;
9433 penetrate = -1;
9434 melee = true;
9435 scale = 1f;
9436 }
9437 else if (type == 1000)
9438 {
9439 width = 22;
9440 height = 22;
9441 aiStyle = 3;
9442 friendly = true;
9443 penetrate = -1;
9444 melee = true;
9445 light = 0.6f;
9446 }
9447 else if (type == 998)
9448 {
9449 netImportant = true;
9450 width = 20;
9451 height = 20;
9452 aiStyle = 26;
9453 friendly = true;
9454 penetrate = -1;
9455 timeLeft *= 5;
9456 }
9457 else if (type == 1001)
9458 {
9459 width = 26;
9460 height = 26;
9461 aiStyle = 194;
9462 hostile = true;
9463 tileCollide = false;
9464 ignoreWater = true;
9465 scale = 1f + (float)Main.rand.Next(51) * 0.01f;
9466 timeLeft = 360;
9467 alpha = 255;
9468 }
9469 else if (type == 1002)
9470 {
9471 width = 260;
9472 height = 260;
9473 aiStyle = 16;
9474 friendly = true;
9475 hostile = true;
9476 penetrate = -1;
9477 tileCollide = false;
9478 alpha = 255;
9479 timeLeft = 2;
9480 trap = true;
9483 }
9484 else if (type == 1003)
9485 {
9486 netImportant = true;
9487 width = 26;
9488 height = 26;
9489 aiStyle = 26;
9490 friendly = true;
9491 penetrate = -1;
9492 timeLeft *= 5;
9493 }
9494 else if (type == 1004)
9495 {
9496 netImportant = true;
9497 width = 26;
9498 height = 26;
9499 aiStyle = 26;
9500 friendly = true;
9501 penetrate = -1;
9502 timeLeft *= 5;
9503 }
9504 else if (type == 1007)
9505 {
9506 width = 50;
9507 height = 50;
9508 aiStyle = 92;
9509 hostile = true;
9510 friendly = true;
9511 penetrate = -1;
9512 scale = 1.1f;
9513 trap = true;
9514 hide = true;
9515 }
9516 else if (type == 1006)
9517 {
9518 arrow = true;
9519 width = 10;
9520 height = 10;
9521 aiStyle = 1;
9522 friendly = true;
9523 ranged = true;
9524 timeLeft = 1200;
9525 }
9526 else if (type == 1008)
9527 {
9528 netImportant = true;
9529 width = 6;
9530 height = 6;
9531 aiStyle = 33;
9532 friendly = true;
9533 penetrate = -1;
9534 alpha = 255;
9535 timeLeft = 36000;
9536 }
9537 else if (type == 1009)
9538 {
9539 netImportant = true;
9540 width = 6;
9541 height = 6;
9542 aiStyle = 33;
9543 friendly = true;
9544 penetrate = -1;
9545 alpha = 255;
9546 timeLeft = 36000;
9547 }
9548 else if (type == 1010)
9549 {
9550 netImportant = true;
9551 width = 6;
9552 height = 6;
9553 aiStyle = 33;
9554 friendly = true;
9555 penetrate = -1;
9556 alpha = 255;
9557 timeLeft = 36000;
9558 }
9559 else if (type == 1011)
9560 {
9561 netImportant = true;
9562 width = 6;
9563 height = 6;
9564 aiStyle = 33;
9565 friendly = true;
9566 penetrate = -1;
9567 alpha = 255;
9568 timeLeft = 36000;
9569 }
9570 else if (type == 1012)
9571 {
9572 width = 18;
9573 height = 18;
9574 aiStyle = 2;
9575 friendly = true;
9576 melee = true;
9577 penetrate = 1;
9578 }
9579 else if (type == 1015 || type == 1016 || type == 1017)
9580 {
9582 }
9583 else if (type == 1018)
9584 {
9585 width = 16;
9586 height = 16;
9587 aiStyle = 67;
9588 penetrate = -1;
9589 netImportant = true;
9590 timeLeft *= 5;
9591 friendly = true;
9592 ignoreWater = true;
9593 }
9594 else if (type == 1019)
9595 {
9596 width = 64;
9597 height = 64;
9598 aiStyle = 6;
9599 friendly = true;
9600 tileCollide = false;
9601 penetrate = -1;
9602 alpha = 255;
9603 ignoreWater = true;
9604 }
9605 else if (type == 1020)
9606 {
9607 width = 12;
9608 height = 12;
9609 aiStyle = 195;
9610 friendly = true;
9611 penetrate = -1;
9612 }
9613 else
9614 {
9615 active = false;
9616 }
9617 width = (int)((float)width * scale);
9618 height = (int)((float)height * scale);
9620 }
9621
9622 public void DefaultToSpray()
9623 {
9624 width = 6;
9625 height = 6;
9626 aiStyle = 31;
9627 friendly = true;
9628 alpha = 255;
9629 penetrate = -1;
9630 extraUpdates = 2;
9631 tileCollide = false;
9632 ignoreWater = true;
9633 }
9634
9635 public void DefaultToWhip()
9636 {
9637 width = 18;
9638 height = 18;
9639 aiStyle = 165;
9640 friendly = true;
9641 penetrate = -1;
9642 tileCollide = false;
9643 scale = 1f;
9644 ownerHitCheck = true;
9645 extraUpdates = 1;
9646 usesLocalNPCImmunity = true;
9648 }
9649
9650 public static int GetNextSlot()
9651 {
9652 int result = 1000;
9653 for (int i = 0; i < 1000; i++)
9654 {
9655 if (!Main.projectile[i].active)
9656 {
9657 result = i;
9658 break;
9659 }
9660 }
9661 return result;
9662 }
9663
9664 public 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)
9665 {
9667 }
9668
9669 public static int FindOldestProjectile()
9670 {
9671 int result = 1000;
9672 int num = 9999999;
9673 for (int i = 0; i < 1000; i++)
9674 {
9675 if (!Main.projectile[i].netImportant && Main.projectile[i].timeLeft < num)
9676 {
9677 result = i;
9678 num = Main.projectile[i].timeLeft;
9679 }
9680 }
9681 return result;
9682 }
9683
9684 public static int NewProjectile(IEntitySource spawnSource, float X, float Y, float SpeedX, float SpeedY, int Type, int Damage, float KnockBack, int Owner = -1, float ai0 = 0f, float ai1 = 0f, float ai2 = 0f)
9685 {
9686 if (Owner == -1)
9687 {
9688 Owner = Main.myPlayer;
9689 }
9690 int num = 1000;
9691 for (int i = 0; i < 1000; i++)
9692 {
9693 if (!Main.projectile[i].active)
9694 {
9695 num = i;
9696 break;
9697 }
9698 }
9699 if (num == 1000)
9700 {
9701 num = FindOldestProjectile();
9702 }
9703 Projectile projectile = Main.projectile[num];
9704 projectile.SetDefaults(Type);
9705 projectile.position.X = X - (float)projectile.width * 0.5f;
9706 projectile.position.Y = Y - (float)projectile.height * 0.5f;
9707 projectile.owner = Owner;
9708 projectile.velocity.X = SpeedX;
9709 projectile.velocity.Y = SpeedY;
9710 projectile.damage = Damage;
9711 projectile.knockBack = KnockBack;
9712 projectile.identity = num;
9713 projectile.gfxOffY = 0f;
9714 projectile.stepSpeed = 1f;
9715 projectile.wet = Collision.WetCollision(projectile.position, projectile.width, projectile.height);
9716 if (projectile.ignoreWater)
9717 {
9718 projectile.wet = false;
9719 }
9720 projectile.honeyWet = Collision.honey;
9721 projectile.shimmerWet = Collision.shimmer;
9722 Main.projectileIdentity[Owner, num] = num;
9724 if (projectile.aiStyle == 1)
9725 {
9726 while (projectile.velocity.X >= 16f || projectile.velocity.X <= -16f || projectile.velocity.Y >= 16f || projectile.velocity.Y < -16f)
9727 {
9728 projectile.velocity.X *= 0.97f;
9729 projectile.velocity.Y *= 0.97f;
9730 }
9731 }
9732 if (Owner == Main.myPlayer)
9733 {
9734 switch (Type)
9735 {
9736 case 206:
9737 projectile.ai[0] = (float)Main.rand.Next(-100, 101) * 0.0005f;
9738 projectile.ai[1] = (float)Main.rand.Next(-100, 101) * 0.0005f;
9739 break;
9740 case 335:
9741 projectile.ai[1] = Main.rand.Next(4);
9742 break;
9743 case 358:
9744 projectile.ai[1] = (float)Main.rand.Next(10, 31) * 0.1f;
9745 break;
9746 case 406:
9747 projectile.ai[1] = (float)Main.rand.Next(10, 21) * 0.1f;
9748 break;
9749 default:
9750 projectile.ai[0] = ai0;
9751 projectile.ai[1] = ai1;
9752 projectile.ai[2] = ai2;
9753 break;
9754 }
9755 }
9756 if (Type == 434)
9757 {
9758 projectile.ai[0] = projectile.position.X;
9759 projectile.ai[1] = projectile.position.Y;
9760 }
9761 if (Type > 0 && Type < ProjectileID.Count)
9762 {
9764 {
9765 projectile.projUUID = projectile.identity;
9766 }
9768 {
9769 int num2 = Main.projectile[(int)projectile.ai[0]].projUUID;
9770 if (num2 >= 0)
9771 {
9772 projectile.ai[0] = num2;
9773 }
9774 }
9775 }
9776 if (Main.netMode != 0 && Owner == Main.myPlayer)
9777 {
9778 NetMessage.SendData(27, -1, -1, null, num);
9779 }
9780 if (Owner == Main.myPlayer)
9781 {
9783 {
9784 int num3 = 0;
9785 int num4 = 0;
9786 int num5 = 99999999;
9787 for (int j = 0; j < 1000; j++)
9788 {
9789 if (Main.projectile[j].active && ProjectileID.Sets.IsAGolfBall[Main.projectile[j].type] && Main.projectile[j].owner == Owner && Main.projectile[j].damage <= 0)
9790 {
9791 num3++;
9792 if (num5 > Main.projectile[j].timeLeft)
9793 {
9794 num4 = j;
9795 num5 = Main.projectile[j].timeLeft;
9796 }
9797 }
9798 }
9799 if (num3 > 10)
9800 {
9801 Main.projectile[num4].Kill();
9802 }
9803 }
9804 if (Type == 28)
9805 {
9806 projectile.timeLeft = 180;
9807 }
9808 if (Type == 516)
9809 {
9810 projectile.timeLeft = 180;
9811 }
9812 if (Type == 519)
9813 {
9814 projectile.timeLeft = 180;
9815 }
9816 if (Type == 29)
9817 {
9818 projectile.timeLeft = 300;
9819 }
9820 if (Type == 470)
9821 {
9822 projectile.timeLeft = 300;
9823 }
9824 if (Type == 637)
9825 {
9826 projectile.timeLeft = 300;
9827 }
9828 if (Type == 30)
9829 {
9830 projectile.timeLeft = 180;
9831 }
9832 if (Type == 517)
9833 {
9834 projectile.timeLeft = 180;
9835 }
9836 if (Type == 37)
9837 {
9838 projectile.timeLeft = 180;
9839 }
9840 if (Type == 773)
9841 {
9842 projectile.timeLeft = 180;
9843 }
9844 if (Type == 75)
9845 {
9846 projectile.timeLeft = 180;
9847 }
9848 if (Type == 133)
9849 {
9850 projectile.timeLeft = 180;
9851 }
9852 if (Type == 136)
9853 {
9854 projectile.timeLeft = 180;
9855 }
9856 if (Type == 139)
9857 {
9858 projectile.timeLeft = 180;
9859 }
9860 if (Type == 142)
9861 {
9862 projectile.timeLeft = 180;
9863 }
9864 if (Type == 397)
9865 {
9866 projectile.timeLeft = 180;
9867 }
9868 if (Type == 419)
9869 {
9870 projectile.timeLeft = 600;
9871 }
9872 if (Type == 420)
9873 {
9874 projectile.timeLeft = 600;
9875 }
9876 if (Type == 421)
9877 {
9878 projectile.timeLeft = 600;
9879 }
9880 if (Type == 422)
9881 {
9882 projectile.timeLeft = 600;
9883 }
9884 if (Type == 588)
9885 {
9886 projectile.timeLeft = 180;
9887 }
9888 if (Type == 779)
9889 {
9890 projectile.timeLeft = 60;
9891 }
9892 if (Type == 783)
9893 {
9894 projectile.timeLeft = 60;
9895 }
9896 if (Type == 862 || Type == 863)
9897 {
9898 projectile.timeLeft = 60;
9899 }
9900 if (Type == 443)
9901 {
9902 projectile.timeLeft = 300;
9903 }
9904 if (Type == 681)
9905 {
9906 projectile.timeLeft = 600;
9907 }
9908 if (Type == 684)
9909 {
9910 projectile.timeLeft = 60;
9911 }
9912 if (Type == 706)
9913 {
9914 projectile.timeLeft = 120;
9915 }
9916 if (Type == 680 && Main.player[projectile.owner].setSquireT2)
9917 {
9918 projectile.penetrate = 7;
9919 }
9920 if (Type == 777 || Type == 781 || Type == 794 || Type == 797 || Type == 800 || Type == 785 || Type == 788 || Type == 791 || Type == 903 || Type == 904 || Type == 905 || Type == 906 || Type == 910 || Type == 911)
9921 {
9922 projectile.timeLeft = 180;
9923 }
9924 }
9925 if (Type == 249)
9926 {
9927 projectile.frame = Main.rand.Next(5);
9928 }
9929 if (Owner == Main.myPlayer)
9930 {
9931 Main.player[Owner].TryUpdateChannel(projectile);
9932 }
9933 return num;
9934 }
9935
9937 {
9939 {
9940 if (entitySource_Parent.Entity is Projectile projectile)
9941 {
9942 next.bannerIdToRespondTo = projectile.bannerIdToRespondTo;
9943 }
9944 else if (entitySource_Parent.Entity is NPC nPC)
9945 {
9946 next.bannerIdToRespondTo = Item.NPCtoBanner(nPC.BannerID());
9947 }
9948 }
9949 }
9950
9952 {
9953 return proj.type switch
9954 {
9955 739 => new Color(50, 50, 50, 80),
9956 740 => new Color(30, 50, 255, 40),
9957 741 => new Color(150, 90, 60, 90),
9958 742 => new Color(30, 255, 170, 30),
9959 743 => new Color(30, 255, 30, 40),
9960 744 => new Color(190, 255, 30, 50),
9961 745 => new Color(255, 130, 30, 50),
9962 746 => new Color(255, 50, 110, 50),
9963 747 => new Color(130, 10, 200, 40),
9964 748 => new Color(255, 30, 50, 50),
9965 749 => new Color(100, 180, 255, 30),
9966 750 => new Color(50, 240, 160, 30),
9967 751 => new Color(220, 80, 220, 70),
9968 752 => new Color(255, 180, 50, 30),
9969 _ => new Color(160, 160, 255, 50),
9970 };
9971 }
9972
9973 public void StatusNPC(int i)
9974 {
9975 NPC nPC = Main.npc[i];
9976 if ((melee || ProjectileID.Sets.IsAWhip[type]) && Main.player[owner].meleeEnchant > 0 && !noEnchantments)
9977 {
9978 byte meleeEnchant = Main.player[owner].meleeEnchant;
9979 if (meleeEnchant == 1)
9980 {
9981 nPC.AddBuff(70, 60 * Main.rand.Next(5, 10));
9982 }
9983 if (meleeEnchant == 2)
9984 {
9985 nPC.AddBuff(39, 60 * Main.rand.Next(3, 7));
9986 }
9987 if (meleeEnchant == 3)
9988 {
9989 nPC.AddBuff(24, 60 * Main.rand.Next(3, 7));
9990 }
9991 if (meleeEnchant == 5)
9992 {
9993 nPC.AddBuff(69, 60 * Main.rand.Next(10, 20));
9994 }
9995 if (meleeEnchant == 6)
9996 {
9997 nPC.AddBuff(31, 60 * Main.rand.Next(1, 4));
9998 }
9999 if (meleeEnchant == 8)
10000 {
10001 nPC.AddBuff(20, 60 * Main.rand.Next(5, 10));
10002 }
10003 if (meleeEnchant == 4)
10004 {
10005 nPC.AddBuff(72, 120);
10006 }
10007 }
10008 if (type == 195)
10009 {
10010 nPC.AddBuff(70, 60 * Main.rand.Next(5, 11));
10011 }
10012 if (type == 119)
10013 {
10014 nPC.AddBuff(324, 240);
10015 }
10016 if (type == 309)
10017 {
10018 nPC.AddBuff(324, 300);
10019 }
10020 if (type == 359)
10021 {
10022 nPC.AddBuff(324, 420);
10023 }
10024 switch (type)
10025 {
10026 case 841:
10027 nPC.AddBuff(307, 240);
10028 break;
10029 case 952:
10030 nPC.AddBuff(326, 240);
10031 break;
10032 case 847:
10033 nPC.AddBuff(309, 240);
10034 break;
10035 case 849:
10036 nPC.AddBuff(310, 240);
10037 break;
10038 case 913:
10039 if (localAI[0] == 0f)
10040 {
10041 nPC.AddBuff(313, 240);
10042 }
10043 nPC.AddBuff(323, 240);
10044 break;
10045 case 912:
10046 nPC.AddBuff(340, 240);
10047 nPC.AddBuff(324, 240);
10048 break;
10049 case 914:
10050 nPC.AddBuff(315, 240);
10051 if (Main.rand.Next(5) == 0)
10052 {
10053 nPC.AddBuff(20, 180);
10054 }
10055 break;
10056 case 848:
10057 nPC.AddBuff(319, 240);
10058 break;
10059 case 915:
10060 nPC.AddBuff(316, 240);
10061 break;
10062 }
10063 if (type == 664 && Main.rand.Next(3) == 0)
10064 {
10065 nPC.AddBuff(24, 60 * Main.rand.Next(3, 6));
10066 }
10067 if (type == 666 && Main.rand.Next(2) == 0)
10068 {
10069 nPC.AddBuff(323, 60 * Main.rand.Next(3, 9));
10070 }
10071 if (type == 668 && Main.rand.Next(3) != 0)
10072 {
10073 nPC.AddBuff(323, 60 * Main.rand.Next(6, 9));
10074 }
10075 if (type == 567 || type == 568)
10076 {
10077 nPC.AddBuff(20, 60 * Main.rand.Next(5, 11));
10078 }
10079 if (type == 598 && ai[1] == (float)i)
10080 {
10081 nPC.AddBuff(169, 900);
10082 }
10083 if (type == 636 && ai[1] == (float)i)
10084 {
10085 nPC.AddBuff(189, 300);
10086 }
10087 if (type == 971 && ai[1] == (float)i)
10088 {
10089 nPC.AddBuff(337, 540);
10090 }
10091 if (type == 975 && ai[1] == (float)i)
10092 {
10093 nPC.AddBuff(344, 540);
10094 }
10095 if (type == 611)
10096 {
10097 nPC.AddBuff(189, 300);
10098 }
10099 if (type == 612)
10100 {
10101 nPC.AddBuff(189, 300);
10102 }
10103 if (type == 978)
10104 {
10105 nPC.AddBuff(24, 180);
10106 }
10107 if (type == 953)
10108 {
10109 nPC.AddBuff(189, 300);
10110 }
10111 if (type == 711)
10112 {
10113 nPC.AddBuff(203, 600);
10114 }
10115 if (type == 706)
10116 {
10117 nPC.AddBuff(323, 480);
10118 }
10119 if (type == 614 && ai[1] == (float)i)
10120 {
10121 nPC.AddBuff(183, 900);
10122 }
10123 if (type == 585)
10124 {
10125 nPC.AddBuff(153, 60 * Main.rand.Next(5, 11));
10126 }
10127 if (type == 583)
10128 {
10129 nPC.AddBuff(20, 60 * Main.rand.Next(3, 6));
10130 }
10131 if (type == 524)
10132 {
10133 nPC.AddBuff(69, 60 * Main.rand.Next(3, 8));
10134 }
10135 if (type == 954 && Main.rand.Next(2) == 0)
10136 {
10137 int num = 24;
10138 if (Main.remixWorld)
10139 {
10140 num = 323;
10141 }
10142 if (Main.rand.Next(3) == 0)
10143 {
10144 nPC.AddBuff(num, Main.rand.Next(60, 240));
10145 }
10146 else
10147 {
10148 nPC.AddBuff(num, Main.rand.Next(60, 120));
10149 }
10150 }
10151 if (type == 504 && Main.rand.Next(2) == 0)
10152 {
10153 if (Main.rand.Next(3) == 0)
10154 {
10155 nPC.AddBuff(323, Main.rand.Next(60, 240));
10156 }
10157 else
10158 {
10159 nPC.AddBuff(323, Main.rand.Next(60, 120));
10160 }
10161 }
10162 if (type == 979 && Main.rand.Next(2) == 0)
10163 {
10164 int num2 = 44;
10165 if (Main.remixWorld)
10166 {
10167 num2 = 324;
10168 }
10169 if (Main.rand.Next(3) == 0)
10170 {
10171 nPC.AddBuff(num2, Main.rand.Next(60, 240));
10172 }
10173 else
10174 {
10175 nPC.AddBuff(num2, Main.rand.Next(60, 120));
10176 }
10177 }
10178 if ((type == 694 || type == 695 || type == 696) && Main.player[owner].setHuntressT2)
10179 {
10180 nPC.AddBuff(204, Main.rand.Next(8, 18) * 30);
10181 }
10182 if (type == 545 && Main.rand.Next(3) == 0)
10183 {
10184 nPC.AddBuff(24, Main.rand.Next(60, 240));
10185 }
10186 if (type == 553)
10187 {
10188 nPC.AddBuff(323, Main.rand.Next(180, 480));
10189 }
10190 if (type == 552 && Main.rand.Next(3) != 0)
10191 {
10192 nPC.AddBuff(324, Main.rand.Next(120, 320));
10193 }
10194 if (type == 495)
10195 {
10196 nPC.AddBuff(153, Main.rand.Next(120, 300));
10197 }
10198 if (type == 497)
10199 {
10200 nPC.AddBuff(153, Main.rand.Next(60, 180));
10201 }
10202 if (type == 496)
10203 {
10204 nPC.AddBuff(153, Main.rand.Next(240, 480));
10205 }
10206 if (type == 46)
10207 {
10208 nPC.AddBuff(153, Main.rand.Next(240, 300));
10209 }
10210 if (type == 476)
10211 {
10212 nPC.AddBuff(151, 30);
10213 }
10214 if (type == 523)
10215 {
10216 nPC.AddBuff(20, 60 * Main.rand.Next(10, 30));
10217 }
10218 if (type == 478 || type == 480)
10219 {
10220 nPC.AddBuff(39, 60 * Main.rand.Next(3, 7));
10221 }
10222 if (type == 479)
10223 {
10224 nPC.AddBuff(69, 60 * Main.rand.Next(7, 15));
10225 }
10226 if (type == 379)
10227 {
10228 nPC.AddBuff(70, 60 * Main.rand.Next(2, 5));
10229 }
10230 if (type >= 390 && type <= 392)
10231 {
10232 nPC.AddBuff(70, 60 * Main.rand.Next(2, 5));
10233 }
10234 if (type == 374)
10235 {
10236 nPC.AddBuff(20, 60 * Main.rand.Next(4, 7));
10237 }
10238 if (type == 376)
10239 {
10240 nPC.AddBuff(24, 60 * Main.rand.Next(3, 7));
10241 }
10242 if (type >= 399 && type <= 402)
10243 {
10244 nPC.AddBuff(24, 60 * Main.rand.Next(3, 7));
10245 }
10246 if (type == 295 || type == 296)
10247 {
10248 nPC.AddBuff(323, 60 * Main.rand.Next(8, 16));
10249 }
10250 if ((melee || ranged) && !npcProj && Main.player[owner].frostBurn && !noEnchantments)
10251 {
10252 nPC.AddBuff(324, 60 * Main.rand.Next(5, 15));
10253 }
10254 if (melee && Main.player[owner].magmaStone && !noEnchantments)
10255 {
10256 if (Main.rand.Next(7) == 0)
10257 {
10258 nPC.AddBuff(323, 360);
10259 }
10260 else if (Main.rand.Next(3) == 0)
10261 {
10262 nPC.AddBuff(323, 120);
10263 }
10264 else
10265 {
10266 nPC.AddBuff(323, 60);
10267 }
10268 }
10269 if (type == 287)
10270 {
10271 nPC.AddBuff(72, 120);
10272 }
10273 if (type == 285)
10274 {
10275 if (Main.rand.Next(3) == 0)
10276 {
10277 nPC.AddBuff(31, 180);
10278 }
10279 else
10280 {
10281 nPC.AddBuff(31, 60);
10282 }
10283 }
10284 if (type == 2 && Main.rand.Next(3) == 0)
10285 {
10286 nPC.AddBuff(24, 180);
10287 }
10288 if (type == 172)
10289 {
10290 if (Main.rand.Next(3) == 0)
10291 {
10292 nPC.AddBuff(44, 180);
10293 }
10294 }
10295 else if (type == 15)
10296 {
10297 int num3 = 24;
10298 if (Main.remixWorld)
10299 {
10300 num3 = 323;
10301 }
10302 if (Main.rand.Next(2) == 0)
10303 {
10304 nPC.AddBuff(num3, 300);
10305 }
10306 }
10307 else if (type == 253)
10308 {
10309 nPC.AddBuff(324, 480);
10310 }
10311 else if (type == 19)
10312 {
10313 if (Main.rand.Next(2) == 0)
10314 {
10315 nPC.AddBuff(24, 360);
10316 }
10317 }
10318 else if (type == 113)
10319 {
10320 if (Main.rand.Next(2) == 0)
10321 {
10322 nPC.AddBuff(44, 180);
10323 }
10324 }
10325 else if (type == 33)
10326 {
10327 if (Main.rand.Next(2) == 0)
10328 {
10329 nPC.AddBuff(20, 420);
10330 }
10331 }
10332 else if (type == 976)
10333 {
10334 if (Main.rand.Next(4) == 0)
10335 {
10336 nPC.AddBuff(20, 420);
10337 }
10338 }
10339 else if (type == 34)
10340 {
10341 if (Main.rand.Next(2) == 0)
10342 {
10343 nPC.AddBuff(24, Main.rand.Next(240, 480));
10344 }
10345 }
10346 else if (type == 948)
10347 {
10348 if (Main.rand.Next(6) == 0)
10349 {
10350 nPC.AddBuff(24, 60 * Main.rand.Next(2, 4));
10351 }
10352 }
10353 else if (type == 35)
10354 {
10355 if (Main.rand.Next(2) == 0)
10356 {
10357 nPC.AddBuff(24, 300);
10358 }
10359 }
10360 else if (type == 54)
10361 {
10362 if (Main.rand.Next(2) == 0)
10363 {
10364 nPC.AddBuff(20, 600);
10365 }
10366 }
10367 else if (type == 267)
10368 {
10369 if (Main.rand.Next(3) == 0)
10370 {
10371 nPC.AddBuff(20, 3600);
10372 }
10373 else
10374 {
10375 nPC.AddBuff(20, 1800);
10376 }
10377 }
10378 else if (type == 63)
10379 {
10380 if (Main.rand.Next(5) != 0)
10381 {
10382 nPC.AddBuff(31, 60 * Main.rand.Next(2, 5));
10383 }
10384 }
10385 else if (type == 85)
10386 {
10387 int num4 = ((ai[0] == 1f) ? 324 : 323);
10388 nPC.AddBuff(num4, 1200);
10389 }
10390 else if (type == 188)
10391 {
10392 nPC.AddBuff(323, 1200);
10393 }
10394 else if (type == 95 || type == 103 || type == 104 || type == 482)
10395 {
10396 nPC.AddBuff(39, 420);
10397 }
10398 else if (type == 278 || type == 279 || type == 280)
10399 {
10400 nPC.AddBuff(69, 600);
10401 }
10402 else if (type == 282 || type == 283)
10403 {
10404 nPC.AddBuff(70, 600);
10405 }
10406 if (type == 163 || type == 310 || type == 1008 || type == 1010 || type == 1011)
10407 {
10408 if (Main.rand.Next(3) == 0)
10409 {
10410 nPC.AddBuff(24, 600);
10411 }
10412 else
10413 {
10414 nPC.AddBuff(24, 300);
10415 }
10416 }
10417 if (type == 1009)
10418 {
10419 nPC.AddBuff(39, 600);
10420 }
10421 else if (type == 98)
10422 {
10423 nPC.AddBuff(20, 600);
10424 }
10425 else if (type == 184)
10426 {
10427 nPC.AddBuff(20, 900);
10428 }
10429 else if (type == 980)
10430 {
10431 nPC.AddBuff(70, 300);
10432 }
10433 else if (type == 265)
10434 {
10435 nPC.AddBuff(20, 1800);
10436 }
10437 else if (type == 355)
10438 {
10439 nPC.AddBuff(70, 1800);
10440 }
10441 }
10442
10443 public void StatusPvP(int i)
10444 {
10445 if ((melee || ProjectileID.Sets.IsAWhip[type]) && Main.player[owner].meleeEnchant > 0 && !noEnchantments)
10446 {
10447 byte meleeEnchant = Main.player[owner].meleeEnchant;
10448 if (meleeEnchant == 1)
10449 {
10450 Main.player[i].AddBuff(70, 60 * Main.rand.Next(5, 10), quiet: false);
10451 }
10452 if (meleeEnchant == 2)
10453 {
10454 Main.player[i].AddBuff(39, 60 * Main.rand.Next(3, 7), quiet: false);
10455 }
10456 if (meleeEnchant == 3)
10457 {
10458 Main.player[i].AddBuff(24, 60 * Main.rand.Next(3, 7), quiet: false);
10459 }
10460 if (meleeEnchant == 5)
10461 {
10462 Main.player[i].AddBuff(69, 60 * Main.rand.Next(10, 20), quiet: false);
10463 }
10464 if (meleeEnchant == 6)
10465 {
10466 Main.player[i].AddBuff(31, 60 * Main.rand.Next(1, 4), quiet: false);
10467 }
10468 if (meleeEnchant == 8)
10469 {
10470 Main.player[i].AddBuff(20, 60 * Main.rand.Next(5, 10), quiet: false);
10471 }
10472 }
10473 if (type == 978)
10474 {
10475 Main.player[i].AddBuff(24, 180);
10476 }
10477 if (type == 295 || type == 296)
10478 {
10479 Main.player[i].AddBuff(323, 60 * Main.rand.Next(8, 16), quiet: false);
10480 }
10481 if (type >= 399 && type <= 402)
10482 {
10483 Main.player[i].AddBuff(24, 60 * Main.rand.Next(3, 7), quiet: false);
10484 }
10485 if (type == 478 || type == 480)
10486 {
10487 Main.player[i].AddBuff(39, 60 * Main.rand.Next(3, 7), quiet: false);
10488 }
10489 if ((melee || ranged) && Main.player[owner].frostBurn && !noEnchantments)
10490 {
10491 Main.player[i].AddBuff(324, 60 * Main.rand.Next(1, 8), quiet: false);
10492 }
10493 if (melee && Main.player[owner].magmaStone && !noEnchantments)
10494 {
10495 if (Main.rand.Next(4) == 0)
10496 {
10497 Main.player[i].AddBuff(24, 360, quiet: false);
10498 }
10499 else if (Main.rand.Next(2) == 0)
10500 {
10501 Main.player[i].AddBuff(24, 240, quiet: false);
10502 }
10503 else
10504 {
10505 Main.player[i].AddBuff(24, 120, quiet: false);
10506 }
10507 }
10508 if (type == 2 && Main.rand.Next(3) == 0)
10509 {
10510 Main.player[i].AddBuff(24, 180, quiet: false);
10511 }
10512 if (type == 172)
10513 {
10514 if (Main.rand.Next(3) == 0)
10515 {
10516 Main.player[i].AddBuff(44, 240, quiet: false);
10517 }
10518 }
10519 else if (type == 15)
10520 {
10521 int num = 24;
10522 if (Main.remixWorld)
10523 {
10524 num = 323;
10525 }
10526 if (Main.rand.Next(2) == 0)
10527 {
10528 Main.player[i].AddBuff(num, 300, quiet: false);
10529 }
10530 }
10531 else if (type == 253)
10532 {
10533 if (Main.rand.Next(2) == 0)
10534 {
10535 Main.player[i].AddBuff(44, 480, quiet: false);
10536 }
10537 }
10538 else if (type == 19)
10539 {
10540 if (Main.rand.Next(5) == 0)
10541 {
10542 Main.player[i].AddBuff(24, 180, quiet: false);
10543 }
10544 }
10545 else if (type == 113)
10546 {
10547 if (Main.rand.Next(5) == 0)
10548 {
10549 Main.player[i].AddBuff(44, 180, quiet: false);
10550 }
10551 }
10552 else if (type == 33)
10553 {
10554 if (Main.rand.Next(5) == 0)
10555 {
10556 Main.player[i].AddBuff(20, 420, quiet: false);
10557 }
10558 }
10559 else if (type == 976)
10560 {
10561 if (Main.rand.Next(4) == 0)
10562 {
10563 Main.player[i].AddBuff(20, 420, quiet: false);
10564 }
10565 }
10566 else if (type == 34)
10567 {
10568 if (Main.rand.Next(2) == 0)
10569 {
10570 Main.player[i].AddBuff(24, 240, quiet: false);
10571 }
10572 }
10573 else if (type == 35)
10574 {
10575 if (Main.rand.Next(4) == 0)
10576 {
10577 Main.player[i].AddBuff(24, 180, quiet: false);
10578 }
10579 }
10580 else if (type == 54)
10581 {
10582 if (Main.rand.Next(2) == 0)
10583 {
10584 Main.player[i].AddBuff(20, 600, quiet: false);
10585 }
10586 }
10587 else if (type == 267)
10588 {
10589 if (Main.rand.Next(3) == 0)
10590 {
10591 Main.player[i].AddBuff(20, 3600, quiet: false);
10592 }
10593 else
10594 {
10595 Main.player[i].AddBuff(20, 1800, quiet: false);
10596 }
10597 }
10598 else if (type == 63)
10599 {
10600 if (Main.rand.Next(3) != 0)
10601 {
10602 Main.player[i].AddBuff(31, 120, quiet: false);
10603 }
10604 }
10605 else if (type == 85 || type == 188)
10606 {
10607 Main.player[i].AddBuff(24, 1200, quiet: false);
10608 }
10609 else if (type == 95 || type == 103 || type == 104 || type == 482)
10610 {
10611 Main.player[i].AddBuff(39, 420, quiet: false);
10612 }
10613 else if (type == 278 || type == 279 || type == 280)
10614 {
10615 Main.player[i].AddBuff(69, 900, quiet: false);
10616 }
10617 else if (type == 282 || type == 283)
10618 {
10619 Main.player[i].AddBuff(70, 600, quiet: false);
10620 }
10621 if (type == 163 || type == 310 || type == 1008 || type == 1010 || type == 1011)
10622 {
10623 if (Main.rand.Next(3) == 0)
10624 {
10625 Main.player[i].AddBuff(24, 600, quiet: false);
10626 }
10627 else
10628 {
10629 Main.player[i].AddBuff(24, 300, quiet: false);
10630 }
10631 }
10632 if (type == 1009)
10633 {
10634 Main.player[i].AddBuff(39, 300, quiet: false);
10635 }
10636 else if (type == 265)
10637 {
10638 Main.player[i].AddBuff(20, 1200, quiet: false);
10639 }
10640 else if (type == 355)
10641 {
10642 Main.player[i].AddBuff(70, 1800, quiet: false);
10643 }
10644 }
10645
10647 {
10648 if (!magic || damage <= 0)
10649 {
10650 return;
10651 }
10652 int num = damage;
10653 if (dmg <= 1)
10654 {
10655 return;
10656 }
10657 int num2 = -1;
10658 int num3 = 1500;
10659 if (Main.player[Main.myPlayer].ghostDmg > (float)num3)
10660 {
10661 return;
10662 }
10663 Main.player[Main.myPlayer].ghostDmg += num;
10664 int[] array = new int[200];
10665 int num4 = 0;
10666 _ = new int[200];
10667 int num5 = 0;
10668 for (int i = 0; i < 200; i++)
10669 {
10670 if (!Main.npc[i].CanBeChasedBy(this))
10671 {
10672 continue;
10673 }
10674 float num6 = Math.Abs(Main.npc[i].position.X + (float)(Main.npc[i].width / 2) - position.X + (float)(width / 2)) + Math.Abs(Main.npc[i].position.Y + (float)(Main.npc[i].height / 2) - position.Y + (float)(height / 2));
10675 if (num6 < 800f)
10676 {
10677 if (Collision.CanHit(position, 1, 1, Main.npc[i].position, Main.npc[i].width, Main.npc[i].height) && num6 > 50f)
10678 {
10679 array[num5] = i;
10680 num5++;
10681 }
10682 else if (num5 == 0)
10683 {
10684 array[num4] = i;
10685 num4++;
10686 }
10687 }
10688 }
10689 if (num4 != 0 || num5 != 0)
10690 {
10691 num2 = ((num5 <= 0) ? array[Main.rand.Next(num4)] : array[Main.rand.Next(num5)]);
10692 float num7 = Main.rand.Next(-100, 101);
10693 float num8 = Main.rand.Next(-100, 101);
10694 float num9 = (float)Math.Sqrt(num7 * num7 + num8 * num8);
10695 num9 = 4f / num9;
10696 num7 *= num9;
10697 num8 *= num9;
10699 }
10700 }
10701
10703 {
10704 float num = 0.2f;
10705 num -= (float)numHits * 0.05f;
10706 if (num <= 0f)
10707 {
10708 return;
10709 }
10710 float num2 = (float)dmg * num;
10711 if ((int)num2 <= 0 || Main.player[Main.myPlayer].lifeSteal <= 0f)
10712 {
10713 return;
10714 }
10715 Main.player[Main.myPlayer].lifeSteal -= num2;
10716 if (!magic)
10717 {
10718 return;
10719 }
10720 float num3 = 0f;
10721 int num4 = owner;
10722 for (int i = 0; i < 255; i++)
10723 {
10724 if (Main.player[i].active && !Main.player[i].dead && ((!Main.player[owner].hostile && !Main.player[i].hostile) || Main.player[owner].team == Main.player[i].team) && Distance(Main.player[i].Center) <= 3000f)
10725 {
10726 int num5 = Main.player[i].statLifeMax2 - Main.player[i].statLife;
10727 if ((float)num5 > num3)
10728 {
10729 num3 = num5;
10730 num4 = i;
10731 }
10732 }
10733 }
10734 NewProjectile(GetProjectileSource_OnHit(victim, 15), Position.X, Position.Y, 0f, 0f, 298, 0, 0f, owner, num4, num2);
10735 }
10736
10738 {
10739 float num = (float)dmg * 0.075f;
10740 if ((int)num != 0 && !(Main.player[Main.myPlayer].lifeSteal <= 0f))
10741 {
10742 Main.player[Main.myPlayer].lifeSteal -= num;
10743 int num2 = owner;
10744 NewProjectile(GetProjectileSource_OnHit(victim, 18), Position.X, Position.Y, 0f, 0f, 305, 0, 0f, owner, num2, num);
10745 }
10746 }
10747
10748 public void StatusPlayer(int i)
10749 {
10750 if (Main.player[i].creativeGodMode)
10751 {
10752 return;
10753 }
10754 if (type == 119)
10755 {
10756 Main.player[i].AddBuff(324, 240);
10757 }
10758 if (type == 359)
10759 {
10760 Main.player[i].AddBuff(324, 420);
10761 }
10762 if (type == 472)
10763 {
10764 Main.player[i].AddBuff(149, Main.rand.Next(30, 150));
10765 }
10766 if (type == 961)
10767 {
10768 Main.player[i].AddBuff(47, 20);
10769 }
10770 if (type == 467)
10771 {
10772 Main.player[i].AddBuff(24, Main.rand.Next(30, 150));
10773 }
10774 if (type == 581)
10775 {
10776 if (Main.expertMode)
10777 {
10778 Main.player[i].AddBuff(164, Main.rand.Next(300, 540));
10779 }
10780 else if (Main.rand.Next(2) == 0)
10781 {
10782 Main.player[i].AddBuff(164, Main.rand.Next(360, 720));
10783 }
10784 }
10785 if (type == 687)
10786 {
10787 Main.player[i].AddBuff(24, 60 * Main.rand.Next(7, 11));
10788 }
10789 if (type == 258 && Main.rand.Next(2) == 0)
10790 {
10791 Main.player[i].AddBuff(24, 60 * Main.rand.Next(5, 8));
10792 }
10793 if (type == 572 && Main.rand.Next(3) != 0)
10794 {
10795 Main.player[i].AddBuff(20, Main.rand.Next(120, 240));
10796 }
10797 if (type == 276)
10798 {
10799 if (Main.expertMode)
10800 {
10801 Main.player[i].AddBuff(20, Main.rand.Next(120, 540));
10802 }
10803 else if (Main.rand.Next(2) == 0)
10804 {
10805 Main.player[i].AddBuff(20, Main.rand.Next(180, 420));
10806 }
10807 }
10808 if (type == 436 && Main.rand.Next(5) >= 2)
10809 {
10810 Main.player[i].AddBuff(31, 300);
10811 }
10812 if (type == 435 && Main.rand.Next(3) != 0)
10813 {
10814 Main.player[i].AddBuff(144, 300);
10815 }
10816 if (type == 682)
10817 {
10818 Main.player[i].AddBuff(196, 300);
10819 }
10820 if (type == 437)
10821 {
10822 Main.player[i].AddBuff(144, 60 * Main.rand.Next(4, 9));
10823 }
10824 if (type == 348)
10825 {
10826 if (Main.rand.Next(2) == 0)
10827 {
10828 Main.player[i].AddBuff(46, 600);
10829 }
10830 else
10831 {
10832 Main.player[i].AddBuff(46, 300);
10833 }
10834 if (Main.rand.Next(3) != 0)
10835 {
10836 if (Main.rand.Next(16) == 0)
10837 {
10838 Main.player[i].AddBuff(47, 60);
10839 }
10840 else if (Main.rand.Next(12) == 0)
10841 {
10842 Main.player[i].AddBuff(47, 40);
10843 }
10844 else if (Main.rand.Next(8) == 0)
10845 {
10846 Main.player[i].AddBuff(47, 20);
10847 }
10848 }
10849 }
10850 if (type == 349)
10851 {
10852 if (Main.rand.Next(3) == 0)
10853 {
10854 Main.player[i].AddBuff(46, 600);
10855 }
10856 else if (Main.rand.Next(2) == 0)
10857 {
10858 Main.player[i].AddBuff(46, 300);
10859 }
10860 }
10861 if (type >= 399 && type <= 402 && !hostile)
10862 {
10863 Main.player[i].AddBuff(24, 60 * Main.rand.Next(3, 7));
10864 }
10865 if (type == 55 || type == 719)
10866 {
10867 if (Main.rand.Next(3) == 0)
10868 {
10869 Main.player[i].AddBuff(20, 600);
10870 }
10871 else if (Main.expertMode)
10872 {
10873 Main.player[i].AddBuff(20, Main.rand.Next(60, 300));
10874 }
10875 }
10876 if (type == 44 && Main.rand.Next(3) == 0)
10877 {
10878 Main.player[i].AddBuff(22, 900);
10879 }
10880 if (type == 293)
10881 {
10882 Main.player[i].AddBuff(80, 60 * Main.rand.Next(2, 7));
10883 }
10884 if (type == 299)
10885 {
10886 Main.player[i].AddBuff(23, 240);
10887 }
10888 if (type == 82 && Main.rand.Next(3) == 0)
10889 {
10890 Main.player[i].AddBuff(24, 420);
10891 }
10892 if (type == 285 && !hostile)
10893 {
10894 if (Main.rand.Next(3) == 0)
10895 {
10896 Main.player[i].AddBuff(31, 180);
10897 }
10898 else
10899 {
10900 Main.player[i].AddBuff(31, 60);
10901 }
10902 }
10903 if (type == 96 || type == 101)
10904 {
10905 if (Main.rand.Next(6) == 0)
10906 {
10907 Main.player[i].AddBuff(39, 180);
10908 }
10909 else if (Main.rand.Next(4) == 0)
10910 {
10911 Main.player[i].AddBuff(39, 180);
10912 }
10913 else if (Main.rand.Next(2) == 0)
10914 {
10915 Main.player[i].AddBuff(39, 120);
10916 }
10917 }
10918 else if (type == 288)
10919 {
10920 Main.player[i].AddBuff(69, 900);
10921 }
10922 else if (type == 253 && !hostile)
10923 {
10924 Main.player[i].AddBuff(324, 600);
10925 }
10926 if (type == 291 || type == 292)
10927 {
10928 Main.player[i].AddBuff(24, 60 * Main.rand.Next(8, 16));
10929 }
10930 if (type == 98)
10931 {
10932 Main.player[i].AddBuff(20, 600);
10933 }
10934 if (type == 184)
10935 {
10936 Main.player[i].AddBuff(20, 900);
10937 }
10938 if (type == 980)
10939 {
10940 Main.player[i].AddBuff(70, 300);
10941 }
10942 if (type == 290)
10943 {
10944 Main.player[i].AddBuff(32, 60 * Main.rand.Next(5, 16));
10945 }
10946 if (type == 174)
10947 {
10948 Main.player[i].AddBuff(46, 1200);
10949 if (!Main.player[i].frozen && Main.rand.Next(20) == 0)
10950 {
10951 Main.player[i].AddBuff(47, 90);
10952 }
10953 else if (!Main.player[i].frozen && Main.expertMode && Main.rand.Next(20) == 0)
10954 {
10955 Main.player[i].AddBuff(47, 60);
10956 }
10957 }
10958 if (type == 257)
10959 {
10960 Main.player[i].AddBuff(46, 2700);
10961 if (!Main.player[i].frozen && Main.rand.Next(5) == 0)
10962 {
10963 Main.player[i].AddBuff(47, 60);
10964 }
10965 }
10966 if (type == 177)
10967 {
10968 Main.player[i].AddBuff(46, 1500);
10969 if (!Main.player[i].frozen && Main.rand.Next(10) == 0)
10970 {
10971 Main.player[i].AddBuff(47, Main.rand.Next(30, 120));
10972 }
10973 }
10974 if (type == 128 && Main.rand.Next(3) == 0)
10975 {
10976 Main.player[i].AddBuff(44, 360);
10977 }
10978 if (type == 176)
10979 {
10980 if (Main.rand.Next(4) == 0)
10981 {
10982 Main.player[i].AddBuff(20, 1200);
10983 }
10984 else if (Main.rand.Next(2) == 0)
10985 {
10986 Main.player[i].AddBuff(20, 300);
10987 }
10988 }
10989 }
10990
10992 {
10993 if (Distance(ent.Center) > ownerHitCheckDistance)
10994 {
10995 return false;
10996 }
10997 if (!Collision.CanHit(Main.player[owner].position, Main.player[owner].width, Main.player[owner].height, ent.position, ent.width, ent.height) && !Collision.CanHitLine(Main.player[owner].Center + new Vector2(Main.player[owner].direction * Main.player[owner].width / 2, Main.player[owner].gravDir * (float)(-Main.player[owner].height) / 3f), 0, 0, ent.Center + new Vector2(0f, -ent.height / 3), 0, 0) && !Collision.CanHitLine(Main.player[owner].Center + new Vector2(Main.player[owner].direction * Main.player[owner].width / 2, Main.player[owner].gravDir * (float)(-Main.player[owner].height) / 3f), 0, 0, ent.Center, 0, 0))
10998 {
10999 return Collision.CanHitLine(Main.player[owner].Center + new Vector2(Main.player[owner].direction * Main.player[owner].width / 2, 0f), 0, 0, ent.Center + new Vector2(0f, ent.height / 3), 0, 0);
11000 }
11001 return true;
11002 }
11003
11005 {
11006 if (Distance(ent.Center) > ownerHitCheckDistance)
11007 {
11008 return false;
11009 }
11010 bool flag = Collision.CanHit(base.position, width, height, ent.position, ent.width, ent.height) || Collision.CanHitLine(base.Center + new Vector2(direction * width / 2, -height / 3), 0, 0, ent.Center + new Vector2(0f, -ent.height / 3), 0, 0) || Collision.CanHitLine(base.Center + new Vector2(direction * width / 2, -height / 3), 0, 0, ent.Center, 0, 0) || Collision.CanHitLine(base.Center + new Vector2(direction * width / 2, 0f), 0, 0, ent.Center + new Vector2(0f, ent.height / 3), 0, 0);
11012 if (num != 0f)
11013 {
11014 if (flag)
11015 {
11016 return flag;
11017 }
11019 Vector2 position = base.Top + new Vector2(0f, 0f - num);
11020 Vector2 position2 = ent.Top + new Vector2(0f, 0f - num);
11021 if (genSearch != null)
11022 {
11024 {
11025 position = result.ToWorldCoordinates();
11026 }
11028 {
11029 position2 = result.ToWorldCoordinates();
11030 }
11031 }
11032 flag |= Collision.CanHitLine(position, 0, 0, position2, 0, 0);
11033 }
11034 return flag;
11035 }
11036
11037 public void Damage()
11038 {
11039 if (type == 18 || type == 72 || type == 86 || type == 87 || aiStyle == 31 || aiStyle == 32 || type == 226 || type == 378 || type == 613 || type == 650 || type == 882 || type == 888 || type == 895 || type == 896 || (type == 434 && localAI[0] != 0f) || type == 439 || type == 444 || (type == 451 && ((int)(ai[0] - 1f) / penetrate == 0 || ai[1] < 5f) && ai[0] != 0f) || type == 500 || type == 653 || type == 1018 || type == 460 || type == 633 || type == 600 || type == 601 || type == 602 || type == 535 || (type == 631 && localAI[1] == 0f) || (type == 537 && localAI[0] <= 30f) || type == 651 || (type == 188 && localAI[0] < 5f) || (aiStyle == 137 && ai[0] != 0f) || aiStyle == 138 || (type == 261 && velocity.Length() < 1.5f) || (type == 818 && ai[0] < 1f) || type == 831 || type == 970 || (type == 833 && ai[0] == 4f) || (type == 834 && ai[0] == 4f) || (type == 835 && ai[0] == 4f) || (type == 281 && ai[0] == -3f) || ((type == 598 || type == 636 || type == 614 || type == 971 || type == 975) && ai[0] == 1f) || (type == 923 && localAI[0] <= 60f) || (type == 919 && localAI[0] <= 60f) || (aiStyle == 15 && ai[0] == 0f && localAI[1] <= 12f) || type == 861 || (type >= 511 && type <= 513 && ai[1] >= 1f) || type == 1007 || (aiStyle == 93 && ai[0] != 0f && ai[0] != 2f) || (aiStyle == 10 && localAI[1] == -1f) || (type == 85 && localAI[0] >= 54f) || (Main.projPet[type] && type != 266 && type != 407 && type != 317 && (type != 388 || ai[0] != 2f) && (type < 390 || type > 392) && (type < 393 || type > 395) && (type != 533 || !(ai[0] >= 6f) || !(ai[0] <= 8f)) && (type < 625 || type > 628) && (type != 755 || ai[0] == 0f) && (type != 946 || ai[0] == 0f) && type != 758 && type != 951 && type != 963 && (type != 759 || frame == Main.projFrames[type] - 1) && type != 833 && type != 834 && type != 835 && type != 864 && (type != 623 || ai[0] != 2f)))
11040 {
11041 return;
11042 }
11044 if (friendly && Main.getGoodWorld && aiStyle == 16 && Main.netMode == 1 && owner != Main.myPlayer && !npcProj)
11045 {
11047 return;
11048 }
11049 if (friendly && owner == Main.myPlayer && !npcProj)
11050 {
11052 if (!minion)
11053 {
11054 CutTiles();
11055 }
11056 }
11057 if (owner == Main.myPlayer)
11058 {
11059 float num = 1f;
11061 {
11062 num *= 2f;
11063 }
11065 {
11066 num *= 3f;
11067 }
11068 if (type == 34 && penetrate == 1)
11069 {
11070 num *= 1f;
11071 }
11072 if (aiStyle == 15 && ai[0] == 0f)
11073 {
11074 num *= 1.2f;
11075 }
11076 if (aiStyle == 15 && (ai[0] == 1f || ai[0] == 2f))
11077 {
11078 num *= 2f;
11079 }
11080 if (type == 877 || type == 879 || type == 878)
11081 {
11082 num = 0.1f + Main.player[owner].velocity.Length() / 7f * 0.9f;
11083 }
11084 if (type == 968)
11085 {
11086 num = 1f;
11087 switch ((int)ai[1])
11088 {
11089 case 0:
11090 num = 1.5f;
11091 break;
11092 case 1:
11093 num = 1f;
11094 break;
11095 case 2:
11096 num = 1.5f;
11097 break;
11098 case 3:
11099 num = 0.1f;
11100 break;
11101 case 4:
11102 num = 1f;
11103 break;
11104 case 5:
11105 num = 1f;
11106 break;
11107 case 6:
11108 num = 1f;
11109 break;
11110 case 7:
11111 num = 0.25f;
11112 break;
11113 case 8:
11114 num = 1f;
11115 break;
11116 case 9:
11117 num = 0.75f;
11118 break;
11119 case 10:
11120 num = 0.5f;
11121 break;
11122 case 11:
11123 num = 0.5f;
11124 break;
11125 case 12:
11126 num = 0.5f;
11127 break;
11128 case 13:
11129 num = 0.5f;
11130 break;
11131 case 14:
11132 num = 0.5f;
11133 break;
11134 case 15:
11135 num = 0.5f;
11136 break;
11137 case 16:
11138 num = 0.5f;
11139 break;
11140 case 17:
11141 num = 1.5f;
11142 break;
11143 case 18:
11144 num = 1.6f;
11145 break;
11146 case 19:
11147 num = 1.8f;
11148 break;
11149 case 20:
11150 num = 1.9f;
11151 break;
11152 case 21:
11153 num = 1.7f;
11154 break;
11155 case 22:
11156 num = 2f;
11157 break;
11158 case 23:
11159 num = 1.9f;
11160 break;
11161 }
11162 }
11163 if (type == 533 && localAI[2] >= 40f)
11164 {
11165 num *= 0.5f;
11166 }
11167 bool flag = !npcProj && !trap;
11168 bool flag2 = usesOwnerMeleeHitCD && flag && owner < 255;
11169 bool flag3 = damage > 0;
11170 if (flag3)
11171 {
11172 int[] array = localNPCImmunity;
11173 if (type == 626 || type == 627 || type == 628)
11174 {
11176 if (projectile != null)
11177 {
11178 array = projectile.localNPCImmunity;
11179 }
11180 }
11181 bool flag4 = true;
11182 for (int i = 0; i < 200 && flag4; i++)
11183 {
11184 if (!Main.npc[i].active)
11185 {
11186 continue;
11187 }
11189 if (flag2 && !Main.player[owner].CanHitNPCWithMeleeHit(i))
11190 {
11191 flag5 = false;
11192 }
11193 if (!((!Main.npc[i].dontTakeDamage || NPCID.Sets.ZappingJellyfish[Main.npc[i].type]) && flag5) || (Main.npc[i].aiStyle == 112 && Main.npc[i].ai[2] > 1f))
11194 {
11195 continue;
11196 }
11197 Main.npc[i].position += Main.npc[i].netOffset;
11198 bool flag6 = !Main.npc[i].friendly;
11199 flag6 |= type == 318;
11200 flag6 |= Main.npc[i].type == 22 && owner < 255 && Main.player[owner].killGuide;
11201 flag6 |= Main.npc[i].type == 54 && owner < 255 && Main.player[owner].killClothier;
11202 if (owner < 255 && !Main.player[owner].CanNPCBeHitByPlayerOrPlayerProjectile(Main.npc[i], this))
11203 {
11204 flag6 = false;
11205 }
11206 bool flag7 = Main.npc[i].friendly && !Main.npc[i].dontTakeDamageFromHostiles;
11207 if ((friendly && (flag6 || NPCID.Sets.ZappingJellyfish[Main.npc[i].type])) || (hostile && flag7))
11208 {
11210 if (owner < 0 || Main.npc[i].immune[owner] == 0 || flag8)
11211 {
11212 bool flag9 = false;
11213 if (type == 11 && (Main.npc[i].type == 47 || Main.npc[i].type == 57))
11214 {
11215 flag9 = true;
11216 }
11217 else if (type == 31 && Main.npc[i].type == 69)
11218 {
11219 flag9 = true;
11220 }
11221 else if (Main.npc[i].trapImmune && trap)
11222 {
11223 flag9 = true;
11224 }
11225 else if (Main.npc[i].immortal && npcProj)
11226 {
11227 flag9 = true;
11228 }
11229 if (!flag9 && (Main.npc[i].noTileCollide || !ownerHitCheck || CanHitWithMeleeWeapon(Main.npc[i])))
11230 {
11231 bool flag10 = false;
11232 if (Main.npc[i].type == 414)
11233 {
11234 Rectangle rect = Main.npc[i].getRect();
11235 int num2 = 8;
11236 rect.X -= num2;
11237 rect.Y -= num2;
11238 rect.Width += num2 * 2;
11239 rect.Height += num2 * 2;
11241 }
11242 else
11243 {
11244 flag10 = Colliding(rectangle, Main.npc[i].getRect());
11245 }
11246 if (flag10)
11247 {
11248 NPC nPC = Main.npc[i];
11249 if (NPCID.Sets.ZappingJellyfish[nPC.type])
11250 {
11251 if ((nPC.dontTakeDamage || !Main.player[owner].CanNPCBeHitByPlayerOrPlayerProjectile(nPC, this)) && (aiStyle == 19 || aiStyle == 161 || aiStyle == 75 || aiStyle == 140 || ProjectileID.Sets.IsAWhip[type] || ProjectileID.Sets.AllowsContactDamageFromJellyfish[type]))
11252 {
11253 Main.player[owner].TakeDamageFromJellyfish(i);
11254 }
11255 if (nPC.dontTakeDamage || !flag6)
11256 {
11257 continue;
11258 }
11259 }
11260 if (type == 876)
11261 {
11263 if (Main.rand.Next(20) == 0)
11264 {
11265 tileCollide = false;
11266 position.X += Main.rand.Next(-256, 257);
11267 }
11268 if (Main.rand.Next(20) == 0)
11269 {
11270 tileCollide = false;
11271 position.Y += Main.rand.Next(-256, 257);
11272 }
11273 if (Main.rand.Next(2) == 0)
11274 {
11275 tileCollide = false;
11276 }
11277 if (Main.rand.Next(3) != 0)
11278 {
11279 vector = position;
11280 position -= velocity * Main.rand.Next(0, 40);
11282 {
11283 position = vector;
11284 position -= velocity * Main.rand.Next(0, 40);
11286 {
11287 position = vector;
11288 }
11289 }
11290 }
11291 velocity *= 0.6f;
11292 if (Main.rand.Next(7) == 0)
11293 {
11294 velocity.X += (float)Main.rand.Next(30, 31) * 0.01f;
11295 }
11296 if (Main.rand.Next(7) == 0)
11297 {
11298 velocity.Y += (float)Main.rand.Next(30, 31) * 0.01f;
11299 }
11300 damage = (int)((double)damage * 0.9);
11301 knockBack *= 0.9f;
11302 if (Main.rand.Next(20) == 0)
11303 {
11304 knockBack *= 10f;
11305 }
11306 if (Main.rand.Next(50) == 0)
11307 {
11308 damage *= 10;
11309 }
11310 if (Main.rand.Next(7) == 0)
11311 {
11312 vector = position;
11313 position.X += Main.rand.Next(-64, 65);
11315 {
11316 position = vector;
11317 }
11318 }
11319 if (Main.rand.Next(7) == 0)
11320 {
11321 vector = position;
11322 position.Y += Main.rand.Next(-64, 65);
11324 {
11325 position = vector;
11326 }
11327 }
11328 if (Main.rand.Next(14) == 0)
11329 {
11330 velocity.X *= -1f;
11331 }
11332 if (Main.rand.Next(14) == 0)
11333 {
11334 velocity.Y *= -1f;
11335 }
11336 if (Main.rand.Next(10) == 0)
11337 {
11338 velocity *= (float)Main.rand.Next(1, 201) * 0.0005f;
11339 }
11340 if (tileCollide)
11341 {
11342 ai[1] = 0f;
11343 }
11344 else
11345 {
11346 ai[1] = 1f;
11347 }
11348 netUpdate = true;
11349 }
11350 bool flag11 = nPC.reflectsProjectiles;
11351 if (Main.getGoodWorld && NPCID.Sets.ReflectStarShotsInForTheWorthy[Main.npc[i].type] && (type == 955 || type == 728))
11352 {
11353 flag11 = true;
11354 }
11355 if (flag11 && CanBeReflected() && nPC.CanReflectProjectile(this))
11356 {
11357 nPC.ReflectProjectile(this);
11358 Main.npc[i].position -= Main.npc[i].netOffset;
11359 return;
11360 }
11361 if (type == 604)
11362 {
11363 Main.player[owner].Counterweight(nPC.Center, damage, knockBack);
11364 }
11365 float num3 = knockBack;
11366 bool flag12 = false;
11367 int num4 = Main.player[owner].armorPenetration;
11368 float armorPenetrationPercent = 0f;
11369 bool flag13 = false;
11370 switch (type)
11371 {
11372 case 442:
11373 flag13 = true;
11374 break;
11375 case 410:
11376 if (Main.remixWorld)
11377 {
11378 num4 += 20;
11379 }
11380 break;
11381 case 864:
11382 num4 += 25;
11383 break;
11384 case 916:
11385 num4 += 50;
11386 break;
11387 case 917:
11388 num4 += 30;
11389 break;
11390 case 595:
11391 num4 += 20;
11392 break;
11393 case 493:
11394 case 494:
11395 num4 += 10;
11396 break;
11397 case 150:
11398 case 151:
11399 case 152:
11400 num4 += 10;
11401 break;
11402 case 189:
11403 num4 += 10;
11404 if (flag && Main.player[owner].strongBees)
11405 {
11406 num4 += 5;
11407 }
11408 break;
11409 case 723:
11410 case 724:
11411 case 725:
11412 case 726:
11413 num4 += 25;
11414 break;
11415 case 532:
11416 num4 += 25;
11417 break;
11418 case 964:
11419 num4 += 20;
11420 break;
11421 case 969:
11422 num4 += 10;
11423 break;
11424 case 85:
11425 num4 += 15;
11426 break;
11427 case 877:
11428 case 878:
11429 case 879:
11430 num3 *= Main.player[owner].velocity.Length() / 7f;
11431 break;
11432 case 963:
11433 num3 *= 0.25f;
11434 break;
11435 case 976:
11436 num4 += 20;
11437 break;
11438 case 974:
11439 num4 += 5;
11440 break;
11441 case 977:
11442 num4 += 5;
11443 break;
11444 }
11445 if (flag13)
11446 {
11447 Kill();
11448 return;
11449 }
11450 int num5 = (int)((float)damage * num);
11451 int num6 = 0;
11453 {
11454 float value = (scale - 1f) * 100f;
11455 value = Utils.Clamp(value, 0f, 50f);
11456 num5 = (int)((float)num5 * (1f + value * 0.23f));
11457 }
11459 {
11460 int num7 = Math.Max(0, Main.player[owner].ownedProjectileCounts[831] - 1);
11461 num5 = (int)((float)num5 * (1f + (float)num7 * 0.4f));
11462 }
11463 if (type == 818)
11464 {
11465 int num8 = Math.Max(0, Main.player[owner].ownedProjectileCounts[831] - 1);
11466 num5 = (int)((float)num5 * (1.5f + (float)num8 * 0.4f));
11467 }
11468 if (type == 963)
11469 {
11470 int num9 = Math.Max(0, Main.player[owner].ownedProjectileCounts[970] - 1);
11471 int num10 = 3 + num9 / 2;
11473 {
11474 return;
11475 }
11476 float num11 = 0.55f;
11477 if (Main.hardMode)
11478 {
11479 num11 = 1.3f;
11480 }
11481 num5 = (int)((float)num5 * (1f + (float)num9 * num11));
11482 }
11483 if (flag && type == 189 && Main.player[owner].strongBees)
11484 {
11485 num5 += 5;
11486 }
11487 if (flag)
11488 {
11489 if (melee && Main.rand.Next(1, 101) <= Main.player[owner].meleeCrit)
11490 {
11491 flag12 = true;
11492 }
11493 if (ranged && Main.rand.Next(1, 101) <= Main.player[owner].rangedCrit)
11494 {
11495 flag12 = true;
11496 }
11497 if (magic && Main.rand.Next(1, 101) <= Main.player[owner].magicCrit)
11498 {
11499 flag12 = true;
11500 }
11501 int num12 = type;
11502 if ((uint)(num12 - 688) <= 2u)
11503 {
11504 if (Main.player[owner].setMonkT3)
11505 {
11506 if (Main.rand.Next(4) == 0)
11507 {
11508 flag12 = true;
11509 }
11510 }
11511 else if (Main.player[owner].setMonkT2 && Main.rand.Next(6) == 0)
11512 {
11513 flag12 = true;
11514 }
11515 }
11516 }
11517 float num13 = 1f;
11518 if (type == 864)
11519 {
11520 num13 = 0.75f;
11521 }
11522 if (type == 688 || type == 689 || type == 690)
11523 {
11524 num13 /= 2f;
11525 }
11527 {
11528 bool flag14 = false;
11529 bool flag15 = false;
11530 bool flag16 = false;
11531 bool flag17 = false;
11532 bool flag18 = false;
11533 bool flag19 = false;
11534 bool flag20 = false;
11535 bool flag21 = false;
11536 bool flag22 = false;
11537 for (int j = 0; j < NPC.maxBuffs; j++)
11538 {
11539 if (nPC.buffTime[j] >= 1)
11540 {
11541 switch (nPC.buffType[j])
11542 {
11543 case 307:
11544 flag14 = true;
11545 break;
11546 case 309:
11547 flag15 = true;
11548 break;
11549 case 313:
11550 flag16 = true;
11551 break;
11552 case 310:
11553 flag17 = true;
11554 break;
11555 case 315:
11556 flag18 = true;
11557 break;
11558 case 326:
11559 flag19 = true;
11560 break;
11561 case 319:
11562 flag21 = true;
11563 break;
11564 case 316:
11565 flag22 = true;
11566 break;
11567 case 340:
11568 flag20 = true;
11569 break;
11570 }
11571 }
11572 }
11573 if (flag14)
11574 {
11575 num6 += 4;
11576 }
11577 if (flag18)
11578 {
11579 num6 += 6;
11580 }
11581 if (flag19)
11582 {
11583 num6 += 7;
11584 }
11585 if (flag20)
11586 {
11587 num6 += 6;
11588 }
11589 if (flag15)
11590 {
11591 num6 += 9;
11592 }
11593 if (flag21)
11594 {
11595 num6 += 8;
11596 if (Main.rand.Next(100) < 12)
11597 {
11598 flag12 = true;
11599 }
11600 }
11601 if (flag17)
11602 {
11603 int num14 = 10;
11604 num6 += num14;
11605 int num15 = NewProjectile(GetProjectileSource_FromThis(), nPC.Center, Vector2.Zero, 916, (int)((float)num14 * num13), 0f, owner);
11606 Main.projectile[num15].localNPCImmunity[i] = -1;
11608 }
11609 if (flag22)
11610 {
11611 int num16 = 20;
11612 num6 += num16;
11613 if (Main.rand.Next(10) == 0)
11614 {
11615 flag12 = true;
11616 }
11618 {
11619 PositionInWorld = base.Center
11620 });
11621 }
11622 if (flag16)
11623 {
11624 nPC.RequestBuffRemoval(313);
11625 int num17 = (int)((float)num5 * 1.75f);
11627 Main.projectile[num18].localNPCImmunity[i] = -1;
11628 num6 += num17;
11629 }
11630 }
11631 num6 = (int)((float)num6 * num13);
11632 num5 += num6;
11633 int num19 = ((!flag) ? Main.DamageVar(num5) : Main.DamageVar(num5, Main.player[owner].luck));
11634 if (type == 1002)
11635 {
11636 num19 /= 2;
11637 }
11639 {
11640 num19 /= 2;
11641 }
11642 if (type == 482 && (nPC.aiStyle == 6 || nPC.aiStyle == 37))
11643 {
11644 num19 /= 2;
11645 }
11646 if (flag)
11647 {
11648 Vector2 positionInWorld = Main.rand.NextVector2FromRectangle(nPC.Hitbox);
11650 particleOrchestraSettings.PositionInWorld = positionInWorld;
11652 switch (type)
11653 {
11654 case 972:
11656 break;
11657 case 973:
11659 break;
11660 case 984:
11661 case 985:
11662 settings.MovementVector = velocity;
11664 break;
11665 case 982:
11667 break;
11668 case 983:
11670 break;
11671 }
11672 }
11673 if (type == 604)
11674 {
11675 friendly = false;
11676 ai[1] = 1000f;
11677 }
11678 if ((type == 400 || type == 401 || type == 402) && nPC.type >= 13 && nPC.type <= 15)
11679 {
11680 num19 = (int)((double)num19 * 0.65);
11681 if (penetrate > 1)
11682 {
11683 penetrate--;
11684 }
11685 }
11686 if (type == 710 && !WorldUtils.Find(base.Center.ToTileCoordinates(), Searches.Chain(new Searches.Down(12), _cachedConditions_notNull, _cachedConditions_solid), out var _))
11687 {
11688 num19 = (int)((float)num19 * 1.5f);
11689 }
11690 if (type == 504 || type == 954 || type == 979)
11691 {
11692 float num20 = (60f - ai[0]) / 2f;
11693 ai[0] += num20;
11694 }
11695 if (aiStyle == 3 && type != 301 && type != 866 && type != 902)
11696 {
11697 if (ai[0] == 0f)
11698 {
11699 if (type == 106)
11700 {
11701 LightDisc_Bounce(base.Center + velocity.SafeNormalize(Vector2.UnitX) * 8f, (-velocity).SafeNormalize(Vector2.UnitX));
11702 }
11703 velocity.X = 0f - velocity.X;
11704 velocity.Y = 0f - velocity.Y;
11705 netUpdate = true;
11706 }
11707 ai[0] = 1f;
11708 }
11709 else if (type == 951)
11710 {
11711 Vector2 vector2 = (nPC.Center - base.Center).SafeNormalize(Vector2.Zero);
11712 vector2.X += (-0.5f + Main.rand.NextFloat()) * 13f;
11713 vector2.Y = -5f;
11714 velocity.X = vector2.X;
11715 velocity.Y = vector2.Y;
11716 netUpdate = true;
11717 }
11718 else if (type == 582 || type == 902)
11719 {
11720 if (ai[0] != 0f)
11721 {
11722 direction *= -1;
11723 }
11724 }
11725 else if (type == 612 || type == 953 || type == 978)
11726 {
11727 direction = Main.player[owner].direction;
11728 }
11729 else if (type == 624)
11730 {
11731 float num21 = 1f;
11732 if (nPC.knockBackResist > 0f)
11733 {
11734 num21 = 1f / nPC.knockBackResist;
11735 }
11736 knockBack = 4f * num21;
11737 num3 = knockBack;
11738 if (nPC.Center.X < base.Center.X)
11739 {
11740 direction = 1;
11741 }
11742 else
11743 {
11744 direction = -1;
11745 }
11746 }
11747 else if (aiStyle == 16)
11748 {
11749 if (timeLeft > 3)
11750 {
11751 timeLeft = 3;
11752 }
11753 if (nPC.position.X + (float)(nPC.width / 2) < position.X + (float)(width / 2))
11754 {
11755 direction = -1;
11756 }
11757 else
11758 {
11759 direction = 1;
11760 }
11761 }
11762 else if (aiStyle == 68)
11763 {
11764 if (timeLeft > 3)
11765 {
11766 timeLeft = 3;
11767 }
11768 if (nPC.position.X + (float)(nPC.width / 2) < position.X + (float)(width / 2))
11769 {
11770 direction = -1;
11771 }
11772 else
11773 {
11774 direction = 1;
11775 }
11776 }
11777 else if (aiStyle == 50)
11778 {
11779 if (nPC.position.X + (float)(nPC.width / 2) < position.X + (float)(width / 2))
11780 {
11781 direction = -1;
11782 }
11783 else
11784 {
11785 direction = 1;
11786 }
11787 }
11788 else if (type == 908)
11789 {
11790 if (nPC.position.X + (float)(nPC.width / 2) < position.X + (float)(width / 2))
11791 {
11792 direction = -1;
11793 }
11794 else
11795 {
11796 direction = 1;
11797 }
11798 }
11799 if (type == 509)
11800 {
11801 int num22 = Main.rand.Next(2, 6);
11802 for (int k = 0; k < num22; k++)
11803 {
11804 Vector2 vector3 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101));
11805 vector3 += velocity * 3f;
11806 vector3.Normalize();
11807 vector3 *= (float)Main.rand.Next(35, 81) * 0.1f;
11808 int num23 = (int)((double)damage * 0.5);
11809 NewProjectile(GetProjectileSource_FromThis(), base.Center.X, base.Center.Y, vector3.X, vector3.Y, 504, num23, knockBack * 0.2f, owner);
11810 }
11811 }
11812 if ((type == 476 || type == 950) && !npcProj)
11813 {
11814 float x = Main.player[owner].Center.X;
11815 if (nPC.Center.X < x)
11816 {
11817 direction = -1;
11818 }
11819 else
11820 {
11821 direction = 1;
11822 }
11823 }
11824 if (type == 598 || type == 636 || type == 614 || type == 971 || type == 975)
11825 {
11826 ai[0] = 1f;
11827 ai[1] = i;
11828 velocity = (nPC.Center - base.Center) * 0.75f;
11829 netUpdate = true;
11830 }
11831 if (type >= 511 && type <= 513)
11832 {
11833 ai[1] += 1f;
11834 netUpdate = true;
11835 }
11836 if (type == 659)
11837 {
11838 timeLeft = 0;
11839 }
11840 if (type == 524)
11841 {
11842 netUpdate = true;
11843 ai[0] += 50f;
11844 }
11845 if ((type == 688 || type == 689 || type == 690) && nPC.type != 68 && nPC.defense < 999)
11846 {
11848 }
11849 if (aiStyle == 39)
11850 {
11851 if (ai[1] == 0f)
11852 {
11853 ai[1] = i + 1;
11854 netUpdate = true;
11855 }
11856 if (Main.player[owner].position.X + (float)(Main.player[owner].width / 2) < position.X + (float)(width / 2))
11857 {
11858 direction = 1;
11859 }
11860 else
11861 {
11862 direction = -1;
11863 }
11864 }
11865 if (type == 41 && timeLeft > 1)
11866 {
11867 timeLeft = 1;
11868 }
11869 if (aiStyle == 99)
11870 {
11871 Main.player[owner].Counterweight(nPC.Center, damage, knockBack);
11872 if (nPC.Center.X < Main.player[owner].Center.X)
11873 {
11874 direction = -1;
11875 }
11876 else
11877 {
11878 direction = 1;
11879 }
11880 if (ai[0] >= 0f)
11881 {
11882 Vector2 vector4 = base.Center - nPC.Center;
11883 vector4.Normalize();
11884 float num24 = 16f;
11885 velocity *= -0.5f;
11886 velocity += vector4 * num24;
11887 netUpdate = true;
11888 localAI[0] += 20f;
11889 if (!Collision.CanHit(position, width, height, Main.player[owner].position, Main.player[owner].width, Main.player[owner].height))
11890 {
11891 localAI[0] += 40f;
11892 num19 = (int)((double)num19 * 0.75);
11893 }
11894 }
11895 }
11896 if (type == 856 && !Collision.CanHit(position, width, height, Main.player[owner].position, Main.player[owner].width, Main.player[owner].height))
11897 {
11898 num19 = (int)((double)num19 * 0.75);
11899 }
11900 if (aiStyle == 93)
11901 {
11902 if (ai[0] == 0f)
11903 {
11904 ai[1] = 0f;
11905 int num25 = -i - 1;
11906 ai[0] = num25;
11907 velocity = nPC.Center - base.Center;
11908 }
11909 num19 = ((ai[0] != 2f) ? ((int)((double)num19 * 0.15)) : ((int)((double)num19 * 1.35)));
11910 }
11911 if (flag)
11912 {
11913 int num26 = Item.NPCtoBanner(nPC.BannerID());
11914 if (num26 >= 0)
11915 {
11916 Main.player[Main.myPlayer].lastCreatureHit = num26;
11917 }
11918 }
11919 if (Main.netMode != 2 && flag)
11920 {
11921 int num27 = Item.NPCtoBanner(nPC.BannerID());
11922 if (num27 > 0 && Main.player[owner].HasNPCBannerBuff(num27))
11923 {
11924 num19 = ((!Main.expertMode) ? ((int)((float)num19 * ItemID.Sets.BannerStrength[Item.BannerToItem(num27)].NormalDamageDealt)) : ((int)((float)num19 * ItemID.Sets.BannerStrength[Item.BannerToItem(num27)].ExpertDamageDealt)));
11925 }
11926 }
11927 if (Main.expertMode)
11928 {
11929 if ((type == 30 || type == 397 || type == 517 || type == 28 || type == 37 || type == 516 || type == 29 || type == 470 || type == 637 || type == 108 || type == 281 || type == 588 || type == 519 || type == 773 || type == 183 || type == 181 || type == 566 || type == 1002) && nPC.type >= 13 && nPC.type <= 15)
11930 {
11931 num19 /= 5;
11932 }
11933 if (type == 280 && ((nPC.type >= 134 && nPC.type <= 136) || nPC.type == 139))
11934 {
11935 num19 = (int)((double)num19 * 0.75);
11936 }
11937 }
11938 if (Main.netMode != 2 && nPC.type == 439 && type >= 0 && type <= ProjectileID.Count && ProjectileID.Sets.CultistIsResistantTo[type])
11939 {
11940 num19 = (int)((float)num19 * 0.75f);
11941 }
11942 if (type == 497 && penetrate != 1)
11943 {
11944 ai[0] = 25f;
11945 float num28 = velocity.Length();
11946 Vector2 vector5 = nPC.Center - base.Center;
11947 vector5.Normalize();
11948 vector5 *= num28;
11949 velocity = -vector5 * 0.9f;
11950 netUpdate = true;
11951 }
11952 if (type == 323 && (nPC.type == 159 || nPC.type == 158))
11953 {
11954 num19 *= 10;
11955 }
11956 if (type == 981 && nPC.type == 104)
11957 {
11958 num19 *= 3;
11959 }
11960 if (type == 294)
11961 {
11962 damage = (int)((double)damage * 0.9);
11963 }
11964 if (type == 265)
11965 {
11966 damage = (int)((double)damage * 0.75);
11967 }
11968 if (type == 355)
11969 {
11970 damage = (int)((double)damage * 0.75);
11971 }
11972 if (type == 114)
11973 {
11974 damage = (int)((double)damage * 0.9);
11975 }
11976 if (type == 76 || type == 78 || type == 77)
11977 {
11978 damage = (int)((double)damage * 0.95);
11979 }
11980 if (type == 85)
11981 {
11982 damage = (int)((double)damage * 0.85);
11983 }
11984 if (type == 866)
11985 {
11986 damage = (int)((double)damage * 0.8);
11987 }
11988 if (type == 841)
11989 {
11990 damage = (int)((double)damage * 0.5);
11991 }
11992 if (type == 914)
11993 {
11994 damage = (int)((double)damage * 0.6);
11995 }
11996 if (type == 952)
11997 {
11998 damage = (int)((double)damage * 0.9);
11999 }
12000 if (type == 913)
12001 {
12002 damage = (int)((double)damage * 0.66);
12003 }
12004 if (type == 912)
12005 {
12006 damage = (int)((double)damage * 0.7);
12007 }
12008 if (type == 847)
12009 {
12010 damage = (int)((double)damage * 0.8);
12011 }
12012 if (type == 848)
12013 {
12014 damage = (int)((double)damage * 0.95);
12015 }
12016 if (type == 849)
12017 {
12018 damage = (int)((double)damage * 0.9);
12019 }
12020 if (type == 915)
12021 {
12022 damage = (int)((double)damage * 0.9);
12023 }
12024 if (type == 931)
12025 {
12026 damage = (int)((double)damage * 0.8);
12027 }
12028 if (type == 242)
12029 {
12030 damage = (int)((double)damage * 0.85);
12031 }
12032 if (type == 323)
12033 {
12034 damage = (int)((double)damage * 0.9);
12035 }
12036 if (type == 5)
12037 {
12038 damage = (int)((double)damage * 0.9);
12039 }
12040 if (type == 4)
12041 {
12042 damage = (int)((double)damage * 0.95);
12043 }
12044 if (type == 309)
12045 {
12046 damage = (int)((double)damage * 0.85);
12047 }
12048 if (type == 132)
12049 {
12050 damage = (int)((double)damage * 0.85);
12051 }
12052 if (type == 985)
12053 {
12054 damage = (int)((double)damage * 0.75);
12055 }
12056 if (type == 950)
12057 {
12058 damage = (int)((double)damage * 0.98);
12059 }
12060 if (type == 964)
12061 {
12062 damage = (int)((double)damage * 0.85);
12063 }
12064 if (type == 477 && penetrate > 1)
12065 {
12066 int[] array2 = new int[10];
12067 int num29 = 0;
12068 int num30 = 700;
12069 int num31 = 20;
12070 for (int l = 0; l < 200; l++)
12071 {
12072 if (l == i || !Main.npc[l].CanBeChasedBy(this))
12073 {
12074 continue;
12075 }
12076 float num32 = (base.Center - Main.npc[l].Center).Length();
12077 if (num32 > (float)num31 && num32 < (float)num30 && Collision.CanHitLine(base.Center, 1, 1, Main.npc[l].Center, 1, 1))
12078 {
12079 array2[num29] = l;
12080 num29++;
12081 if (num29 >= 9)
12082 {
12083 break;
12084 }
12085 }
12086 }
12087 if (num29 > 0)
12088 {
12089 num29 = Main.rand.Next(num29);
12090 Vector2 vector6 = Main.npc[array2[num29]].Center - base.Center;
12091 float num33 = velocity.Length();
12092 vector6.Normalize();
12094 netUpdate = true;
12095 }
12096 }
12097 if (type == 261 && velocity.Length() < 3.5f)
12098 {
12099 num19 /= 2;
12100 num3 /= 2f;
12101 }
12102 if (flag && melee && Main.player[owner].parryDamageBuff && !ProjectileID.Sets.DontApplyParryDamageBuff[type])
12103 {
12104 num19 *= 5;
12105 Main.player[owner].parryDamageBuff = false;
12106 Main.player[owner].ClearBuff(198);
12107 }
12108 StatusNPC(i);
12109 if (flag && nPC.life > 5)
12110 {
12112 }
12114 {
12115 nPC.UpdateNPC_BuffSetFlags(lowerBuffTime: false);
12116 }
12117 if (type == 317)
12118 {
12119 ai[1] = -1f;
12120 netUpdate = true;
12121 }
12122 int num34 = direction;
12123 switch (type)
12124 {
12125 case 697:
12126 case 699:
12127 case 707:
12128 case 708:
12129 case 759:
12130 num34 = ((Main.player[owner].Center.X < nPC.Center.X) ? 1 : (-1));
12131 break;
12132 }
12133 if (aiStyle == 188 || aiStyle == 189 || aiStyle == 190 || aiStyle == 191)
12134 {
12135 num34 = ((Main.player[owner].Center.X < nPC.Center.X) ? 1 : (-1));
12136 }
12137 if (aiStyle == 15)
12138 {
12139 num34 = ((Main.player[owner].Center.X < nPC.Center.X) ? 1 : (-1));
12140 if (ai[0] == 0f)
12141 {
12142 num3 *= 0.35f;
12143 }
12144 if (ai[0] == 6f)
12145 {
12146 num3 *= 0.5f;
12147 }
12148 }
12149 if (flag && !hostile)
12150 {
12151 num19 += nPC.checkArmorPenetration(num4, armorPenetrationPercent);
12152 }
12154 int num35 = ((!flag) ? ((int)nPC.StrikeNPCNoInteraction(num19, num3, num34, flag12)) : ((int)nPC.StrikeNPC(num19, num3, num34, flag12)));
12155 if (flag && attempt.DidNPCDie())
12156 {
12157 Main.player[owner].OnKillNPC(ref attempt, this);
12158 }
12159 if (flag && Main.player[owner].accDreamCatcher)
12160 {
12161 Main.player[owner].addDPS(num35);
12162 }
12163 bool flag23 = !nPC.immortal;
12164 bool flag24 = num35 > 0 && nPC.lifeMax > 5 && friendly && !hostile && aiStyle != 59;
12165 bool flag25 = false;
12166 if (flag23 && active && timeLeft > 10 && nPC.active && nPC.type == 676 && CanBeReflected())
12167 {
12168 nPC.ReflectProjectile(this);
12169 penetrate++;
12170 }
12171 if (flag && flag23)
12172 {
12173 if (type == 997 && (!nPC.immortal || flag25) && !nPC.SpawnedFromStatue && !NPCID.Sets.CountsAsCritter[nPC.type])
12174 {
12175 Main.player[owner].HorsemansBlade_SpawnPumpkin(i, (int)((float)damage * 1f), knockBack);
12176 }
12177 if (type == 756 && penetrate == 1)
12178 {
12179 damage = 0;
12180 penetrate = -1;
12181 flag4 = false;
12182 }
12183 if ((flag25 || nPC.value > 0f) && Main.player[owner].hasLuckyCoin && Main.rand.Next(5) == 0)
12184 {
12185 int num36 = 71;
12186 if (Main.rand.Next(10) == 0)
12187 {
12188 num36 = 72;
12189 }
12190 if (Main.rand.Next(100) == 0)
12191 {
12192 num36 = 73;
12193 }
12194 int num37 = Item.NewItem(GetItemSource_OnHit(nPC, 2), (int)nPC.position.X, (int)nPC.position.Y, nPC.width, nPC.height, num36);
12195 Main.item[num37].stack = Main.rand.Next(1, 11);
12196 Main.item[num37].velocity.Y = (float)Main.rand.Next(-20, 1) * 0.2f;
12197 Main.item[num37].velocity.X = (float)Main.rand.Next(10, 31) * 0.2f * (float)num34;
12198 Main.item[num37].timeLeftInWhichTheItemCannotBeTakenByEnemies = 60;
12199 if (Main.netMode == 1)
12200 {
12201 NetMessage.SendData(148, -1, -1, null, num37);
12202 }
12203 }
12204 if (type == 999 && owner == Main.myPlayer && Main.rand.Next(3) == 0)
12205 {
12206 Player player = Main.player[owner];
12207 Vector2 vector7 = (base.Center - nPC.Center).SafeNormalize(Vector2.Zero) * 0.25f;
12208 int dmg = damage / 2;
12209 float kB = knockBack;
12210 int num38 = NewProjectile(GetProjectileSource_FromThis(), base.Center.X, base.Center.Y, vector7.X, vector7.Y, player.beeType(), player.beeDamage(dmg), player.beeKB(kB), owner);
12211 Main.projectile[num38].melee = true;
12212 }
12213 if (flag24)
12214 {
12215 if (type == 304 && !Main.player[owner].moonLeech)
12216 {
12217 vampireHeal(num35, new Vector2(nPC.Center.X, nPC.Center.Y), nPC);
12218 }
12219 if (nPC.canGhostHeal || flag25)
12220 {
12221 if (Main.player[owner].ghostHeal && !Main.player[owner].moonLeech)
12222 {
12223 ghostHeal(num35, new Vector2(nPC.Center.X, nPC.Center.Y), nPC);
12224 }
12225 if (Main.player[owner].ghostHurt)
12226 {
12227 ghostHurt(num35, new Vector2(nPC.Center.X, nPC.Center.Y), nPC);
12228 }
12229 if (magic && Main.player[owner].setNebula && Main.player[owner].nebulaCD == 0 && Main.rand.Next(3) == 0)
12230 {
12231 Main.player[owner].nebulaCD = 30;
12232 int num39 = Utils.SelectRandom<int>(Main.rand, 3453, 3454, 3455);
12233 int num40 = Item.NewItem(GetItemSource_OnHit(nPC, 1), (int)nPC.position.X, (int)nPC.position.Y, nPC.width, nPC.height, num39);
12234 Main.item[num40].velocity.Y = (float)Main.rand.Next(-20, 1) * 0.2f;
12235 Main.item[num40].velocity.X = (float)Main.rand.Next(10, 31) * 0.2f * (float)num34;
12236 if (Main.netMode == 1)
12237 {
12238 NetMessage.SendData(21, -1, -1, null, num40);
12239 }
12240 }
12241 }
12242 if (melee && Main.player[owner].beetleOffense && (!nPC.immortal || flag25))
12243 {
12244 if (Main.player[owner].beetleOrbs == 0)
12245 {
12246 Main.player[owner].beetleCounter += num35 * 3;
12247 }
12248 else if (Main.player[owner].beetleOrbs == 1)
12249 {
12250 Main.player[owner].beetleCounter += num35 * 2;
12251 }
12252 else
12253 {
12254 Main.player[owner].beetleCounter += num35;
12255 }
12256 Main.player[owner].beetleCountdown = 0;
12257 }
12258 if (arrow && type != 631 && Main.player[owner].phantasmTime > 0)
12259 {
12260 Vector2 source = Main.player[owner].position + Main.player[owner].Size * Utils.RandomVector2(Main.rand, 0f, 1f);
12261 Vector2 vector8 = nPC.DirectionFrom(source) * 6f;
12262 int num41 = (int)((float)damage * 0.3f);
12266 }
12268 switch (type)
12269 {
12270 case 914:
12271 player2.AddBuff(314, 180);
12272 break;
12273 case 847:
12274 player2.AddBuff(308, 180);
12275 break;
12276 case 849:
12277 player2.AddBuff(311, 180);
12278 break;
12279 case 912:
12280 {
12281 int num42 = 15;
12282 if (!player2.coolWhipBuff)
12283 {
12285 player2.coolWhipBuff = true;
12286 }
12287 player2.AddBuff(312, 180);
12288 break;
12289 }
12290 }
12291 }
12292 }
12293 if (flag && (melee || ProjectileID.Sets.IsAWhip[type]) && Main.player[owner].meleeEnchant == 7)
12294 {
12295 NewProjectile(GetProjectileSource_FromThis(), nPC.Center.X, nPC.Center.Y, nPC.velocity.X, nPC.velocity.Y, 289, 0, 0f, owner);
12296 }
12297 if (flag && type == 913)
12298 {
12299 localAI[0] = 1f;
12300 }
12301 if (Main.netMode != 0)
12302 {
12303 if (flag12)
12304 {
12305 NetMessage.SendData(28, -1, -1, null, i, num19, num3, num34, 1);
12306 }
12307 else
12308 {
12309 NetMessage.SendData(28, -1, -1, null, i, num19, num3, num34);
12310 }
12311 }
12312 if (type == 916)
12313 {
12315 }
12316 if (type >= 390 && type <= 392)
12317 {
12318 localAI[1] = 20f;
12319 }
12321 {
12323 {
12324 nPC.immune[owner] = 0;
12325 perIDStaticNPCImmunity[type][i] = Main.GameUpdateCount + (uint)idStaticNPCHitCooldown;
12326 }
12327 }
12328 else if (type == 434)
12329 {
12330 numUpdates = 0;
12331 }
12332 else if (type == 598 || type == 636 || type == 614)
12333 {
12335 if (type == 636)
12336 {
12338 }
12339 if (type == 614)
12340 {
12342 }
12344 }
12345 else if (type == 632)
12346 {
12347 nPC.immune[owner] = 5;
12348 }
12349 else if (type == 514)
12350 {
12351 nPC.immune[owner] = 1;
12352 }
12353 else if (type == 611)
12354 {
12355 if (localAI[1] <= 0f)
12356 {
12357 NewProjectile(GetProjectileSource_FromThis(), nPC.Center.X, nPC.Center.Y, 0f, 0f, 612, damage, 10f, owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f);
12358 }
12359 localAI[1] = 4f;
12360 }
12361 else if (type == 595 || type == 735)
12362 {
12363 nPC.immune[owner] = 5;
12364 }
12365 else if (type == 927)
12366 {
12367 nPC.immune[owner] = 4;
12368 }
12369 else if (type == 286)
12370 {
12371 nPC.immune[owner] = 5;
12372 }
12373 else if (type == 443)
12374 {
12375 nPC.immune[owner] = 8;
12376 }
12377 else if (type >= 424 && type <= 426)
12378 {
12379 nPC.immune[owner] = 5;
12380 }
12381 else if (type == 634 || type == 635)
12382 {
12383 nPC.immune[owner] = 5;
12384 }
12385 else if (type == 659)
12386 {
12387 nPC.immune[owner] = 5;
12388 }
12389 else if (type == 246)
12390 {
12391 nPC.immune[owner] = 7;
12392 }
12393 else if (type == 249)
12394 {
12395 nPC.immune[owner] = 7;
12396 }
12397 else if (type == 16)
12398 {
12399 nPC.immune[owner] = 8;
12400 }
12401 else if (type == 409)
12402 {
12403 nPC.immune[owner] = 6;
12404 }
12405 else if (type == 311)
12406 {
12407 nPC.immune[owner] = 7;
12408 }
12409 else if (type == 582 || type == 902)
12410 {
12411 nPC.immune[owner] = 7;
12412 if (ai[0] != 1f)
12413 {
12414 ai[0] = 1f;
12415 netUpdate = true;
12416 }
12417 }
12418 else
12419 {
12420 if (type == 451)
12421 {
12422 if (ai[0] == 0f)
12423 {
12424 ai[0] += penetrate;
12425 }
12426 else
12427 {
12428 ai[0] -= penetrate + 1;
12429 }
12430 ai[1] = 0f;
12431 netUpdate = true;
12432 Main.npc[i].position -= Main.npc[i].netOffset;
12433 break;
12434 }
12435 if (type == 864)
12436 {
12437 array[i] = 10;
12438 nPC.immune[owner] = 0;
12439 if (ai[0] > 0f)
12440 {
12441 ai[0] = -1f;
12442 ai[1] = 0f;
12443 netUpdate = true;
12444 }
12445 }
12446 else if (type == 661 || type == 856)
12447 {
12448 array[i] = 8;
12449 nPC.immune[owner] = 0;
12450 }
12451 else if (type == 866)
12452 {
12453 array[i] = -1;
12454 nPC.immune[owner] = 0;
12455 penetrate--;
12456 if (penetrate == 0)
12457 {
12458 penetrate = 1;
12459 damage = 0;
12460 ai[1] = -1f;
12461 netUpdate = true;
12462 Main.npc[i].position -= Main.npc[i].netOffset;
12463 break;
12464 }
12465 if (owner == Main.myPlayer)
12466 {
12468 float num44 = ai[1];
12469 ai[1] = num43;
12470 if (ai[1] != num44)
12471 {
12472 netUpdate = true;
12473 }
12474 if (num43 != -1)
12475 {
12477 }
12478 }
12479 }
12480 else if (usesLocalNPCImmunity && localNPCHitCooldown != -2)
12481 {
12482 nPC.immune[owner] = 0;
12484 }
12486 {
12487 nPC.immune[owner] = 10;
12488 }
12489 }
12490 if (type == 710)
12491 {
12492 BetsySharpnel(i);
12493 }
12494 if (penetrate > 0 && type != 317 && type != 866)
12495 {
12496 if (type == 357)
12497 {
12498 damage = (int)((double)damage * 0.8);
12499 }
12500 penetrate--;
12501 if (penetrate == 0)
12502 {
12503 Main.npc[i].position -= Main.npc[i].netOffset;
12505 {
12506 penetrate = -1;
12507 damage = 0;
12508 }
12509 flag4 = false;
12510 }
12511 }
12512 if (aiStyle == 7)
12513 {
12514 ai[0] = 1f;
12515 damage = 0;
12516 netUpdate = true;
12517 }
12518 else if (aiStyle == 13)
12519 {
12520 ai[0] = 1f;
12521 netUpdate = true;
12522 }
12523 else if (aiStyle == 69)
12524 {
12525 ai[0] = 1f;
12526 netUpdate = true;
12527 }
12528 else if (type == 607)
12529 {
12530 ai[0] = 1f;
12531 netUpdate = true;
12532 friendly = false;
12533 }
12534 else if (type == 638 || type == 639 || type == 640)
12535 {
12536 array[i] = -1;
12537 nPC.immune[owner] = 0;
12538 damage = (int)((double)damage * 0.96);
12539 }
12540 else if (type == 617)
12541 {
12542 array[i] = 8;
12543 nPC.immune[owner] = 0;
12544 }
12545 else if (type == 656)
12546 {
12547 array[i] = 8;
12548 nPC.immune[owner] = 0;
12549 localAI[0] += 1f;
12550 }
12551 else if (type == 618)
12552 {
12553 array[i] = 20;
12554 nPC.immune[owner] = 0;
12555 }
12556 else if (type == 642)
12557 {
12558 array[i] = 10;
12559 nPC.immune[owner] = 0;
12560 }
12561 else if (type == 857)
12562 {
12563 array[i] = 10;
12564 nPC.immune[owner] = 0;
12565 }
12566 else if (type == 611 || type == 612)
12567 {
12568 array[i] = 6;
12569 nPC.immune[owner] = 4;
12570 }
12571 else if (type == 645)
12572 {
12573 array[i] = -1;
12574 nPC.immune[owner] = 0;
12575 if (ai[1] != -1f)
12576 {
12577 ai[0] = 0f;
12578 ai[1] = -1f;
12579 netUpdate = true;
12580 }
12581 }
12582 numHits++;
12583 if (type == 697)
12584 {
12585 if (ai[0] >= 42f)
12586 {
12587 localAI[1] = 1f;
12588 }
12589 }
12590 else if (type == 699)
12591 {
12593 }
12594 else if (type == 706)
12595 {
12596 damage = (int)((float)damage * 0.95f);
12597 }
12598 else if (type == 728)
12599 {
12600 SummonSuperStarSlash(nPC.Center);
12601 }
12602 else if (type == 34)
12603 {
12604 if (ai[0] == -1f)
12605 {
12606 ai[1] = -1f;
12607 netUpdate = true;
12608 }
12609 }
12610 else if (type == 79)
12611 {
12612 if (ai[0] == -1f)
12613 {
12614 ai[1] = -1f;
12615 netUpdate = true;
12616 }
12618 {
12619 PositionInWorld = nPC.Center,
12620 MovementVector = velocity
12621 });
12622 }
12623 else if (type == 931)
12624 {
12626 if (num45 != -1)
12627 {
12628 ai[0] = num45;
12629 netUpdate = true;
12630 }
12631 }
12632 else if (aiStyle == 165)
12633 {
12634 if (nPC.active)
12635 {
12636 Main.player[owner].MinionAttackTargetNPC = i;
12637 }
12638 }
12639 else if (type == 623)
12640 {
12642 {
12643 PositionInWorld = Vector2.Lerp(base.Center, nPC.Hitbox.ClosestPointInRect(base.Center), 0.5f) + new Vector2(0f, Main.rand.NextFloatDirection() * 10f),
12644 MovementVector = new Vector2(direction, Main.rand.NextFloatDirection() * 0.5f) * (3f + 3f * Main.rand.NextFloat())
12645 });
12646 }
12647 if (flag2)
12648 {
12649 Main.player[owner].SetMeleeHitCooldown(i, Main.player[owner].itemAnimation);
12650 }
12651 }
12652 }
12653 }
12654 }
12655 Main.npc[i].position -= Main.npc[i].netOffset;
12656 }
12657 }
12658 if (flag3 && Main.player[Main.myPlayer].hostile)
12659 {
12660 for (int m = 0; m < 255; m++)
12661 {
12662 if (m == owner)
12663 {
12664 continue;
12665 }
12667 if (!player3.active || player3.dead || player3.immune || !player3.hostile || playerImmune[m] > 0 || (Main.player[Main.myPlayer].team != 0 && Main.player[Main.myPlayer].team == player3.team))
12668 {
12669 continue;
12670 }
12671 bool flag26 = !ownerHitCheck;
12672 if (ownerHitCheck)
12673 {
12675 }
12676 if (!flag26 || !Colliding(rectangle, player3.getRect()))
12677 {
12678 continue;
12679 }
12680 if (aiStyle == 3)
12681 {
12682 if (ai[0] == 0f)
12683 {
12684 velocity.X = 0f - velocity.X;
12685 velocity.Y = 0f - velocity.Y;
12686 netUpdate = true;
12687 }
12688 ai[0] = 1f;
12689 }
12690 else if (aiStyle == 16)
12691 {
12692 if (timeLeft > 3)
12693 {
12694 timeLeft = 3;
12695 }
12696 if (player3.position.X + (float)(player3.width / 2) < position.X + (float)(width / 2))
12697 {
12698 direction = -1;
12699 }
12700 else
12701 {
12702 direction = 1;
12703 }
12704 }
12705 else if (aiStyle == 68)
12706 {
12707 if (timeLeft > 3)
12708 {
12709 timeLeft = 3;
12710 }
12711 if (player3.position.X + (float)(player3.width / 2) < position.X + (float)(width / 2))
12712 {
12713 direction = -1;
12714 }
12715 else
12716 {
12717 direction = 1;
12718 }
12719 }
12720 int playerIndex = owner;
12722 {
12723 playerIndex = (int)ai[0];
12724 }
12726 if (type == 41 && timeLeft > 1)
12727 {
12728 timeLeft = 1;
12729 }
12730 bool flag27 = false;
12731 if (melee && Main.rand.Next(1, 101) <= Main.player[owner].meleeCrit)
12732 {
12733 flag27 = true;
12734 }
12735 int num46 = Main.DamageVar((int)((float)damage * num), Main.player[owner].luck);
12736 bool dodgeable = IsDamageDodgable();
12737 if (!player3.immune)
12738 {
12739 StatusPvP(m);
12740 }
12742 int num47 = (int)player3.Hurt(playerDeathReason, num46, direction, pvp: true, quiet: false, flag27, -1, dodgeable);
12743 if (num47 > 0 && Main.player[owner].ghostHeal && friendly && !hostile)
12744 {
12745 ghostHeal(num47, new Vector2(player3.Center.X, player3.Center.Y), player3);
12746 }
12747 if (type == 304 && num47 > 0)
12748 {
12749 vampireHeal(num47, new Vector2(player3.Center.X, player3.Center.Y), player3);
12750 }
12751 if ((melee || ProjectileID.Sets.IsAWhip[type]) && Main.player[owner].meleeEnchant == 7)
12752 {
12753 NewProjectile(GetProjectileSource_FromThis(), player3.Center.X, player3.Center.Y, player3.velocity.X, player3.velocity.Y, 289, 0, 0f, owner);
12754 }
12755 if (Main.netMode != 0)
12756 {
12758 }
12759 playerImmune[m] = 40;
12760 if (penetrate > 0)
12761 {
12762 penetrate--;
12763 if (penetrate == 0)
12764 {
12765 break;
12766 }
12767 }
12768 if (aiStyle == 7)
12769 {
12770 ai[0] = 1f;
12771 damage = 0;
12772 netUpdate = true;
12773 }
12774 else if (aiStyle == 13)
12775 {
12776 ai[0] = 1f;
12777 netUpdate = true;
12778 }
12779 else if (aiStyle == 69)
12780 {
12781 ai[0] = 1f;
12782 netUpdate = true;
12783 }
12784 }
12785 }
12786 }
12787 if (type == 10 && Main.netMode != 1)
12788 {
12789 for (int n = 0; n < 200; n++)
12790 {
12791 NPC nPC2 = Main.npc[n];
12792 if (!nPC2.active)
12793 {
12794 continue;
12795 }
12796 if (nPC2.type == 534)
12797 {
12798 if (rectangle.Intersects(nPC2.Hitbox))
12799 {
12800 nPC2.Transform(441);
12801 }
12802 }
12803 else
12804 {
12805 if (nPC2.type != 687 || !rectangle.Intersects(nPC2.Hitbox))
12806 {
12807 continue;
12808 }
12809 nPC2.Transform(683);
12810 Vector2 vector9 = nPC2.Center - new Vector2(20f);
12812 if (Main.netMode == 2)
12813 {
12814 NetMessage.SendData(106, -1, -1, null, (int)vector9.X, vector9.Y);
12815 }
12817 {
12818 NPC.unlockedSlimeYellowSpawn = true;
12819 if (Main.netMode == 2)
12820 {
12822 }
12823 }
12824 }
12825 }
12826 }
12827 if ((type == 11 || type == 463) && Main.netMode != 1)
12828 {
12829 bool crimson = type == 463;
12830 for (int num48 = 0; num48 < 200; num48++)
12831 {
12832 if (Main.npc[num48].active)
12833 {
12834 Rectangle value2 = new Rectangle((int)Main.npc[num48].position.X, (int)Main.npc[num48].position.Y, Main.npc[num48].width, Main.npc[num48].height);
12835 if (rectangle.Intersects(value2))
12836 {
12837 Main.npc[num48].AttemptToConvertNPCToEvil(crimson);
12838 }
12839 }
12840 }
12841 }
12842 if (Main.netMode == 2 || !hostile || Main.myPlayer >= 255 || damage <= 0)
12843 {
12844 return;
12845 }
12846 int num49 = -1;
12847 switch (type)
12848 {
12849 case 452:
12850 case 454:
12851 case 455:
12852 case 462:
12853 num49 = 1;
12854 break;
12855 case 871:
12856 case 872:
12857 case 873:
12858 case 874:
12859 case 919:
12860 case 923:
12861 case 924:
12862 num49 = 1;
12863 break;
12864 }
12865 int myPlayer = Main.myPlayer;
12866 bool flag28 = Main.player[myPlayer].active && !Main.player[myPlayer].dead && (!Main.player[myPlayer].immune || num49 != -1);
12867 if (flag28 && type == 281)
12868 {
12869 flag28 = ai[1] - 1f == (float)myPlayer;
12870 }
12871 if (Main.getGoodWorld && type == 281)
12872 {
12873 flag28 = true;
12874 }
12875 if (!flag28 || !Colliding(rectangle, Main.player[myPlayer].getRect()))
12876 {
12877 return;
12878 }
12879 int num50 = direction;
12880 num50 = ((!(Main.player[myPlayer].position.X + (float)(Main.player[myPlayer].width / 2) < position.X + (float)(width / 2))) ? 1 : (-1));
12881 if (!Main.player[myPlayer].CanParryAgainst(Main.player[myPlayer].Hitbox, base.Hitbox, velocity))
12882 {
12883 int num51 = Main.DamageVar(damage, 0f - Main.player[owner].luck);
12885 if (num52 > 0 && Main.player[myPlayer].HasNPCBannerBuff(num52))
12886 {
12888 num51 = ((!Main.expertMode) ? ((int)((float)num51 * bannerEffect.NormalDamageReceived)) : ((int)((float)num51 * bannerEffect.ExpertDamageReceived)));
12889 }
12890 if (Main.player[myPlayer].resistCold && coldDamage)
12891 {
12892 num51 = (int)((float)num51 * 0.7f);
12893 }
12894 if (!reflected)
12895 {
12896 float num53 = Main.GameModeInfo.EnemyDamageMultiplier;
12897 if (Main.GameModeInfo.IsJourneyMode)
12898 {
12900 if (power.GetIsUnlocked())
12901 {
12902 num53 = power.StrengthMultiplierToGiveNPCs;
12903 }
12904 }
12905 num51 = (int)((float)num51 * num53);
12906 }
12907 int num54 = num51 * 2;
12908 if (type == 961)
12909 {
12910 if (penetrate == 1)
12911 {
12912 damage = 0;
12913 penetrate = -1;
12914 }
12915 else
12916 {
12917 damage = (int)((double)damage * 0.7);
12918 }
12919 }
12921 int playerIndex2 = -1;
12923 {
12924 playerIndex2 = (int)ai[0];
12925 }
12926 if (Main.player[myPlayer].Hurt(PlayerDeathReason.ByProjectile(playerIndex2, whoAmI), num54, num50, pvp: false, quiet: false, Crit: false, num49, dodgeable2) > 0.0 && !Main.player[myPlayer].dead)
12927 {
12928 StatusPlayer(myPlayer);
12929 }
12930 if (trap)
12931 {
12932 Main.player[myPlayer].trapDebuffSource = true;
12933 if (Main.player[myPlayer].dead)
12934 {
12936 }
12937 }
12938 }
12939 if (true)
12940 {
12941 if (type == 435 || type == 682)
12942 {
12943 penetrate--;
12944 }
12945 if (type == 436)
12946 {
12947 penetrate--;
12948 }
12949 if (type == 681)
12950 {
12951 timeLeft = 0;
12952 }
12953 if (type == 437)
12954 {
12955 penetrate--;
12956 }
12957 }
12958 }
12959
12961 {
12962 Rectangle result = new Rectangle((int)position.X, (int)position.Y, width, height);
12963 if (type == 101)
12964 {
12965 result.Inflate(30, 30);
12966 }
12967 if (type == 85)
12968 {
12969 int num = (int)Utils.Remap(localAI[0], 0f, 72f, 10f, 40f);
12970 result.Inflate(num, num);
12971 }
12972 if (type == 188)
12973 {
12974 result.Inflate(20, 20);
12975 }
12976 if (aiStyle == 29)
12977 {
12978 result.Inflate(4, 4);
12979 }
12980 if (type == 967)
12981 {
12982 result.Inflate(10, 10);
12983 }
12984 return result;
12985 }
12986
12988 {
12989 if (aiStyle != 16 || ProjectileID.Sets.RocketsSkipDamageForPlayers[type] || (timeLeft > 1 && type != 108 && type != 164 && type != 1002) || !Main.player[j].active || Main.player[j].dead || Main.player[j].immune || (ownerHitCheck && !CanHitWithMeleeWeapon(Main.player[j])))
12990 {
12991 return;
12992 }
12993 Rectangle value = new Rectangle((int)Main.player[j].position.X, (int)Main.player[j].position.Y, Main.player[j].width, Main.player[j].height);
12994 if (!projRectangle.Intersects(value))
12995 {
12996 return;
12997 }
12998 if (Main.player[j].position.X + (float)(Main.player[j].width / 2) < position.X + (float)(width / 2))
12999 {
13000 direction = -1;
13001 }
13002 else
13003 {
13004 direction = 1;
13005 }
13006 int num = Main.DamageVar(damage, 0f - Main.player[j].luck);
13007 int playerIndex = owner;
13008 bool pvp = true;
13009 if (type == 108 || type == 1002)
13010 {
13011 playerIndex = -1;
13012 pvp = false;
13013 }
13015 {
13016 playerIndex = (int)ai[0];
13017 }
13018 bool dodgeable = IsDamageDodgable();
13020 if (Main.player[j].Hurt(damageSource, num, direction, pvp, quiet: false, Crit: false, -1, dodgeable) > 0.0 && !Main.player[j].dead)
13021 {
13022 StatusPlayer(j);
13023 }
13024 if (trap)
13025 {
13026 Main.player[j].trapDebuffSource = true;
13027 if (Main.player[j].dead)
13028 {
13030 }
13031 }
13032 }
13033
13034 public bool IsDamageDodgable()
13035 {
13036 int num = type;
13037 if (((uint)(num - 871) <= 3u || num == 919 || (uint)(num - 923) <= 1u) && damage == 9999)
13038 {
13039 return false;
13040 }
13041 return true;
13042 }
13043
13045 {
13046 int num = 0;
13047 for (int i = 0; i < 1000; i++)
13048 {
13049 if (i != protectedProjectileIndex && Main.projectile[i].active && Main.projectile[i].owner == Main.myPlayer && Main.projectile[i].type == projectileType && Main.projectile[i].ai[0] == 1f && Main.projectile[i].ai[1] == (float)targetNPCIndex)
13050 {
13051 bufferForScan[num++] = new Point(i, Main.projectile[i].timeLeft);
13052 if (num >= bufferForScan.Length)
13053 {
13054 break;
13055 }
13056 }
13057 }
13058 if (num < bufferForScan.Length)
13059 {
13060 return;
13061 }
13062 int num2 = 0;
13063 for (int j = 1; j < bufferForScan.Length; j++)
13064 {
13066 {
13067 num2 = j;
13068 }
13069 }
13070 Main.projectile[bufferForScan[num2].X].Kill();
13071 }
13072
13074 {
13075 int num = 0;
13076 for (int i = 0; i < localNPCImmunity.Length; i++)
13077 {
13078 if (localNPCImmunity[i] > 0)
13079 {
13080 num++;
13081 if (num >= cap)
13082 {
13083 break;
13084 }
13085 }
13086 }
13087 return num;
13088 }
13089
13091 {
13093 {
13094 PositionInWorld = targetNPC.Center
13095 });
13096 }
13097
13098 private void TryDoingOnHitEffects(Entity entity)
13099 {
13100 switch (type)
13101 {
13102 case 221:
13103 case 227:
13104 case 614:
13105 case 729:
13106 case 908:
13107 case 977:
13108 return;
13109 }
13110 Main.player[owner].OnHit(entity.Center.X, entity.Center.Y, entity);
13111 }
13112
13113 private void SummonSuperStarSlash(Vector2 target)
13114 {
13115 Vector2 v = Main.rand.NextVector2CircularEdge(200f, 200f);
13116 if (v.Y < 0f)
13117 {
13118 v.Y *= -1f;
13119 }
13120 v.Y += 100f;
13121 Vector2 vector = v.SafeNormalize(Vector2.UnitY) * 6f;
13122 NewProjectile(GetProjectileSource_FromThis(), target - vector * 20f, vector, 729, (int)((double)damage * 0.75), 0f, owner, 0f, target.Y);
13123 }
13124
13125 private void SummonMonkGhast()
13126 {
13127 if (localAI[0] > 0f)
13128 {
13129 return;
13130 }
13131 localAI[0] = 1000f;
13132 List<NPC> list = new List<NPC>();
13133 for (int i = 0; i < 200; i++)
13134 {
13135 NPC nPC = Main.npc[i];
13136 if (nPC.CanBeChasedBy(this) && Distance(nPC.Center) < 800f)
13137 {
13138 list.Add(nPC);
13139 }
13140 }
13141 Vector2 center = base.Center;
13143 if (list.Count > 0)
13144 {
13145 NPC nPC2 = list[Main.rand.Next(list.Count)];
13146 center = nPC2.Center;
13147 zero = nPC2.velocity;
13148 }
13149 int num = Main.rand.Next(2) * 2 - 1;
13150 Vector2 vector = new Vector2((float)num * (4f + (float)Main.rand.Next(3)), 0f);
13151 Vector2 vector2 = center + new Vector2(-num * 120, 0f);
13152 vector += (center + zero * 15f - vector2).SafeNormalize(Vector2.Zero) * 2f;
13154 }
13155
13156 private void CutTiles()
13157 {
13158 if (!CanCutTiles())
13159 {
13160 return;
13161 }
13162 AchievementsHelper.CurrentlyMining = true;
13163 bool flag = true;
13164 bool[] tileCutIgnorance = Main.player[owner].GetTileCutIgnorance(allowRegrowth: false, trap);
13165 DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile;
13166 DelegateMethods.tileCutIgnore = tileCutIgnorance;
13168 if (type == 461 || type == 632 || type == 642)
13169 {
13170 Utils.PlotTileLine(base.Center, base.Center + velocity * localAI[1], (float)width * scale, DelegateMethods.CutTiles);
13171 }
13172 else if (ProjectileID.Sets.IsAWhip[type])
13173 {
13174 flag = false;
13177 Vector2 vector = new Vector2((float)width * scale / 2f, 0f);
13178 for (int i = 0; i < WhipPointsForCollision.Count; i++)
13179 {
13181 }
13182 }
13183 else if (type == 756)
13184 {
13185 Utils.PlotTileLine(base.Center, base.Center + velocity.SafeNormalize(-Vector2.UnitY) * 200f * scale, 22f * scale, DelegateMethods.CutTiles);
13186 }
13187 else if (type == 927)
13188 {
13189 Vector2 end = base.Center + velocity.SafeNormalize(Vector2.UnitX) * 220f * scale;
13190 Utils.PlotTileLine(base.Center, end, 80f * scale, DelegateMethods.CutTiles);
13191 }
13192 else if (type == 802 || type == 842 || type == 938 || type == 939 || type == 940 || type == 941 || type == 942 || type == 943 || type == 944 || type == 945)
13193 {
13194 Utils.PlotTileLine(base.Center, base.Center + velocity.SafeNormalize(-Vector2.UnitY) * 10f, 10f * scale, DelegateMethods.CutTiles);
13195 }
13196 else if (type == 611)
13197 {
13198 Utils.PlotTileLine(base.Center, base.Center + velocity + velocity.SafeNormalize(Vector2.Zero) * 48f, (float)width * scale, DelegateMethods.CutTiles);
13199 }
13200 else if (type == 697 || type == 707)
13201 {
13202 float num = 40f;
13203 if (type == 707)
13204 {
13205 num = 60f;
13206 }
13207 float f = rotation - (float)Math.PI / 4f * (float)Math.Sign(velocity.X);
13208 Utils.PlotTileLine(base.Center + f.ToRotationVector2() * (0f - num), base.Center + f.ToRotationVector2() * num, (float)width * scale, DelegateMethods.CutTiles);
13209 }
13210 else if (aiStyle == 190 || aiStyle == 191)
13211 {
13212 flag = false;
13213 Vector2 vector2 = (rotation - (float)Math.PI / 4f).ToRotationVector2() * 60f * scale;
13214 Vector2 vector3 = (rotation + (float)Math.PI / 4f).ToRotationVector2() * 60f * scale;
13215 float num2 = 60f * scale;
13217 }
13219 {
13220 CutTilesAt(extensionBox.TopLeft(), extensionBox.Width, extensionBox.Height);
13221 }
13222 if (flag)
13223 {
13225 }
13226 AchievementsHelper.CurrentlyMining = false;
13227 }
13228
13230 {
13231 int num = (int)(boxPosition.X / 16f);
13232 int num2 = (int)((boxPosition.X + (float)boxWidth) / 16f) + 1;
13233 int num3 = (int)(boxPosition.Y / 16f);
13234 int num4 = (int)((boxPosition.Y + (float)boxHeight) / 16f) + 1;
13235 if (num < 0)
13236 {
13237 num = 0;
13238 }
13239 if (num2 > Main.maxTilesX)
13240 {
13242 }
13243 if (num3 < 0)
13244 {
13245 num3 = 0;
13246 }
13247 if (num4 > Main.maxTilesY)
13248 {
13250 }
13251 bool[] tileCutIgnorance = Main.player[owner].GetTileCutIgnorance(allowRegrowth: false, trap);
13252 for (int i = num; i < num2; i++)
13253 {
13254 for (int j = num3; j < num4; j++)
13255 {
13256 if (Main.tile[i, j] != null && Main.tileCut[Main.tile[i, j].type] && !tileCutIgnorance[Main.tile[i, j].type] && WorldGen.CanCutTile(i, j, TileCuttingContext.AttackProjectile))
13257 {
13258 WorldGen.KillTile(i, j);
13259 if (Main.netMode != 0)
13260 {
13261 NetMessage.SendData(17, -1, -1, null, 0, i, j);
13262 }
13263 }
13264 }
13265 }
13266 }
13267
13268 private bool CanCutTiles()
13269 {
13270 if (aiStyle != 45 && aiStyle != 137 && aiStyle != 92 && aiStyle != 105 && aiStyle != 106 && !ProjectileID.Sets.IsAGolfBall[type] && type != 463 && type != 69 && type != 70 && type != 621 && type != 10 && type != 11 && type != 379 && type != 407 && type != 476 && type != 623 && (type < 625 || type > 628) && type != 833 && type != 834 && type != 835 && type != 818 && type != 831 && type != 820 && type != 864 && type != 970 && type != 995 && type != 908)
13271 {
13272 return type != 1020;
13273 }
13274 return false;
13275 }
13276
13277 public bool Colliding(Rectangle myRect, Rectangle targetRect)
13278 {
13279 if (aiStyle == 15)
13280 {
13281 if (ai[0] == 0f)
13282 {
13283 Vector2 mountedCenter = Main.player[owner].MountedCenter;
13284 Vector2 vector = targetRect.ClosestPointInRect(mountedCenter) - mountedCenter;
13285 vector.Y /= 0.8f;
13286 float num = 55f;
13287 return vector.Length() <= num;
13288 }
13289 }
13290 else if (type == 973)
13291 {
13292 Vector2 v = targetRect.ClosestPointInRect(base.Center) - base.Center;
13293 v.SafeNormalize(Vector2.UnitX);
13294 float num2 = 100f * scale;
13295 if (v.Length() < num2 && Collision.CanHit(base.Center, 0, 0, targetRect.Center.ToVector2(), 0, 0))
13296 {
13297 return true;
13298 }
13299 }
13300 else
13301 {
13302 if (type == 85)
13303 {
13304 if (!myRect.Intersects(targetRect))
13305 {
13306 return false;
13307 }
13308 return Collision.CanHit(base.Center, 0, 0, targetRect.Center.ToVector2(), 0, 0);
13309 }
13310 if (type == 985)
13311 {
13312 float coneLength = 90f * scale;
13313 float maximumAngle = (float)Math.PI / 4f;
13314 float coneRotation = rotation;
13315 if (targetRect.IntersectsConeFastInaccurate(base.Center, coneLength, coneRotation, maximumAngle) && Collision.CanHit(base.Center, 0, 0, targetRect.Center.ToVector2(), 0, 0))
13316 {
13317 return true;
13318 }
13319 }
13320 else
13321 {
13322 if (aiStyle == 190)
13323 {
13324 float coneLength2 = 94f * scale;
13325 float num3 = (float)Math.PI * 2f / 25f * ai[0];
13326 float maximumAngle2 = (float)Math.PI / 4f;
13327 float num4 = rotation + num3;
13328 if (targetRect.IntersectsConeSlowMoreAccurate(base.Center, coneLength2, num4, maximumAngle2))
13329 {
13330 return true;
13331 }
13332 float num5 = Utils.Remap(localAI[0], ai[1] * 0.3f, ai[1] * 0.5f, 1f, 0f);
13333 if (num5 > 0f)
13334 {
13335 float coneRotation2 = num4 - (float)Math.PI / 4f * ai[0] * num5;
13336 if (targetRect.IntersectsConeSlowMoreAccurate(base.Center, coneLength2, coneRotation2, maximumAngle2))
13337 {
13338 return true;
13339 }
13340 }
13341 return false;
13342 }
13343 if (type == 623)
13344 {
13345 if (ai[0] == 2f)
13346 {
13347 Rectangle value = Utils.CenteredRectangle(base.Center + new Vector2(direction * 40, 0f), new Vector2(80f, 40f));
13348 if (targetRect.Intersects(value))
13349 {
13350 return true;
13351 }
13352 }
13353 }
13354 else
13355 {
13356 if (type == 933)
13357 {
13358 float collisionPoint = 0f;
13359 float num6 = 40f;
13360 for (int i = 14; i < oldPos.Length; i += 15)
13361 {
13362 float num7 = localAI[0] - (float)i;
13363 if (!(num7 < 0f) && !(num7 > 60f))
13364 {
13365 Vector2 vector2 = oldPos[i] + base.Size / 2f;
13366 Vector2 vector3 = (oldRot[i] + (float)Math.PI / 2f).ToRotationVector2();
13367 _lanceHitboxBounds.X = (int)vector2.X - _lanceHitboxBounds.Width / 2;
13368 _lanceHitboxBounds.Y = (int)vector2.Y - _lanceHitboxBounds.Height / 2;
13369 if (_lanceHitboxBounds.Intersects(targetRect) && Collision.CheckAABBvLineCollision(targetRect.TopLeft(), targetRect.Size(), vector2 - vector3 * num6, vector2 + vector3 * num6, 20f, ref collisionPoint))
13370 {
13371 return true;
13372 }
13373 }
13374 }
13375 Vector2 vector4 = (rotation + (float)Math.PI / 2f).ToRotationVector2();
13376 _lanceHitboxBounds.X = (int)position.X - _lanceHitboxBounds.Width / 2;
13377 _lanceHitboxBounds.Y = (int)position.Y - _lanceHitboxBounds.Height / 2;
13378 if (_lanceHitboxBounds.Intersects(targetRect) && Collision.CheckAABBvLineCollision(targetRect.TopLeft(), targetRect.Size(), base.Center - vector4 * num6, base.Center + vector4 * num6, 20f, ref collisionPoint))
13379 {
13380 return true;
13381 }
13382 return false;
13383 }
13384 if (type == 927)
13385 {
13386 for (float num8 = 0f; num8 <= 1f; num8 += 0.05f)
13387 {
13388 float num9 = Utils.Remap(num8, 0f, 1f, 1f, 5f);
13390 Vector2 vector5 = velocity.SafeNormalize(Vector2.Zero) * width * num9 * scale;
13391 rectangle.Offset((int)vector5.X, (int)vector5.Y);
13392 if (rectangle.Intersects(targetRect))
13393 {
13394 return true;
13395 }
13396 }
13397 }
13398 else
13399 {
13400 if (type == 877 || type == 878 || type == 879)
13401 {
13402 float f = rotation - (float)Math.PI / 4f - (float)Math.PI / 2f - ((spriteDirection == 1) ? ((float)Math.PI) : 0f);
13403 float collisionPoint2 = 0f;
13404 float num10 = 95f;
13405 _lanceHitboxBounds.X = (int)position.X - _lanceHitboxBounds.Width / 2;
13406 _lanceHitboxBounds.Y = (int)position.Y - _lanceHitboxBounds.Height / 2;
13407 if (_lanceHitboxBounds.Intersects(targetRect) && Collision.CheckAABBvLineCollision(targetRect.TopLeft(), targetRect.Size(), base.Center, base.Center + f.ToRotationVector2() * num10, 23f * scale, ref collisionPoint2))
13408 {
13409 return true;
13410 }
13411 return false;
13412 }
13413 if (type == 974)
13414 {
13415 float f2 = rotation;
13416 float collisionPoint3 = 0f;
13417 float num11 = 46f * scale;
13418 float num12 = 8f;
13419 Vector2 vector6 = f2.ToRotationVector2();
13420 Rectangle hitbox = base.Hitbox;
13421 hitbox.Inflate((int)num11, (int)num11);
13422 if (hitbox.Intersects(targetRect) && Collision.CheckAABBvLineCollision(targetRect.TopLeft(), targetRect.Size(), base.Center - vector6 * num11, base.Center + vector6 * num11, num12 * scale, ref collisionPoint3))
13423 {
13424 return true;
13425 }
13426 return false;
13427 }
13428 if (type == 919 || type == 932)
13429 {
13430 float f3 = rotation;
13431 float collisionPoint4 = 0f;
13432 float num13 = 40f;
13433 Vector2 vector7 = f3.ToRotationVector2();
13434 _lanceHitboxBounds.X = (int)position.X - _lanceHitboxBounds.Width / 2;
13435 _lanceHitboxBounds.Y = (int)position.Y - _lanceHitboxBounds.Height / 2;
13436 if (_lanceHitboxBounds.Intersects(targetRect) && Collision.CheckAABBvLineCollision(targetRect.TopLeft(), targetRect.Size(), base.Center - vector7 * num13, base.Center + vector7 * num13, 8f, ref collisionPoint4))
13437 {
13438 return true;
13439 }
13440 return false;
13441 }
13442 if (type == 923)
13443 {
13444 float collisionPoint5 = 0f;
13445 _ = scale;
13446 float f4 = rotation;
13447 Vector2 objectPosition = targetRect.TopLeft();
13448 Vector2 objectDimensions = targetRect.Size();
13449 Vector2 vector8 = f4.ToRotationVector2();
13450 float num14 = scale * 0.7f;
13452 {
13453 return true;
13454 }
13456 {
13457 return true;
13458 }
13460 {
13461 return true;
13462 }
13463 return false;
13464 }
13465 if (type == 598 && targetRect.Width > 8 && targetRect.Height > 8)
13466 {
13467 targetRect.Inflate(-targetRect.Width / 8, -targetRect.Height / 8);
13468 }
13469 else
13470 {
13471 if (type == 872)
13472 {
13473 Rectangle hitbox2 = base.Hitbox;
13474 int num15 = 80;
13475 for (int j = 0; j < num15; j += 2)
13476 {
13478 if (!(vector9 == Vector2.Zero))
13479 {
13480 hitbox2.X = (int)vector9.X;
13481 hitbox2.Y = (int)vector9.Y;
13482 if (hitbox2.Intersects(targetRect))
13483 {
13484 return true;
13485 }
13486 }
13487 }
13488 return false;
13489 }
13490 if (type == 871)
13491 {
13493 for (int k = 0; k < num16; k++)
13494 {
13496 for (int l = 0; l < hallowBossPelletStormInfo.BulletsInStorm; l++)
13497 {
13498 if (hallowBossPelletStormInfo.IsValid(l) && hallowBossPelletStormInfo.GetBulletHitbox(l, base.Center).Intersects(targetRect))
13499 {
13500 return true;
13501 }
13502 }
13503 }
13504 return false;
13505 }
13507 {
13510 for (int m = 0; m < WhipPointsForCollision.Count; m++)
13511 {
13512 Point point = WhipPointsForCollision[m].ToPoint();
13513 myRect.Location = new Point(point.X - myRect.Width / 2, point.Y - myRect.Height / 2);
13514 if (myRect.Intersects(targetRect))
13515 {
13516 return true;
13517 }
13518 }
13519 return false;
13520 }
13521 if (type == 614 && targetRect.Width > 8 && targetRect.Height > 8)
13522 {
13523 targetRect.Inflate(-targetRect.Width / 8, -targetRect.Height / 8);
13524 }
13525 else if (type == 963 && ai[0] >= 2f)
13526 {
13527 targetRect.Inflate(30, 30);
13528 }
13529 else if (type == 758)
13530 {
13531 if (ai[0] == 2f && Utils.CenteredRectangle(base.Center + new Vector2(spriteDirection * 30, 0f), new Vector2(50f, 20f)).Intersects(targetRect))
13532 {
13533 return true;
13534 }
13535 }
13536 else if (type == 636 && targetRect.Width > 8 && targetRect.Height > 8)
13537 {
13538 targetRect.Inflate(-targetRect.Width / 8, -targetRect.Height / 8);
13539 }
13540 else if (type == 607)
13541 {
13542 myRect.X += (int)velocity.X;
13543 myRect.Y += (int)velocity.Y;
13544 }
13545 else if (type == 661)
13546 {
13547 if (Vector2.Distance(myRect.Center.ToVector2(), targetRect.Center.ToVector2()) > 500f || !Collision.CanHitLine(myRect.Center.ToVector2(), 0, 0, targetRect.Center.ToVector2(), 0, 0))
13548 {
13549 return false;
13550 }
13551 }
13552 else
13553 {
13554 if (aiStyle == 137)
13555 {
13556 if (myRect.Intersects(targetRect) && targetRect.Distance(base.Center) < (float)(height / 2 - 20))
13557 {
13558 if (AI_137_CanHit(targetRect.Center.ToVector2()))
13559 {
13560 return true;
13561 }
13562 if (AI_137_CanHit(targetRect.TopLeft() + new Vector2(targetRect.Width / 2, 0f)))
13563 {
13564 return true;
13565 }
13566 }
13567 return false;
13568 }
13569 if (aiStyle == 19)
13570 {
13571 Vector2 center = base.Center;
13573 {
13574 Vector2 vector10 = extensionBox.Center.ToVector2();
13576 Vector2 size = extensionBox.Size();
13577 float num18 = MathHelper.Max(extensionBox.Width, extensionBox.Height);
13578 if (num18 < 12f)
13579 {
13580 num18 = 12f;
13581 }
13582 for (float num19 = num18; num19 < num17; num19 += num18)
13583 {
13584 if (Utils.CenteredRectangle(Vector2.Lerp(center, vector10, num19 / num17), size).Intersects(targetRect))
13585 {
13586 return true;
13587 }
13588 }
13589 if (extensionBox.Intersects(targetRect))
13590 {
13591 return true;
13592 }
13593 }
13594 }
13595 }
13596 }
13597 }
13598 }
13599 }
13600 }
13601 if (myRect.Intersects(targetRect))
13602 {
13603 return true;
13604 }
13605 if (type == 461)
13606 {
13607 float collisionPoint6 = 0f;
13608 if (Collision.CheckAABBvLineCollision(targetRect.TopLeft(), targetRect.Size(), base.Center, base.Center + velocity * localAI[1], 22f * scale, ref collisionPoint6))
13609 {
13610 return true;
13611 }
13612 return false;
13613 }
13614 if (type == 697 || type == 707)
13615 {
13616 float f5 = rotation - (float)Math.PI / 4f * (float)Math.Sign(velocity.X);
13617 float collisionPoint7 = 0f;
13618 float num20 = 50f;
13619 if (type == 697)
13620 {
13621 num20 = 65f;
13622 }
13623 if (type == 707)
13624 {
13625 num20 = 110f;
13626 }
13627 if (Collision.CheckAABBvLineCollision(targetRect.TopLeft(), targetRect.Size(), base.Center + f5.ToRotationVector2() * (0f - num20), base.Center + f5.ToRotationVector2() * num20, 23f * scale, ref collisionPoint7))
13628 {
13629 return true;
13630 }
13631 return false;
13632 }
13633 if (type == 699)
13634 {
13635 float f6 = rotation - (float)Math.PI / 4f * (float)Math.Sign(velocity.X) + ((spriteDirection == -1) ? ((float)Math.PI) : 0f);
13636 float collisionPoint8 = 0f;
13637 float num21 = -95f;
13638 if (Collision.CheckAABBvLineCollision(targetRect.TopLeft(), targetRect.Size(), base.Center, base.Center + f6.ToRotationVector2() * num21, 23f * scale, ref collisionPoint8))
13639 {
13640 return true;
13641 }
13642 return false;
13643 }
13644 if (type == 642)
13645 {
13646 float collisionPoint9 = 0f;
13647 if (Collision.CheckAABBvLineCollision(targetRect.TopLeft(), targetRect.Size(), base.Center, base.Center + velocity * localAI[1], 30f * scale, ref collisionPoint9))
13648 {
13649 return true;
13650 }
13651 return false;
13652 }
13653 if (type == 802 || type == 842 || type == 938 || type == 939 || type == 940 || type == 941 || type == 942 || type == 943 || type == 944 || type == 945)
13654 {
13655 float collisionPoint10 = 0f;
13656 if (Collision.CheckAABBvLineCollision(targetRect.TopLeft(), targetRect.Size(), base.Center, base.Center + velocity * 6f, 10f * scale, ref collisionPoint10))
13657 {
13658 return true;
13659 }
13660 return false;
13661 }
13662 if (type == 632)
13663 {
13664 float collisionPoint11 = 0f;
13665 if (Collision.CheckAABBvLineCollision(targetRect.TopLeft(), targetRect.Size(), base.Center, base.Center + velocity * localAI[1], 22f * scale, ref collisionPoint11))
13666 {
13667 return true;
13668 }
13669 return false;
13670 }
13671 if (type == 455)
13672 {
13673 float collisionPoint12 = 0f;
13674 if (Collision.CheckAABBvLineCollision(targetRect.TopLeft(), targetRect.Size(), base.Center, base.Center + velocity * localAI[1], 36f * scale, ref collisionPoint12))
13675 {
13676 return true;
13677 }
13678 return false;
13679 }
13680 if (type == 611)
13681 {
13682 float collisionPoint13 = 0f;
13683 if (Collision.CheckAABBvLineCollision(targetRect.TopLeft(), targetRect.Size(), base.Center, base.Center + velocity + velocity.SafeNormalize(Vector2.Zero) * 48f, 16f * scale, ref collisionPoint13))
13684 {
13685 return true;
13686 }
13687 return false;
13688 }
13689 if (type == 684)
13690 {
13691 float collisionPoint14 = 0f;
13692 Vector2 vector11 = velocity.SafeNormalize(Vector2.UnitY).RotatedBy(-1.5707963705062866) * scale;
13693 if (Collision.CheckAABBvLineCollision(targetRect.TopLeft(), targetRect.Size(), base.Center - vector11 * 40f, base.Center + vector11 * 40f, 16f * scale, ref collisionPoint14))
13694 {
13695 return true;
13696 }
13697 return false;
13698 }
13699 if (type == 537)
13700 {
13701 float collisionPoint15 = 0f;
13702 if (Collision.CheckAABBvLineCollision(targetRect.TopLeft(), targetRect.Size(), base.Center, base.Center + velocity * localAI[1], 22f * scale, ref collisionPoint15))
13703 {
13704 return true;
13705 }
13706 return false;
13707 }
13708 if (type == 756 || type == 961)
13709 {
13710 float collisionPoint16 = 0f;
13711 if (Collision.CheckAABBvLineCollision(targetRect.TopLeft(), targetRect.Size(), base.Center, base.Center + velocity.SafeNormalize(-Vector2.UnitY) * 200f * scale, 22f * scale, ref collisionPoint16))
13712 {
13713 return true;
13714 }
13715 return false;
13716 }
13717 if (type == 687)
13718 {
13719 float collisionPoint17 = 0f;
13720 float num22 = ai[0] / 25f;
13721 if (num22 > 1f)
13722 {
13723 num22 = 1f;
13724 }
13725 float num23 = (ai[0] - 38f) / 40f;
13726 if (num23 < 0f)
13727 {
13728 num23 = 0f;
13729 }
13730 Vector2 lineStart = base.Center + rotation.ToRotationVector2() * 400f * num23;
13731 Vector2 lineEnd = base.Center + rotation.ToRotationVector2() * 400f * num22;
13732 if (Collision.CheckAABBvLineCollision(targetRect.TopLeft(), targetRect.Size(), lineStart, lineEnd, 40f * scale, ref collisionPoint17))
13733 {
13734 return true;
13735 }
13736 return false;
13737 }
13738 if (type == 466 || type == 580 || type == 686)
13739 {
13740 for (int n = 0; n < oldPos.Length && (oldPos[n].X != 0f || oldPos[n].Y != 0f); n++)
13741 {
13742 myRect.X = (int)oldPos[n].X;
13743 myRect.Y = (int)oldPos[n].Y;
13744 if (myRect.Intersects(targetRect))
13745 {
13746 return true;
13747 }
13748 }
13749 return false;
13750 }
13751 if (type == 711)
13752 {
13753 if (penetrate != -1)
13754 {
13755 for (int num24 = 0; num24 < oldPos.Length && (oldPos[num24].X != 0f || oldPos[num24].Y != 0f); num24++)
13756 {
13757 myRect.X = (int)oldPos[num24].X;
13758 myRect.Y = (int)oldPos[num24].Y;
13759 if (myRect.Intersects(targetRect))
13760 {
13761 return true;
13762 }
13763 }
13764 }
13765 }
13766 else if (type == 464 && ai[1] != 1f)
13767 {
13768 Vector2 vector12 = new Vector2(0f, -720f).RotatedBy(velocity.ToRotation());
13769 float num25 = ai[0] % 45f / 45f;
13771 for (int num26 = 0; num26 < 6; num26++)
13772 {
13773 float num27 = (float)num26 * ((float)Math.PI * 2f) / 6f;
13774 if (Utils.CenteredRectangle(base.Center + spinningpoint.RotatedBy(num27), new Vector2(30f, 30f)).Intersects(targetRect))
13775 {
13776 return true;
13777 }
13778 }
13779 }
13780 return false;
13781 }
13782
13783 public void ProjLight()
13784 {
13785 if (!(light > 0f))
13786 {
13787 return;
13788 }
13789 float num = light;
13790 float num2 = light;
13791 float num3 = light;
13792 switch (type)
13793 {
13794 case 987:
13795 num *= 0.6f;
13796 num2 *= 0.5f;
13797 num3 *= 0.1f;
13798 break;
13799 case 988:
13800 num *= 0.8f;
13801 num2 *= 0.35f;
13802 num3 *= 0f;
13803 break;
13804 case 989:
13805 num *= 0f;
13806 num2 *= 0.65f;
13807 num3 *= 0f;
13808 break;
13809 case 990:
13810 num *= 0f;
13811 num2 *= 0.35f;
13812 num3 *= 0.7f;
13813 break;
13814 case 991:
13815 num *= 0.9f;
13816 num2 *= 0f;
13817 num3 *= 0.5f;
13818 break;
13819 case 992:
13820 num *= 0.75f;
13821 num2 *= 0f;
13822 num3 *= 0.75f;
13823 break;
13824 case 993:
13825 num *= (float)Main.DiscoR / 255f;
13826 num2 *= (float)Main.DiscoG / 255f;
13827 num3 *= (float)Main.DiscoB / 255f;
13828 break;
13829 }
13830 if (type == 446)
13831 {
13832 num *= 0f;
13833 num3 *= 0.8f;
13834 }
13835 else if (type == 493 || type == 494)
13836 {
13837 num2 *= 0.3f;
13838 }
13839 else if (type == 876)
13840 {
13841 num *= 0.1f;
13842 num2 *= 0.7f;
13843 num3 *= 1f;
13844 }
13845 else if (type == 867)
13846 {
13847 float num4 = (float)Main.rand.Next(28, 42) * 0.005f;
13848 num4 += (float)(270 - Main.mouseTextColor) / 500f;
13849 num = 0.1f;
13850 num2 = 0.3f + num4 / 2f;
13851 num3 = 0.6f + num4;
13852 }
13853 else if (type == 1000)
13854 {
13855 float num5 = (float)Main.rand.Next(28, 42) * 0.005f;
13856 num5 += (float)(270 - Main.mouseTextColor) / 500f;
13857 num = 0.3f + num5 * 0.25f;
13858 num2 = 0.35f + num5 * 0.75f;
13859 num3 = 0.5f + num5;
13860 }
13861 else if (type == 332)
13862 {
13863 num3 *= 0.1f;
13864 num2 *= 0.6f;
13865 }
13866 else if (type == 259)
13867 {
13868 num3 *= 0.1f;
13869 if (Main.getGoodWorld)
13870 {
13871 num = 0f;
13872 num2 = 0f;
13873 num3 = 0f;
13874 }
13875 }
13876 else if (type == 329)
13877 {
13878 num3 *= 0.1f;
13879 num2 *= 0.9f;
13880 }
13881 else if (type == 2 || type == 82)
13882 {
13883 num2 *= 0.75f;
13884 num3 *= 0.55f;
13885 }
13886 else if (type == 172)
13887 {
13888 num2 *= 0.55f;
13889 num *= 0.35f;
13890 }
13891 else if (type == 308)
13892 {
13893 num2 *= 0.7f;
13894 num *= 0.1f;
13895 }
13896 else if (type == 304)
13897 {
13898 num2 *= 0.2f;
13899 num3 *= 0.1f;
13900 }
13901 else if (type == 263)
13902 {
13903 num2 *= 0.7f;
13904 num *= 0.1f;
13905 }
13906 else if (type == 274)
13907 {
13908 num2 *= 0.1f;
13909 num *= 0.7f;
13910 }
13911 else if (type == 254)
13912 {
13913 num *= 0.1f;
13914 }
13915 else if (type == 94)
13916 {
13917 num *= 0.5f;
13918 num2 *= 0f;
13919 }
13920 else if (type == 95 || type == 96 || type == 103 || type == 104)
13921 {
13922 num *= 0.35f;
13923 num2 *= 1f;
13924 num3 *= 0f;
13925 }
13926 else if (type == 4)
13927 {
13928 num2 *= 0.1f;
13929 num *= 0.5f;
13930 }
13931 else if (type == 257)
13932 {
13933 num2 *= 0.9f;
13934 num *= 0.1f;
13935 }
13936 else if (type == 9)
13937 {
13938 num2 *= 0.1f;
13939 num3 *= 0.6f;
13940 }
13941 else if (type == 488)
13942 {
13943 num = 0.3f;
13944 num3 = 0.25f;
13945 num2 = 0f;
13946 }
13947 else if (type == 92)
13948 {
13949 num2 *= 0.6f;
13950 num *= 0.8f;
13951 }
13952 else if (type == 93)
13953 {
13954 num2 *= 1f;
13955 num *= 1f;
13956 num3 *= 0.01f;
13957 }
13958 else if (type == 12 || type == 955)
13959 {
13960 num *= 0.9f;
13961 num2 *= 0.8f;
13962 num3 *= 0.1f;
13963 }
13964 else if (type == 14 || type == 110 || type == 180 || type == 242 || type == 302)
13965 {
13966 num2 *= 0.7f;
13967 num3 *= 0.1f;
13968 }
13969 else if (type == 981)
13970 {
13971 num2 *= 0.7f;
13972 num3 *= 0.7f;
13973 }
13974 else if (type == 15)
13975 {
13976 num2 *= 0.4f;
13977 num3 *= 0.1f;
13978 num = 1f;
13979 }
13980 else if (type == 16)
13981 {
13982 num *= 0.1f;
13983 num2 *= 0.4f;
13984 num3 = 1f;
13985 }
13986 else if (type == 18)
13987 {
13988 num2 *= 0.1f;
13989 num *= 0.6f;
13990 }
13991 else if (type == 19)
13992 {
13993 num2 *= 0.5f;
13994 num3 *= 0.1f;
13995 }
13996 else if (type == 20)
13997 {
13998 num *= 0.1f;
13999 num3 *= 0.3f;
14000 }
14001 else if (type == 22)
14002 {
14003 num = 0f;
14004 num2 = 0f;
14005 }
14006 else if (type == 27)
14007 {
14008 num *= 0f;
14009 num2 *= 0.3f;
14010 num3 = 1f;
14011 }
14012 else if (type == 34)
14013 {
14014 num2 *= 0.1f;
14015 num3 *= 0.1f;
14016 }
14017 else if (type == 36)
14018 {
14019 num = 0.8f;
14020 num2 *= 0.2f;
14021 num3 *= 0.6f;
14022 }
14023 else if (type == 41)
14024 {
14025 num2 *= 0.8f;
14026 num3 *= 0.6f;
14027 }
14028 else if (type == 44 || type == 45)
14029 {
14030 num3 = 1f;
14031 num *= 0.6f;
14032 num2 *= 0.1f;
14033 }
14034 else if (type == 50)
14035 {
14036 num *= 0.7f;
14037 num3 *= 0.8f;
14038 }
14039 else if (type == 515)
14040 {
14041 num2 *= 0.6f;
14042 num3 *= 0.85f;
14043 }
14044 else if (type == 870)
14045 {
14046 num *= 0.9f;
14047 num2 = 0.35f;
14048 }
14049 else if (type == 53)
14050 {
14051 num *= 0.7f;
14052 num2 *= 0.8f;
14053 }
14054 else if (type == 473)
14055 {
14056 num *= 1.05f;
14057 num2 *= 0.95f;
14058 num3 *= 0.55f;
14059 }
14060 else if (type == 72)
14061 {
14062 num *= 0.45f;
14063 num2 *= 0.75f;
14064 num3 = 1f;
14065 }
14066 else if (type == 86)
14067 {
14068 num *= 1f;
14069 num2 *= 0.45f;
14070 num3 = 0.75f;
14071 }
14072 else if (type == 87)
14073 {
14074 num *= 0.45f;
14075 num2 = 1f;
14076 num3 *= 0.75f;
14077 }
14078 else if (type == 73)
14079 {
14080 num *= 0.4f;
14081 num2 *= 0.6f;
14082 num3 *= 1f;
14083 }
14084 else if (type == 74)
14085 {
14086 num *= 1f;
14087 num2 *= 0.4f;
14088 num3 *= 0.6f;
14089 }
14090 else if (type == 284)
14091 {
14092 num *= 1f;
14093 num2 *= 0.1f;
14094 num3 *= 0.8f;
14095 }
14096 else if (type == 285)
14097 {
14098 num *= 0.1f;
14099 num2 *= 0.5f;
14100 num3 *= 1f;
14101 }
14102 else if (type == 286)
14103 {
14104 num *= 1f;
14105 num2 *= 0.5f;
14106 num3 *= 0.1f;
14107 }
14108 else if (type == 287)
14109 {
14110 num *= 0.9f;
14111 num2 *= 1f;
14112 num3 *= 0.4f;
14113 }
14114 else if (type == 283)
14115 {
14116 num *= 0.8f;
14117 num2 *= 0.1f;
14118 }
14119 else if (type == 76 || type == 77 || type == 78)
14120 {
14121 num *= 1f;
14122 num2 *= 0.3f;
14123 num3 *= 0.6f;
14124 }
14125 else if (type == 79)
14126 {
14127 num = (float)Main.DiscoR / 255f;
14128 num2 = (float)Main.DiscoG / 255f;
14129 num3 = (float)Main.DiscoB / 255f;
14130 }
14131 else if (type == 80)
14132 {
14133 num *= 0f;
14134 num2 *= 0.8f;
14135 num3 *= 1f;
14136 }
14137 else if (type == 83 || type == 88)
14138 {
14139 num *= 0.7f;
14140 num2 *= 0f;
14141 num3 *= 1f;
14142 }
14143 else if (type == 100)
14144 {
14145 num *= 1f;
14146 num2 *= 0.5f;
14147 num3 *= 0f;
14148 }
14149 else if (type == 84 || type == 389)
14150 {
14151 num *= 0.8f;
14152 num2 *= 0f;
14153 num3 *= 0.5f;
14154 }
14155 else if (type == 89 || type == 90)
14156 {
14157 num2 *= 0.2f;
14158 num3 *= 1f;
14159 num *= 0.05f;
14160 }
14161 else if (type == 106)
14162 {
14163 num *= 0f;
14164 num2 *= 0.5f;
14165 num3 *= 1f;
14166 }
14167 else if (type == 113)
14168 {
14169 num *= 0.25f;
14170 num2 *= 0.75f;
14171 num3 *= 1f;
14172 }
14173 else if (type == 114 || type == 115)
14174 {
14175 num *= 0.5f;
14176 num2 *= 0.05f;
14177 num3 *= 1f;
14178 }
14179 else if (type == 116)
14180 {
14181 num3 *= 0.25f;
14182 }
14183 else if (type == 131)
14184 {
14185 num *= 0.1f;
14186 num2 *= 0.4f;
14187 }
14188 else if (type == 132 || type == 157)
14189 {
14190 num *= 0.2f;
14191 num3 *= 0.6f;
14192 }
14193 else if (type == 156)
14194 {
14195 num *= 1f;
14196 num3 *= 0.6f;
14197 num2 = 0f;
14198 }
14199 else if (type == 173)
14200 {
14201 num *= 0.3f;
14202 num3 *= 1f;
14203 num2 = 0.4f;
14204 }
14205 else if (type == 207)
14206 {
14207 num *= 0.4f;
14208 num3 *= 0.4f;
14209 }
14210 else if (type == 253)
14211 {
14212 num = 0f;
14213 num2 *= 0.4f;
14214 }
14215 else if (type == 211)
14216 {
14217 num *= 0.5f;
14218 num2 *= 0.9f;
14219 num3 *= 1f;
14220 if (localAI[0] == 0f)
14221 {
14222 light = 1.5f;
14223 }
14224 else
14225 {
14226 light = 1f;
14227 }
14228 }
14229 else if (type == 209)
14230 {
14231 float num6 = (255f - (float)alpha) / 255f;
14232 num *= 0.3f;
14233 num2 *= 0.4f;
14234 num3 *= 1.75f;
14235 num3 *= num6;
14236 num *= num6;
14237 num2 *= num6;
14238 }
14239 else if (type == 226 || ((type == 221) | (type == 229)))
14240 {
14241 num *= 0.25f;
14242 num2 *= 1f;
14243 num3 *= 0.5f;
14244 }
14245 else if (type == 251)
14246 {
14247 num = (float)Main.DiscoR / 255f;
14248 num2 = (float)Main.DiscoG / 255f;
14249 num3 = (float)Main.DiscoB / 255f;
14250 num = (num + 1f) / 2f;
14251 num2 = (num2 + 1f) / 2f;
14252 num3 = (num3 + 1f) / 2f;
14253 num *= light;
14254 num2 *= light;
14255 num3 *= light;
14256 }
14257 else if (type == 278 || type == 279)
14258 {
14259 num *= 1f;
14260 num2 *= 1f;
14261 num3 *= 0f;
14262 }
14263 if (type == 870)
14264 {
14265 Vector3 rgb = (DelegateMethods.v3_1 = new Vector3(num, num2, num3));
14266 Point p = base.Center.ToTileCoordinates();
14267 DelegateMethods.v2_1 = p.ToVector2();
14268 DelegateMethods.f_1 = 4.5f;
14270 Lighting.AddLight(base.Center, rgb);
14271 }
14272 else
14273 {
14274 Lighting.AddLight((int)((position.X + (float)(width / 2)) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), num, num2, num3);
14275 }
14276 }
14277
14279 {
14280 return new Rectangle((int)position.X, (int)position.Y, width, height);
14281 }
14282
14283 public void Update(int i)
14284 {
14285 if (!active)
14286 {
14287 return;
14288 }
14289 if (Main.netMode == 1 && (ProjectileID.Sets.IsAGolfBall[type] || type == 820))
14290 {
14291 int num = (int)(position.X + (float)(width / 2)) / 16;
14292 int num2 = (int)(position.Y + (float)(height / 2)) / 16;
14293 if (Main.tile[num, num2] == null)
14294 {
14295 return;
14296 }
14297 }
14299 while (numUpdates >= 0)
14300 {
14301 numUpdates--;
14302 if (type == 640 && ai[1] > 0f)
14303 {
14304 ai[1] -= 1f;
14305 continue;
14306 }
14307 if (position.X <= Main.leftWorld || position.X + (float)width >= Main.rightWorld || position.Y <= Main.topWorld || position.Y + (float)height >= Main.bottomWorld)
14308 {
14309 active = false;
14310 return;
14311 }
14313 {
14315 }
14316 if (numUpdates == -1 && (minion || sentry))
14317 {
14318 Player player = Main.player[owner];
14319 damage = (int)((float)originalDamage * player.minionDamage + 5E-06f);
14320 }
14321 if (minion && numUpdates == -1 && type != 625 && type != 628)
14322 {
14323 minionPos = Main.player[owner].numMinions;
14324 if (Main.player[owner].slotsMinions + minionSlots > (float)Main.player[owner].maxMinions && owner == Main.myPlayer)
14325 {
14326 if ((type == 627 || type == 626) && owner == Main.myPlayer)
14327 {
14328 int byUUID = GetByUUID(owner, ai[0]);
14329 if (byUUID != -1)
14330 {
14331 Projectile projectile = Main.projectile[byUUID];
14332 if (projectile.type != 625)
14333 {
14334 projectile.localAI[1] = localAI[1];
14335 }
14336 projectile = Main.projectile[(int)localAI[1]];
14337 projectile.ai[0] = ai[0];
14338 projectile.ai[1] = 1f;
14339 projectile.netUpdate = true;
14340 }
14341 }
14342 Kill();
14343 }
14344 else
14345 {
14346 Main.player[owner].numMinions++;
14347 Main.player[owner].slotsMinions += minionSlots;
14348 }
14349 }
14350 float num3 = 1f + Math.Abs(velocity.X) / 3f;
14351 if (gfxOffY > 0f)
14352 {
14353 gfxOffY -= num3 * stepSpeed;
14354 if (gfxOffY < 0f)
14355 {
14356 gfxOffY = 0f;
14357 }
14358 }
14359 else if (gfxOffY < 0f)
14360 {
14361 gfxOffY += num3 * stepSpeed;
14362 if (gfxOffY > 0f)
14363 {
14364 gfxOffY = 0f;
14365 }
14366 }
14367 if (gfxOffY > 16f)
14368 {
14369 gfxOffY = 16f;
14370 }
14371 if (gfxOffY < -16f)
14372 {
14373 gfxOffY = -16f;
14374 }
14377 whoAmI = i;
14378 if (soundDelay > 0)
14379 {
14380 soundDelay--;
14381 }
14382 netUpdate = false;
14383 for (int j = 0; j < 255; j++)
14384 {
14385 if (playerImmune[j] > 0)
14386 {
14387 playerImmune[j]--;
14388 }
14389 }
14391 {
14392 for (int k = 0; k < 200; k++)
14393 {
14394 if (localNPCImmunity[k] > 0)
14395 {
14397 }
14398 }
14399 }
14400 AI();
14401 if (ShouldUseWindPhysics() && (double)base.Center.Y < Main.worldSurface * 16.0 && Main.tile[(int)base.Center.X / 16, (int)base.Center.Y / 16] != null && Main.tile[(int)base.Center.X / 16, (int)base.Center.Y / 16].wall == 0 && ((velocity.X > 0f && Main.windSpeedCurrent < 0f) || (velocity.X < 0f && Main.windSpeedCurrent > 0f) || Math.Abs(velocity.X) < Math.Abs(Main.windSpeedCurrent * Main.windPhysicsStrength) * 180f) && Math.Abs(velocity.X) < 16f)
14402 {
14403 velocity.X += Main.windSpeedCurrent * Main.windPhysicsStrength;
14404 MathHelper.Clamp(velocity.X, -16f, 16f);
14405 }
14406 if (owner < 255 && !Main.player[owner].active)
14407 {
14408 Kill();
14409 }
14410 if (type == 242 || type == 302 || type == 638)
14411 {
14412 wet = false;
14413 }
14414 if (!ignoreWater)
14415 {
14416 bool flag;
14417 bool flag2;
14418 try
14419 {
14422 if (flag)
14423 {
14424 lavaWet = true;
14425 }
14426 if (Collision.honey)
14427 {
14428 honeyWet = true;
14429 }
14430 if (Collision.shimmer)
14431 {
14432 shimmerWet = true;
14433 }
14434 }
14435 catch
14436 {
14437 active = false;
14438 return;
14439 }
14440 if (wet && !lavaWet)
14441 {
14442 if (type == 85 || type == 15 || type == 188)
14443 {
14444 Kill();
14445 }
14446 if (type == 2)
14447 {
14448 type = 1;
14449 light = 0f;
14450 }
14451 }
14452 if (type == 34)
14453 {
14454 if (wet && !lavaWet)
14455 {
14456 Kill();
14457 }
14458 if (lavaWet)
14459 {
14460 flag2 = (wet = (lavaWet = false));
14461 }
14462 }
14463 if (type == 80)
14464 {
14465 flag2 = false;
14466 wet = false;
14467 if (flag && ai[0] >= 0f)
14468 {
14469 Kill();
14470 }
14471 }
14472 if (flag2)
14473 {
14474 if (type != 155 && wetCount == 0 && !wet)
14475 {
14476 if (!flag)
14477 {
14478 if (shimmerWet)
14479 {
14480 for (int l = 0; l < 10; l++)
14481 {
14482 int num4 = Dust.NewDust(new Vector2(position.X - 6f, position.Y + (float)(height / 2) - 8f), width + 12, 24, 308);
14483 Main.dust[num4].velocity.Y -= 4f;
14484 Main.dust[num4].velocity.X *= 2.5f;
14485 Main.dust[num4].scale = 1.3f;
14486 Main.dust[num4].noGravity = true;
14487 switch (Main.rand.Next(6))
14488 {
14489 case 0:
14490 Main.dust[num4].color = new Color(255, 255, 210);
14491 break;
14492 case 1:
14493 Main.dust[num4].color = new Color(190, 245, 255);
14494 break;
14495 case 2:
14496 Main.dust[num4].color = new Color(255, 150, 255);
14497 break;
14498 default:
14499 Main.dust[num4].color = new Color(190, 175, 255);
14500 break;
14501 }
14502 SoundEngine.PlaySound(19, (int)position.X, (int)position.Y, 4);
14503 }
14504 }
14505 else if (honeyWet)
14506 {
14507 for (int m = 0; m < 10; m++)
14508 {
14509 int num5 = Dust.NewDust(new Vector2(position.X - 6f, position.Y + (float)(height / 2) - 8f), width + 12, 24, 152);
14510 Main.dust[num5].velocity.Y -= 1f;
14511 Main.dust[num5].velocity.X *= 2.5f;
14512 Main.dust[num5].scale = 1.3f;
14513 Main.dust[num5].alpha = 100;
14514 Main.dust[num5].noGravity = true;
14515 }
14516 SoundEngine.PlaySound(19, (int)position.X, (int)position.Y);
14517 }
14518 else
14519 {
14520 for (int n = 0; n < 10; n++)
14521 {
14522 int num6 = Dust.NewDust(new Vector2(position.X - 6f, position.Y + (float)(height / 2) - 8f), width + 12, 24, Dust.dustWater());
14523 Main.dust[num6].velocity.Y -= 4f;
14524 Main.dust[num6].velocity.X *= 2.5f;
14525 Main.dust[num6].scale = 1.3f;
14526 Main.dust[num6].alpha = 100;
14527 Main.dust[num6].noGravity = true;
14528 }
14529 SoundEngine.PlaySound(19, (int)position.X, (int)position.Y);
14530 }
14531 }
14532 else
14533 {
14534 for (int num7 = 0; num7 < 10; num7++)
14535 {
14536 int num8 = Dust.NewDust(new Vector2(position.X - 6f, position.Y + (float)(height / 2) - 8f), width + 12, 24, 35);
14537 Main.dust[num8].velocity.Y -= 1.5f;
14538 Main.dust[num8].velocity.X *= 2.5f;
14539 Main.dust[num8].scale = 1.3f;
14540 Main.dust[num8].alpha = 100;
14541 Main.dust[num8].noGravity = true;
14542 }
14543 SoundEngine.PlaySound(19, (int)position.X, (int)position.Y);
14544 }
14545 }
14546 wet = true;
14547 }
14548 else if (wet)
14549 {
14550 wet = false;
14551 if (type == 155)
14552 {
14553 velocity.Y *= 0.5f;
14554 }
14555 else if (wetCount == 0)
14556 {
14557 wetCount = 10;
14558 if (!lavaWet)
14559 {
14560 if (shimmerWet)
14561 {
14562 for (int num9 = 0; num9 < 10; num9++)
14563 {
14564 int num10 = Dust.NewDust(new Vector2(position.X - 6f, position.Y + (float)(height / 2) - 8f), width + 12, 24, 308);
14565 Main.dust[num10].velocity.Y -= 4f;
14566 Main.dust[num10].velocity.X *= 2.5f;
14567 Main.dust[num10].scale = 1.3f;
14568 Main.dust[num10].noGravity = true;
14569 switch (Main.rand.Next(6))
14570 {
14571 case 0:
14572 Main.dust[num10].color = new Color(255, 255, 210);
14573 break;
14574 case 1:
14575 Main.dust[num10].color = new Color(190, 245, 255);
14576 break;
14577 case 2:
14578 Main.dust[num10].color = new Color(255, 150, 255);
14579 break;
14580 default:
14581 Main.dust[num10].color = new Color(190, 175, 255);
14582 break;
14583 }
14584 SoundEngine.PlaySound(19, (int)position.X, (int)position.Y, 5);
14585 }
14586 }
14587 else if (honeyWet)
14588 {
14589 for (int num11 = 0; num11 < 10; num11++)
14590 {
14591 int num12 = Dust.NewDust(new Vector2(position.X - 6f, position.Y + (float)(height / 2) - 8f), width + 12, 24, 152);
14592 Main.dust[num12].velocity.Y -= 1f;
14593 Main.dust[num12].velocity.X *= 2.5f;
14594 Main.dust[num12].scale = 1.3f;
14595 Main.dust[num12].alpha = 100;
14596 Main.dust[num12].noGravity = true;
14597 }
14598 SoundEngine.PlaySound(19, (int)position.X, (int)position.Y);
14599 }
14600 else
14601 {
14602 for (int num13 = 0; num13 < 10; num13++)
14603 {
14604 int num14 = Dust.NewDust(new Vector2(position.X - 6f, position.Y + (float)(height / 2)), width + 12, 24, Dust.dustWater());
14605 Main.dust[num14].velocity.Y -= 4f;
14606 Main.dust[num14].velocity.X *= 2.5f;
14607 Main.dust[num14].scale = 1.3f;
14608 Main.dust[num14].alpha = 100;
14609 Main.dust[num14].noGravity = true;
14610 }
14611 SoundEngine.PlaySound(19, (int)position.X, (int)position.Y);
14612 }
14613 }
14614 else
14615 {
14616 for (int num15 = 0; num15 < 10; num15++)
14617 {
14618 int num16 = Dust.NewDust(new Vector2(position.X - 6f, position.Y + (float)(height / 2) - 8f), width + 12, 24, 35);
14619 Main.dust[num16].velocity.Y -= 1.5f;
14620 Main.dust[num16].velocity.X *= 2.5f;
14621 Main.dust[num16].scale = 1.3f;
14622 Main.dust[num16].alpha = 100;
14623 Main.dust[num16].noGravity = true;
14624 }
14625 SoundEngine.PlaySound(19, (int)position.X, (int)position.Y);
14626 }
14627 }
14628 }
14629 if (!wet)
14630 {
14631 lavaWet = false;
14632 honeyWet = false;
14633 shimmerWet = false;
14634 }
14635 if (wetCount > 0)
14636 {
14637 wetCount--;
14638 }
14639 }
14640 if (shimmerWet)
14641 {
14642 Shimmer();
14643 }
14648 {
14649 if (velocity.X < 0f)
14650 {
14651 direction = -1;
14652 }
14653 else
14654 {
14655 direction = 1;
14656 }
14657 }
14658 if (!active)
14659 {
14660 return;
14661 }
14662 ProjLight();
14663 if (!npcProj && friendly && Main.player[owner].magicQuiver && extraUpdates < 1 && arrow)
14664 {
14665 extraUpdates = 1;
14666 }
14667 if (type == 2 || type == 82)
14668 {
14669 Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100);
14670 }
14671 else if (type == 172)
14672 {
14673 Dust.NewDust(new Vector2(position.X, position.Y), width, height, 135, 0f, 0f, 100);
14674 }
14675 else if (type == 103)
14676 {
14677 int num17 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 75, 0f, 0f, 100);
14678 if (Main.rand.Next(2) == 0)
14679 {
14680 Main.dust[num17].noGravity = true;
14681 Main.dust[num17].scale *= 2f;
14682 }
14683 }
14684 else if (type == 278)
14685 {
14686 int num18 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 169, 0f, 0f, 100);
14687 if (Main.rand.Next(2) == 0)
14688 {
14689 Main.dust[num18].noGravity = true;
14690 Main.dust[num18].scale *= 1.5f;
14691 }
14692 }
14693 else if (type == 4)
14694 {
14695 if (Main.rand.Next(5) == 0)
14696 {
14697 Dust.NewDust(new Vector2(position.X, position.Y), width, height, 14, 0f, 0f, 150, default(Color), 1.1f);
14698 }
14699 }
14700 else if (type == 5)
14701 {
14702 int num19 = Main.rand.Next(3);
14704 {
14705 0 => 15,
14706 1 => 57,
14707 _ => 58,
14708 }, velocity.X * 0.5f, velocity.Y * 0.5f, 150, default(Color), 1.2f);
14709 }
14710 Damage();
14711 if (type == 434 && localAI[0] == 0f && numUpdates == 0)
14712 {
14713 extraUpdates = 1;
14715 localAI[0] = 1f;
14716 localAI[1] = 0.9999f;
14717 netUpdate = true;
14718 }
14719 if (Main.netMode != 1 && (type == 99 || type == 1013 || type == 655 || type == 727 || type == 1014 || type == 1021))
14720 {
14722 }
14724 {
14725 for (int num20 = oldPos.Length - 1; num20 > 0; num20--)
14726 {
14727 oldPos[num20] = oldPos[num20 - 1];
14728 }
14729 oldPos[0] = position;
14730 }
14731 else if (ProjectileID.Sets.TrailingMode[type] == 1)
14732 {
14733 if (frameCounter == 0 || oldPos[0] == Vector2.Zero)
14734 {
14735 for (int num21 = oldPos.Length - 1; num21 > 0; num21--)
14736 {
14737 oldPos[num21] = oldPos[num21 - 1];
14738 }
14739 oldPos[0] = position;
14740 if (velocity == Vector2.Zero && type == 466)
14741 {
14742 float num22 = rotation + (float)Math.PI / 2f + ((Main.rand.Next(2) == 1) ? (-1f) : 1f) * ((float)Math.PI / 2f);
14743 float num23 = (float)Main.rand.NextDouble() * 2f + 2f;
14744 Vector2 vector = new Vector2((float)Math.Cos(num22) * num23, (float)Math.Sin(num22) * num23);
14745 int num24 = Dust.NewDust(oldPos[oldPos.Length - 1], 0, 0, 229, vector.X, vector.Y);
14746 Main.dust[num24].noGravity = true;
14747 Main.dust[num24].scale = 1.7f;
14748 }
14749 if (velocity == Vector2.Zero && type == 580)
14750 {
14751 float num25 = rotation + (float)Math.PI / 2f + ((Main.rand.Next(2) == 1) ? (-1f) : 1f) * ((float)Math.PI / 2f);
14752 float num26 = (float)Main.rand.NextDouble() * 2f + 2f;
14753 Vector2 vector2 = new Vector2((float)Math.Cos(num25) * num26, (float)Math.Sin(num25) * num26);
14754 int num27 = Dust.NewDust(oldPos[oldPos.Length - 1], 0, 0, 229, vector2.X, vector2.Y);
14755 Main.dust[num27].noGravity = true;
14756 Main.dust[num27].scale = 1.7f;
14757 }
14758 }
14759 }
14760 else if (ProjectileID.Sets.TrailingMode[type] == 2)
14761 {
14762 for (int num28 = oldPos.Length - 1; num28 > 0; num28--)
14763 {
14764 oldPos[num28] = oldPos[num28 - 1];
14765 oldRot[num28] = oldRot[num28 - 1];
14767 }
14768 oldPos[0] = position;
14769 oldRot[0] = rotation;
14771 }
14772 else if (ProjectileID.Sets.TrailingMode[type] == 3)
14773 {
14774 for (int num29 = oldPos.Length - 1; num29 > 0; num29--)
14775 {
14776 oldPos[num29] = oldPos[num29 - 1];
14777 oldRot[num29] = oldRot[num29 - 1];
14779 }
14780 oldPos[0] = position;
14781 oldRot[0] = rotation;
14783 float amount = 0.65f;
14784 int num30 = 1;
14785 for (int num31 = 0; num31 < num30; num31++)
14786 {
14787 for (int num32 = oldPos.Length - 1; num32 > 0; num32--)
14788 {
14789 if (!(oldPos[num32] == Vector2.Zero))
14790 {
14791 if (oldPos[num32].Distance(oldPos[num32 - 1]) > 2f)
14792 {
14794 }
14795 oldRot[num32] = (oldPos[num32 - 1] - oldPos[num32]).SafeNormalize(Vector2.Zero).ToRotation();
14796 }
14797 }
14798 }
14799 }
14800 else if (ProjectileID.Sets.TrailingMode[type] == 4)
14801 {
14802 Vector2 vector3 = Main.player[owner].position - Main.player[owner].oldPosition;
14803 for (int num33 = oldPos.Length - 1; num33 > 0; num33--)
14804 {
14805 oldPos[num33] = oldPos[num33 - 1];
14806 oldRot[num33] = oldRot[num33 - 1];
14808 if (numUpdates == 0 && oldPos[num33] != Vector2.Zero)
14809 {
14810 oldPos[num33] += vector3;
14811 }
14812 }
14813 oldPos[0] = position;
14814 oldRot[0] = rotation;
14816 }
14817 else if (ProjectileID.Sets.TrailingMode[type] == 5)
14818 {
14819 for (int num34 = oldPos.Length - 1; num34 > 0; num34--)
14820 {
14821 oldPos[num34] = oldPos[num34 - 1];
14822 oldRot[num34] = oldRot[num34 - 1];
14824 }
14825 oldPos[0] = position;
14826 oldRot[0] = velocity.ToRotation();
14828 }
14830 {
14831 timeLeft++;
14832 }
14833 timeLeft--;
14834 if (timeLeft <= 0)
14835 {
14836 Kill();
14837 }
14838 if (penetrate == 0)
14839 {
14840 Kill();
14841 }
14842 if (!active || owner != Main.myPlayer)
14843 {
14844 continue;
14845 }
14846 if (netUpdate2)
14847 {
14848 netUpdate = true;
14849 }
14850 if (!active)
14851 {
14852 netSpam = 0;
14853 }
14854 if (netUpdate)
14855 {
14856 if (netSpam < 60)
14857 {
14858 netSpam += 5;
14859 NetMessage.SendData(27, -1, -1, null, i);
14860 netUpdate2 = false;
14861 }
14862 else
14863 {
14864 netUpdate2 = true;
14865 }
14866 }
14867 if (netSpam > 0)
14868 {
14869 netSpam--;
14870 }
14871 }
14872 netUpdate = false;
14873 }
14874
14876 {
14877 if ((aiStyle != 3 || ai[0] != 1f) && (aiStyle != 7 || ai[0] != 1f) && (aiStyle != 13 || ai[0] != 1f) && aiStyle != 65 && aiStyle != 69 && aiStyle != 114 && aiStyle != 123 && aiStyle != 112 && !manualDirectionChange && aiStyle != 67 && aiStyle != 26 && aiStyle != 15)
14878 {
14879 return aiStyle != 150;
14880 }
14881 return false;
14882 }
14883
14885 {
14886 if (npcProj)
14887 {
14888 return;
14889 }
14891 int boxWidth = width;
14892 int boxHeight = height;
14893 if (aiStyle == 190 || aiStyle == 191)
14894 {
14895 for (float num = -(float)Math.PI / 4f; num <= (float)Math.PI / 4f; num += (float)Math.PI / 2f)
14896 {
14897 Rectangle r = Utils.CenteredRectangle(base.Center + (rotation + num).ToRotationVector2() * 70f * scale, new Vector2(60f * scale, 60f * scale));
14898 EmitEnchantmentVisualsAt(r.TopLeft(), r.Width, r.Height);
14899 }
14900 }
14901 else if (ProjectileID.Sets.IsAWhip[type])
14902 {
14905 Vector2 vector = WhipPointsForCollision[WhipPointsForCollision.Count - 1];
14906 EmitEnchantmentVisualsAt(new Vector2(vector.X - (float)(width / 2), vector.Y - (float)(height / 2)), width, height);
14907 }
14908 else
14909 {
14911 }
14912 }
14913
14915 {
14916 Player player = Main.player[owner];
14917 if (player.frostBurn && (melee || ranged) && friendly && !hostile && !noEnchantments && Main.rand.Next(2 * (1 + extraUpdates)) == 0)
14918 {
14919 int num = Dust.NewDust(boxPosition, boxWidth, boxHeight, 135, velocity.X * 0.2f + (float)(direction * 3), velocity.Y * 0.2f, 100, default(Color), 2f);
14920 Main.dust[num].noGravity = true;
14921 Main.dust[num].velocity *= 0.7f;
14922 Main.dust[num].velocity.Y -= 0.5f;
14923 }
14924 if (melee && player.magmaStone && !noEnchantments && Main.rand.Next(3) != 0)
14925 {
14926 int num2 = Dust.NewDust(new Vector2(boxPosition.X - 4f, boxPosition.Y - 4f), boxWidth + 8, boxHeight + 8, 6, velocity.X * 0.2f, velocity.Y * 0.2f, 100, default(Color), 2f);
14927 if (Main.rand.Next(2) == 0)
14928 {
14929 Main.dust[num2].scale = 1.5f;
14930 }
14931 Main.dust[num2].noGravity = true;
14932 Main.dust[num2].velocity.X *= 2f;
14933 Main.dust[num2].velocity.Y *= 2f;
14934 }
14935 if ((!melee && !ProjectileID.Sets.IsAWhip[type]) || player.meleeEnchant <= 0 || noEnchantments)
14936 {
14937 return;
14938 }
14939 if (player.meleeEnchant == 1 && Main.rand.Next(3) == 0)
14940 {
14941 int num3 = Dust.NewDust(boxPosition, boxWidth, boxHeight, 171, 0f, 0f, 100);
14942 Main.dust[num3].noGravity = true;
14943 Main.dust[num3].fadeIn = 1.5f;
14944 Main.dust[num3].velocity *= 0.25f;
14945 }
14946 if (player.meleeEnchant == 1)
14947 {
14948 if (Main.rand.Next(3) == 0)
14949 {
14950 int num4 = Dust.NewDust(boxPosition, boxWidth, boxHeight, 171, 0f, 0f, 100);
14951 Main.dust[num4].noGravity = true;
14952 Main.dust[num4].fadeIn = 1.5f;
14953 Main.dust[num4].velocity *= 0.25f;
14954 }
14955 }
14956 else if (player.meleeEnchant == 2)
14957 {
14958 if (Main.rand.Next(2) == 0)
14959 {
14960 int num5 = Dust.NewDust(boxPosition, boxWidth, boxHeight, 75, velocity.X * 0.2f + (float)(direction * 3), velocity.Y * 0.2f, 100, default(Color), 2.5f);
14961 Main.dust[num5].noGravity = true;
14962 Main.dust[num5].velocity *= 0.7f;
14963 Main.dust[num5].velocity.Y -= 0.5f;
14964 }
14965 }
14966 else if (player.meleeEnchant == 3)
14967 {
14968 if (Main.rand.Next(2) == 0)
14969 {
14970 int num6 = Dust.NewDust(boxPosition, boxWidth, boxHeight, 6, velocity.X * 0.2f + (float)(direction * 3), velocity.Y * 0.2f, 100, default(Color), 2.5f);
14971 Main.dust[num6].noGravity = true;
14972 Main.dust[num6].velocity *= 0.7f;
14973 Main.dust[num6].velocity.Y -= 0.5f;
14974 }
14975 }
14976 else if (player.meleeEnchant == 4)
14977 {
14978 int num7 = 0;
14979 if (Main.rand.Next(2) == 0)
14980 {
14981 num7 = Dust.NewDust(boxPosition, boxWidth, boxHeight, 57, velocity.X * 0.2f + (float)(direction * 3), velocity.Y * 0.2f, 100, default(Color), 1.1f);
14982 Main.dust[num7].noGravity = true;
14983 Main.dust[num7].velocity.X /= 2f;
14984 Main.dust[num7].velocity.Y /= 2f;
14985 }
14986 }
14987 else if (player.meleeEnchant == 5)
14988 {
14989 if (Main.rand.Next(2) == 0)
14990 {
14991 int num8 = Dust.NewDust(boxPosition, boxWidth, boxHeight, 169, 0f, 0f, 100);
14992 Main.dust[num8].velocity.X += direction;
14993 Main.dust[num8].velocity.Y += 0.2f;
14994 Main.dust[num8].noGravity = true;
14995 }
14996 }
14997 else if (player.meleeEnchant == 6)
14998 {
14999 if (Main.rand.Next(2) == 0)
15000 {
15001 int num9 = Dust.NewDust(boxPosition, boxWidth, boxHeight, 135, 0f, 0f, 100);
15002 Main.dust[num9].velocity.X += direction;
15003 Main.dust[num9].velocity.Y += 0.2f;
15004 Main.dust[num9].noGravity = true;
15005 }
15006 }
15007 else if (player.meleeEnchant == 7)
15008 {
15010 if (vector.Length() > 4f)
15011 {
15012 vector *= 4f / vector.Length();
15013 }
15014 if (Main.rand.Next(20) == 0)
15015 {
15016 int num10 = Main.rand.Next(139, 143);
15017 int num11 = Dust.NewDust(boxPosition, boxWidth, boxHeight, num10, vector.X, vector.Y, 0, default(Color), 1.2f);
15018 Main.dust[num11].velocity.X *= 1f + (float)Main.rand.Next(-50, 51) * 0.01f;
15019 Main.dust[num11].velocity.Y *= 1f + (float)Main.rand.Next(-50, 51) * 0.01f;
15020 Main.dust[num11].velocity.X += (float)Main.rand.Next(-50, 51) * 0.05f;
15021 Main.dust[num11].velocity.Y += (float)Main.rand.Next(-50, 51) * 0.05f;
15022 Main.dust[num11].scale *= 1f + (float)Main.rand.Next(-30, 31) * 0.01f;
15023 }
15024 if (Main.rand.Next(40) == 0)
15025 {
15026 int num12 = Main.rand.Next(276, 283);
15028 Main.gore[num13].velocity.X *= 1f + (float)Main.rand.Next(-50, 51) * 0.01f;
15029 Main.gore[num13].velocity.Y *= 1f + (float)Main.rand.Next(-50, 51) * 0.01f;
15030 Main.gore[num13].scale *= 1f + (float)Main.rand.Next(-20, 21) * 0.01f;
15031 Main.gore[num13].velocity.X += (float)Main.rand.Next(-50, 51) * 0.05f;
15032 Main.gore[num13].velocity.Y += (float)Main.rand.Next(-50, 51) * 0.05f;
15033 }
15034 }
15035 else if (player.meleeEnchant == 8 && Main.rand.Next(4) == 0)
15036 {
15037 int num14 = Dust.NewDust(boxPosition, boxWidth, boxHeight, 46, 0f, 0f, 100);
15038 Main.dust[num14].noGravity = true;
15039 Main.dust[num14].fadeIn = 1.5f;
15040 Main.dust[num14].velocity *= 0.25f;
15041 }
15042 }
15043
15045 {
15046 bool flag = false;
15047 overrideWidth = -1;
15048 overrideHeight = -1;
15049 bool flag2 = false;
15051 bool flag4 = flag3.HasValue && !flag3.Value;
15052 bool flag5 = flag3.HasValue && flag3.Value;
15053 if (tileCollide)
15054 {
15056 bool flag6 = true;
15057 Vector2? vector = null;
15058 if (Main.projPet[type])
15059 {
15060 flag6 = false;
15061 if (Main.player[owner].position.Y + (float)Main.player[owner].height - 12f > position.Y + (float)height)
15062 {
15063 flag6 = true;
15064 }
15065 }
15066 if (type == 500)
15067 {
15068 flag6 = false;
15069 if (Main.player[owner].Bottom.Y > base.Bottom.Y + 4f)
15070 {
15071 flag6 = true;
15072 }
15073 }
15074 if (type == 653 || type == 668)
15075 {
15076 flag6 = false;
15077 if (Main.player[owner].Bottom.Y > base.Bottom.Y + 4f)
15078 {
15079 flag6 = true;
15080 }
15081 }
15082 if (aiStyle == 62)
15083 {
15084 flag6 = true;
15085 }
15086 if (aiStyle == 66)
15087 {
15088 flag6 = true;
15089 }
15090 if (type == 317)
15091 {
15092 flag6 = true;
15093 }
15094 if (type == 373)
15095 {
15096 flag6 = true;
15097 }
15098 if (aiStyle == 53)
15099 {
15100 flag6 = false;
15101 }
15102 if (type == 9 || type == 12 || type == 15 || type == 13)
15103 {
15104 flag6 = false;
15105 }
15107 {
15108 flag6 = false;
15109 }
15110 if (type == 24)
15111 {
15112 flag6 = false;
15113 }
15114 switch (type)
15115 {
15116 case 663:
15117 case 665:
15118 case 667:
15119 case 677:
15120 case 678:
15121 case 679:
15122 case 688:
15123 case 689:
15124 case 690:
15125 case 691:
15126 case 692:
15127 case 693:
15128 flag6 = false;
15129 break;
15130 case 759:
15131 flag6 = true;
15132 break;
15133 case 1020:
15134 {
15135 float num = MathHelper.WrapAngle(rotation);
15136 flag6 = num >= (float)Math.PI / 2f || num < -(float)Math.PI / 2f;
15137 break;
15138 }
15139 }
15141 {
15143 }
15144 if (type == 771 || type == 822 || type == 823 || type == 843 || type == 846 || type == 845 || type == 852)
15145 {
15147 overrideHeight = 34;
15148 vector = new Vector2(0.75f, 0.75f);
15149 }
15150 if (type == 969)
15151 {
15152 overrideWidth = 18;
15153 overrideHeight = 32;
15154 }
15155 if (type == 824 || type == 839 || type == 840 || type == 850 || type == 853)
15156 {
15158 overrideHeight = 58;
15159 vector = new Vector2(0.75f, 0.75f);
15160 }
15161 if (type == 826 || type == 830 || type == 838)
15162 {
15164 overrideHeight = 38;
15165 vector = new Vector2(0.75f, 0.75f);
15166 }
15167 if (type == 828 || type == 829 || type == 827 || type == 844)
15168 {
15170 overrideHeight = 22;
15171 vector = new Vector2(0.75f, 0.75f);
15172 }
15173 if (aiStyle == 29 || type == 28 || aiStyle == 49 || type == 906 || type == 903 || type == 904 || type == 910)
15174 {
15175 overrideWidth = width - 8;
15176 overrideHeight = height - 8;
15177 }
15178 else if (type == 250 || type == 267 || type == 297 || type == 323 || type == 3 || type == 711)
15179 {
15180 overrideWidth = 6;
15181 overrideHeight = 6;
15182 }
15183 else if (type == 308)
15184 {
15185 overrideWidth = 26;
15187 }
15188 else if (type == 663 || type == 665 || type == 667 || type == 677 || type == 678 || type == 679 || type == 691 || type == 692 || type == 693)
15189 {
15190 overrideWidth = 16;
15192 }
15193 else if (type == 688 || type == 689 || type == 690)
15194 {
15195 overrideWidth = 16;
15197 vector = new Vector2(0.5f, 1f);
15198 }
15199 else if (type == 669 || type == 706)
15200 {
15201 overrideWidth = 10;
15202 overrideHeight = 10;
15203 }
15204 else if (type == 261 || type == 277)
15205 {
15206 overrideWidth = 26;
15207 overrideHeight = 26;
15208 }
15209 else if (type == 481 || type == 491 || type == 106 || type == 262 || type == 271 || type == 270 || type == 272 || type == 273 || type == 274 || type == 280 || type == 288 || type == 301 || type == 320 || type == 333 || type == 335 || type == 343 || type == 344 || type == 497 || type == 496 || type == 6 || type == 19 || type == 113 || type == 52 || type == 520 || type == 523 || type == 585 || type == 598 || type == 599 || type == 636 || type == 837 || type == 861 || type == 867 || type == 971 || type == 975 || type == 1000)
15210 {
15211 overrideWidth = 10;
15212 overrideHeight = 10;
15213 }
15214 else if (type == 514)
15215 {
15216 overrideWidth = 4;
15217 overrideHeight = 4;
15218 }
15219 else if (type == 248 || type == 247 || type == 507 || type == 508 || type == 662 || type == 680 || type == 685 || type == 757 || type == 928)
15220 {
15221 overrideWidth = width - 12;
15222 overrideHeight = height - 12;
15223 }
15224 else if (aiStyle == 18 || type == 254)
15225 {
15226 overrideWidth = width - 36;
15227 overrideHeight = height - 36;
15228 }
15229 else if (type == 182 || type == 190 || type == 33 || type == 229 || type == 237 || type == 243 || type == 866)
15230 {
15231 overrideWidth = width - 20;
15232 overrideHeight = height - 20;
15233 }
15234 else if (aiStyle == 27)
15235 {
15236 overrideWidth = width - 12;
15237 overrideHeight = height - 12;
15238 }
15239 else if (type == 533 && ai[0] >= 6f)
15240 {
15241 overrideWidth = width + 6;
15242 overrideHeight = height + 6;
15243 }
15244 else if (type == 755 && ai[0] >= 0f)
15245 {
15246 overrideWidth = width + 6;
15247 overrideHeight = height + 6;
15248 }
15249 else if (type == 759)
15250 {
15251 if (velocity.X != lastVelocity.X)
15252 {
15253 velocity.X = 0f - lastVelocity.X;
15254 }
15255 if (velocity.Y != lastVelocity.Y)
15256 {
15257 velocity.Y = 0f - lastVelocity.Y;
15258 }
15259 }
15260 else if (type == 582 || type == 634 || type == 635 || type == 902)
15261 {
15262 overrideWidth = 8;
15263 overrideHeight = 8;
15264 }
15265 else if (type == 617)
15266 {
15267 overrideWidth = (int)(20f * scale);
15268 overrideHeight = (int)(20f * scale);
15269 }
15270 else if (type == 304)
15271 {
15272 overrideWidth = 4;
15273 overrideHeight = 4;
15274 }
15275 else if (aiStyle == 9)
15276 {
15277 overrideWidth = 4;
15278 overrideHeight = 4;
15279 }
15280 else if (type == 931)
15281 {
15282 overrideWidth = 4;
15283 overrideHeight = 4;
15284 }
15285 if (((type != 440 && type != 449 && type != 606) || ai[1] != 1f) && (type != 466 || localAI[1] != 1f) && (type != 580 || !(localAI[1] > 0f)) && (type != 640 || !(localAI[1] > 0f)))
15286 {
15287 if (aiStyle == 10)
15288 {
15289 if (type >= 736 && type <= 738)
15290 {
15292 }
15293 else if (type == 411 || type == 412 || type == 413 || type == 414)
15294 {
15297 }
15298 else if (type == 42 || type == 65 || type == 68 || type == 354 || (type == 31 && ai[0] == 2f))
15299 {
15301 }
15302 else
15303 {
15305 }
15306 }
15307 else
15308 {
15310 int num2 = ((overrideWidth != -1) ? overrideWidth : width);
15311 int num3 = ((overrideHeight != -1) ? overrideHeight : height);
15312 if (overrideHeight != -1 || overrideWidth != -1)
15313 {
15314 vector2 = ((!vector.HasValue) ? new Vector2(position.X + (float)(width / 2) - (float)(num2 / 2), position.Y + (float)(height / 2) - (float)(num3 / 2)) : (base.Center - new Vector2(num2, num3) * vector.Value));
15315 }
15316 if (wet)
15317 {
15318 if (shimmerWet)
15319 {
15322 wetVelocity = velocity * 0.375f;
15323 if (velocity.X != vector3.X)
15324 {
15325 wetVelocity.X = velocity.X;
15326 }
15327 if (velocity.Y != vector3.Y)
15328 {
15329 wetVelocity.Y = velocity.Y;
15330 }
15331 }
15332 else if (honeyWet)
15333 {
15336 wetVelocity = velocity * 0.25f;
15337 if (velocity.X != vector4.X)
15338 {
15339 wetVelocity.X = velocity.X;
15340 }
15341 if (velocity.Y != vector4.Y)
15342 {
15343 wetVelocity.Y = velocity.Y;
15344 }
15345 }
15346 else
15347 {
15350 wetVelocity = velocity * 0.5f;
15351 if (velocity.X != vector5.X)
15352 {
15353 wetVelocity.X = velocity.X;
15354 }
15355 if (velocity.Y != vector5.Y)
15356 {
15357 wetVelocity.Y = velocity.Y;
15358 }
15359 }
15360 if (!Main.projPet[type])
15361 {
15364 if (aiStyle == 137)
15365 {
15366 if (vector2.Y != vector6.Y)
15367 {
15368 flag = true;
15369 }
15370 if (velocity.Y != vector6.W)
15371 {
15372 flag = true;
15373 }
15374 vector2.Y = vector6.Y;
15375 position.Y = vector2.Y + vector7.Y;
15376 velocity.Y = vector6.W;
15377 }
15378 else
15379 {
15380 if (vector2.X != vector6.X)
15381 {
15382 flag = true;
15383 }
15384 if (vector2.Y != vector6.Y)
15385 {
15386 flag = true;
15387 }
15388 if (velocity.X != vector6.Z)
15389 {
15390 flag = true;
15391 }
15392 if (velocity.Y != vector6.W)
15393 {
15394 flag = true;
15395 }
15396 vector2.X = vector6.X;
15397 vector2.Y = vector6.Y;
15399 velocity.X = vector6.Z;
15400 velocity.Y = vector6.W;
15401 }
15402 }
15403 }
15404 else
15405 {
15406 int num4 = Math.Min(num2, num3);
15407 if (num4 < 3)
15408 {
15409 num4 = 3;
15410 }
15411 if (num4 > 16)
15412 {
15413 num4 = 16;
15414 }
15415 if (velocity.Length() > (float)num4)
15416 {
15418 float num5 = velocity.Length();
15419 float num6 = num4;
15420 Vector2 vector9 = velocity.SafeNormalize(Vector2.Zero);
15421 if (vector8.Y == 0f)
15422 {
15423 vector9.Y = 0f;
15424 }
15426 _ = Vector2.Zero;
15427 _ = Vector2.Zero;
15429 int num7 = 0;
15430 while (num5 > 0f)
15431 {
15432 num7++;
15433 if (num7 > 300)
15434 {
15435 break;
15436 }
15437 vector10 = vector2;
15438 float num8 = num5;
15439 if (num8 > num6)
15440 {
15441 num8 = num6;
15442 }
15443 num5 -= num8;
15446 vector2 += vector12;
15448 if (!Main.projPet[type])
15449 {
15452 if (aiStyle == 137)
15453 {
15454 if (vector2.Y != vector13.Y)
15455 {
15456 flag = true;
15457 }
15458 if (velocity.Y != vector13.W)
15459 {
15460 flag = true;
15461 }
15462 vector2.Y = vector13.Y;
15463 position.Y = vector2.Y + vector14.Y;
15464 velocity.Y = vector13.W;
15465 }
15466 else
15467 {
15468 if (vector2.X != vector13.X)
15469 {
15470 flag = true;
15471 }
15472 if (vector2.Y != vector13.Y)
15473 {
15474 flag = true;
15475 }
15476 if (velocity.X != vector13.Z)
15477 {
15478 flag = true;
15479 }
15480 if (velocity.Y != vector13.W)
15481 {
15482 flag = true;
15483 }
15484 vector2.X = vector13.X;
15485 vector2.Y = vector13.Y;
15487 velocity.X = vector13.Z;
15488 velocity.Y = vector13.W;
15489 }
15490 }
15491 flag2 = true;
15492 if (owner == Main.myPlayer && vector2 != vector10 && !flag4)
15493 {
15495 }
15497 zero += vector12;
15498 }
15499 velocity = zero;
15500 if (Math.Abs(velocity.X - lastVelocity.X) < 0.0001f)
15501 {
15502 velocity.X = lastVelocity.X;
15503 }
15504 if (Math.Abs(velocity.Y - lastVelocity.Y) < 0.0001f)
15505 {
15506 velocity.Y = lastVelocity.Y;
15507 }
15508 if (!Main.projPet[type])
15509 {
15512 if (aiStyle == 137)
15513 {
15514 if (vector2.Y != vector15.Y)
15515 {
15516 flag = true;
15517 }
15518 if (velocity.Y != vector15.W)
15519 {
15520 flag = true;
15521 }
15522 vector2.Y = vector15.Y;
15523 position.Y = vector2.Y + vector16.Y;
15524 velocity.Y = vector15.W;
15525 }
15526 else
15527 {
15528 if (vector2.X != vector15.X)
15529 {
15530 flag = true;
15531 }
15532 if (vector2.Y != vector15.Y)
15533 {
15534 flag = true;
15535 }
15536 if (velocity.X != vector15.Z)
15537 {
15538 flag = true;
15539 }
15540 if (velocity.Y != vector15.W)
15541 {
15542 flag = true;
15543 }
15544 vector2.X = vector15.X;
15545 vector2.Y = vector15.Y;
15547 velocity.X = vector15.Z;
15548 velocity.Y = vector15.W;
15549 }
15550 }
15551 }
15552 else
15553 {
15555 if (!Main.projPet[type])
15556 {
15559 if (aiStyle == 137)
15560 {
15561 if (vector2.Y != vector17.Y)
15562 {
15563 flag = true;
15564 }
15565 if (velocity.Y != vector17.W)
15566 {
15567 flag = true;
15568 }
15569 vector2.Y = vector17.Y;
15570 position.Y = vector2.Y + vector18.Y;
15571 velocity.Y = vector17.W;
15572 }
15573 else
15574 {
15575 if (vector2.X != vector17.X)
15576 {
15577 flag = true;
15578 }
15579 if (vector2.Y != vector17.Y)
15580 {
15581 flag = true;
15582 }
15583 if (velocity.X != vector17.Z)
15584 {
15585 flag = true;
15586 }
15587 if (velocity.Y != vector17.W)
15588 {
15589 flag = true;
15590 }
15591 vector2.X = vector17.X;
15592 vector2.Y = vector17.Y;
15594 velocity.X = vector17.Z;
15595 velocity.Y = vector17.W;
15596 }
15597 }
15598 }
15599 }
15600 }
15601 }
15602 if (lastVelocity != velocity)
15603 {
15604 flag = true;
15605 }
15606 if (flag)
15607 {
15608 if (owner == Main.myPlayer && CanCutTiles() && (friendly || hostile) && damage > 0)
15609 {
15610 int num9 = (int)(position.X + velocity.X - 1f) / 16;
15611 int num10 = (int)((position.X + (float)width + velocity.X + 1f) / 16f) + 1;
15612 int num11 = (int)(position.Y + velocity.Y - 1f) / 16;
15613 int num12 = (int)((position.Y + (float)height + velocity.Y + 1f) / 16f) + 1;
15614 if (num9 < 0)
15615 {
15616 num9 = 0;
15617 }
15618 if (num10 > Main.maxTilesX)
15619 {
15621 }
15622 if (num11 < 0)
15623 {
15624 num11 = 0;
15625 }
15626 if (num12 > Main.maxTilesY)
15627 {
15629 }
15630 bool[] tileCutIgnorance = Main.player[owner].GetTileCutIgnorance(allowRegrowth: false, trap);
15631 for (int i = num9; i < num10; i++)
15632 {
15633 for (int j = num11; j < num12; j++)
15634 {
15635 if (Main.tile[i, j] != null && !tileCutIgnorance[Main.tile[i, j].type] && Main.tile[i, j].type == 484 && WorldGen.CanCutTile(i, j, TileCuttingContext.AttackProjectile))
15636 {
15637 WorldGen.KillTile(i, j);
15638 if (Main.netMode != 0)
15639 {
15640 NetMessage.SendData(17, -1, -1, null, 0, i, j);
15641 }
15642 }
15643 }
15644 }
15645 }
15646 if (Main.rand.Next(3) == 0 && owner == Main.myPlayer && CanCutTiles() && (friendly || hostile) && damage > 0)
15647 {
15648 int num13 = (int)(position.X + velocity.X - 1f) / 16;
15649 int num14 = (int)((position.X + (float)width + velocity.X + 1f) / 16f) + 1;
15650 int num15 = (int)(position.Y + velocity.Y - 1f) / 16;
15651 int num16 = (int)((position.Y + (float)height + velocity.Y + 1f) / 16f) + 1;
15652 if (num13 < 0)
15653 {
15654 num13 = 0;
15655 }
15656 if (num14 > Main.maxTilesX)
15657 {
15659 }
15660 if (num15 < 0)
15661 {
15662 num15 = 0;
15663 }
15664 if (num16 > Main.maxTilesY)
15665 {
15667 }
15668 bool[] tileCutIgnorance2 = Main.player[owner].GetTileCutIgnorance(allowRegrowth: false, trap);
15669 for (int k = num13; k < num14; k++)
15670 {
15671 for (int l = num15; l < num16; l++)
15672 {
15673 if (Main.tile[k, l] != null && !tileCutIgnorance2[Main.tile[k, l].type] && TileID.Sets.CrackedBricks[Main.tile[k, l].type] && WorldGen.CanCutTile(k, l, TileCuttingContext.AttackProjectile))
15674 {
15675 WorldGen.KillTile(k, l);
15676 if (Main.netMode != 0)
15677 {
15678 NetMessage.SendData(17, -1, -1, null, 0, k, l);
15679 }
15680 }
15681 }
15682 }
15683 }
15684 if (type == 663 || type == 665 || type == 667 || type == 677 || type == 678 || type == 679 || type == 691 || type == 692 || type == 693 || type == 688 || type == 689 || type == 690)
15685 {
15686 position += velocity;
15688 }
15689 else if (type == 434)
15690 {
15691 position += velocity;
15692 numUpdates = 0;
15693 }
15694 else if (type == 1020)
15695 {
15696 if (velocity.X != lastVelocity.X && Math.Abs(lastVelocity.X) > 1f)
15697 {
15698 velocity.X = (0f - lastVelocity.X) * 0.25f;
15699 }
15700 if (velocity.Y != lastVelocity.Y && Math.Abs(lastVelocity.Y) > 1f)
15701 {
15702 velocity.Y = (0f - lastVelocity.Y) * 0.25f;
15703 }
15704 }
15705 else if (type == 601)
15706 {
15707 if (Main.netMode != 2 && alpha > 0)
15708 {
15709 if (ai[1] != 0f)
15710 {
15712 }
15713 else
15714 {
15716 }
15717 }
15718 if (owner == Main.myPlayer)
15719 {
15721 }
15722 position += velocity;
15723 Kill();
15724 }
15725 else if (type == 985)
15726 {
15727 position += velocity;
15729 velocity *= 0.01f;
15730 localAI[1] = 1f;
15731 }
15732 else if (type == 451)
15733 {
15734 ai[0] = 1f;
15735 ai[1] = 0f;
15736 netUpdate = true;
15737 velocity = lastVelocity / 2f;
15738 }
15739 else if (type == 645)
15740 {
15741 ai[0] = 0f;
15742 ai[1] = -1f;
15743 netUpdate = true;
15744 }
15745 else if (type == 584)
15746 {
15747 bool flag7 = false;
15748 if (velocity.X != lastVelocity.X)
15749 {
15750 velocity.X = lastVelocity.X * -0.75f;
15751 flag7 = true;
15752 }
15753 if ((velocity.Y != lastVelocity.Y && lastVelocity.Y > 2f) || velocity.Y == 0f)
15754 {
15755 velocity.Y = lastVelocity.Y * -0.75f;
15756 flag7 = true;
15757 }
15758 if (flag7)
15759 {
15760 float num17 = lastVelocity.Length() / velocity.Length();
15761 if (num17 == 0f)
15762 {
15763 num17 = 1f;
15764 }
15765 velocity /= num17;
15766 penetrate--;
15767 }
15768 }
15769 else if (type == 532)
15770 {
15771 bool flag8 = false;
15772 if (velocity.X != lastVelocity.X)
15773 {
15774 velocity.X = lastVelocity.X * -0.75f;
15775 flag8 = true;
15776 }
15777 if ((velocity.Y != lastVelocity.Y && lastVelocity.Y > 2f) || velocity.Y == 0f)
15778 {
15779 velocity.Y = lastVelocity.Y * -0.75f;
15780 flag8 = true;
15781 }
15782 if (flag8)
15783 {
15784 float num18 = lastVelocity.Length() / velocity.Length();
15785 if (num18 == 0f)
15786 {
15787 num18 = 1f;
15788 }
15789 velocity /= num18;
15790 penetrate--;
15792 }
15793 }
15794 else if (type == 533)
15795 {
15796 float num19 = 1f;
15797 bool flag9 = false;
15798 if (velocity.X != lastVelocity.X)
15799 {
15800 velocity.X = lastVelocity.X * (0f - num19);
15801 flag9 = true;
15802 }
15803 if (velocity.Y != lastVelocity.Y || velocity.Y == 0f)
15804 {
15805 velocity.Y = lastVelocity.Y * (0f - num19) * 0.5f;
15806 flag9 = true;
15807 }
15808 if (flag9)
15809 {
15810 float num20 = lastVelocity.Length() / velocity.Length();
15811 if (num20 == 0f)
15812 {
15813 num20 = 1f;
15814 }
15815 velocity /= num20;
15816 if (ai[0] == 7f && (double)velocity.Y < -0.1)
15817 {
15818 velocity.Y += 0.1f;
15819 }
15820 if (ai[0] >= 6f && ai[0] < 9f)
15821 {
15823 }
15824 localAI[2] += 30f;
15825 }
15826 }
15827 else if (type == 502)
15828 {
15829 ai[0] += 1f;
15830 SoundEngine.PlaySound(37, (int)position.X, (int)position.Y, 5 + (int)ai[0]);
15831 if (ai[0] >= 5f)
15832 {
15833 position += velocity;
15834 Kill();
15835 }
15836 else
15837 {
15838 if (velocity.Y != lastVelocity.Y)
15839 {
15840 velocity.Y = 0f - lastVelocity.Y;
15841 }
15842 if (velocity.X != lastVelocity.X)
15843 {
15844 velocity.X = 0f - lastVelocity.X;
15845 }
15846 }
15847 Vector2 spinningpoint = new Vector2(0f, -3f - ai[0]).RotatedByRandom(3.1415927410125732);
15848 float num21 = 10f + ai[0] * 4f;
15849 Vector2 vector19 = new Vector2(1.05f, 1f);
15850 for (float num22 = 0f; num22 < num21; num22 += 1f)
15851 {
15852 int num23 = Dust.NewDust(base.Center, 0, 0, 66, 0f, 0f, 0, Color.Transparent);
15853 Main.dust[num23].position = base.Center;
15854 Main.dust[num23].velocity = spinningpoint.RotatedBy((float)Math.PI * 2f * num22 / num21) * vector19 * (0.8f + Main.rand.NextFloat() * 0.4f);
15855 Main.dust[num23].color = Main.hslToRgb(num22 / num21, 1f, 0.5f);
15856 Main.dust[num23].noGravity = true;
15857 Main.dust[num23].scale = 1f + ai[0] / 3f;
15858 }
15859 if (Main.myPlayer == owner)
15860 {
15861 int num24 = width;
15862 int num25 = height;
15863 int num26 = penetrate;
15864 position = base.Center;
15865 width = (height = 40 + 8 * (int)ai[0]);
15866 base.Center = position;
15867 penetrate = -1;
15868 Damage();
15869 penetrate = num26;
15870 position = base.Center;
15871 width = num24;
15872 height = num25;
15873 base.Center = position;
15874 }
15875 }
15876 else if (type == 444)
15877 {
15878 if (velocity.X != lastVelocity.X)
15879 {
15880 velocity.X = 0f - lastVelocity.X;
15881 }
15882 if (velocity.Y != lastVelocity.Y)
15883 {
15884 velocity.Y = 0f - lastVelocity.Y;
15885 }
15886 ai[0] = velocity.ToRotation();
15887 }
15888 else if (type == 617)
15889 {
15890 if (velocity.X != lastVelocity.X)
15891 {
15892 velocity.X = (0f - lastVelocity.X) * 0.35f;
15893 }
15894 if (velocity.Y != lastVelocity.Y)
15895 {
15896 velocity.Y = (0f - lastVelocity.Y) * 0.35f;
15897 }
15898 }
15899 else if (type == 440 || type == 449 || type == 606)
15900 {
15901 if (ai[1] != 1f)
15902 {
15903 ai[1] = 1f;
15904 position += velocity;
15906 }
15907 }
15908 else if (type == 85)
15909 {
15910 velocity = lastVelocity * 0.95f;
15911 position -= velocity;
15912 }
15913 else if (type == 466 || type == 580 || type == 640)
15914 {
15915 if (localAI[1] < 1f)
15916 {
15917 localAI[1] += 2f;
15918 position += velocity;
15920 }
15921 }
15922 else if (type == 851)
15923 {
15924 if (velocity.X != lastVelocity.X)
15925 {
15926 velocity.X = (0f - lastVelocity.X) * 0.8f;
15927 }
15928 if (velocity.Y != lastVelocity.Y)
15929 {
15930 velocity.Y = (0f - lastVelocity.Y) * 0.5f;
15931 }
15932 }
15933 else if (type == 855)
15934 {
15935 if (velocity.X != lastVelocity.X)
15936 {
15937 velocity.X = 0f - lastVelocity.X;
15938 }
15939 if (velocity.Y != lastVelocity.Y)
15940 {
15941 velocity.Y = 0f - lastVelocity.Y;
15942 if (lastVelocity.Y < 0f)
15943 {
15944 velocity.Y *= 0.25f;
15945 }
15946 }
15947 }
15948 else if (aiStyle == 54)
15949 {
15950 if (velocity.X != lastVelocity.X)
15951 {
15952 velocity.X = lastVelocity.X * -0.6f;
15953 }
15954 if (velocity.Y != lastVelocity.Y)
15955 {
15956 velocity.Y = lastVelocity.Y * -0.6f;
15957 }
15958 }
15959 else if (type == 861)
15960 {
15961 float num27 = -1f;
15962 if (ai[1] == 1f)
15963 {
15964 num27 = -0.6f;
15965 }
15966 if (velocity.X != lastVelocity.X)
15967 {
15968 velocity.X = lastVelocity.X * num27;
15969 }
15970 if (velocity.Y != lastVelocity.Y && (double)lastVelocity.Y > 0.7)
15971 {
15972 velocity.Y = lastVelocity.Y * num27;
15973 }
15974 if (Math.Abs(velocity.Y) < 0.5f)
15975 {
15976 velocity.Y = 0f;
15977 }
15978 if (ai[1] != 1f)
15979 {
15980 netUpdate = true;
15981 }
15982 ai[1] = 1f;
15983 }
15984 else if (!Main.projPet[type] && type != 500 && type != 820 && aiStyle != 160 && type != 650 && type != 882 && type != 888 && type != 894 && type != 895 && type != 898 && type != 901 && type != 957)
15985 {
15986 if (aiStyle == 99)
15987 {
15988 if (type >= 556 && type <= 561)
15989 {
15990 bool flag10 = false;
15991 if (velocity.X != lastVelocity.X)
15992 {
15993 flag10 = true;
15994 velocity.X = lastVelocity.X * -1f;
15995 }
15996 if (velocity.Y != lastVelocity.Y)
15997 {
15998 flag10 = true;
15999 velocity.Y = lastVelocity.Y * -1f;
16000 }
16001 if (flag10)
16002 {
16003 Vector2 vector20 = Main.player[owner].Center - base.Center;
16004 vector20.Normalize();
16006 vector20 *= 0.25f;
16007 velocity *= 0.75f;
16008 velocity += vector20;
16009 if (velocity.Length() > 6f)
16010 {
16011 velocity *= 0.5f;
16012 }
16013 }
16014 }
16015 }
16016 else if (type == 604)
16017 {
16018 if (velocity.X != lastVelocity.X)
16019 {
16020 velocity.X = 0f - lastVelocity.X;
16021 }
16022 if (velocity.Y != lastVelocity.Y)
16023 {
16024 velocity.Y = 0f - lastVelocity.Y;
16025 }
16026 }
16027 else if (type == 379)
16028 {
16029 if (velocity.X != lastVelocity.X)
16030 {
16031 velocity.X = lastVelocity.X * -0.6f;
16032 }
16033 if (velocity.Y != lastVelocity.Y && lastVelocity.Y > 2f)
16034 {
16035 velocity.Y = lastVelocity.Y * -0.6f;
16036 }
16037 }
16038 else if (type == 491)
16039 {
16040 if (ai[0] <= 0f)
16041 {
16042 ai[0] = -10f;
16043 }
16044 if (velocity.X != lastVelocity.X && Math.Abs(lastVelocity.X) > 0f)
16045 {
16046 velocity.X = lastVelocity.X * -1f;
16047 }
16048 if (velocity.Y != lastVelocity.Y && Math.Abs(lastVelocity.Y) > 0f)
16049 {
16050 velocity.Y = lastVelocity.Y * -1f;
16051 }
16052 }
16053 else if ((type >= 515 && type <= 517) || type == 637)
16054 {
16055 if (velocity.X != lastVelocity.X && Math.Abs(lastVelocity.X) > 1f)
16056 {
16057 velocity.X = lastVelocity.X * -0.9f;
16058 }
16059 if (velocity.Y != lastVelocity.Y && Math.Abs(lastVelocity.Y) > 1f)
16060 {
16061 velocity.Y = lastVelocity.Y * -0.9f;
16062 }
16063 }
16064 else if (type == 921 || type == 926 || type == 937)
16065 {
16066 if (velocity.X != lastVelocity.X && Math.Abs(lastVelocity.X) > 1f)
16067 {
16068 velocity.X = lastVelocity.X * -0.4f;
16069 }
16070 if (velocity.Y != lastVelocity.Y && Math.Abs(lastVelocity.Y) > 1f)
16071 {
16072 velocity.Y = lastVelocity.Y * -0.95f;
16073 }
16074 penetrate--;
16075 }
16076 else if (type == 969)
16077 {
16078 if (velocity.X != lastVelocity.X && Math.Abs(lastVelocity.X) > 1f)
16079 {
16080 velocity.X = lastVelocity.X * -0.75f;
16081 }
16082 if (velocity.Y != lastVelocity.Y && Math.Abs(lastVelocity.Y) > 1f)
16083 {
16084 velocity.Y = lastVelocity.Y * -0.75f;
16085 }
16086 }
16087 else if (type == 681)
16088 {
16089 timeLeft = 4;
16090 }
16091 else if (type == 409)
16092 {
16093 if (velocity.X != lastVelocity.X)
16094 {
16095 velocity.X = lastVelocity.X * -1f;
16096 }
16097 if (velocity.Y != lastVelocity.Y)
16098 {
16099 velocity.Y = lastVelocity.Y * -1f;
16100 }
16101 }
16102 else if (type == 254)
16103 {
16104 if (velocity.X != lastVelocity.X)
16105 {
16106 velocity.X = lastVelocity.X * -1f;
16107 }
16108 if (velocity.Y != lastVelocity.Y)
16109 {
16110 velocity.Y = lastVelocity.Y * -1f;
16111 }
16112 }
16113 else if (type == 225)
16114 {
16115 ai[1] += 1f;
16116 if (ai[1] == 1f)
16117 {
16118 damage = (int)((float)damage * 0.66f);
16119 }
16120 if (ai[1] >= 4f)
16121 {
16122 Kill();
16123 return;
16124 }
16125 velocity.X = 0f - lastVelocity.X;
16126 velocity.Y = 0f - lastVelocity.Y;
16128 if (num28 != -1)
16129 {
16130 NPC nPC = Main.npc[num28];
16131 float t = Distance(nPC.Center);
16132 Vector2 vector21 = -Vector2.UnitY * MathHelper.Lerp((float)nPC.height * 0.1f, (float)nPC.height * 0.5f, Utils.GetLerpValue(0f, 300f, t));
16133 velocity = DirectionTo(nPC.Center + vector21).SafeNormalize(-Vector2.UnitY) * velocity.Length();
16134 netUpdate = true;
16135 }
16136 }
16137 else if (type == 285)
16138 {
16139 ai[1] += 1f;
16140 if (ai[1] == 1f)
16141 {
16142 damage = (int)((float)damage * 0.66f);
16143 }
16144 if (ai[1] >= 2f)
16145 {
16146 Kill();
16147 return;
16148 }
16149 if (velocity.X != lastVelocity.X)
16150 {
16151 velocity.X = lastVelocity.X * -1f;
16152 }
16153 if (velocity.Y != lastVelocity.Y)
16154 {
16155 velocity.Y = lastVelocity.Y * -1f;
16156 }
16158 if (num29 != -1)
16159 {
16160 NPC nPC2 = Main.npc[num29];
16161 Distance(nPC2.Center);
16162 velocity = DirectionTo(nPC2.Center).SafeNormalize(-Vector2.UnitY) * velocity.Length();
16163 netUpdate = true;
16164 }
16165 }
16166 else if (type == 931)
16167 {
16168 if (velocity.X != lastVelocity.X)
16169 {
16170 velocity.X = lastVelocity.X * -1f;
16171 }
16172 if (velocity.Y != lastVelocity.Y)
16173 {
16174 velocity.Y = lastVelocity.Y * -1f;
16175 }
16176 }
16177 else if (type == 155)
16178 {
16179 if (ai[1] > 10f)
16180 {
16182 if (Main.netMode == 0)
16183 {
16184 Main.NewText(networkText.ToString(), byte.MaxValue, 240, 20);
16185 }
16186 else if (Main.netMode == 2)
16187 {
16189 }
16190 }
16191 ai[1] = 0f;
16192 if (velocity.X != lastVelocity.X)
16193 {
16194 velocity.X = lastVelocity.X * -0.6f;
16195 }
16196 if (velocity.Y != lastVelocity.Y && lastVelocity.Y > 2f)
16197 {
16198 velocity.Y = lastVelocity.Y * -0.6f;
16199 }
16200 }
16201 else if (aiStyle == 33)
16202 {
16203 if (localAI[0] == 0f)
16204 {
16205 if (wet)
16206 {
16207 position += lastVelocity / 2f;
16208 }
16209 else
16210 {
16212 }
16213 velocity *= 0f;
16214 localAI[0] = 1f;
16215 }
16216 }
16217 else if (type != 308 && type != 377 && type != 966)
16218 {
16219 if (type == 477)
16220 {
16221 if (velocity.Y != lastVelocity.Y || velocity.X != lastVelocity.X)
16222 {
16223 penetrate--;
16224 if (penetrate <= 0)
16225 {
16226 Kill();
16227 }
16228 if (velocity.X != lastVelocity.X)
16229 {
16230 velocity.X = 0f - lastVelocity.X;
16231 }
16232 if (velocity.Y != lastVelocity.Y)
16233 {
16234 velocity.Y = 0f - lastVelocity.Y;
16235 }
16236 }
16237 if (penetrate > 0 && owner == Main.myPlayer)
16238 {
16239 int[] array = new int[10];
16240 int num30 = 0;
16241 int num31 = 700;
16242 int num32 = 20;
16243 for (int m = 0; m < 200; m++)
16244 {
16245 if (!Main.npc[m].CanBeChasedBy(this))
16246 {
16247 continue;
16248 }
16249 float num33 = (base.Center - Main.npc[m].Center).Length();
16250 if (num33 > (float)num32 && num33 < (float)num31 && Collision.CanHitLine(base.Center, 1, 1, Main.npc[m].Center, 1, 1))
16251 {
16252 array[num30] = m;
16253 num30++;
16254 if (num30 >= 9)
16255 {
16256 break;
16257 }
16258 }
16259 }
16260 if (num30 > 0)
16261 {
16262 num30 = Main.rand.Next(num30);
16263 Vector2 vector22 = Main.npc[array[num30]].Center - base.Center;
16264 float num34 = velocity.Length();
16265 vector22.Normalize();
16267 netUpdate = true;
16268 }
16269 }
16270 }
16271 else if (type == 94)
16272 {
16273 if (velocity.X != lastVelocity.X)
16274 {
16275 velocity.X = 0f - lastVelocity.X;
16276 }
16277 if (velocity.Y != lastVelocity.Y)
16278 {
16279 velocity.Y = 0f - lastVelocity.Y;
16280 }
16281 }
16282 else if (type == 496)
16283 {
16284 if (velocity.X != lastVelocity.X)
16285 {
16286 if (Math.Abs(velocity.X) < 1f)
16287 {
16288 velocity.X = 0f - lastVelocity.X;
16289 }
16290 else
16291 {
16292 Kill();
16293 }
16294 }
16295 if (velocity.Y != lastVelocity.Y)
16296 {
16297 if (Math.Abs(velocity.Y) < 1f)
16298 {
16299 velocity.Y = 0f - lastVelocity.Y;
16300 }
16301 else
16302 {
16303 Kill();
16304 }
16305 }
16306 }
16307 else if (type == 311)
16308 {
16309 if (velocity.X != lastVelocity.X)
16310 {
16311 velocity.X = 0f - lastVelocity.X;
16312 ai[1] += 1f;
16313 }
16314 if (velocity.Y != lastVelocity.Y)
16315 {
16316 velocity.Y = 0f - lastVelocity.Y;
16317 ai[1] += 1f;
16318 }
16319 if (ai[1] > 4f)
16320 {
16321 Kill();
16322 }
16323 }
16324 else if (type == 312)
16325 {
16326 if (velocity.X != lastVelocity.X)
16327 {
16328 velocity.X = 0f - lastVelocity.X;
16329 ai[1] += 1f;
16330 }
16331 if (velocity.Y != lastVelocity.Y)
16332 {
16333 velocity.Y = 0f - lastVelocity.Y;
16334 ai[1] += 1f;
16335 }
16336 }
16337 else if (type == 522 || type == 620)
16338 {
16339 if (velocity.X != lastVelocity.X)
16340 {
16341 velocity.X = 0f - lastVelocity.X;
16342 }
16343 if (velocity.Y != lastVelocity.Y)
16344 {
16345 velocity.Y = 0f - lastVelocity.Y;
16346 }
16347 }
16348 else if (type == 524)
16349 {
16350 ai[0] += 100f;
16351 if (velocity.X != lastVelocity.X)
16352 {
16353 velocity.X = 0f - lastVelocity.X;
16354 }
16355 if (velocity.Y != lastVelocity.Y)
16356 {
16357 velocity.Y = 0f - lastVelocity.Y;
16358 }
16359 }
16360 else if (aiStyle == 93)
16361 {
16362 if (velocity != lastVelocity)
16363 {
16364 ai[1] = 0f;
16365 ai[0] = 1f;
16366 netUpdate = true;
16367 tileCollide = false;
16368 position += velocity;
16371 velocity *= 3f;
16372 }
16373 }
16374 else if (type == 281)
16375 {
16376 bool flag11 = Math.Abs(velocity.X) + Math.Abs(velocity.Y) < 2f || ai[0] == -1f;
16377 if (ai[0] == -2f || ai[0] == -3f)
16378 {
16379 flag11 = false;
16380 }
16381 if (flag11)
16382 {
16383 if (Main.myPlayer == owner)
16384 {
16385 int num35 = ((velocity.X > 0f) ? 1 : 2);
16386 if (damage == 0)
16387 {
16388 num35 += 2;
16389 }
16390 NPC.ReleaseNPC((int)base.Center.X, (int)base.Bottom.Y - 4, 614, num35, owner);
16391 ai[0] = -3f;
16392 netUpdate = true;
16393 }
16394 }
16395 else
16396 {
16397 if (velocity.X != lastVelocity.X)
16398 {
16399 velocity.X = (0f - lastVelocity.X) * 0.5f;
16400 }
16401 if (velocity.Y != lastVelocity.Y)
16402 {
16403 velocity.Y = (0f - lastVelocity.Y) * 0.5f;
16404 }
16405 }
16406 }
16407 else if (type == 290 || type == 294)
16408 {
16409 if (velocity.X != lastVelocity.X)
16410 {
16411 position.X += velocity.X;
16412 velocity.X = 0f - lastVelocity.X;
16413 }
16414 if (velocity.Y != lastVelocity.Y)
16415 {
16416 position.Y += velocity.Y;
16417 velocity.Y = 0f - lastVelocity.Y;
16418 }
16419 }
16420 else if ((type == 181 || type == 189 || type == 357 || type == 566) && penetrate > 0)
16421 {
16422 if (type == 357)
16423 {
16424 damage = (int)((double)damage * 0.9);
16425 }
16426 penetrate--;
16427 if (velocity.X != lastVelocity.X)
16428 {
16429 velocity.X = 0f - lastVelocity.X;
16430 }
16431 if (velocity.Y != lastVelocity.Y)
16432 {
16433 velocity.Y = 0f - lastVelocity.Y;
16434 }
16435 }
16436 else if (type == 307 && ai[1] < 5f)
16437 {
16438 ai[1] += 1f;
16439 if (velocity.X != lastVelocity.X)
16440 {
16441 velocity.X = 0f - lastVelocity.X;
16442 }
16443 if (velocity.Y != lastVelocity.Y)
16444 {
16445 velocity.Y = 0f - lastVelocity.Y;
16446 }
16447 }
16448 else if (type == 99 || type == 1005 || type == 1014)
16449 {
16450 if (velocity.Y != lastVelocity.Y && lastVelocity.Y > 5f)
16451 {
16453 SoundEngine.PlaySound(0, (int)position.X, (int)position.Y);
16454 velocity.Y = (0f - lastVelocity.Y) * 0.2f;
16455 }
16456 if (velocity.X != lastVelocity.X)
16457 {
16458 Kill();
16459 }
16460 }
16461 else if (type == 1021)
16462 {
16463 if (velocity.Y != lastVelocity.Y)
16464 {
16465 if (lastVelocity.Y > 4f)
16466 {
16468 SoundEngine.PlaySound(0, (int)position.X, (int)position.Y);
16469 velocity.Y = (0f - lastVelocity.Y) * 0.9f;
16470 }
16471 else if (lastVelocity.Y > 0f)
16472 {
16473 localAI[1] = 999f;
16474 }
16475 }
16476 if (velocity.X != lastVelocity.X)
16477 {
16478 if (localAI[1] <= 3f)
16479 {
16480 velocity.X = lastVelocity.X * -0.75f;
16481 localAI[1] += 1f;
16482 }
16483 else
16484 {
16485 Kill();
16486 }
16487 }
16488 }
16489 else if (type == 1013)
16490 {
16491 float num36 = Math.Abs(lastVelocity.X);
16492 float num37 = Math.Abs(lastVelocity.Y);
16493 float num38 = 0.95f;
16494 float num39 = 0.95f;
16495 if (num36 < 0.5f)
16496 {
16497 num38 = 0.1f;
16498 }
16499 else if (num36 < 0.75f)
16500 {
16501 num38 = 0.25f;
16502 }
16503 else if (num36 < 1f)
16504 {
16505 num38 = 0.5f;
16506 }
16507 if (num37 < 0.5f)
16508 {
16509 num39 = 0.1f;
16510 }
16511 else if (num37 < 0.75f)
16512 {
16513 num39 = 0.25f;
16514 }
16515 else if (num37 < 1f)
16516 {
16517 num39 = 0.5f;
16518 }
16519 bool flag12 = false;
16520 if (velocity.Y != lastVelocity.Y)
16521 {
16522 if (Math.Abs(lastVelocity.Y) > 5f)
16523 {
16524 flag12 = true;
16525 }
16526 velocity.Y = (0f - lastVelocity.Y) * num39;
16527 }
16528 if (velocity.X != lastVelocity.X)
16529 {
16530 if (Math.Abs(lastVelocity.X) > 5f)
16531 {
16532 flag12 = true;
16533 }
16534 velocity.X = (0f - lastVelocity.X) * num38;
16535 }
16536 if (flag12)
16537 {
16538 localAI[1] += 1f;
16540 SoundEngine.PlaySound(0, (int)position.X, (int)position.Y);
16541 }
16542 if (velocity.Length() < 0.1f && localAI[0] > 50f)
16543 {
16544 Kill();
16545 }
16546 if (localAI[1] > 20f)
16547 {
16548 Kill();
16549 }
16550 }
16551 else if (type == 727)
16552 {
16553 int num40 = 30;
16554 float num41 = 2f;
16555 float num42 = 2f;
16556 if (velocity.Y != lastVelocity.Y && lastVelocity.Y > 5f)
16557 {
16559 SoundEngine.PlaySound(0, (int)position.X, (int)position.Y);
16560 velocity.Y = (0f - lastVelocity.Y) * 0.65f;
16561 if (owner == Main.myPlayer)
16562 {
16563 int num43 = Main.rand.Next(3, 6);
16564 float num44 = Main.rand.NextFloat();
16565 for (float num45 = 0f; num45 < 1f; num45 += 1f / (float)num43)
16566 {
16567 Vector2 vector23 = ((num44 + num45) * ((float)Math.PI * 2f)).ToRotationVector2() * num42;
16568 if (vector23.Y > 0f)
16569 {
16570 vector23 *= -0.7f;
16571 }
16573 }
16574 }
16575 }
16576 if (velocity.X != lastVelocity.X)
16577 {
16578 Kill();
16579 if (owner == Main.myPlayer)
16580 {
16581 int num46 = Main.rand.Next(3, 6);
16582 float num47 = Main.rand.NextFloat();
16583 for (float num48 = 0f; num48 < 1f; num48 += 1f / (float)num46)
16584 {
16585 Vector2 vector24 = ((num47 + num48) * ((float)Math.PI * 2f)).ToRotationVector2() * num42;
16586 if (vector24.Y > 0f)
16587 {
16588 vector24 *= -0.7f;
16589 }
16591 }
16592 }
16593 }
16594 }
16595 else if (type == 655)
16596 {
16597 if (velocity.Y != lastVelocity.Y && lastVelocity.Y > 5f)
16598 {
16600 SoundEngine.PlaySound(0, (int)position.X, (int)position.Y);
16601 velocity.Y = (0f - lastVelocity.Y) * 0.2f;
16602 }
16603 if (velocity.X != lastVelocity.X)
16604 {
16605 Kill();
16606 }
16607 }
16608 else if (type == 36)
16609 {
16610 if (penetrate > 1)
16611 {
16614 penetrate--;
16615 if (velocity.X != lastVelocity.X)
16616 {
16617 velocity.X = 0f - lastVelocity.X;
16618 }
16619 if (velocity.Y != lastVelocity.Y)
16620 {
16621 velocity.Y = 0f - lastVelocity.Y;
16622 }
16623 }
16624 else
16625 {
16626 Kill();
16627 }
16628 }
16629 else if (aiStyle == 21)
16630 {
16631 if (velocity.X != lastVelocity.X)
16632 {
16633 velocity.X = 0f - lastVelocity.X;
16634 }
16635 if (velocity.Y != lastVelocity.Y)
16636 {
16637 velocity.Y = 0f - lastVelocity.Y;
16638 }
16639 }
16640 else if (aiStyle == 17)
16641 {
16642 if (velocity.X != lastVelocity.X)
16643 {
16644 velocity.X = lastVelocity.X * -0.75f;
16645 }
16646 if (velocity.Y != lastVelocity.Y && (double)lastVelocity.Y > 1.5)
16647 {
16648 velocity.Y = lastVelocity.Y * -0.7f;
16649 }
16650 }
16651 else if (aiStyle == 15)
16652 {
16654 }
16655 else if (aiStyle == 9)
16656 {
16657 bool flag13 = owner == Main.myPlayer;
16658 if (type == 79)
16659 {
16660 bool flag14 = ai[0] >= 0f;
16661 flag13 = flag13 && !flag14;
16662 if (flag14)
16663 {
16664 if (velocity.X != lastVelocity.X)
16665 {
16666 velocity.X *= 0.1f;
16667 }
16668 if (velocity.Y != lastVelocity.Y)
16669 {
16670 velocity.Y *= 0.1f;
16671 }
16672 }
16673 }
16674 if (flag13)
16675 {
16676 Kill();
16677 }
16678 }
16679 else if (aiStyle == 39)
16680 {
16682 if (type == 33 || type == 106)
16683 {
16684 if (velocity.X != lastVelocity.X)
16685 {
16686 velocity.X = 0f - lastVelocity.X;
16687 }
16688 if (velocity.Y != lastVelocity.Y)
16689 {
16690 velocity.Y = 0f - lastVelocity.Y;
16691 }
16692 }
16693 else
16694 {
16695 ai[0] = 1f;
16696 if (aiStyle == 3)
16697 {
16698 velocity.X = 0f - lastVelocity.X;
16699 velocity.Y = 0f - lastVelocity.Y;
16700 }
16701 }
16702 netUpdate = true;
16703 SoundEngine.PlaySound(0, (int)position.X, (int)position.Y);
16704 }
16705 else if (aiStyle == 3 || aiStyle == 13 || aiStyle == 69 || aiStyle == 109)
16706 {
16707 if (type == 106)
16708 {
16709 Vector2 hitPoint = base.Center + velocity.SafeNormalize(Vector2.UnitX) * 8f * scale;
16710 Vector2 normal = new Vector2((velocity.X != lastVelocity.X) ? (-Math.Sign(lastVelocity.X)) : 0, (velocity.Y != lastVelocity.Y) ? (-Math.Sign(lastVelocity.Y)) : 0);
16712 }
16714 if (type == 33 || type == 106 || type == 866)
16715 {
16716 if (velocity.X != lastVelocity.X)
16717 {
16718 velocity.X = 0f - lastVelocity.X;
16719 }
16720 if (velocity.Y != lastVelocity.Y)
16721 {
16722 velocity.Y = 0f - lastVelocity.Y;
16723 }
16724 }
16725 else
16726 {
16727 ai[0] = 1f;
16728 if ((aiStyle == 3 || aiStyle == 109) && type != 383)
16729 {
16730 velocity.X = 0f - lastVelocity.X;
16731 velocity.Y = 0f - lastVelocity.Y;
16732 }
16733 }
16734 netUpdate = true;
16735 SoundEngine.PlaySound(0, (int)position.X, (int)position.Y);
16736 }
16737 else if (aiStyle == 8 && type != 96)
16738 {
16740 ai[0] += 1f;
16741 int num49 = 5;
16742 switch (type)
16743 {
16744 case 15:
16745 num49 = 6;
16746 break;
16747 case 253:
16748 num49 = 8;
16749 break;
16750 }
16751 if (ai[0] >= (float)num49)
16752 {
16753 position += velocity;
16754 Kill();
16755 }
16756 else
16757 {
16758 if (type == 15 && velocity.Y > 4f)
16759 {
16760 if (velocity.Y != lastVelocity.Y)
16761 {
16762 velocity.Y = (0f - lastVelocity.Y) * 0.8f;
16763 }
16764 }
16765 else if (velocity.Y != lastVelocity.Y)
16766 {
16767 velocity.Y = 0f - lastVelocity.Y;
16768 }
16769 if (velocity.X != lastVelocity.X)
16770 {
16771 velocity.X = 0f - lastVelocity.X;
16772 }
16773 }
16774 }
16775 else if (aiStyle == 61)
16776 {
16777 if (velocity.X != lastVelocity.X)
16778 {
16779 velocity.X = lastVelocity.X * -0.3f;
16780 }
16781 if (velocity.Y != lastVelocity.Y && lastVelocity.Y > 1f)
16782 {
16783 velocity.Y = lastVelocity.Y * -0.3f;
16784 }
16785 }
16786 else if (aiStyle == 14)
16787 {
16788 if (type == 928)
16789 {
16790 int num50 = 0;
16791 for (int num51 = 1000; num51 >= 0; num51--)
16792 {
16793 if (num51 != whoAmI && Main.projectile[num51].active && Main.projectile[num51].owner == owner && Main.projectile[num51].type == type)
16794 {
16795 num50++;
16796 if (num50 >= 2 && timeLeft > Main.projectile[num51].timeLeft && Main.projectile[num51].timeLeft > 30)
16797 {
16798 Main.projectile[num51].timeLeft = 2;
16799 }
16800 }
16801 }
16802 }
16803 if (type == 261 && ((velocity.X != lastVelocity.X && (lastVelocity.X < -3f || lastVelocity.X > 3f)) || (velocity.Y != lastVelocity.Y && (lastVelocity.Y < -3f || lastVelocity.Y > 3f))))
16804 {
16805 for (int n = 0; n < 10; n++)
16806 {
16808 }
16809 SoundEngine.PlaySound(0, (int)base.Center.X, (int)base.Center.Y);
16811 }
16812 if (type >= 326 && type <= 328 && velocity.X != lastVelocity.X)
16813 {
16814 velocity.X = lastVelocity.X * -0.1f;
16815 }
16816 if (type >= 400 && type <= 402)
16817 {
16818 if (velocity.X != lastVelocity.X)
16819 {
16820 velocity.X = lastVelocity.X * -0.1f;
16821 }
16822 }
16823 else if (type == 870 && ai[1] == 0f)
16824 {
16825 if (velocity.X != lastVelocity.X || velocity.Y != lastVelocity.Y)
16826 {
16828 ai[1] = 1f;
16829 }
16830 }
16831 else if (type == 50)
16832 {
16833 if (velocity.X != lastVelocity.X)
16834 {
16835 velocity.X = lastVelocity.X * -0.2f;
16836 }
16837 if (velocity.Y != lastVelocity.Y && (double)lastVelocity.Y > 1.5)
16838 {
16839 velocity.Y = lastVelocity.Y * -0.2f;
16840 }
16841 }
16842 else if (type == 185)
16843 {
16844 if (velocity.X != lastVelocity.X)
16845 {
16846 velocity.X = lastVelocity.X * -0.9f;
16847 }
16848 if (velocity.Y != lastVelocity.Y && lastVelocity.Y > 1f)
16849 {
16850 velocity.Y = lastVelocity.Y * -0.9f;
16851 }
16852 }
16853 else if (type == 277)
16854 {
16855 if (velocity.X != lastVelocity.X)
16856 {
16857 velocity.X = lastVelocity.X * -0.9f;
16858 }
16859 if (velocity.Y != lastVelocity.Y && lastVelocity.Y > 3f)
16860 {
16861 velocity.Y = lastVelocity.Y * -0.9f;
16862 }
16863 }
16864 else if (type != 480)
16865 {
16866 if (type == 450)
16867 {
16868 if (velocity.X != lastVelocity.X)
16869 {
16870 velocity.X = lastVelocity.X * -0.1f;
16871 }
16872 }
16873 else
16874 {
16875 if (velocity.X != lastVelocity.X)
16876 {
16877 velocity.X = lastVelocity.X * -0.5f;
16878 }
16879 if (velocity.Y != lastVelocity.Y && lastVelocity.Y > 1f)
16880 {
16881 velocity.Y = lastVelocity.Y * -0.5f;
16882 }
16883 }
16884 }
16885 }
16886 else if (aiStyle == 16)
16887 {
16888 if (velocity.X != lastVelocity.X)
16889 {
16890 velocity.X = lastVelocity.X * -0.4f;
16891 if (type == 29)
16892 {
16893 velocity.X *= 0.8f;
16894 }
16895 }
16896 if (velocity.Y != lastVelocity.Y && (double)lastVelocity.Y > 0.7 && type != 102)
16897 {
16898 velocity.Y = lastVelocity.Y * -0.4f;
16899 if (type == 29)
16900 {
16901 velocity.Y *= 0.8f;
16902 }
16903 }
16904 if (type == 134 || type == 137 || type == 140 || type == 143 || type == 303 || (type >= 338 && type <= 341) || type == 776 || type == 780 || type == 793 || type == 796 || type == 799 || type == 784 || type == 787 || type == 790 || type == 803 || type == 804 || type == 808 || type == 809 || type == 810 || type == 805 || type == 806 || type == 807 || type == 930)
16905 {
16906 velocity *= 0f;
16907 alpha = 255;
16908 timeLeft = 3;
16909 }
16910 }
16911 else if (aiStyle == 68)
16912 {
16913 velocity *= 0f;
16914 alpha = 255;
16915 timeLeft = 3;
16916 netUpdate = true;
16917 }
16918 else if (type == 870)
16919 {
16920 if (velocity.X != lastVelocity.X)
16921 {
16922 velocity.X = lastVelocity.X * -0.2f;
16923 }
16924 if (velocity.Y != lastVelocity.Y && lastVelocity.Y > 0f)
16925 {
16926 velocity.Y = lastVelocity.Y * -0.2f;
16927 }
16928 }
16929 else
16930 {
16931 position += velocity;
16932 Kill();
16933 }
16934 }
16935 }
16936 }
16937 }
16939 if (!flag2 && !flag4 && owner == Main.myPlayer && (tileCollide || flag5) && position != oldPosition)
16940 {
16943 int num52 = ((overrideWidth != -1) ? overrideWidth : width);
16944 int num53 = ((overrideHeight != -1) ? overrideHeight : height);
16945 if (overrideHeight != -1 || overrideWidth != -1)
16946 {
16947 vector25 = new Vector2(position.X + (float)(width / 2) - (float)(num52 / 2), position.Y + (float)(height / 2) - (float)(num53 / 2));
16948 vector26 = new Vector2(oldPosition.X + (float)(width / 2) - (float)(num52 / 2), oldPosition.Y + (float)(height / 2) - (float)(num53 / 2));
16949 }
16951 }
16952 }
16953
16955 {
16957 for (int i = 0; i < 4; i++)
16958 {
16959 Dust dust = Dust.NewDustPerfect(hitPoint, 306, spinningpoint.RotatedBy((float)Math.PI / 4f * Main.rand.NextFloatDirection()) * 0.6f * Main.rand.NextFloat(), 200, default(Color), 1.6f);
16960 dust.color = Color.Lerp(new Color(219, 253, 0), Color.Cyan, Main.rand.NextFloat());
16961 Dust dust2 = Dust.CloneDust(dust);
16962 dust2.color = Color.White;
16963 dust2.scale = 1f;
16964 dust2.alpha = 50;
16965 }
16966 }
16967
16968 private void AI_149_GolfBall()
16969 {
16970 if (!npcProj && timeLeft < 10)
16971 {
16972 timeLeft = 10;
16973 }
16974 if (ai[1] == -1f)
16975 {
16976 Tile tileSafely = Framing.GetTileSafely(base.Bottom.ToTileCoordinates());
16977 if (!tileSafely.active() || tileSafely.type != 494)
16978 {
16979 ai[1] = 0f;
16980 netUpdate = true;
16981 }
16982 return;
16983 }
16985 if (ballStepResult.State == BallState.Resting)
16986 {
16987 damage = 0;
16988 if (Main.netMode == 1 && owner == Main.myPlayer && localAI[1] != (float)ballStepResult.State)
16989 {
16990 netUpdate = true;
16991 }
16992 }
16993 localAI[1] = (float)ballStepResult.State;
16994 rotation += localAI[0];
16995 if (velocity.Y != 0f && ballStepResult.State == BallState.Moving)
16996 {
16997 rotation += velocity.X * 0.1f + velocity.Y * 0.1f;
16998 }
16999 if (ballStepResult.State == BallState.Moving && owner == Main.myPlayer)
17000 {
17001 bool? flag = ProjectileID.Sets.ForcePlateDetection[135];
17002 if ((!flag.HasValue || flag.Value) && localAI[1] != 0f)
17003 {
17005 }
17006 }
17007 if (ballStepResult.State == BallState.Moving && Main.netMode == 2 && Main.player.IndexInRange(owner) && Main.player[owner].active)
17008 {
17010 }
17011 }
17012
17014 {
17015 localAI[0] = 40f;
17016 float mAX_SPREAD = 20f;
17017 int fluff = 10;
17018 int distFluff = 50;
17019 int layerStart = 1;
17020 int num = 6;
17021 if (velocity.Length() < 8f || Math.Abs(velocity.Y) < 4f)
17022 {
17023 mAX_SPREAD = 15f;
17024 fluff = 7;
17025 distFluff = 30;
17026 num = 4;
17027 }
17028 if (velocity.Length() < 4f || Math.Abs(velocity.Y) < 2f)
17029 {
17030 mAX_SPREAD = 15f;
17031 fluff = 7;
17032 distFluff = 30;
17033 num = 2;
17034 layerStart = 0;
17035 }
17036 int layerEnd = num;
17037 int num2 = num - 2;
17038 if (num2 < 1)
17039 {
17040 num2 = 1;
17041 }
17043 for (int i = 0; i < 10; i++)
17044 {
17045 Dust dust = Dust.NewDustPerfect(base.Center + Main.rand.NextVector2Circular(width / 2, height / 2), 228, Main.rand.NextVector2Circular(3f, 3f));
17046 dust.scale = 0.6f;
17047 if (i < 5)
17048 {
17049 dust.noGravity = true;
17050 dust.scale = 1.8f;
17051 }
17052 }
17053 }
17054
17056 {
17057 if (aiStyle == 4 || aiStyle == 38 || aiStyle == 84 || aiStyle == 148 || (aiStyle == 7 && ai[0] == 2f) || ((type == 440 || type == 449 || type == 606) && ai[1] == 1f) || (aiStyle == 93 && ai[0] < 0f) || type == 540 || type == 756 || type == 818 || type == 856 || type == 961 || type == 933 || ProjectileID.Sets.IsAGolfBall[type])
17058 {
17059 return;
17060 }
17061 if (wet)
17062 {
17064 }
17065 else
17066 {
17067 position += velocity;
17068 }
17069 if (Main.projPet[type] && tileCollide)
17070 {
17071 bool fall = false;
17072 if (aiStyle == 62)
17073 {
17074 fall = true;
17075 }
17076 switch (type)
17077 {
17078 case 317:
17079 case 387:
17080 case 388:
17081 case 533:
17082 case 759:
17083 fall = true;
17084 break;
17085 }
17087 position.X = vector.X;
17088 position.Y = vector.Y;
17089 velocity.X = vector.Z;
17090 velocity.Y = vector.W;
17091 }
17092 }
17093
17094 public void FishingCheck()
17095 {
17096 if (Main.player[owner].wet && !(base.Center.Y >= Main.player[owner].RotatedRelativePoint(Main.player[owner].MountedCenter).Y))
17097 {
17098 return;
17099 }
17101 fisher.X = (int)(base.Center.X / 16f);
17102 fisher.Y = (int)(base.Center.Y / 16f);
17103 fisher.bobberType = type;
17104 GetFishingPondState(fisher.X, fisher.Y, out fisher.inLava, out fisher.inHoney, out fisher.waterTilesCount, out fisher.chumsInWater);
17105 if (Main.notTheBeesWorld && Main.rand.Next(2) == 0)
17106 {
17107 fisher.inHoney = false;
17108 }
17109 if (fisher.waterTilesCount < 75)
17110 {
17111 Main.player[owner].displayedFishingInfo = Language.GetTextValue("GameUI.NotEnoughWater");
17112 return;
17113 }
17114 fisher.playerFishingConditions = Main.player[owner].GetFishingConditions();
17115 int baitItemType = fisher.playerFishingConditions.BaitItemType;
17116 if (baitItemType == 2673)
17117 {
17118 Main.player[owner].displayedFishingInfo = Language.GetTextValue("GameUI.FishingWarning");
17119 if ((fisher.X < 380 || fisher.X > Main.maxTilesX - 380) && fisher.waterTilesCount > 1000 && !NPC.AnyNPCs(370))
17120 {
17121 ai[1] = Main.rand.Next(-180, -60) - 100;
17122 localAI[1] = 1f;
17123 netUpdate = true;
17124 }
17125 return;
17126 }
17127 fisher.fishingLevel = fisher.playerFishingConditions.FinalFishingLevel;
17128 if (fisher.fishingLevel == 0)
17129 {
17130 return;
17131 }
17132 fisher.CanFishInLava = ItemID.Sets.CanFishInLava[fisher.playerFishingConditions.PoleItemType] || ItemID.Sets.IsLavaBait[fisher.playerFishingConditions.BaitItemType] || Main.player[owner].accLavaFishing;
17133 if (fisher.chumsInWater > 0)
17134 {
17135 fisher.fishingLevel += 11;
17136 }
17137 if (fisher.chumsInWater > 1)
17138 {
17139 fisher.fishingLevel += 6;
17140 }
17141 if (fisher.chumsInWater > 2)
17142 {
17143 fisher.fishingLevel += 3;
17144 }
17145 Main.player[owner].displayedFishingInfo = Language.GetTextValue("GameUI.FishingPower", fisher.fishingLevel);
17146 fisher.waterNeededToFish = 300;
17147 float num = (float)Main.maxTilesX / 4200f;
17148 num *= num;
17149 fisher.atmo = (float)((double)(position.Y / 16f - (60f + 10f * num)) / (Main.worldSurface / 6.0));
17150 if ((double)fisher.atmo < 0.25)
17151 {
17152 fisher.atmo = 0.25f;
17153 }
17154 if (fisher.atmo > 1f)
17155 {
17156 fisher.atmo = 1f;
17157 }
17158 fisher.waterNeededToFish = (int)((float)fisher.waterNeededToFish * fisher.atmo);
17159 fisher.waterQuality = (float)fisher.waterTilesCount / (float)fisher.waterNeededToFish;
17160 if (fisher.waterQuality < 1f)
17161 {
17162 fisher.fishingLevel = (int)((float)fisher.fishingLevel * fisher.waterQuality);
17163 }
17164 fisher.waterQuality = 1f - fisher.waterQuality;
17165 if (fisher.waterTilesCount < fisher.waterNeededToFish)
17166 {
17167 Main.player[owner].displayedFishingInfo = Language.GetTextValue("GameUI.FullFishingPower", fisher.fishingLevel, 0.0 - Math.Round(fisher.waterQuality * 100f));
17168 }
17169 if (Main.player[owner].luck < 0f)
17170 {
17171 if (Main.rand.NextFloat() < 0f - Main.player[owner].luck)
17172 {
17173 fisher.fishingLevel = (int)((double)fisher.fishingLevel * (0.9 - (double)Main.rand.NextFloat() * 0.3));
17174 }
17175 }
17176 else if (Main.rand.NextFloat() < Main.player[owner].luck)
17177 {
17178 fisher.fishingLevel = (int)((double)fisher.fishingLevel * (1.1 + (double)Main.rand.NextFloat() * 0.3));
17179 }
17180 int num2 = (fisher.fishingLevel + 75) / 2;
17181 if (Main.rand.Next(100) > num2)
17182 {
17183 return;
17184 }
17185 fisher.heightLevel = 0;
17186 if (Main.remixWorld)
17187 {
17188 if ((double)fisher.Y < Main.worldSurface * 0.5)
17189 {
17190 fisher.heightLevel = 0;
17191 }
17192 else if ((double)fisher.Y < Main.worldSurface)
17193 {
17194 fisher.heightLevel = 1;
17195 }
17196 else if ((double)fisher.Y < Main.rockLayer)
17197 {
17198 fisher.heightLevel = 3;
17199 }
17200 else if (fisher.Y < Main.maxTilesY - 300)
17201 {
17202 fisher.heightLevel = 2;
17203 }
17204 else
17205 {
17206 fisher.heightLevel = 4;
17207 }
17208 if (fisher.heightLevel == 2 && Main.rand.Next(2) == 0)
17209 {
17210 fisher.heightLevel = 1;
17211 }
17212 }
17213 else if ((double)fisher.Y < Main.worldSurface * 0.5)
17214 {
17215 fisher.heightLevel = 0;
17216 }
17217 else if ((double)fisher.Y < Main.worldSurface)
17218 {
17219 fisher.heightLevel = 1;
17220 }
17221 else if ((double)fisher.Y < Main.rockLayer)
17222 {
17223 fisher.heightLevel = 2;
17224 }
17225 else if (fisher.Y < Main.maxTilesY - 300)
17226 {
17227 fisher.heightLevel = 3;
17228 }
17229 else
17230 {
17231 fisher.heightLevel = 4;
17232 }
17233 FishingCheck_RollDropLevels(fisher.fishingLevel, out fisher.common, out fisher.uncommon, out fisher.rare, out fisher.veryrare, out fisher.legendary, out fisher.crate);
17237 bool flag = false;
17238 if (fisher.rolledItemDrop > 0)
17239 {
17240 if (Main.player[owner].sonarPotion)
17241 {
17242 Item item = new Item();
17243 item.SetDefaults(fisher.rolledItemDrop);
17244 item.position = position;
17246 }
17247 float num3 = fisher.fishingLevel;
17248 ai[1] = (float)Main.rand.Next(-240, -90) - num3;
17249 localAI[1] = fisher.rolledItemDrop;
17250 netUpdate = true;
17251 flag = true;
17252 }
17253 if (fisher.rolledEnemySpawn > 0)
17254 {
17255 if (Main.player[owner].sonarPotion)
17256 {
17257 PopupText.AssignAsSonarText(PopupText.NewText(PopupTextContext.SonarAlert, fisher.rolledEnemySpawn, base.Center, stay5TimesLonger: false));
17258 }
17259 float num4 = fisher.fishingLevel;
17260 ai[1] = (float)Main.rand.Next(-240, -90) - num4;
17261 localAI[1] = -fisher.rolledEnemySpawn;
17262 netUpdate = true;
17263 flag = true;
17264 }
17265 if (!flag && fisher.inLava)
17266 {
17267 int num5 = 0;
17268 if (ItemID.Sets.IsLavaBait[fisher.playerFishingConditions.BaitItemType])
17269 {
17270 num5++;
17271 }
17272 if (ItemID.Sets.CanFishInLava[fisher.playerFishingConditions.PoleItemType])
17273 {
17274 num5++;
17275 }
17276 if (Main.player[owner].accLavaFishing)
17277 {
17278 num5++;
17279 }
17280 if (num5 >= 2)
17281 {
17282 localAI[1] += 240f;
17283 }
17284 }
17285 if (fisher.CanFishInLava && fisher.inLava)
17286 {
17288 }
17289 }
17290
17292 {
17293 if (fisher.inLava || fisher.inHoney || !Main.bloodMoon || Main.dayTime)
17294 {
17295 return;
17296 }
17297 int maxValue = 6;
17298 if (fisher.playerFishingConditions.PoleItemType == 4325)
17299 {
17300 maxValue = 3;
17301 }
17302 if (Main.rand.Next(maxValue) != 0)
17303 {
17304 return;
17305 }
17306 if (!NPC.unlockedSlimeRedSpawn && Main.rand.Next(5) == 0)
17307 {
17308 fisher.rolledEnemySpawn = 682;
17309 }
17310 else if (Main.hardMode)
17311 {
17312 fisher.rolledEnemySpawn = Utils.SelectRandom(Main.rand, new short[4] { 620, 621, 586, 587 });
17313 if (Main.rand.Next(10) == 0)
17314 {
17315 fisher.rolledEnemySpawn = 618;
17316 }
17317 }
17318 else
17319 {
17320 fisher.rolledEnemySpawn = Utils.SelectRandom(Main.rand, new short[2] { 586, 587 });
17321 }
17322 }
17323
17325 {
17326 bool flag = Main.player[owner].ZoneCorrupt;
17327 bool flag2 = Main.player[owner].ZoneCrimson;
17328 bool flag3 = Main.player[owner].ZoneJungle;
17329 bool flag4 = Main.player[owner].ZoneSnow;
17330 bool flag5 = Main.player[owner].ZoneDungeon;
17331 if (!NPC.downedBoss3)
17332 {
17333 flag5 = false;
17334 }
17335 if (Main.notTheBeesWorld && !Main.remixWorld && Main.rand.Next(2) == 0)
17336 {
17337 flag3 = false;
17338 }
17339 if (Main.remixWorld && fisher.heightLevel == 0)
17340 {
17341 flag = false;
17342 flag2 = false;
17343 }
17344 else if (flag && flag2)
17345 {
17346 if (Main.rand.Next(2) == 0)
17347 {
17348 flag2 = false;
17349 }
17350 else
17351 {
17352 flag = false;
17353 }
17354 }
17355 if (fisher.rolledEnemySpawn > 0)
17356 {
17357 return;
17358 }
17359 if (fisher.inLava)
17360 {
17361 if (fisher.CanFishInLava)
17362 {
17363 if (fisher.crate && Main.rand.Next(6) == 0)
17364 {
17365 fisher.rolledItemDrop = (Main.hardMode ? 4878 : 4877);
17366 }
17367 else if (fisher.legendary && Main.hardMode && Main.rand.Next(3) == 0)
17368 {
17369 fisher.rolledItemDrop = Main.rand.NextFromList(new short[4] { 4819, 4820, 4872, 2331 });
17370 }
17371 else if (fisher.legendary && !Main.hardMode && Main.rand.Next(3) == 0)
17372 {
17373 fisher.rolledItemDrop = Main.rand.NextFromList(new short[3] { 4819, 4820, 4872 });
17374 }
17375 else if (fisher.veryrare)
17376 {
17377 fisher.rolledItemDrop = 2312;
17378 }
17379 else if (fisher.rare)
17380 {
17381 fisher.rolledItemDrop = 2315;
17382 }
17383 }
17384 return;
17385 }
17386 if (fisher.inHoney)
17387 {
17388 if (fisher.rare || (fisher.uncommon && Main.rand.Next(2) == 0))
17389 {
17390 fisher.rolledItemDrop = 2314;
17391 }
17392 else if (fisher.uncommon && fisher.questFish == 2451)
17393 {
17394 fisher.rolledItemDrop = 2451;
17395 }
17396 return;
17397 }
17398 if (Main.rand.Next(50) > fisher.fishingLevel && Main.rand.Next(50) > fisher.fishingLevel && fisher.waterTilesCount < fisher.waterNeededToFish)
17399 {
17400 fisher.rolledItemDrop = Main.rand.Next(2337, 2340);
17401 if (Main.rand.Next(8) == 0)
17402 {
17403 fisher.rolledItemDrop = 5275;
17404 }
17405 return;
17406 }
17407 if (fisher.crate)
17408 {
17409 bool hardMode = Main.hardMode;
17410 if (fisher.rare && flag5)
17411 {
17412 fisher.rolledItemDrop = (hardMode ? 3984 : 3205);
17413 }
17414 else if (fisher.rare && (Main.player[owner].ZoneBeach || (Main.remixWorld && fisher.heightLevel == 1 && (double)fisher.Y >= Main.rockLayer && Main.rand.Next(2) == 0)))
17415 {
17416 fisher.rolledItemDrop = (hardMode ? 5003 : 5002);
17417 }
17418 else if (fisher.rare && flag)
17419 {
17420 fisher.rolledItemDrop = (hardMode ? 3982 : 3203);
17421 }
17422 else if (fisher.rare && flag2)
17423 {
17424 fisher.rolledItemDrop = (hardMode ? 3983 : 3204);
17425 }
17426 else if (fisher.rare && Main.player[owner].ZoneHallow)
17427 {
17428 fisher.rolledItemDrop = (hardMode ? 3986 : 3207);
17429 }
17430 else if (fisher.rare && flag3)
17431 {
17432 fisher.rolledItemDrop = (hardMode ? 3987 : 3208);
17433 }
17434 else if (fisher.rare && Main.player[owner].ZoneSnow)
17435 {
17436 fisher.rolledItemDrop = (hardMode ? 4406 : 4405);
17437 }
17438 else if (fisher.rare && Main.player[owner].ZoneDesert)
17439 {
17440 fisher.rolledItemDrop = (hardMode ? 4408 : 4407);
17441 }
17442 else if (fisher.rare && fisher.heightLevel == 0)
17443 {
17444 fisher.rolledItemDrop = (hardMode ? 3985 : 3206);
17445 }
17446 else if (fisher.veryrare || fisher.legendary)
17447 {
17448 fisher.rolledItemDrop = (hardMode ? 3981 : 2336);
17449 }
17450 else if (fisher.uncommon)
17451 {
17452 fisher.rolledItemDrop = (hardMode ? 3980 : 2335);
17453 }
17454 else
17455 {
17456 fisher.rolledItemDrop = (hardMode ? 3979 : 2334);
17457 }
17458 return;
17459 }
17460 if (!NPC.combatBookWasUsed && Main.bloodMoon && fisher.legendary && Main.rand.Next(3) == 0)
17461 {
17462 fisher.rolledItemDrop = 4382;
17463 return;
17464 }
17465 if (Main.bloodMoon && fisher.legendary && Main.rand.Next(2) == 0)
17466 {
17467 fisher.rolledItemDrop = 5240;
17468 return;
17469 }
17470 if (fisher.legendary && Main.rand.Next(5) == 0)
17471 {
17472 fisher.rolledItemDrop = 2423;
17473 return;
17474 }
17475 if (fisher.legendary && Main.rand.Next(5) == 0)
17476 {
17477 fisher.rolledItemDrop = 3225;
17478 return;
17479 }
17480 if (fisher.legendary && Main.rand.Next(10) == 0)
17481 {
17482 fisher.rolledItemDrop = 2420;
17483 return;
17484 }
17485 if (!fisher.legendary && !fisher.veryrare && fisher.uncommon && Main.rand.Next(5) == 0)
17486 {
17487 fisher.rolledItemDrop = 3196;
17488 return;
17489 }
17490 bool flag6 = Main.player[owner].ZoneDesert;
17491 if (flag5)
17492 {
17493 flag6 = false;
17494 if (fisher.rolledItemDrop == 0 && fisher.veryrare && Main.rand.Next(7) == 0)
17495 {
17496 fisher.rolledItemDrop = 3000;
17497 }
17498 }
17499 else
17500 {
17501 if (flag)
17502 {
17503 if (fisher.legendary && Main.hardMode && Main.player[owner].ZoneSnow && fisher.heightLevel == 3 && Main.rand.Next(3) != 0)
17504 {
17505 fisher.rolledItemDrop = 2429;
17506 }
17507 else if (fisher.legendary && Main.hardMode && Main.rand.Next(2) == 0)
17508 {
17509 fisher.rolledItemDrop = 3210;
17510 }
17511 else if (fisher.rare)
17512 {
17513 fisher.rolledItemDrop = 2330;
17514 }
17515 else if (fisher.uncommon && fisher.questFish == 2454)
17516 {
17517 fisher.rolledItemDrop = 2454;
17518 }
17519 else if (fisher.uncommon && fisher.questFish == 2485)
17520 {
17521 fisher.rolledItemDrop = 2485;
17522 }
17523 else if (fisher.uncommon && fisher.questFish == 2457)
17524 {
17525 fisher.rolledItemDrop = 2457;
17526 }
17527 else if (fisher.uncommon)
17528 {
17529 fisher.rolledItemDrop = 2318;
17530 }
17531 }
17532 else if (flag2)
17533 {
17534 if (fisher.legendary && Main.hardMode && Main.player[owner].ZoneSnow && fisher.heightLevel == 3 && Main.rand.Next(3) != 0)
17535 {
17536 fisher.rolledItemDrop = 2429;
17537 }
17538 else if (fisher.legendary && Main.hardMode && Main.rand.Next(2) == 0)
17539 {
17540 fisher.rolledItemDrop = 3211;
17541 }
17542 else if (fisher.uncommon && fisher.questFish == 2477)
17543 {
17544 fisher.rolledItemDrop = 2477;
17545 }
17546 else if (fisher.uncommon && fisher.questFish == 2463)
17547 {
17548 fisher.rolledItemDrop = 2463;
17549 }
17550 else if (fisher.uncommon)
17551 {
17552 fisher.rolledItemDrop = 2319;
17553 }
17554 else if (fisher.common)
17555 {
17556 fisher.rolledItemDrop = 2305;
17557 }
17558 }
17559 else if (Main.player[owner].ZoneHallow)
17560 {
17561 if (flag6 && Main.rand.Next(2) == 0)
17562 {
17563 if (fisher.uncommon && fisher.questFish == 4393)
17564 {
17565 fisher.rolledItemDrop = 4393;
17566 }
17567 else if (fisher.uncommon && fisher.questFish == 4394)
17568 {
17569 fisher.rolledItemDrop = 4394;
17570 }
17571 else if (fisher.uncommon)
17572 {
17573 fisher.rolledItemDrop = 4410;
17574 }
17575 else if (Main.rand.Next(3) == 0)
17576 {
17577 fisher.rolledItemDrop = 4402;
17578 }
17579 else
17580 {
17581 fisher.rolledItemDrop = 4401;
17582 }
17583 }
17584 else if (fisher.legendary && Main.hardMode && Main.player[owner].ZoneSnow && fisher.heightLevel == 3 && Main.rand.Next(3) != 0)
17585 {
17586 fisher.rolledItemDrop = 2429;
17587 }
17588 else if (fisher.legendary && Main.hardMode && Main.rand.Next(2) == 0)
17589 {
17590 fisher.rolledItemDrop = 3209;
17591 }
17592 else if (fisher.legendary && Main.hardMode && Main.rand.Next(3) != 0)
17593 {
17594 fisher.rolledItemDrop = 5274;
17595 }
17596 else if (fisher.heightLevel > 1 && fisher.veryrare)
17597 {
17598 fisher.rolledItemDrop = 2317;
17599 }
17600 else if (fisher.heightLevel > 1 && fisher.uncommon && fisher.questFish == 2465)
17601 {
17602 fisher.rolledItemDrop = 2465;
17603 }
17604 else if (fisher.heightLevel < 2 && fisher.uncommon && fisher.questFish == 2468)
17605 {
17606 fisher.rolledItemDrop = 2468;
17607 }
17608 else if (fisher.rare)
17609 {
17610 fisher.rolledItemDrop = 2310;
17611 }
17612 else if (fisher.uncommon && fisher.questFish == 2471)
17613 {
17614 fisher.rolledItemDrop = 2471;
17615 }
17616 else if (fisher.uncommon)
17617 {
17618 fisher.rolledItemDrop = 2307;
17619 }
17620 }
17621 if (fisher.rolledItemDrop == 0 && Main.player[owner].ZoneGlowshroom && fisher.uncommon && fisher.questFish == 2475)
17622 {
17623 fisher.rolledItemDrop = 2475;
17624 }
17625 if (flag4 && flag3 && Main.rand.Next(2) == 0)
17626 {
17627 flag4 = false;
17628 }
17629 if (fisher.rolledItemDrop == 0 && flag4)
17630 {
17631 if (fisher.heightLevel < 2 && fisher.uncommon && fisher.questFish == 2467)
17632 {
17633 fisher.rolledItemDrop = 2467;
17634 }
17635 else if (fisher.heightLevel == 1 && fisher.uncommon && fisher.questFish == 2470)
17636 {
17637 fisher.rolledItemDrop = 2470;
17638 }
17639 else if (fisher.heightLevel >= 2 && fisher.uncommon && fisher.questFish == 2484)
17640 {
17641 fisher.rolledItemDrop = 2484;
17642 }
17643 else if (fisher.heightLevel > 1 && fisher.uncommon && fisher.questFish == 2466)
17644 {
17645 fisher.rolledItemDrop = 2466;
17646 }
17647 else if ((fisher.common && Main.rand.Next(12) == 0) || (fisher.uncommon && Main.rand.Next(6) == 0))
17648 {
17649 fisher.rolledItemDrop = 3197;
17650 }
17651 else if (fisher.uncommon)
17652 {
17653 fisher.rolledItemDrop = 2306;
17654 }
17655 else if (fisher.common)
17656 {
17657 fisher.rolledItemDrop = 2299;
17658 }
17659 else if (fisher.heightLevel > 1 && Main.rand.Next(3) == 0)
17660 {
17661 fisher.rolledItemDrop = 2309;
17662 }
17663 }
17664 if (fisher.rolledItemDrop == 0 && flag3)
17665 {
17666 if (fisher.heightLevel == 1 && fisher.uncommon && fisher.questFish == 2452)
17667 {
17668 fisher.rolledItemDrop = 2452;
17669 }
17670 else if (fisher.heightLevel == 1 && fisher.uncommon && fisher.questFish == 2483)
17671 {
17672 fisher.rolledItemDrop = 2483;
17673 }
17674 else if (fisher.heightLevel == 1 && fisher.uncommon && fisher.questFish == 2488)
17675 {
17676 fisher.rolledItemDrop = 2488;
17677 }
17678 else if (fisher.heightLevel >= 1 && fisher.uncommon && fisher.questFish == 2486)
17679 {
17680 fisher.rolledItemDrop = 2486;
17681 }
17682 else if (fisher.heightLevel > 1 && fisher.uncommon)
17683 {
17684 fisher.rolledItemDrop = 2311;
17685 }
17686 else if (fisher.uncommon)
17687 {
17688 fisher.rolledItemDrop = 2313;
17689 }
17690 else if (fisher.common)
17691 {
17692 fisher.rolledItemDrop = 2302;
17693 }
17694 }
17695 }
17696 if (fisher.rolledItemDrop == 0)
17697 {
17698 if ((Main.remixWorld && fisher.heightLevel == 1 && (double)fisher.Y >= Main.rockLayer && Main.rand.Next(3) == 0) || (fisher.heightLevel <= 1 && (fisher.X < 380 || fisher.X > Main.maxTilesX - 380) && fisher.waterTilesCount > 1000))
17699 {
17700 if (fisher.veryrare && Main.rand.Next(2) == 0)
17701 {
17702 fisher.rolledItemDrop = 2341;
17703 }
17704 else if (fisher.veryrare)
17705 {
17706 fisher.rolledItemDrop = 2342;
17707 }
17708 else if (fisher.rare && Main.rand.Next(5) == 0)
17709 {
17710 fisher.rolledItemDrop = 2438;
17711 }
17712 else if (fisher.rare && Main.rand.Next(3) == 0)
17713 {
17714 fisher.rolledItemDrop = 2332;
17715 }
17716 else if (fisher.uncommon && fisher.questFish == 2480)
17717 {
17718 fisher.rolledItemDrop = 2480;
17719 }
17720 else if (fisher.uncommon && fisher.questFish == 2481)
17721 {
17722 fisher.rolledItemDrop = 2481;
17723 }
17724 else if (fisher.uncommon)
17725 {
17726 fisher.rolledItemDrop = 2316;
17727 }
17728 else if (fisher.common && Main.rand.Next(2) == 0)
17729 {
17730 fisher.rolledItemDrop = 2301;
17731 }
17732 else if (fisher.common)
17733 {
17734 fisher.rolledItemDrop = 2300;
17735 }
17736 else
17737 {
17738 fisher.rolledItemDrop = 2297;
17739 }
17740 }
17741 else if (flag6)
17742 {
17743 if (fisher.uncommon && fisher.questFish == 4393)
17744 {
17745 fisher.rolledItemDrop = 4393;
17746 }
17747 else if (fisher.uncommon && fisher.questFish == 4394)
17748 {
17749 fisher.rolledItemDrop = 4394;
17750 }
17751 else if (fisher.uncommon)
17752 {
17753 fisher.rolledItemDrop = 4410;
17754 }
17755 else if (Main.rand.Next(3) == 0)
17756 {
17757 fisher.rolledItemDrop = 4402;
17758 }
17759 else
17760 {
17761 fisher.rolledItemDrop = 4401;
17762 }
17763 }
17764 }
17765 if (fisher.rolledItemDrop != 0)
17766 {
17767 return;
17768 }
17769 if (fisher.heightLevel < 2 && fisher.uncommon && fisher.questFish == 2461)
17770 {
17771 fisher.rolledItemDrop = 2461;
17772 }
17773 else if (fisher.heightLevel == 0 && fisher.uncommon && fisher.questFish == 2453)
17774 {
17775 fisher.rolledItemDrop = 2453;
17776 }
17777 else if (fisher.heightLevel == 0 && fisher.uncommon && fisher.questFish == 2473)
17778 {
17779 fisher.rolledItemDrop = 2473;
17780 }
17781 else if (fisher.heightLevel == 0 && fisher.uncommon && fisher.questFish == 2476)
17782 {
17783 fisher.rolledItemDrop = 2476;
17784 }
17785 else if (fisher.heightLevel < 2 && fisher.uncommon && fisher.questFish == 2458)
17786 {
17787 fisher.rolledItemDrop = 2458;
17788 }
17789 else if (fisher.heightLevel < 2 && fisher.uncommon && fisher.questFish == 2459)
17790 {
17791 fisher.rolledItemDrop = 2459;
17792 }
17793 else if (fisher.heightLevel == 0 && fisher.uncommon)
17794 {
17795 fisher.rolledItemDrop = 2304;
17796 }
17797 else if (fisher.heightLevel > 0 && fisher.heightLevel < 3 && fisher.uncommon && fisher.questFish == 2455)
17798 {
17799 fisher.rolledItemDrop = 2455;
17800 }
17801 else if (fisher.heightLevel == 1 && fisher.uncommon && fisher.questFish == 2479)
17802 {
17803 fisher.rolledItemDrop = 2479;
17804 }
17805 else if (fisher.heightLevel == 1 && fisher.uncommon && fisher.questFish == 2456)
17806 {
17807 fisher.rolledItemDrop = 2456;
17808 }
17809 else if (fisher.heightLevel == 1 && fisher.uncommon && fisher.questFish == 2474)
17810 {
17811 fisher.rolledItemDrop = 2474;
17812 }
17813 else if (fisher.heightLevel > 1 && fisher.rare && Main.rand.Next(5) == 0)
17814 {
17815 if (Main.hardMode && Main.rand.Next(2) == 0)
17816 {
17817 fisher.rolledItemDrop = 2437;
17818 }
17819 else
17820 {
17821 fisher.rolledItemDrop = 2436;
17822 }
17823 }
17824 else if (fisher.heightLevel > 1 && fisher.legendary && Main.rand.Next(3) != 0)
17825 {
17826 fisher.rolledItemDrop = 2308;
17827 }
17828 else if (fisher.heightLevel > 1 && fisher.veryrare && Main.rand.Next(2) == 0)
17829 {
17830 fisher.rolledItemDrop = 2320;
17831 }
17832 else if (fisher.heightLevel > 1 && fisher.rare)
17833 {
17834 fisher.rolledItemDrop = 2321;
17835 }
17836 else if (fisher.heightLevel > 1 && fisher.uncommon && fisher.questFish == 2478)
17837 {
17838 fisher.rolledItemDrop = 2478;
17839 }
17840 else if (fisher.heightLevel > 1 && fisher.uncommon && fisher.questFish == 2450)
17841 {
17842 fisher.rolledItemDrop = 2450;
17843 }
17844 else if (fisher.heightLevel > 1 && fisher.uncommon && fisher.questFish == 2464)
17845 {
17846 fisher.rolledItemDrop = 2464;
17847 }
17848 else if (fisher.heightLevel > 1 && fisher.uncommon && fisher.questFish == 2469)
17849 {
17850 fisher.rolledItemDrop = 2469;
17851 }
17852 else if (fisher.heightLevel > 2 && fisher.uncommon && fisher.questFish == 2462)
17853 {
17854 fisher.rolledItemDrop = 2462;
17855 }
17856 else if (fisher.heightLevel > 2 && fisher.uncommon && fisher.questFish == 2482)
17857 {
17858 fisher.rolledItemDrop = 2482;
17859 }
17860 else if (fisher.heightLevel > 2 && fisher.uncommon && fisher.questFish == 2472)
17861 {
17862 fisher.rolledItemDrop = 2472;
17863 }
17864 else if (fisher.heightLevel > 2 && fisher.uncommon && fisher.questFish == 2460)
17865 {
17866 fisher.rolledItemDrop = 2460;
17867 }
17868 else if (fisher.heightLevel > 1 && fisher.uncommon && Main.rand.Next(4) != 0)
17869 {
17870 fisher.rolledItemDrop = 2303;
17871 }
17872 else if (fisher.heightLevel > 1 && (fisher.uncommon || fisher.common || Main.rand.Next(4) == 0))
17873 {
17874 if (Main.rand.Next(4) == 0)
17875 {
17876 fisher.rolledItemDrop = 2303;
17877 }
17878 else
17879 {
17880 fisher.rolledItemDrop = 2309;
17881 }
17882 }
17883 else if (fisher.uncommon && fisher.questFish == 2487)
17884 {
17885 fisher.rolledItemDrop = 2487;
17886 }
17887 else if (fisher.waterTilesCount > 1000 && fisher.common)
17888 {
17889 fisher.rolledItemDrop = 2298;
17890 }
17891 else
17892 {
17893 fisher.rolledItemDrop = 2290;
17894 }
17895 }
17896
17898 {
17899 fisher.questFish = Main.anglerQuestItemNetIDs[Main.anglerQuest];
17900 if (Main.player[owner].HasItem(fisher.questFish))
17901 {
17902 fisher.questFish = -1;
17903 }
17904 if (!NPC.AnyNPCs(369))
17905 {
17906 fisher.questFish = -1;
17907 }
17909 {
17910 fisher.questFish = -1;
17911 }
17912 }
17913
17914 private void FishingCheck_RollDropLevels(int fishingLevel, out bool common, out bool uncommon, out bool rare, out bool veryrare, out bool legendary, out bool crate)
17915 {
17916 int num = 150 / fishingLevel;
17917 int num2 = 150 * 2 / fishingLevel;
17918 int num3 = 150 * 7 / fishingLevel;
17919 int num4 = 150 * 15 / fishingLevel;
17920 int num5 = 150 * 30 / fishingLevel;
17921 int num6 = 10;
17922 if (Main.player[owner].cratePotion)
17923 {
17924 num6 += 15;
17925 }
17926 if (num < 2)
17927 {
17928 num = 2;
17929 }
17930 if (num2 < 3)
17931 {
17932 num2 = 3;
17933 }
17934 if (num3 < 4)
17935 {
17936 num3 = 4;
17937 }
17938 if (num4 < 5)
17939 {
17940 num4 = 5;
17941 }
17942 if (num5 < 6)
17943 {
17944 num5 = 6;
17945 }
17946 common = false;
17947 uncommon = false;
17948 rare = false;
17949 veryrare = false;
17950 legendary = false;
17951 crate = false;
17952 if (Main.rand.Next(num) == 0)
17953 {
17954 common = true;
17955 }
17956 if (Main.rand.Next(num2) == 0)
17957 {
17958 uncommon = true;
17959 }
17960 if (Main.rand.Next(num3) == 0)
17961 {
17962 rare = true;
17963 }
17964 if (Main.rand.Next(num4) == 0)
17965 {
17966 veryrare = true;
17967 }
17968 if (Main.rand.Next(num5) == 0)
17969 {
17970 legendary = true;
17971 }
17972 if (Main.rand.Next(100) < num6)
17973 {
17974 crate = true;
17975 }
17976 }
17977
17978 private static void GetFishingPondState(int x, int y, out bool lava, out bool honey, out int numWaters, out int chumCount)
17979 {
17980 lava = false;
17981 honey = false;
17982 numWaters = 0;
17983 chumCount = 0;
17984 Point tileCoords = new Point(0, 0);
17986 for (int i = minX; i <= maxX; i++)
17987 {
17988 int num = y;
17989 while (Main.tile[i, num] != null && Main.tile[i, num].liquid > 0 && !WorldGen.SolidTile(i, num) && num < Main.maxTilesY - 10)
17990 {
17991 numWaters++;
17992 num++;
17993 if (Main.tile[i, num].lava())
17994 {
17995 lava = true;
17996 }
17997 else if (Main.tile[i, num].honey())
17998 {
17999 honey = true;
18000 }
18001 tileCoords.X = i;
18002 tileCoords.Y = num;
18003 chumCount += Main.instance.ChumBucketProjectileHelper.GetChumsInLocation(tileCoords);
18004 }
18005 }
18006 if (honey)
18007 {
18008 numWaters = (int)((double)numWaters * 1.5);
18009 }
18010 }
18011
18012 private static void GetFishingPondWidth(int x, int y, out int minX, out int maxX)
18013 {
18014 minX = x;
18015 maxX = x;
18016 while (minX > 10 && Main.tile[minX, y] != null && Main.tile[minX, y].liquid > 0 && !WorldGen.SolidTile(minX, y))
18017 {
18018 minX--;
18019 }
18020 while (maxX < Main.maxTilesX - 10 && Main.tile[maxX, y] != null && Main.tile[maxX, y].liquid > 0 && !WorldGen.SolidTile(maxX, y))
18021 {
18022 maxX++;
18023 }
18024 }
18025
18026 public bool CanBeReflected()
18027 {
18028 if (active && friendly && !hostile && damage > 0)
18029 {
18030 if (type == 728 || type == 955)
18031 {
18032 return true;
18033 }
18034 if (aiStyle == 1 || aiStyle == 2 || aiStyle == 8 || aiStyle == 21 || aiStyle == 24 || aiStyle == 28 || aiStyle == 29 || aiStyle == 131)
18035 {
18036 return true;
18037 }
18038 }
18039 return false;
18040 }
18041
18043 {
18044 float num = ai[1];
18045 if (rawHueOverride.HasValue)
18046 {
18047 num = rawHueOverride.Value;
18048 }
18049 float num2 = (num + 0.5f) % 1f;
18050 float saturation = 1f;
18051 float luminosity = 0.5f;
18052 if (Main.player[owner].active)
18053 {
18054 switch (Main.player[owner].name)
18055 {
18056 case "Cenx":
18057 {
18061 Color color3 = Color.Lerp(new Color(0.3f, 1f, 0.2f), Color.HotPink, amount13);
18062 if (lerpToWhite != 0f)
18063 {
18065 }
18066 color3.A = (byte)((float)(int)color3.A * alphaChannelMultiplier);
18067 return color3;
18068 }
18069 case "Crowno":
18071 num2 = MathHelper.Lerp(127f / 180f, 47f / 60f, Utils.Turn01ToCyclic010(num2));
18073 break;
18074 case "Yoraiz0r":
18076 luminosity = 0.5f;
18077 break;
18078 case "Jaxrud":
18079 num2 = MathHelper.Lerp(13f / 72f, 0.43611112f, Utils.Turn01ToCyclic010(num2));
18080 luminosity = 0.5f;
18081 break;
18082 case "Lazure":
18083 num2 = MathHelper.Lerp(8f / 15f, 83f / 90f, Utils.Turn01ToCyclic010(num2));
18084 luminosity = 0.5f;
18085 break;
18086 case "Leinfors":
18088 luminosity = 0.5f;
18089 break;
18090 case "Grox The Great":
18092 luminosity = 0.5f;
18094 break;
18095 case "Acamaeda":
18096 num2 = MathHelper.Lerp(0.06f, 0.28f, Utils.Turn01ToCyclic010(num2));
18097 luminosity = 0.5f;
18099 break;
18100 case "Alchemystics":
18101 num2 = MathHelper.Lerp(0.74f, 0.96f, Utils.Turn01ToCyclic010(num2));
18102 luminosity = 0.6f;
18104 break;
18105 case "Antithesis":
18106 {
18107 num2 = 0.51f;
18108 float amount14 = (float)Math.Cos(num * ((float)Math.PI * 2f)) * 0.5f + 0.5f;
18109 luminosity = MathHelper.Lerp(0f, 0.5f, amount14);
18110 break;
18111 }
18112 case "Aurora3500":
18114 luminosity = 0.5f;
18116 break;
18117 case "Bame":
18118 {
18122 Color color2 = Color.Lerp(Color.Yellow, new Color(0.4f, 0f, 0.75f), amount12);
18123 if (lerpToWhite != 0f)
18124 {
18126 }
18127 color2.A = (byte)((float)(int)color2.A * alphaChannelMultiplier);
18128 return color2;
18129 }
18130 case "Criddle":
18131 num2 = MathHelper.Lerp(0.05f, 0.15f, Utils.Turn01ToCyclic010(num2));
18132 luminosity = 0.5f;
18134 break;
18135 case "Darthkitten":
18136 {
18137 num2 = 1f;
18138 float amount11 = (float)Math.Cos(num * ((float)Math.PI * 2f)) * 0.5f + 0.5f;
18139 luminosity = MathHelper.Lerp(1f, 0.4f, amount11);
18140 break;
18141 }
18142 case "darthmorf":
18143 {
18144 num2 = 0f;
18145 float amount10 = (float)Math.Cos(num * ((float)Math.PI * 2f)) * 0.5f + 0.5f;
18146 luminosity = MathHelper.Lerp(0f, 0.2f, amount10);
18147 break;
18148 }
18149 case "Discipile":
18150 {
18151 num2 = 0.53f;
18152 float amount9 = (float)Math.Cos(num * ((float)Math.PI * 2f)) * 0.5f + 0.5f;
18153 luminosity = MathHelper.Lerp(0.05f, 0.5f, amount9);
18154 break;
18155 }
18156 case "Doylee":
18158 luminosity = 0.5f;
18160 break;
18161 case "Ghostar":
18162 {
18163 num2 = 0.66f;
18164 float amount8 = (float)Math.Cos(num * ((float)Math.PI * 2f)) * 0.5f + 0.5f;
18165 luminosity = MathHelper.Lerp(0.15f, 0.85f, amount8);
18166 break;
18167 }
18168 case "Jenosis":
18169 num2 = MathHelper.Lerp(0.9f, 1.13f, Utils.Turn01ToCyclic010(num2)) % 1f;
18170 luminosity = 0.5f;
18172 break;
18173 case "Kazzymodus":
18174 {
18175 num2 = 0.33f;
18176 float amount7 = (float)Math.Cos(num * ((float)Math.PI * 2f)) * 0.5f + 0.5f;
18177 luminosity = MathHelper.Lerp(0.15f, 0.4f, amount7);
18178 break;
18179 }
18180 case "Khaios":
18181 {
18182 num2 = 0.33f;
18183 float amount6 = (float)Math.Cos(num * ((float)Math.PI * 2f)) * 0.5f + 0.5f;
18184 luminosity = MathHelper.Lerp(0f, 0.2f, amount6);
18185 break;
18186 }
18187 case "Loki":
18188 {
18189 num2 = 0f;
18190 float amount5 = (float)Math.Cos(num * ((float)Math.PI * 2f)) * 0.5f + 0.5f;
18191 luminosity = MathHelper.Lerp(0f, 0.25f, amount5);
18192 break;
18193 }
18194 case "ManaUser":
18195 num2 = MathHelper.Lerp(0.41f, 0.57f, Utils.Turn01ToCyclic010(num2));
18196 luminosity = 0.5f;
18197 break;
18198 case "Mid":
18199 {
18200 num2 = 0f;
18201 float amount4 = (float)Math.Cos(num * ((float)Math.PI * 2f)) * 0.5f + 0.5f;
18202 luminosity = MathHelper.Lerp(0f, 0.9f, amount4);
18203 break;
18204 }
18205 case "Nimbus":
18207 luminosity = 1f;
18209 break;
18210 case "Nike Leon":
18212 luminosity = 0.5f;
18214 break;
18215 case "ppowersteef":
18217 luminosity = 0.5f;
18219 break;
18220 case "RBrandon":
18221 num2 = 0.03f;
18222 luminosity = 0.3f;
18224 break;
18225 case "Redigit":
18226 num2 = 0.7f;
18227 luminosity = 0.5f;
18228 break;
18229 case "Serenity":
18230 {
18231 num2 = 0.85f;
18232 float amount3 = (float)Math.Cos(num * ((float)Math.PI * 2f)) * 0.5f + 0.5f;
18233 luminosity = MathHelper.Lerp(1f, 0.5f, amount3);
18234 break;
18235 }
18236 case "Sigma":
18238 luminosity = 0.5f;
18240 break;
18241 case "teiull":
18243 luminosity = 0.5f;
18244 break;
18245 case "Unit One":
18246 {
18250 if (lerpToWhite != 0f)
18251 {
18252 color = Color.Lerp(color, Color.White, lerpToWhite);
18253 }
18254 color.A = (byte)((float)(int)color.A * alphaChannelMultiplier);
18255 return color;
18256 }
18257 case "Vulpes Inculta":
18258 num2 = MathHelper.Lerp(0.65f, 0.75f, Utils.Turn01ToCyclic010(num2));
18259 luminosity = 0.5f;
18261 break;
18262 case "Waze3174":
18264 luminosity = 0.3f;
18266 break;
18267 case "Xman101":
18268 {
18269 num2 = 0.06f;
18270 float amount = (float)Math.Cos(num * ((float)Math.PI * 2f)) * 0.5f + 0.5f;
18271 luminosity = MathHelper.Lerp(0f, 0.5f, amount);
18272 break;
18273 }
18274 case "Zoomo":
18275 num2 = 0.77f;
18276 luminosity = 0.5f;
18278 break;
18279 }
18280 }
18282 color4 *= Opacity;
18283 if (lerpToWhite != 0f)
18284 {
18286 }
18287 color4.A = (byte)((float)(int)color4.A * alphaChannelMultiplier);
18288 return color4;
18289 }
18290
18292 {
18293 if (Main.player[owner].active)
18294 {
18295 double timeForVisualEffects = Main.timeForVisualEffects;
18296 switch (Main.player[owner].name)
18297 {
18298 case "Cenx":
18299 {
18303 return Main.rgbToHsl(Color.Lerp(new Color(0.3f, 1f, 0.2f), Color.HotPink, amount2)).X;
18304 }
18305 case "Crowno":
18306 laserLuminance = MathHelper.Lerp(0.25f, 0.4f, Utils.GetLerpValue(-1f, 1f, (float)Math.Cos(timeForVisualEffects / 105.0 * 6.2831854820251465)));
18307 laserAlphaMultiplier = 0.5f;
18308 return MathHelper.Lerp(127f / 180f, 47f / 60f, Utils.Turn01ToCyclic010(laserIndex / 6f));
18309 case "Tsuki":
18310 case "Yoraiz0r":
18311 return 0.92f;
18312 case "Lazure":
18313 return MathHelper.Lerp(8f / 15f, 83f / 90f, Utils.Turn01ToCyclic010(laserIndex / 6f));
18314 case "Jaxrud":
18315 return MathHelper.Lerp(13f / 72f, 0.43611112f, Utils.Turn01ToCyclic010(laserIndex / 6f));
18316 case "Ghostar":
18317 laserLuminance = MathHelper.Lerp(0.4f, 0.7f, Utils.GetLerpValue(-1f, 1f, (float)Math.Cos(timeForVisualEffects / 120.0 * 6.2831854820251465)));
18318 laserAlphaMultiplier = 0.3f;
18319 return 0.66f;
18320 case "Devalaous":
18321 return 0.66f + (float)Math.Cos(timeForVisualEffects / 180.0 * 6.2831854820251465) * 0.1f;
18322 case "Leinfors":
18323 return 0.73f + (float)Math.Cos(timeForVisualEffects / 3.0 * 6.2831854820251465) * 0.03f;
18324 case "Aeroblop":
18325 return 0.25f + (float)Math.Cos(timeForVisualEffects / 180.0 * 6.2831854820251465) * 0.1f;
18326 case "Doylee":
18327 return 0.84f + (float)Math.Cos(timeForVisualEffects / 90.0 * 6.2831854820251465) * 0.16f;
18328 case "Darkhalis":
18329 case "Arkhalis":
18330 return 0.75f + (float)Math.Cos(timeForVisualEffects / 180.0 * 6.2831854820251465) * 0.07f;
18331 case "Nike Leon":
18332 return 0.07f + (float)Math.Cos(timeForVisualEffects / 180.0 * 6.2831854820251465) * 0.04f;
18333 case "Suweeka":
18334 return 0.5f + (float)Math.Cos(timeForVisualEffects / 180.0 * 6.2831854820251465) * 0.18f;
18335 case "W1K":
18336 return 0.75f + (float)Math.Cos(timeForVisualEffects / 120.0 * 6.2831854820251465) * 0.05f;
18337 case "Grox The Great":
18338 return 0.41f + (float)Math.Cos(timeForVisualEffects / 120.0 * 6.2831854820251465) * 0.1f;
18339 case "Acamaeda":
18340 return 0.18f + (float)Math.Cos(timeForVisualEffects / 90.0 * 6.2831854820251465) * 0.1f;
18341 case "Alchemystics":
18342 return 0.73f + (float)Math.Cos(timeForVisualEffects / 180.0 * 6.2831854820251465) * 0.18f;
18343 case "Antithesis":
18344 laserLuminance = 0.25f;
18345 laserAlphaMultiplier = 0.4f;
18346 return 0.7f + (float)Math.Cos(timeForVisualEffects / 180.0 * 6.2831854820251465) * 0.05f;
18347 case "Aurora3500":
18348 laserLuminance = MathHelper.Lerp(0f, 0.5f, Utils.GetLerpValue(-1f, 1f, (float)Math.Cos(timeForVisualEffects / 105.0 * 6.2831854820251465)));
18349 laserAlphaMultiplier = 0.25f;
18350 return 0.35f;
18351 case "Bame":
18352 {
18356 return Main.rgbToHsl(Color.Lerp(Color.Yellow, new Color(0.2f, 0f, 0.7f), amount)).X;
18357 }
18358 case "Criddle":
18359 return 0.91f + (float)Math.Cos(timeForVisualEffects / 180.0 * 6.2831854820251465) * 0.19f;
18360 case "Darthkitten":
18361 laserLuminance = MathHelper.Lerp(0.4f, 0.9f, Utils.GetLerpValue(-1f, 1f, (float)Math.Cos(timeForVisualEffects / 120.0 * 6.2831854820251465)));
18362 laserAlphaMultiplier = 0.3f;
18363 return 1f;
18364 case "darthmorf":
18365 laserLuminance = MathHelper.Lerp(0f, 0.2f, Utils.GetLerpValue(-1f, 1f, (float)Math.Cos(timeForVisualEffects / 105.0 * 6.2831854820251465)));
18366 laserAlphaMultiplier = 0.4f;
18367 return 0f;
18368 case "Discipile":
18369 laserLuminance = MathHelper.Lerp(0f, 0.4f, Utils.GetLerpValue(-1f, 1f, (float)Math.Cos(timeForVisualEffects / 105.0 * 6.2831854820251465)));
18370 laserAlphaMultiplier = 0.35f;
18371 return 0.55f;
18372 case "Jenosis":
18373 return 0.66f + (float)Math.Cos(timeForVisualEffects / 180.0 * 6.2831854820251465) * 0.08f;
18374 case "Kazzymodus":
18375 laserLuminance = MathHelper.Lerp(0.6f, 0.8f, Utils.GetLerpValue(-1f, 1f, (float)Math.Cos(timeForVisualEffects / 90.0 * 6.2831854820251465)));
18376 laserAlphaMultiplier = 0.3f;
18377 return 0.33f;
18378 case "Khaios":
18379 laserLuminance = MathHelper.Lerp(0f, 0.1f, Utils.GetLerpValue(-1f, 1f, (float)Math.Cos(timeForVisualEffects / 105.0 * 6.2831854820251465)));
18380 laserAlphaMultiplier = 0.25f;
18381 return 0.35f;
18382 case "Loki":
18383 laserLuminance = MathHelper.Lerp(0f, 0.3f, Utils.GetLerpValue(-1f, 1f, (float)Math.Cos(timeForVisualEffects / 5.0 * 6.2831854820251465)));
18384 laserAlphaMultiplier = 0.4f;
18385 return 0f;
18386 case "ManaUser":
18387 return 0.49f + (float)Math.Cos(timeForVisualEffects / 140.0 * 6.2831854820251465) * 0.08f;
18388 case "Mid":
18389 laserLuminance = 0.25f;
18390 laserAlphaMultiplier = 0.4f;
18391 return 0.86f + (float)Math.Cos(timeForVisualEffects / 270.0 * 6.2831854820251465) * 0.13f;
18392 case "Nimbus":
18393 laserLuminance = MathHelper.Lerp(0f, 0.3f, Utils.GetLerpValue(-1f, 1f, (float)Math.Cos(timeForVisualEffects / 20.0 * 6.2831854820251465)));
18394 laserAlphaMultiplier = 0.2f;
18395 return 0.75f;
18396 case "ppowersteef":
18397 laserLuminance = MathHelper.Lerp(0.1f, 0.5f, Utils.GetLerpValue(-1f, 1f, (float)Math.Cos(timeForVisualEffects / 105.0 * 6.2831854820251465)));
18398 laserAlphaMultiplier = 0.25f;
18399 return 0.6f;
18400 case "RBrandon":
18401 laserLuminance = MathHelper.Lerp(0f, 0.5f, Utils.GetLerpValue(-1f, 1f, (float)Math.Cos(timeForVisualEffects / 105.0 * 6.2831854820251465)));
18402 laserAlphaMultiplier = 0.4f;
18403 return 1f;
18404 case "Redigit":
18405 return 0.7f;
18406 case "Serenity":
18407 laserLuminance = MathHelper.Lerp(0.9f, 0.65f, Utils.GetLerpValue(-1f, 1f, (float)Math.Cos(timeForVisualEffects / 120.0 * 6.2831854820251465)));
18408 laserAlphaMultiplier = 0.3f;
18409 return 0.85f;
18410 case "Sigma":
18411 return 0.06f + (float)Math.Cos(timeForVisualEffects / 180.0 * 6.2831854820251465) * 0.06f;
18412 case "teiull":
18413 return 0.5f + (float)Math.Cos(timeForVisualEffects / 45.0 * 6.2831854820251465) * 0.3f;
18414 case "Unit One":
18415 return 0.38f + (float)Math.Cos(timeForVisualEffects / 90.0 * 6.2831854820251465) * 0.24f;
18416 case "Vulpes Inculta":
18417 return 0.7f + (float)Math.Cos(timeForVisualEffects / 180.0 * 6.2831854820251465) * 0.05f;
18418 case "Waze3174":
18419 return 0.38f + (float)Math.Cos(timeForVisualEffects / 90.0 * 6.2831854820251465) * 0.24f;
18420 case "Xman101":
18421 laserLuminance = MathHelper.Lerp(0.9f, 0.55f, Utils.GetLerpValue(-1f, 1f, (float)Math.Cos(timeForVisualEffects / 120.0 * 6.2831854820251465)));
18422 laserAlphaMultiplier = 0.2f;
18423 return 0.33f;
18424 case "Zoomo":
18425 return 0.77f;
18426 case "Random":
18427 return Main.rand.NextFloat();
18428 }
18429 }
18430 return (float)(int)laserIndex / 6f;
18431 }
18432
18433 public static int GetByUUID(int owner, float uuid)
18434 {
18435 return GetByUUID(owner, (int)uuid);
18436 }
18437
18438 public static int GetByUUID(int owner, int uuid)
18439 {
18440 if (uuid < 0 || uuid >= 1000 || owner < 0 || owner >= 255)
18441 {
18442 return -1;
18443 }
18444 int num = Main.projectileIdentity[owner, uuid];
18445 if (num >= 0 && Main.projectile[num].active)
18446 {
18447 return num;
18448 }
18449 return -1;
18450 }
18451
18453 {
18454 if (owner < 0 || owner >= 255)
18455 {
18456 return;
18457 }
18458 switch (type)
18459 {
18460 case 461:
18461 case 632:
18462 case 642:
18463 case 644:
18464 {
18465 for (int i = 0; i < 1000; i++)
18466 {
18467 if (Main.projectile[i].owner == owner && (float)Main.projectile[i].identity == ai[1] && Main.projectile[i].active)
18468 {
18469 ai[1] = i;
18470 break;
18471 }
18472 }
18473 break;
18474 }
18475 }
18476 }
18477
18479 {
18480 if (Main.windPhysics)
18481 {
18483 if (flag.HasValue)
18484 {
18485 return !flag.Value;
18486 }
18487 switch (aiStyle)
18488 {
18489 case 1:
18490 case 2:
18491 case 8:
18492 case 10:
18493 case 14:
18494 case 16:
18495 case 17:
18496 case 21:
18497 case 24:
18498 case 28:
18499 case 29:
18500 case 32:
18501 case 33:
18502 case 34:
18503 case 35:
18504 case 49:
18505 case 72:
18506 case 93:
18507 case 96:
18508 case 106:
18509 return true;
18510 }
18511 }
18512 return false;
18513 }
18514
18515 private void AI_151_SuperStar()
18516 {
18517 alpha -= 10;
18518 int num = 100;
18519 if (alpha < num)
18520 {
18521 alpha = num;
18522 }
18523 if (soundDelay == 0)
18524 {
18525 soundDelay = 20 + Main.rand.Next(40);
18527 }
18528 rotation += (Math.Abs(velocity.X) + Math.Abs(velocity.Y)) * 0.005f * (float)direction;
18530 if (base.Hitbox.Intersects(Utils.CenteredRectangle(Main.screenPosition + vector / 2f, vector + new Vector2(400f))) && Main.rand.Next(6) == 0)
18531 {
18532 Gore.NewGore(position, velocity * 0.2f, Utils.SelectRandom<int>(Main.rand, 16, 17, 17, 17));
18533 }
18534 for (int i = 0; i < 2; i++)
18535 {
18536 if (Main.rand.Next(8) == 0)
18537 {
18538 int num2 = 228;
18539 Dust dust = Dust.NewDustDirect(position, width, height, num2, 0f, 0f, 127);
18540 dust.velocity *= 0.25f;
18541 dust.scale = 1.3f;
18542 dust.noGravity = true;
18543 dust.velocity += velocity.RotatedBy((float)Math.PI / 8f * (1f - (float)(2 * i))) * 0.2f;
18544 }
18545 }
18546 }
18547
18548 public bool IsInterruptible(Player player)
18549 {
18550 int num = aiStyle;
18551 if (num == 160)
18552 {
18553 return true;
18554 }
18555 return false;
18556 }
18557
18558 public void Interrupt(Player player)
18559 {
18560 int num = aiStyle;
18561 if (num == 160)
18562 {
18563 Kill();
18564 player.heldProj = -1;
18565 player.itemAnimation = 0;
18566 player.itemTime = 0;
18567 }
18568 }
18569
18571 {
18572 return null;
18573 }
18574
18576 {
18577 return new EntitySource_Parent(this);
18578 }
18579
18581 {
18582 return new EntitySource_Parent(this);
18583 }
18584
18586 {
18587 return new EntitySource_DropAsItem(this);
18588 }
18589
18591 {
18592 return new EntitySource_Parent(this);
18593 }
18594
18599
18604
18605 public static IEntitySource InheritSource(Projectile projectile)
18606 {
18607 return projectile?.GetProjectileSource_FromThis();
18608 }
18609
18611 {
18612 float num = (float)Math.PI / 2f;
18613 bool flag = true;
18614 if (type == 976)
18615 {
18616 flag = false;
18617 }
18618 if (flag)
18619 {
18620 alpha -= 10;
18621 int num2 = 100;
18622 if (alpha < num2)
18623 {
18624 alpha = num2;
18625 }
18626 }
18627 if (soundDelay == 0)
18628 {
18629 if (type == 977)
18630 {
18631 soundDelay = -1;
18633 }
18634 else if (type == 976)
18635 {
18636 soundDelay = -1;
18637 }
18638 else
18639 {
18640 soundDelay = 20 + Main.rand.Next(40);
18642 }
18643 }
18644 if (ai[0] != 0f)
18645 {
18646 if (type == 976)
18647 {
18648 velocity = velocity.RotatedBy(ai[0]);
18649 }
18650 else
18651 {
18652 int num3 = 10 * MaxUpdates;
18653 velocity = velocity.RotatedBy(ai[0] / (float)num3);
18654 }
18655 }
18656 if (type == 977)
18657 {
18658 velocity *= 0.96f;
18659 if (Main.rand.Next(8) == 0)
18660 {
18661 Dust dust = Dust.NewDustDirect(base.Center, 0, 0, 172, velocity.X * 0.1f, velocity.Y * 0.1f, 100, default(Color), 0.9f);
18662 dust.noGravity = true;
18663 dust.position = base.Center;
18664 dust.velocity = Main.rand.NextVector2Circular(1f, 1f) + velocity * 0.5f;
18665 }
18666 }
18667 if (type == 976)
18668 {
18670 {
18671 Kill();
18672 return;
18673 }
18674 if (++frameCounter >= 2)
18675 {
18676 frameCounter = 0;
18677 if (++frame >= 7)
18678 {
18679 frame = 0;
18680 }
18681 }
18682 float fromValue = 60 - timeLeft;
18683 float fromMax = ai[1] + 20f;
18684 float num4 = Utils.Remap(fromValue, ai[1], fromMax, 0f, 1f) * Utils.Remap(fromValue, ai[1], ai[1] + 60f, 1f, 0f);
18685 velocity = velocity.SafeNormalize(Vector2.UnitY) * (4f + 12f * (1f - num4));
18686 Opacity = Utils.Remap(fromValue, 0f, 10f, 0f, 1f) * Utils.Remap(fromValue, 30f, 60f, 1f, 0f);
18687 num = 0f;
18688 if (Main.rand.Next(3) == 0)
18689 {
18690 Dust dust2 = Dust.NewDustDirect(position, width, height, 40, 0f, 0f, 0, default(Color), 1.2f);
18691 dust2.noGravity = true;
18692 dust2.velocity = velocity * 0.5f;
18693 }
18694 if (localAI[1] == 0f)
18695 {
18696 localAI[1] = 1f;
18697 for (int i = 0; i < 10; i++)
18698 {
18699 Dust.NewDustDirect(position, width, height, 40, 0f, 0f, 0, default(Color), 0.7f).velocity = velocity.SafeNormalize(Vector2.UnitY).RotatedBy(Main.rand.NextFloat() * ((float)Math.PI * 2f) * 0.25f) * (Main.rand.NextFloat() * 3f);
18700 }
18701 }
18702 }
18703 rotation = velocity.ToRotation() + num;
18704 tileCollide = false;
18705 }
18706
18707 public void Resize(int newWidth, int newHeight)
18708 {
18709 position = base.Center;
18710 width = newWidth;
18711 height = newHeight;
18712 base.Center = position;
18713 }
18714
18715 private void Shimmer()
18716 {
18717 if (hostile || (aiStyle == 99 && ai[0] == -1f) || (aiStyle == 15 && (ai[0] == 2f || ai[0] == 4f)))
18718 {
18719 return;
18720 }
18721 if (type == 502)
18722 {
18723 velocity.Y -= 0.4f;
18724 timeLeft -= 5;
18725 }
18726 else if (type == 469 || type == 181)
18727 {
18728 velocity.Y -= 0.2f;
18729 if (type == 469 && velocity.Y < 0f)
18730 {
18731 Kill();
18732 }
18733 }
18734 else if (type == 819 || type == 117 || type == 474 || type == 225 || type == 103 || type == 2 || type == 82 || type == 120 || type == 172 || type == 41 || type == 91 || type == 278 || type == 5 || type == 639 || type == 631 || type == 495 || type == 4 || type == 282 || type == 1 || type == 81)
18735 {
18736 velocity.Y -= 0.4f;
18737 }
18738 else if (aiStyle == 1 || aiStyle == 16 || aiStyle == 40)
18739 {
18740 int num = (int)(base.Center.X / 16f);
18741 int num2 = (int)(position.Y / 16f);
18742 if (WorldGen.InWorld(num, num2) && Main.tile[num, num2] != null && Main.tile[num, num2].liquid == byte.MaxValue && Main.tile[num, num2].shimmer() && WorldGen.InWorld(num, num2 - 1) && Main.tile[num, num2 - 1] != null && Main.tile[num, num2 - 1].liquid > 0 && Main.tile[num, num2 - 1].shimmer())
18743 {
18744 Kill();
18745 }
18746 else if (velocity.Y > 0f)
18747 {
18748 velocity.Y *= -1f;
18749 netUpdate = true;
18750 if (timeLeft > 600)
18751 {
18752 timeLeft = 600;
18753 }
18754 timeLeft -= 60;
18755 shimmerWet = false;
18756 wet = false;
18757 }
18758 }
18759 else if (aiStyle == 5 || aiStyle == 8 || aiStyle == 21 || aiStyle == 28 || aiStyle == 29 || aiStyle == 33 || aiStyle == 36 || aiStyle == 47 || aiStyle == 93 || aiStyle == 115 || aiStyle == 151 || aiStyle == 152)
18760 {
18761 int num3 = (int)(base.Center.X / 16f);
18762 int num4 = (int)(position.Y / 16f);
18763 if (WorldGen.InWorld(num3, num4) && Main.tile[num3, num4] != null && Main.tile[num3, num4].liquid == byte.MaxValue && Main.tile[num3, num4].shimmer() && WorldGen.InWorld(num3, num4 - 1) && Main.tile[num3, num4 - 1] != null && Main.tile[num3, num4 - 1].liquid > 0 && Main.tile[num3, num4 - 1].shimmer())
18764 {
18765 Kill();
18766 }
18767 else if (velocity.Y > 0f)
18768 {
18769 velocity.Y *= -1f;
18770 netUpdate = true;
18771 shimmerWet = false;
18772 wet = false;
18773 }
18774 }
18775 else if (aiStyle == 15)
18776 {
18777 if (velocity.Y > 0f)
18778 {
18779 velocity.Y *= -1f;
18780 netUpdate = true;
18781 }
18782 velocity.Y -= 0.4f;
18783 if (velocity.Y < -8f)
18784 {
18785 velocity.Y = -8f;
18786 }
18787 }
18788 else if (aiStyle == 99)
18789 {
18790 if (velocity.Y > 0f)
18791 {
18792 velocity.Y *= -1f;
18793 netUpdate = true;
18794 shimmerWet = false;
18795 wet = false;
18796 }
18797 if (velocity.Y > -8f)
18798 {
18799 velocity.Y = -8f;
18800 }
18801 }
18802 else if (aiStyle == 7 || aiStyle == 9 || aiStyle == 13 || aiStyle == 35 || aiStyle == 53 || aiStyle == 130 || aiStyle == 134 || aiStyle == 137 || aiStyle == 138 || aiStyle == 149 || aiStyle == 160)
18803 {
18804 Kill();
18805 }
18806 else if (aiStyle == 2)
18807 {
18808 velocity.Y -= 0.7f;
18809 if (type == 936 && !NPC.unlockedSlimeRainbowSpawn && velocity.Y < 0f)
18810 {
18811 if (timeLeft > 5)
18812 {
18813 timeLeft = 5;
18814 }
18815 if (Main.netMode != 1)
18816 {
18817 NPC.unlockedSlimeRainbowSpawn = true;
18819 int num5 = NPC.NewNPC(GetNPCSource_FromThis(), (int)base.Center.X + 4, (int)base.Center.Y, 681);
18820 NPC obj = Main.npc[num5];
18821 obj.velocity = velocity;
18822 obj.netUpdate = true;
18824 }
18825 }
18826 else
18827 {
18828 timeLeft -= 20;
18829 }
18830 }
18831 else if (aiStyle == 14 || aiStyle == 16)
18832 {
18833 if (timeLeft > 3000)
18834 {
18835 timeLeft -= 60;
18836 }
18837 velocity.Y -= 0.5f;
18838 }
18839 else if (aiStyle == 25 || aiStyle == 17)
18840 {
18841 if (velocity.Y > 10f)
18842 {
18843 velocity.Y *= 0.97f;
18844 }
18845 velocity.Y -= 0.7f;
18846 if (velocity.Y < -10f)
18847 {
18848 velocity.Y = -10f;
18849 }
18850 }
18851 }
18852
18853 public void AI()
18854 {
18855 //IL_1ac5c: Unknown result type (might be due to invalid IL or missing references)
18856 //IL_1acde: Unknown result type (might be due to invalid IL or missing references)
18857 //IL_1ace3: Unknown result type (might be due to invalid IL or missing references)
18858 //IL_1ac98: Unknown result type (might be due to invalid IL or missing references)
18859 //IL_1ac9d: Unknown result type (might be due to invalid IL or missing references)
18860 //IL_2feb4: Unknown result type (might be due to invalid IL or missing references)
18861 //IL_30646: Unknown result type (might be due to invalid IL or missing references)
18862 //IL_30735: Unknown result type (might be due to invalid IL or missing references)
18863 if (aiStyle == 1)
18864 {
18865 AI_001();
18866 }
18867 else if (aiStyle == 2)
18868 {
18869 if (Main.windPhysics)
18870 {
18871 velocity.X += Main.windSpeedCurrent * Main.windPhysicsStrength;
18872 }
18873 if (type == 93 && Main.rand.Next(5) == 0)
18874 {
18875 int num = Dust.NewDust(base.position, width, height, 57, velocity.X * 0.2f + (float)(direction * 3), velocity.Y * 0.2f, 100);
18876 Main.dust[num].noGravity = true;
18877 Main.dust[num].fadeIn = 1f;
18878 Main.dust[num].velocity.X *= 0.3f;
18879 Main.dust[num].velocity.Y *= 0.3f;
18880 }
18881 if (type == 968)
18882 {
18883 if (localAI[0] == 0f)
18884 {
18885 localAI[0] = 1f;
18886 Vector2 vector = Main.player[owner].velocity;
18887 float num2 = Utils.Remap(vector.Length(), 0f, 3f, 0f, 0.5f);
18888 Vector2 vector2 = base.Center + new Vector2(-8f, -8f) + velocity.SafeNormalize(Vector2.Zero) * 25f;
18889 for (int i = 0; i < 8; i++)
18890 {
18891 Dust dust = Main.dust[Dust.NewDust(vector2, 16, 16, 31, velocity.X, velocity.Y, 50, default(Color), 0.75f + Main.rand.NextFloat() * 0.3f)];
18892 dust.velocity = (velocity * (0.2f + num2)).RotatedByRandom(0.699999988079071) + vector * 0.25f;
18893 Dust dust2 = dust;
18894 dust2.velocity *= 0f + Main.rand.NextFloat() * 1f;
18895 dust.fadeIn = 0.1f;
18896 dust2 = dust;
18897 dust2.position -= dust.velocity;
18898 dust.noGravity = true;
18899 }
18900 }
18901 alpha = Math.Max(0, alpha - 50);
18902 frame = (int)this.ai[1];
18903 }
18904 if (type == 304 && localAI[0] == 0f)
18905 {
18906 localAI[0] += 1f;
18907 alpha = 0;
18908 }
18909 if (type == 510)
18910 {
18911 rotation += Math.Abs(velocity.X) * 0.04f * (float)direction;
18912 }
18913 else
18914 {
18915 rotation += (Math.Abs(velocity.X) + Math.Abs(velocity.Y)) * 0.03f * (float)direction;
18916 }
18917 if (type == 909)
18918 {
18919 int num3 = 38;
18920 this.ai[0] += 1f;
18921 if (this.ai[0] >= (float)num3)
18922 {
18923 velocity.Y += 0.4f;
18924 velocity.X *= 0.97f;
18925 }
18926 if (Main.netMode != 1 && this.ai[1] == 0f)
18927 {
18928 this.ai[1] = 1 + Main.rand.Next(6);
18929 netUpdate = true;
18930 }
18931 if (this.ai[1] > 0f)
18932 {
18933 frame = (int)this.ai[1] - 1;
18934 }
18935 }
18936 else if (type == 162)
18937 {
18938 if (this.ai[1] == 0f)
18939 {
18940 this.ai[1] = 1f;
18942 }
18943 this.ai[0] += 1f;
18944 if (this.ai[0] >= 18f)
18945 {
18946 velocity.Y += 0.28f;
18947 velocity.X *= 0.99f;
18948 }
18949 if (this.ai[0] > 2f)
18950 {
18951 alpha = 0;
18952 if (this.ai[0] == 3f)
18953 {
18954 for (int j = 0; j < 10; j++)
18955 {
18956 int num4 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 31, 0f, 0f, 100, default(Color), 1.5f);
18957 Dust dust2 = Main.dust[num4];
18958 dust2.velocity *= 0.5f;
18959 dust2 = Main.dust[num4];
18960 dust2.velocity += velocity * 0.1f;
18961 }
18962 for (int k = 0; k < 5; k++)
18963 {
18964 int num5 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 6, 0f, 0f, 100, default(Color), 2f);
18965 Main.dust[num5].noGravity = true;
18966 Dust dust2 = Main.dust[num5];
18967 dust2.velocity *= 3f;
18968 dust2 = Main.dust[num5];
18969 dust2.velocity += velocity * 0.2f;
18970 num5 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 6, 0f, 0f, 100);
18971 dust2 = Main.dust[num5];
18972 dust2.velocity *= 2f;
18973 dust2 = Main.dust[num5];
18974 dust2.velocity += velocity * 0.3f;
18975 }
18976 for (int l = 0; l < 1; l++)
18977 {
18978 int num6 = Gore.NewGore(new Vector2(base.position.X - 10f, base.position.Y - 10f), default(Vector2), Main.rand.Next(61, 64));
18979 Gore gore = Main.gore[num6];
18980 gore.position += velocity * 1.25f;
18981 Main.gore[num6].scale = 1.5f;
18982 gore = Main.gore[num6];
18983 gore.velocity += velocity * 0.5f;
18984 gore = Main.gore[num6];
18985 gore.velocity *= 0.02f;
18986 }
18987 }
18988 }
18989 }
18990 else if (type == 281)
18991 {
18992 if (this.ai[1] == 0f)
18993 {
18994 this.ai[1] = 1f;
18996 }
18997 this.ai[0] += 1f;
18998 if (this.ai[0] >= 18f)
18999 {
19000 velocity.Y += 0.28f;
19001 velocity.X *= 0.99f;
19002 }
19003 if (this.ai[0] > 2f)
19004 {
19005 alpha = 0;
19006 if (this.ai[0] == 3f)
19007 {
19008 for (int m = 0; m < 10; m++)
19009 {
19010 int num7 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 31, 0f, 0f, 100, default(Color), 1.5f);
19011 Dust dust2 = Main.dust[num7];
19012 dust2.velocity *= 0.5f;
19013 dust2 = Main.dust[num7];
19014 dust2.velocity += velocity * 0.1f;
19015 }
19016 for (int n = 0; n < 5; n++)
19017 {
19018 int num8 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 6, 0f, 0f, 100, default(Color), 2f);
19019 Main.dust[num8].noGravity = true;
19020 Dust dust2 = Main.dust[num8];
19021 dust2.velocity *= 3f;
19022 dust2 = Main.dust[num8];
19023 dust2.velocity += velocity * 0.2f;
19024 num8 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 6, 0f, 0f, 100);
19025 dust2 = Main.dust[num8];
19026 dust2.velocity *= 2f;
19027 dust2 = Main.dust[num8];
19028 dust2.velocity += velocity * 0.3f;
19029 }
19030 for (int num9 = 0; num9 < 1; num9++)
19031 {
19032 int num10 = Gore.NewGore(new Vector2(base.position.X - 10f, base.position.Y - 10f), default(Vector2), Main.rand.Next(61, 64));
19033 Gore gore = Main.gore[num10];
19034 gore.position += velocity * 1.25f;
19035 Main.gore[num10].scale = 1.5f;
19036 gore = Main.gore[num10];
19037 gore.velocity += velocity * 0.5f;
19038 gore = Main.gore[num10];
19039 gore.velocity *= 0.02f;
19040 }
19041 }
19042 }
19043 }
19044 else if (type == 240)
19045 {
19046 if (this.ai[1] == 0f)
19047 {
19048 this.ai[1] = 1f;
19050 }
19051 this.ai[0] += 1f;
19052 if (this.ai[0] >= 16f)
19053 {
19054 velocity.Y += 0.18f;
19055 velocity.X *= 0.991f;
19056 }
19057 if (this.ai[0] > 2f)
19058 {
19059 alpha = 0;
19060 if (this.ai[0] == 3f)
19061 {
19062 for (int num11 = 0; num11 < 7; num11++)
19063 {
19064 int num12 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 31, 0f, 0f, 100, default(Color), 1.5f);
19066 dust2.velocity *= 0.5f;
19067 dust2 = Main.dust[num12];
19068 dust2.velocity += velocity * 0.1f;
19069 }
19070 for (int num13 = 0; num13 < 3; num13++)
19071 {
19072 int num14 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 6, 0f, 0f, 100, default(Color), 2f);
19073 Main.dust[num14].noGravity = true;
19075 dust2.velocity *= 3f;
19076 dust2 = Main.dust[num14];
19077 dust2.velocity += velocity * 0.2f;
19078 num14 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 6, 0f, 0f, 100);
19079 dust2 = Main.dust[num14];
19080 dust2.velocity *= 2f;
19081 dust2 = Main.dust[num14];
19082 dust2.velocity += velocity * 0.3f;
19083 }
19084 for (int num15 = 0; num15 < 1; num15++)
19085 {
19086 int num16 = Gore.NewGore(new Vector2(base.position.X - 10f, base.position.Y - 10f), default(Vector2), Main.rand.Next(61, 64));
19087 Gore gore = Main.gore[num16];
19088 gore.position += velocity * 1.25f;
19089 Main.gore[num16].scale = 1.25f;
19090 gore = Main.gore[num16];
19091 gore.velocity += velocity * 0.5f;
19092 gore = Main.gore[num16];
19093 gore.velocity *= 0.02f;
19094 }
19095 }
19096 }
19097 }
19098 else if (type == 497)
19099 {
19100 int num17 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 27, velocity.X, velocity.Y, 100, default(Color), 1.2f);
19101 Main.dust[num17].position = (Main.dust[num17].position + base.Center) / 2f;
19102 Main.dust[num17].noGravity = true;
19104 dust2.velocity *= 0.3f;
19105 dust2 = Main.dust[num17];
19106 dust2.velocity -= velocity * 0.1f;
19107 this.ai[0] += 1f;
19108 if (this.ai[0] >= 30f)
19109 {
19110 velocity.X *= 0.99f;
19111 velocity.Y += 0.5f;
19112 }
19113 else
19114 {
19115 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 1.57f;
19116 }
19117 }
19118 else if (type == 861)
19119 {
19120 if (Main.myPlayer == owner)
19121 {
19122 localAI[0]++;
19123 if (localAI[0] > 30f)
19124 {
19125 localAI[0] = 30f;
19126 }
19127 Player player = Main.player[owner];
19128 for (int num18 = 0; num18 < 255; num18++)
19129 {
19131 if (player2 != null && player2.active && !player2.dead && (player2.whoAmI != player.whoAmI || !(localAI[0] < 30f)) && Colliding(base.Hitbox, player2.Hitbox))
19132 {
19133 Kill();
19134 break;
19135 }
19136 }
19137 }
19138 if (velocity.Y == 0f)
19139 {
19140 velocity.X *= 0.95f;
19141 }
19142 else
19143 {
19144 velocity.X *= 0.995f;
19145 }
19146 if (Math.Abs(velocity.X) < 0.5f)
19147 {
19148 velocity.X = 0f;
19149 }
19150 if (velocity.X == 0f && velocity.Y == 0f)
19151 {
19152 Kill();
19153 }
19154 velocity.Y += 0.1f;
19155 if (this.ai[1] == 1f)
19156 {
19157 frame = (frameCounter = 0);
19158 rotation += (Math.Abs(velocity.X) + Math.Abs(velocity.Y)) * 0.03f * (float)direction;
19159 }
19160 else
19161 {
19162 if (frame == 0)
19163 {
19164 frame = 1;
19165 }
19166 frameCounter++;
19167 if (frameCounter > 4)
19168 {
19169 frameCounter = 0;
19170 frame++;
19171 if (frame >= Main.projFrames[type])
19172 {
19173 frame = 1;
19174 }
19175 }
19176 rotation = velocity.ToRotation() + (float)Math.PI / 4f;
19177 spriteDirection = ((!(velocity.X < 0f)) ? 1 : (-1));
19178 if (spriteDirection == -1)
19179 {
19180 rotation += (float)Math.PI / 2f;
19181 }
19182 }
19183 }
19184 else if (type == 249)
19185 {
19186 this.ai[0] += 1f;
19187 if (this.ai[0] >= 0f)
19188 {
19189 velocity.Y += 0.25f;
19190 }
19191 }
19192 else if (type == 347)
19193 {
19194 this.ai[0] += 1f;
19195 if (this.ai[0] >= 5f)
19196 {
19197 velocity.Y += 0.25f;
19198 }
19199 }
19200 else if (type == 501)
19201 {
19202 this.ai[0] += 1f;
19203 if (this.ai[0] >= 18f)
19204 {
19205 velocity.X *= 0.995f;
19206 velocity.Y += 0.2f;
19207 }
19208 }
19209 else if (type == 504 || type == 954 || type == 979)
19210 {
19211 alpha = 255;
19212 this.ai[0] += 1f;
19213 if (this.ai[0] > 3f)
19214 {
19215 int num19 = 100;
19216 if (this.ai[0] > 20f)
19217 {
19218 int num20 = 40;
19219 float num21 = this.ai[0] - 20f;
19220 num19 = (int)(100f * (1f - num21 / (float)num20));
19221 if (num21 >= (float)num20)
19222 {
19223 Kill();
19224 }
19225 }
19226 if (this.ai[0] <= 10f)
19227 {
19228 num19 = (int)this.ai[0] * 10;
19229 }
19230 if (Main.rand.Next(100) < num19)
19231 {
19232 int num22 = ((type != 979) ? Dust.NewDust(base.position, width, height, 6, 0f, 0f, 150) : Dust.NewDust(base.position, width, height, 135, 0f, 0f, 150));
19233 Main.dust[num22].position = (Main.dust[num22].position + base.Center) / 2f;
19234 Main.dust[num22].noGravity = true;
19236 dust2.velocity *= 2f;
19237 dust2 = Main.dust[num22];
19238 dust2.scale *= 1.6f;
19239 dust2 = Main.dust[num22];
19240 dust2.velocity += velocity;
19241 }
19242 }
19243 if (this.ai[0] >= 20f)
19244 {
19245 velocity.X *= 0.99f;
19246 velocity.Y += 0.1f;
19247 }
19248 }
19249 else if (type == 69 || type == 70 || type == 621)
19250 {
19251 this.ai[0] += 1f;
19252 if (this.ai[0] >= 10f)
19253 {
19254 velocity.Y += 0.25f;
19255 velocity.X *= 0.99f;
19256 }
19257 }
19258 else if (type == 166)
19259 {
19260 if (owner == Main.myPlayer && this.ai[1] == 1f)
19261 {
19262 for (int num23 = 0; num23 < 200; num23++)
19263 {
19264 if (Main.npc[num23].active && Main.npc[num23].townNPC && Colliding(base.Hitbox, Main.npc[num23].Hitbox))
19265 {
19266 Kill();
19267 return;
19268 }
19269 }
19270 if (Main.netMode == 1)
19271 {
19272 for (int num24 = 0; num24 < 255; num24++)
19273 {
19274 if (num24 != owner && Main.player[num24].active && !Main.player[owner].InOpposingTeam(Main.player[num24]) && Colliding(base.Hitbox, Main.player[num24].Hitbox))
19275 {
19276 Kill();
19277 return;
19278 }
19279 }
19280 }
19281 }
19282 this.ai[0] += 1f;
19283 if (this.ai[0] >= 20f)
19284 {
19285 velocity.Y += 0.3f;
19286 velocity.X *= 0.98f;
19287 }
19288 }
19289 else if (type == 300)
19290 {
19291 if (this.ai[0] == 0f)
19292 {
19294 }
19295 this.ai[0] += 1f;
19296 if (this.ai[0] >= 60f)
19297 {
19298 velocity.Y += 0.2f;
19299 velocity.X *= 0.99f;
19300 }
19301 }
19302 else if (type == 306)
19303 {
19304 if (alpha <= 200)
19305 {
19306 for (int num25 = 0; num25 < 4; num25++)
19307 {
19308 float num26 = velocity.X / 4f * (float)num25;
19309 float num27 = velocity.Y / 4f * (float)num25;
19310 int num28 = Dust.NewDust(base.position, width, height, 184);
19311 Main.dust[num28].position.X = base.Center.X - num26;
19312 Main.dust[num28].position.Y = base.Center.Y - num27;
19314 dust2.velocity *= 0f;
19315 Main.dust[num28].scale = 0.7f;
19316 }
19317 }
19318 alpha -= 50;
19319 if (alpha < 0)
19320 {
19321 alpha = 0;
19322 }
19323 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 0.785f;
19324 }
19325 else if (type == 304)
19326 {
19327 this.ai[0] += 1f;
19328 if (this.ai[0] >= 30f)
19329 {
19330 alpha += 10;
19331 damage = (int)((double)damage * 0.9);
19332 knockBack = (int)((double)knockBack * 0.9);
19333 if (alpha >= 255)
19334 {
19335 active = false;
19336 }
19337 }
19338 if (this.ai[0] < 30f)
19339 {
19340 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 1.57f;
19341 }
19342 }
19343 else if (type == 370 || type == 371 || type == 936)
19344 {
19345 this.ai[0] += 1f;
19346 if (this.ai[0] >= 15f)
19347 {
19348 velocity.Y += 0.3f;
19349 velocity.X *= 0.98f;
19350 }
19351 }
19352 else
19353 {
19354 int num29 = 20;
19355 if (type == 93)
19356 {
19357 num29 = 28 + Main.rand.Next(6);
19358 }
19359 this.ai[0] += 1f;
19360 if (this.ai[0] >= (float)num29)
19361 {
19362 if (type == 93)
19363 {
19364 this.ai[0] = 40f;
19365 }
19366 velocity.Y += 0.4f;
19367 velocity.X *= 0.97f;
19368 }
19369 else if (type == 48 || type == 54 || type == 93 || type == 520 || type == 599)
19370 {
19371 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 1.57f;
19372 }
19373 }
19374 if (velocity.Y > 16f)
19375 {
19376 velocity.Y = 16f;
19377 }
19378 if (type == 54 && Main.rand.Next(20) == 0)
19379 {
19380 Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 40, velocity.X * 0.1f, velocity.Y * 0.1f, 0, default(Color), 0.75f);
19381 }
19382 }
19383 else if (aiStyle == 3)
19384 {
19385 if (soundDelay == 0 && type != 383)
19386 {
19387 soundDelay = 8;
19389 }
19390 if (type == 19)
19391 {
19392 for (int num30 = 0; num30 < 2; num30++)
19393 {
19394 int num31 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 6, velocity.X * 0.2f, velocity.Y * 0.2f, 100, default(Color), 2f);
19395 Main.dust[num31].noGravity = true;
19396 Main.dust[num31].velocity.X *= 0.3f;
19397 Main.dust[num31].velocity.Y *= 0.3f;
19398 }
19399 }
19400 else if (type == 1000)
19401 {
19402 if (Main.rand.Next(3) == 0)
19403 {
19404 switch (Main.rand.Next(3))
19405 {
19406 default:
19407 {
19408 int num32 = Main.rand.Next(3) switch
19409 {
19410 1 => 57,
19411 2 => 58,
19412 _ => 15,
19413 };
19414 Dust dust3 = Main.dust[Dust.NewDust(base.position, width, height, num32, velocity.X * 0.25f, velocity.Y * 0.25f, 150, default(Color), 0.7f)];
19415 Dust dust2 = dust3;
19416 dust2.velocity *= 0.5f;
19417 break;
19418 }
19419 case 1:
19420 {
19421 Dust dust3 = Main.dust[Dust.NewDust(base.position, width, height, 267, velocity.X, velocity.Y, 50, new Color(50, 50, 200), 1.1f)];
19422 dust3.fadeIn = 0.1f;
19423 dust3.velocity = velocity * 0.5f;
19424 dust3.noGravity = true;
19425 break;
19426 }
19427 case 2:
19428 {
19429 Dust dust3 = Main.dust[Dust.NewDust(base.position, width, height, 76, velocity.X * 0.15f, velocity.Y * 0.15f, 0, default(Color), 1.1f)];
19430 dust3.noGravity = true;
19431 Dust.NewDust(base.position, width, height, 15, velocity.X * 0.05f, velocity.Y * 0.05f, 150, default(Color), 0.6f);
19432 break;
19433 }
19434 }
19435 }
19436 }
19437 else if (type == 867)
19438 {
19439 if (Main.rand.Next(3) == 0)
19440 {
19441 int num33 = Dust.NewDust(base.position, width, height, 165, velocity.X, velocity.Y, 50);
19443 dust2.velocity *= 0.5f;
19444 Main.dust[num33].noGravity = true;
19445 }
19446 }
19447 else if (type == 33)
19448 {
19449 if (Main.rand.Next(1) == 0)
19450 {
19451 int num34 = Dust.NewDust(base.position, width, height, 40, velocity.X * 0.25f, velocity.Y * 0.25f, 0, default(Color), 1.4f);
19452 Main.dust[num34].noGravity = true;
19453 }
19454 }
19455 else if (type == 320)
19456 {
19457 if (Main.rand.Next(3) == 0)
19458 {
19459 int num35 = Dust.NewDust(base.position, width, height, 5, velocity.X * 0.25f, velocity.Y * 0.25f, 0, default(Color), 1.1f);
19460 if (Main.rand.Next(2) == 0)
19461 {
19462 Main.dust[num35].scale = 0.9f;
19464 dust2.velocity *= 0.2f;
19465 }
19466 else
19467 {
19468 Main.dust[num35].noGravity = true;
19469 }
19470 }
19471 }
19472 else if (type == 6)
19473 {
19474 if (Main.rand.Next(5) == 0)
19475 {
19476 int num36 = Main.rand.Next(3);
19477 Dust.NewDust(base.position, width, height, num36 switch
19478 {
19479 0 => 15,
19480 1 => 57,
19481 _ => 58,
19482 }, velocity.X * 0.25f, velocity.Y * 0.25f, 150, default(Color), 0.7f);
19483 }
19484 }
19485 else if (type == 113 && Main.rand.Next(1) == 0)
19486 {
19487 int num37 = Dust.NewDust(base.position, width, height, 76, velocity.X * 0.15f, velocity.Y * 0.15f, 0, default(Color), 1.1f);
19488 Main.dust[num37].noGravity = true;
19489 Dust.NewDust(base.position, width, height, 15, velocity.X * 0.05f, velocity.Y * 0.05f, 150, default(Color), 0.6f);
19490 }
19491 if (this.ai[0] == 0f)
19492 {
19493 bool flag = true;
19494 int num38 = type;
19495 if (num38 == 866)
19496 {
19497 flag = false;
19498 }
19499 if (flag)
19500 {
19501 this.ai[1] += 1f;
19502 }
19503 if (type == 106 && this.ai[1] >= 45f)
19504 {
19505 this.ai[0] = 1f;
19506 this.ai[1] = 0f;
19507 netUpdate = true;
19508 }
19509 if (type == 320 || type == 383)
19510 {
19511 if (this.ai[1] >= 10f)
19512 {
19513 velocity.Y += 0.5f;
19514 if (type == 383 && velocity.Y < 0f)
19515 {
19516 velocity.Y += 0.35f;
19517 }
19518 velocity.X *= 0.95f;
19519 if (velocity.Y > 16f)
19520 {
19521 velocity.Y = 16f;
19522 }
19523 if (type == 383 && Vector2.Distance(base.Center, Main.player[owner].Center) > 800f)
19524 {
19525 this.ai[0] = 1f;
19526 netUpdate = true;
19527 }
19528 }
19529 }
19530 else if (type == 182)
19531 {
19532 if (Main.rand.Next(2) == 0)
19533 {
19534 int num39 = Dust.NewDust(base.position, width, height, 57, 0f, 0f, 255, default(Color), 0.75f);
19536 dust2.velocity *= 0.1f;
19537 Main.dust[num39].noGravity = true;
19538 }
19539 if (velocity.X > 0f)
19540 {
19541 spriteDirection = 1;
19542 }
19543 else if (velocity.X < 0f)
19544 {
19545 spriteDirection = -1;
19546 }
19547 float num40 = base.position.X;
19548 float num41 = base.position.Y;
19549 float num42 = 800f;
19550 bool flag2 = false;
19551 if (this.ai[1] > 10f && this.ai[1] < 360f)
19552 {
19553 for (int num43 = 0; num43 < 200; num43++)
19554 {
19555 if (Main.npc[num43].CanBeChasedBy(this))
19556 {
19557 float num44 = Main.npc[num43].position.X + (float)(Main.npc[num43].width / 2);
19558 float num45 = Main.npc[num43].position.Y + (float)(Main.npc[num43].height / 2);
19559 float num46 = Distance(Main.npc[num43].Center);
19560 if (num46 < num42 && Collision.CanHit(new Vector2(base.position.X + (float)(width / 2), base.position.Y + (float)(height / 2)), 1, 1, Main.npc[num43].position, Main.npc[num43].width, Main.npc[num43].height))
19561 {
19562 num42 = num46;
19563 num40 = num44;
19564 num41 = num45;
19565 flag2 = true;
19566 }
19567 }
19568 }
19569 }
19570 if (!flag2)
19571 {
19572 num40 = base.position.X + (float)(width / 2) + velocity.X * 100f;
19573 num41 = base.position.Y + (float)(height / 2) + velocity.Y * 100f;
19574 if (this.ai[1] >= 30f)
19575 {
19576 this.ai[0] = 1f;
19577 this.ai[1] = 0f;
19578 netUpdate = true;
19579 }
19580 }
19581 float num47 = 12f;
19582 float num48 = 0.25f;
19583 Vector2 vector3 = new Vector2(base.position.X + (float)width * 0.5f, base.position.Y + (float)height * 0.5f);
19584 float num49 = num40 - vector3.X;
19585 float num50 = num41 - vector3.Y;
19586 float num51 = (float)Math.Sqrt(num49 * num49 + num50 * num50);
19587 float num52 = num51;
19588 num51 = num47 / num51;
19589 num49 *= num51;
19590 num50 *= num51;
19591 if (velocity.X < num49)
19592 {
19593 velocity.X += num48;
19594 if (velocity.X < 0f && num49 > 0f)
19595 {
19596 velocity.X += num48 * 2f;
19597 }
19598 }
19599 else if (velocity.X > num49)
19600 {
19601 velocity.X -= num48;
19602 if (velocity.X > 0f && num49 < 0f)
19603 {
19604 velocity.X -= num48 * 2f;
19605 }
19606 }
19607 if (velocity.Y < num50)
19608 {
19609 velocity.Y += num48;
19610 if (velocity.Y < 0f && num50 > 0f)
19611 {
19612 velocity.Y += num48 * 2f;
19613 }
19614 }
19615 else if (velocity.Y > num50)
19616 {
19617 velocity.Y -= num48;
19618 if (velocity.Y > 0f && num50 < 0f)
19619 {
19620 velocity.Y -= num48 * 2f;
19621 }
19622 }
19623 }
19624 else if (type == 866)
19625 {
19626 if (owner == Main.myPlayer && damage > 0)
19627 {
19628 float num53 = this.ai[1];
19629 if (localAI[0] >= 10f && localAI[0] <= 360f)
19630 {
19632 this.ai[1] = num54;
19633 }
19634 else
19635 {
19636 this.ai[1] = -1f;
19637 }
19638 if (this.ai[1] != num53)
19639 {
19640 netUpdate = true;
19641 }
19642 }
19643 localAI[0] += 1f;
19644 int num55 = (int)this.ai[1];
19646 if (Main.npc.IndexInRange(num55) && Main.npc[num55].CanBeChasedBy(this))
19647 {
19648 vector4 = Main.npc[num55].Center;
19649 }
19650 else
19651 {
19652 vector4 = base.Center + velocity * 100f;
19653 int num56 = 30;
19654 if (owner != Main.myPlayer)
19655 {
19656 num56 = 60;
19657 }
19658 if (localAI[0] >= (float)num56)
19659 {
19660 this.ai[0] = 1f;
19661 this.ai[1] = 0f;
19662 netUpdate = true;
19663 }
19664 }
19665 float num57 = 12f;
19666 float num58 = 0.25f;
19667 Vector2 vector5 = new Vector2(base.position.X + (float)width * 0.5f, base.position.Y + (float)height * 0.5f);
19668 float num59 = vector4.X - vector5.X;
19669 float num60 = vector4.Y - vector5.Y;
19670 float num61 = (float)Math.Sqrt(num59 * num59 + num60 * num60);
19671 float num62 = num61;
19672 num61 = num57 / num61;
19673 num59 *= num61;
19674 num60 *= num61;
19675 if (velocity.X < num59)
19676 {
19677 velocity.X += num58;
19678 if (velocity.X < 0f && num59 > 0f)
19679 {
19680 velocity.X += num58 * 2f;
19681 }
19682 }
19683 else if (velocity.X > num59)
19684 {
19685 velocity.X -= num58;
19686 if (velocity.X > 0f && num59 < 0f)
19687 {
19688 velocity.X -= num58 * 2f;
19689 }
19690 }
19691 if (velocity.Y < num60)
19692 {
19693 velocity.Y += num58;
19694 if (velocity.Y < 0f && num60 > 0f)
19695 {
19696 velocity.Y += num58 * 2f;
19697 }
19698 }
19699 else if (velocity.Y > num60)
19700 {
19701 velocity.Y -= num58;
19702 if (velocity.Y > 0f && num60 < 0f)
19703 {
19704 velocity.Y -= num58 * 2f;
19705 }
19706 }
19707 }
19708 else if (type == 301)
19709 {
19710 if (this.ai[1] >= 20f)
19711 {
19712 this.ai[0] = 1f;
19713 this.ai[1] = 0f;
19715 netUpdate = true;
19716 }
19717 }
19718 else if (this.ai[1] >= 30f)
19719 {
19720 this.ai[0] = 1f;
19721 this.ai[1] = 0f;
19722 netUpdate = true;
19723 }
19724 }
19725 else
19726 {
19727 tileCollide = false;
19728 float num63 = 9f;
19729 float num64 = 0.4f;
19730 if (type == 1000)
19731 {
19732 num63 = 9.5f;
19733 }
19734 if (type == 19)
19735 {
19736 num63 = 20f;
19737 num64 = 1.5f;
19738 }
19739 else if (type == 33)
19740 {
19741 num63 = 18f;
19742 num64 = 1.2f;
19743 }
19744 else if (type == 182)
19745 {
19746 num63 = 16f;
19747 num64 = 1.2f;
19748 }
19749 else if (type == 866)
19750 {
19751 num63 = 16f;
19752 num64 = 1.2f;
19753 }
19754 else if (type == 106)
19755 {
19756 num63 = 16f;
19757 num64 = 1.2f;
19758 }
19759 else if (type == 272)
19760 {
19761 num63 = 20f;
19762 num64 = 1.5f;
19763 }
19764 else if (type == 333)
19765 {
19766 num63 = 12f;
19767 num64 = 0.6f;
19768 }
19769 else if (type == 301)
19770 {
19771 num63 = 15f;
19772 num64 = 3f;
19773 }
19774 else if (type == 320)
19775 {
19776 num63 = 15f;
19777 num64 = 3f;
19778 }
19779 else if (type == 383)
19780 {
19781 num63 = 16f;
19782 num64 = 4f;
19783 }
19784 Vector2 vector6 = new Vector2(base.position.X + (float)width * 0.5f, base.position.Y + (float)height * 0.5f);
19785 float num65 = Main.player[owner].position.X + (float)(Main.player[owner].width / 2) - vector6.X;
19786 float num66 = Main.player[owner].position.Y + (float)(Main.player[owner].height / 2) - vector6.Y;
19787 float num67 = (float)Math.Sqrt(num65 * num65 + num66 * num66);
19788 if (num67 > 3000f)
19789 {
19790 Kill();
19791 }
19792 num67 = num63 / num67;
19793 num65 *= num67;
19794 num66 *= num67;
19795 if (type == 383)
19796 {
19798 if (vector7 != Vector2.Zero)
19799 {
19801 vector8.Normalize();
19802 velocity += vector8 * Math.Min(num64, vector7.Length());
19803 }
19804 }
19805 else
19806 {
19807 if (velocity.X < num65)
19808 {
19809 velocity.X += num64;
19810 if (velocity.X < 0f && num65 > 0f)
19811 {
19812 velocity.X += num64;
19813 }
19814 }
19815 else if (velocity.X > num65)
19816 {
19817 velocity.X -= num64;
19818 if (velocity.X > 0f && num65 < 0f)
19819 {
19820 velocity.X -= num64;
19821 }
19822 }
19823 if (velocity.Y < num66)
19824 {
19825 velocity.Y += num64;
19826 if (velocity.Y < 0f && num66 > 0f)
19827 {
19828 velocity.Y += num64;
19829 }
19830 }
19831 else if (velocity.Y > num66)
19832 {
19833 velocity.Y -= num64;
19834 if (velocity.Y > 0f && num66 < 0f)
19835 {
19836 velocity.Y -= num64;
19837 }
19838 }
19839 }
19840 if (Main.myPlayer == owner)
19841 {
19842 Rectangle rectangle = new Rectangle((int)base.position.X, (int)base.position.Y, width, height);
19843 Rectangle value = new Rectangle((int)Main.player[owner].position.X, (int)Main.player[owner].position.Y, Main.player[owner].width, Main.player[owner].height);
19844 if (rectangle.Intersects(value))
19845 {
19846 Kill();
19847 }
19848 }
19849 }
19850 if (type == 106)
19851 {
19852 rotation += 0.3f * (float)direction;
19853 }
19854 else if (type == 866)
19855 {
19856 rotation = velocity.ToRotation();
19857 if (Main.rand.Next(2) == 0)
19858 {
19859 int num68 = Dust.NewDust(base.position, width, height, 212);
19861 dust2.velocity *= 0.1f;
19862 Main.dust[num68].noGravity = true;
19863 }
19864 }
19865 else if (type == 383)
19866 {
19867 if (this.ai[0] == 0f)
19868 {
19869 Vector2 v = velocity;
19870 v = v.SafeNormalize(Vector2.Zero);
19871 rotation = (float)Math.Atan2(v.Y, v.X) + 1.57f;
19872 }
19873 else
19874 {
19875 Vector2 v2 = base.Center - Main.player[owner].Center;
19876 v2 = v2.SafeNormalize(Vector2.Zero);
19877 rotation = (float)Math.Atan2(v2.Y, v2.X) + 1.57f;
19878 }
19879 }
19880 else if (type == 301)
19881 {
19882 if (this.ai[0] == 0f)
19883 {
19884 rotation = velocity.ToRotation() + (float)Math.PI / 4f;
19885 if (Main.rand.Next(2) == 0)
19886 {
19887 int num69 = Dust.NewDust(base.position, width, height, 57, velocity.X * 0.2f, velocity.Y * 0.2f, 200, default(Color), 1.2f);
19889 dust2.velocity += velocity * 0.3f;
19890 dust2 = Main.dust[num69];
19891 dust2.velocity *= 0.2f;
19892 Main.dust[num69].noGravity = true;
19893 }
19894 if (Main.rand.Next(3) == 0)
19895 {
19896 int num70 = Dust.NewDust(base.position, width, height, 43, 0f, 0f, 254, default(Color), 0.3f);
19898 dust2.velocity += velocity * 0.5f;
19899 dust2 = Main.dust[num70];
19900 dust2.velocity *= 0.5f;
19901 Main.dust[num70].noGravity = true;
19902 }
19903 }
19904 else
19905 {
19906 rotation += 0.4f * (float)direction;
19907 }
19908 }
19909 else
19910 {
19911 rotation += 0.4f * (float)direction;
19912 }
19913 }
19914 else if (aiStyle == 4)
19915 {
19916 if (Main.netMode != 2 && this.ai[1] == 0f && localAI[0] == 0f)
19917 {
19918 localAI[0] = 1f;
19920 if (type == 494)
19921 {
19923 }
19925 }
19926 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 1.57f;
19927 if (this.ai[0] == 0f)
19928 {
19929 if (type >= 150 && type <= 152 && this.ai[1] == 0f && alpha == 255 && Main.rand.Next(2) == 0)
19930 {
19931 type++;
19932 netUpdate = true;
19933 }
19934 alpha -= 50;
19935 if (type >= 150 && type <= 152)
19936 {
19937 alpha -= 25;
19938 }
19939 else if (type == 493 || type == 494)
19940 {
19941 alpha -= 50;
19942 }
19943 if (alpha > 0)
19944 {
19945 return;
19946 }
19947 alpha = 0;
19948 this.ai[0] = 1f;
19949 if (this.ai[1] == 0f)
19950 {
19951 this.ai[1] += 1f;
19952 base.position += velocity * 1f;
19953 }
19954 if (type == 7 && Main.myPlayer == owner)
19955 {
19956 int num71 = type;
19957 if (this.ai[1] >= 6f)
19958 {
19959 num71++;
19960 }
19961 int num72 = NewProjectile(GetProjectileSource_FromThis(), base.position.X + velocity.X + (float)(width / 2), base.position.Y + velocity.Y + (float)(height / 2), velocity.X, velocity.Y, num71, damage, knockBack, owner);
19962 Main.projectile[num72].damage = damage;
19963 Main.projectile[num72].ai[1] = this.ai[1] + 1f;
19964 NetMessage.SendData(27, -1, -1, null, num72);
19965 }
19966 else if (type == 494 && Main.myPlayer == owner)
19967 {
19968 int num73 = type;
19969 if (this.ai[1] >= (float)(7 + Main.rand.Next(2)))
19970 {
19971 num73--;
19972 }
19973 int num74 = damage;
19974 float num75 = knockBack;
19975 if (num73 == 493)
19976 {
19977 num74 = (int)((double)damage * 1.25);
19978 num75 = knockBack * 1.25f;
19979 }
19980 int number = NewProjectile(GetProjectileSource_FromThis(), base.position.X + velocity.X + (float)(width / 2), base.position.Y + velocity.Y + (float)(height / 2), velocity.X, velocity.Y, num73, num74, num75, owner, 0f, this.ai[1] + 1f);
19981 NetMessage.SendData(27, -1, -1, null, number);
19982 }
19983 else if ((type == 150 || type == 151) && Main.myPlayer == owner)
19984 {
19985 int num76 = type;
19986 if (type == 150)
19987 {
19988 num76 = 151;
19989 }
19990 else if (type == 151)
19991 {
19992 num76 = 150;
19993 }
19994 if (this.ai[1] >= 10f && type == 151)
19995 {
19996 num76 = 152;
19997 }
19998 int num77 = NewProjectile(GetProjectileSource_FromThis(), base.position.X + velocity.X + (float)(width / 2), base.position.Y + velocity.Y + (float)(height / 2), velocity.X, velocity.Y, num76, damage, knockBack, owner);
19999 Main.projectile[num77].damage = damage;
20000 Main.projectile[num77].ai[1] = this.ai[1] + 1f;
20001 NetMessage.SendData(27, -1, -1, null, num77);
20002 }
20003 return;
20004 }
20006 {
20007 if (type >= 150 && type <= 152)
20008 {
20009 for (int num78 = 0; num78 < 8; num78++)
20010 {
20011 int num79 = Dust.NewDust(base.position, width, height, 7, velocity.X * 0.025f, velocity.Y * 0.025f, 200, default(Color), 1.3f);
20012 Main.dust[num79].noGravity = true;
20014 dust2.velocity *= 0.5f;
20015 }
20016 }
20017 else if (type == 493 || type == 494)
20018 {
20019 for (int num80 = 0; num80 < 8; num80++)
20020 {
20021 int num81 = Dust.NewDust(base.position, width, height, Main.rand.Next(68, 71), velocity.X * 0.025f, velocity.Y * 0.025f, 200, default(Color), 1.3f);
20022 Main.dust[num81].noGravity = true;
20024 dust2.velocity *= 0.5f;
20025 }
20026 }
20027 else
20028 {
20029 for (int num82 = 0; num82 < 3; num82++)
20030 {
20031 Dust.NewDust(base.position, width, height, 18, velocity.X * 0.025f, velocity.Y * 0.025f, 170, default(Color), 1.2f);
20032 }
20033 Dust.NewDust(base.position, width, height, 14, 0f, 0f, 170, default(Color), 1.1f);
20034 }
20035 }
20036 if (type >= 150 && type <= 152)
20037 {
20038 alpha += 3;
20039 }
20040 else if (type == 493 || type == 494)
20041 {
20042 alpha += 4;
20043 }
20044 else
20045 {
20046 alpha += 5;
20047 }
20048 if (alpha >= 255)
20049 {
20050 Kill();
20051 }
20052 }
20053 else if (aiStyle == 5)
20054 {
20055 if (!Main.remixWorld && type == 12 && Main.dayTime && damage == 1000)
20056 {
20057 Kill();
20058 }
20059 if (type == 503 || type == 723 || type == 724 || type == 725 || type == 726)
20060 {
20061 if (base.Center.Y > this.ai[1])
20062 {
20063 tileCollide = true;
20064 }
20065 }
20066 else if (type == 92)
20067 {
20068 if (base.position.Y > this.ai[1])
20069 {
20070 tileCollide = true;
20071 }
20072 }
20073 else if (type == 9)
20074 {
20075 tileCollide = base.Bottom.Y >= this.ai[1];
20076 }
20077 else
20078 {
20079 if (this.ai[1] == 0f && !Collision.SolidCollision(base.position, width, height))
20080 {
20081 this.ai[1] = 1f;
20082 netUpdate = true;
20083 }
20084 if (this.ai[1] != 0f)
20085 {
20086 tileCollide = true;
20087 }
20088 }
20089 if (soundDelay == 0)
20090 {
20091 soundDelay = 20 + Main.rand.Next(40);
20093 }
20094 if (type == 503 || type == 9)
20095 {
20096 alpha -= 15;
20097 int num83 = 150;
20098 if (base.Center.Y >= this.ai[1])
20099 {
20100 num83 = 0;
20101 }
20102 if (alpha < num83)
20103 {
20104 alpha = num83;
20105 }
20106 localAI[0] += (Math.Abs(velocity.X) + Math.Abs(velocity.Y)) * 0.01f * (float)direction;
20107 }
20108 else if (type == 723 || type == 724 || type == 725 || type == 726)
20109 {
20110 alpha -= 15;
20111 int num84 = 100;
20112 if (base.Center.Y >= this.ai[1])
20113 {
20114 num84 = 0;
20115 }
20116 if (alpha < num84)
20117 {
20118 alpha = num84;
20119 }
20120 localAI[0] += (Math.Abs(velocity.X) + Math.Abs(velocity.Y)) * 0.01f * (float)direction;
20121 }
20122 else
20123 {
20124 if (localAI[0] == 0f)
20125 {
20126 localAI[0] = 1f;
20127 }
20128 alpha += (int)(25f * localAI[0]);
20129 if (alpha > 200)
20130 {
20131 alpha = 200;
20132 localAI[0] = -1f;
20133 }
20134 if (alpha < 0)
20135 {
20136 alpha = 0;
20137 localAI[0] = 1f;
20138 }
20139 }
20140 if (type == 503)
20141 {
20142 rotation = velocity.ToRotation() - (float)Math.PI / 2f;
20143 }
20144 else
20145 {
20146 rotation += (Math.Abs(velocity.X) + Math.Abs(velocity.Y)) * 0.01f * (float)direction;
20147 }
20148 if (type == 503)
20149 {
20150 if (Main.rand.Next(16) == 0)
20151 {
20152 Vector2 vector9 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy(velocity.ToRotation());
20153 int num85 = Dust.NewDust(base.position, width, height, 58, velocity.X * 0.5f, velocity.Y * 0.5f, 150, default(Color), 1.2f);
20154 Main.dust[num85].velocity = vector9 * 0.66f;
20155 Main.dust[num85].position = base.Center + vector9 * 12f;
20156 }
20157 if (Main.rand.Next(48) == 0)
20158 {
20159 int num86 = Gore.NewGore(base.Center, new Vector2(velocity.X * 0.2f, velocity.Y * 0.2f), 16);
20160 Gore gore = Main.gore[num86];
20161 gore.velocity *= 0.66f;
20162 gore = Main.gore[num86];
20163 gore.velocity += velocity * 0.3f;
20164 }
20165 }
20166 if (type == 12 || type == 955)
20167 {
20169 if (base.Hitbox.Intersects(Utils.CenteredRectangle(Main.screenPosition + vector10 / 2f, vector10 + new Vector2(400f))) && Main.rand.Next(6) == 0)
20170 {
20171 int num87 = Utils.SelectRandom<int>(Main.rand, 16, 17, 17, 17);
20173 {
20174 num87 = Utils.SelectRandom<int>(Main.rand, 16, 16, 16, 17);
20175 }
20176 Gore.NewGore(base.position, velocity * 0.2f, num87);
20177 }
20178 light = 0.9f;
20179 if (Main.rand.Next(20) == 0 || (Main.tenthAnniversaryWorld && Main.rand.Next(15) == 0))
20180 {
20181 Dust.NewDust(base.position, width, height, 58, velocity.X * 0.5f, velocity.Y * 0.5f, 150, default(Color), 1.2f);
20182 }
20183 }
20184 else if (type == 723 || type == 724 || type == 725 || type == 726)
20185 {
20186 if (type == 726 || type == 725 || type == 726)
20187 {
20189 if (base.Hitbox.Intersects(Utils.CenteredRectangle(Main.screenPosition + vector11 / 2f, vector11 + new Vector2(400f))) && Main.rand.Next(24) == 0)
20190 {
20191 Gore.NewGore(base.position, velocity * 0.2f, Utils.SelectRandom<int>(Main.rand, 16, 17));
20192 }
20193 if (Main.rand.Next(3) == 0)
20194 {
20195 Dust dust4 = Dust.NewDustDirect(base.position, width, height, 86, 0f, 0f, 127);
20196 Dust dust2 = dust4;
20197 dust2.velocity *= 0.5f;
20198 dust4.noGravity = true;
20199 }
20200 }
20201 if (type == 723)
20202 {
20204 if (base.Hitbox.Intersects(Utils.CenteredRectangle(Main.screenPosition + vector12 / 2f, vector12 + new Vector2(400f))) && Main.rand.Next(6) == 0)
20205 {
20206 Gore.NewGore(base.position, velocity * 0.2f, 17);
20207 }
20208 for (float num88 = 0f; num88 < 3f; num88 += 1f)
20209 {
20210 Vector2 vector13 = base.Center + new Vector2(0f, 12f * scale).RotatedBy(base.position.Y / 200f + num88 * ((float)Math.PI * 2f) + rotation) - velocity * 0.5f;
20212 dust5.noLight = true;
20213 dust5.noGravity = true;
20214 dust5 = Dust.NewDustPerfect(vector13, 267, velocity * 0.2f * num88, 0, Color.White, 0.4f);
20215 dust5.noLight = true;
20216 dust5.noGravity = true;
20217 }
20218 }
20219 }
20220 else if (type == 9)
20221 {
20223 if (base.Hitbox.Intersects(Utils.CenteredRectangle(Main.screenPosition + vector14 / 2f, vector14 + new Vector2(400f))) && Main.rand.Next(20) == 0)
20224 {
20225 Gore.NewGore(base.position, velocity * 0.2f, Main.rand.Next(16, 18));
20226 }
20227 if (Main.rand.Next(4) == 0)
20228 {
20229 Dust dust6 = Dust.NewDustDirect(base.position, width, height, 86, 0f, 0f, 127);
20230 Dust dust2 = dust6;
20231 dust2.velocity *= 0.7f;
20232 dust6.noGravity = true;
20233 dust2 = dust6;
20234 dust2.velocity += velocity * 0.3f;
20235 if (Main.rand.Next(2) == 0)
20236 {
20237 dust2 = dust6;
20238 dust2.position -= velocity * 4f;
20239 }
20240 }
20241 }
20242 else if (this.ai[1] == 1f || type == 92)
20243 {
20244 light = 0.9f;
20245 if (Main.rand.Next(10) == 0)
20246 {
20247 Dust.NewDust(base.position, width, height, 58, velocity.X * 0.5f, velocity.Y * 0.5f, 150, default(Color), 1.2f);
20248 }
20249 if (Main.rand.Next(20) == 0)
20250 {
20251 Gore.NewGore(base.position, new Vector2(velocity.X * 0.2f, velocity.Y * 0.2f), Main.rand.Next(16, 18));
20252 }
20253 }
20254 }
20255 else if (aiStyle == 6)
20256 {
20257 bool flag3 = type == 1019;
20258 velocity *= 0.95f;
20259 this.ai[0] += 1f;
20260 if (this.ai[0] == 180f)
20261 {
20262 Kill();
20263 }
20264 if (this.ai[1] == 0f)
20265 {
20266 this.ai[1] = 1f;
20267 int num89 = 10 + type;
20268 int num90 = 30;
20269 if (type == 463)
20270 {
20271 num89 = 231;
20272 }
20273 if (flag3)
20274 {
20275 num89 = 0;
20276 num90 = 40;
20277 }
20278 for (int num91 = 0; num91 < num90; num91++)
20279 {
20281 if (flag3)
20282 {
20283 dust7.noGravity = num91 % 3 != 0;
20284 if (!dust7.noGravity)
20285 {
20286 Dust dust2 = dust7;
20287 dust2.scale *= 1.25f;
20288 dust2 = dust7;
20289 dust2.velocity /= 2f;
20290 dust7.velocity.Y -= 2.2f;
20291 }
20292 else
20293 {
20294 Dust dust2 = dust7;
20295 dust2.scale *= 1.75f;
20296 dust2 = dust7;
20297 dust2.velocity += velocity * 0.65f;
20298 }
20299 }
20300 }
20301 }
20302 bool flag4 = Main.myPlayer == owner;
20303 if (flag3)
20304 {
20305 flag4 = Main.netMode != 1;
20306 }
20307 if (flag4 && (type == 10 || type == 11 || type == 463 || flag3))
20308 {
20309 int num92 = (int)(base.position.X / 16f) - 1;
20310 int num93 = (int)((base.position.X + (float)width) / 16f) + 2;
20311 int num94 = (int)(base.position.Y / 16f) - 1;
20312 int num95 = (int)((base.position.Y + (float)height) / 16f) + 2;
20313 if (num92 < 0)
20314 {
20315 num92 = 0;
20316 }
20317 if (num93 > Main.maxTilesX)
20318 {
20320 }
20321 if (num94 < 0)
20322 {
20323 num94 = 0;
20324 }
20325 if (num95 > Main.maxTilesY)
20326 {
20328 }
20329 Vector2 vector15 = default(Vector2);
20330 for (int num96 = num92; num96 < num93; num96++)
20331 {
20332 for (int num97 = num94; num97 < num95; num97++)
20333 {
20334 vector15.X = num96 * 16;
20335 vector15.Y = num97 * 16;
20336 if (!(base.position.X + (float)width > vector15.X) || !(base.position.X < vector15.X + 16f) || !(base.position.Y + (float)height > vector15.Y) || !(base.position.Y < vector15.Y + 16f) || !Main.tile[num96, num97].active())
20337 {
20338 continue;
20339 }
20340 if (type == 10)
20341 {
20342 if (Main.tile[num96, num97].type == 23 || Main.tile[num96, num97].type == 199)
20343 {
20344 Main.tile[num96, num97].type = 2;
20346 if (Main.netMode == 1)
20347 {
20349 }
20350 }
20351 if (Main.tile[num96, num97].type == 25 || Main.tile[num96, num97].type == 203)
20352 {
20353 Main.tile[num96, num97].type = 1;
20355 if (Main.netMode == 1)
20356 {
20358 }
20359 }
20360 if (Main.tile[num96, num97].type == 112 || Main.tile[num96, num97].type == 234)
20361 {
20362 Main.tile[num96, num97].type = 53;
20364 if (Main.netMode == 1)
20365 {
20367 }
20368 }
20369 if (Main.tile[num96, num97].type == 163 || Main.tile[num96, num97].type == 200)
20370 {
20371 Main.tile[num96, num97].type = 161;
20373 if (Main.netMode == 1)
20374 {
20376 }
20377 }
20378 if (Main.tile[num96, num97].type == 400 || Main.tile[num96, num97].type == 401)
20379 {
20380 Main.tile[num96, num97].type = 396;
20382 if (Main.netMode == 1)
20383 {
20385 }
20386 }
20387 if (Main.tile[num96, num97].type == 398 || Main.tile[num96, num97].type == 399)
20388 {
20389 Main.tile[num96, num97].type = 397;
20391 if (Main.netMode == 1)
20392 {
20394 }
20395 }
20396 if (Main.tile[num96, num97].type == 661 || Main.tile[num96, num97].type == 662)
20397 {
20398 Main.tile[num96, num97].type = 60;
20400 if (Main.netMode == 1)
20401 {
20403 }
20404 }
20405 }
20406 if (type == 11 || type == 463)
20407 {
20408 if (type == 11)
20409 {
20410 WorldGen.Convert(num96, num97, 1, 1);
20411 }
20412 if (type == 463)
20413 {
20414 WorldGen.Convert(num96, num97, 4, 1);
20415 }
20416 }
20417 if (!flag3)
20418 {
20419 continue;
20420 }
20421 Tile tile = Main.tile[num96, num97];
20422 if (tile.type >= 0 && tile.type < TileID.Count && TileID.Sets.CommonSapling[tile.type])
20423 {
20424 if (Main.remixWorld && num97 >= (int)Main.worldSurface - 1 && num97 < Main.maxTilesY - 20)
20425 {
20427 }
20429 }
20430 }
20431 }
20432 }
20433 if (flag3 && velocity.Length() < 0.5f)
20434 {
20435 Kill();
20436 }
20437 }
20438 else if (aiStyle == 7)
20439 {
20441 }
20442 else if (aiStyle == 8)
20443 {
20444 if (type == 258 && localAI[0] == 0f)
20445 {
20446 localAI[0] = 1f;
20448 }
20449 if (type == 96 && localAI[0] == 0f)
20450 {
20451 localAI[0] = 1f;
20453 }
20454 if (type == 27)
20455 {
20456 for (int num98 = 0; num98 < 5; num98++)
20457 {
20458 float num99 = velocity.X / 3f * (float)num98;
20459 float num100 = velocity.Y / 3f * (float)num98;
20460 int num101 = 4;
20461 int num102 = Dust.NewDust(new Vector2(base.position.X + (float)num101, base.position.Y + (float)num101), width - num101 * 2, height - num101 * 2, 172, 0f, 0f, 100, default(Color), 1.2f);
20462 Main.dust[num102].noGravity = true;
20464 dust2.velocity *= 0.1f;
20465 dust2 = Main.dust[num102];
20466 dust2.velocity += velocity * 0.1f;
20467 Main.dust[num102].position.X -= num99;
20468 Main.dust[num102].position.Y -= num100;
20469 }
20470 if (Main.rand.Next(5) == 0)
20471 {
20472 int num103 = 4;
20473 int num104 = Dust.NewDust(new Vector2(base.position.X + (float)num103, base.position.Y + (float)num103), width - num103 * 2, height - num103 * 2, 172, 0f, 0f, 100, default(Color), 0.6f);
20475 dust2.velocity *= 0.25f;
20476 dust2 = Main.dust[num104];
20477 dust2.velocity += velocity * 0.5f;
20478 }
20479 }
20480 else if (type == 502)
20481 {
20482 float num105 = (float)Main.DiscoR / 255f;
20483 float num106 = (float)Main.DiscoG / 255f;
20484 float num107 = (float)Main.DiscoB / 255f;
20485 num105 = (0.5f + num105) / 2f;
20486 num106 = (0.5f + num106) / 2f;
20487 num107 = (0.5f + num107) / 2f;
20489 }
20490 else if (type == 95 || type == 96)
20491 {
20492 int num108 = Dust.NewDust(new Vector2(base.position.X + velocity.X, base.position.Y + velocity.Y), width, height, 75, velocity.X, velocity.Y, 100, default(Color), 3f * scale);
20493 Main.dust[num108].noGravity = true;
20494 }
20495 else if (type == 253)
20496 {
20497 for (int num109 = 0; num109 < 2; num109++)
20498 {
20499 int num110 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 135, velocity.X * 0.2f, velocity.Y * 0.2f, 100, default(Color), 2f);
20500 Main.dust[num110].noGravity = true;
20501 Main.dust[num110].velocity.X *= 0.3f;
20502 Main.dust[num110].velocity.Y *= 0.3f;
20503 }
20504 }
20505 else
20506 {
20507 for (int num111 = 0; num111 < 2; num111++)
20508 {
20509 int num112 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 6, velocity.X * 0.2f, velocity.Y * 0.2f, 100, default(Color), 2f);
20510 if (type == 258 && Main.getGoodWorld)
20511 {
20512 Main.dust[num112].noLight = true;
20513 }
20514 Main.dust[num112].noGravity = true;
20515 Main.dust[num112].velocity.X *= 0.3f;
20516 Main.dust[num112].velocity.Y *= 0.3f;
20517 }
20518 }
20519 if (type != 27 && type != 96 && type != 258)
20520 {
20521 this.ai[1] += 1f;
20522 }
20523 if (this.ai[1] >= 20f)
20524 {
20525 velocity.Y += 0.2f;
20526 }
20527 if (type == 502)
20528 {
20529 rotation = velocity.ToRotation() + (float)Math.PI / 2f;
20530 if (velocity.X != 0f)
20531 {
20533 }
20534 }
20535 else
20536 {
20537 rotation += 0.3f * (float)direction;
20538 }
20539 if (velocity.Y > 16f)
20540 {
20541 velocity.Y = 16f;
20542 }
20543 }
20544 else if (aiStyle == 9)
20545 {
20547 }
20548 else if (aiStyle == 10)
20549 {
20550 AI_010();
20551 }
20552 else if (aiStyle == 11)
20553 {
20554 bool flag5 = type == 72 || type == 86 || type == 87;
20555 if (flag5)
20556 {
20557 if (velocity.X > 0f)
20558 {
20559 spriteDirection = -1;
20560 }
20561 else if (velocity.X < 0f)
20562 {
20563 spriteDirection = 1;
20564 }
20565 rotation = velocity.X * 0.1f;
20566 frameCounter++;
20567 if (frameCounter >= 4)
20568 {
20569 frame++;
20570 frameCounter = 0;
20571 }
20572 if (frame >= 4)
20573 {
20574 frame = 0;
20575 }
20576 if (Main.rand.Next(6) == 0)
20577 {
20578 int num113 = 56;
20579 if (type == 86)
20580 {
20581 num113 = 73;
20582 }
20583 else if (type == 87)
20584 {
20585 num113 = 74;
20586 }
20587 int num114 = Dust.NewDust(base.position, width, height, num113, 0f, 0f, 200, default(Color), 0.8f);
20589 dust2.velocity *= 0.3f;
20590 Main.dust[num114].shader = GameShaders.Armor.GetSecondaryShader(Main.player[owner].cLight, Main.player[owner]);
20591 }
20592 }
20593 else
20594 {
20595 rotation += 0.02f;
20596 }
20597 if (type == 72)
20598 {
20599 if (Main.player[owner].blueFairy)
20600 {
20601 timeLeft = 2;
20602 }
20603 }
20604 else if (type == 86)
20605 {
20606 if (Main.player[owner].redFairy)
20607 {
20608 timeLeft = 2;
20609 }
20610 }
20611 else if (type == 87)
20612 {
20613 if (Main.player[owner].greenFairy)
20614 {
20615 timeLeft = 2;
20616 }
20617 }
20618 else if (type == 18 && Main.player[owner].lightOrb)
20619 {
20620 timeLeft = 2;
20621 }
20622 if (!Main.player[owner].dead)
20623 {
20624 float num115 = 3f;
20625 if (flag5)
20626 {
20627 num115 = 6f;
20628 }
20629 Vector2 vector16 = new Vector2(base.position.X + (float)width * 0.5f, base.position.Y + (float)height * 0.5f);
20630 float num116 = Main.player[owner].position.X + (float)(Main.player[owner].width / 2) - vector16.X;
20631 float num117 = Main.player[owner].position.Y + (float)(Main.player[owner].height / 2) - vector16.Y;
20632 int num118 = 800;
20633 int num119 = 70;
20634 if (type == 18)
20635 {
20636 if (Main.player[owner].controlUp)
20637 {
20638 num117 = Main.player[owner].position.Y - 40f - vector16.Y;
20639 num116 -= 6f;
20640 num119 = 4;
20641 }
20642 else if (Main.player[owner].controlDown)
20643 {
20644 num117 = Main.player[owner].position.Y + (float)Main.player[owner].height + 40f - vector16.Y;
20645 num116 -= 6f;
20646 num119 = 4;
20647 }
20648 }
20649 if (flag5)
20650 {
20651 num119 = 50;
20652 }
20653 float num120 = (float)Math.Sqrt(num116 * num116 + num117 * num117);
20654 num120 = (float)Math.Sqrt(num116 * num116 + num117 * num117);
20655 if (num120 > (float)num118)
20656 {
20657 base.position.X = Main.player[owner].position.X + (float)(Main.player[owner].width / 2) - (float)(width / 2);
20658 base.position.Y = Main.player[owner].position.Y + (float)(Main.player[owner].height / 2) - (float)(height / 2);
20659 }
20660 else if (num120 > (float)num119)
20661 {
20662 float num121 = num120 - (float)num119;
20663 num120 = num115 / num120;
20664 num116 *= num120;
20665 num117 *= num120;
20666 velocity.X = num116;
20667 velocity.Y = num117;
20668 if (flag5 && velocity.Length() > num121)
20669 {
20670 velocity = velocity.SafeNormalize(Vector2.Zero) * num121;
20671 }
20672 }
20673 else
20674 {
20675 velocity.X = (velocity.Y = 0f);
20676 }
20677 }
20678 else
20679 {
20680 Kill();
20681 }
20682 }
20683 else if (aiStyle == 12)
20684 {
20685 if (type == 288 && localAI[0] == 0f)
20686 {
20687 localAI[0] = 1f;
20689 }
20690 if (type == 280 || type == 288)
20691 {
20692 scale -= 0.002f;
20693 if (scale <= 0f)
20694 {
20695 Kill();
20696 }
20697 if (type == 288)
20698 {
20699 this.ai[0] = 4f;
20700 }
20701 if (this.ai[0] > 3f)
20702 {
20703 velocity.Y += 0.075f;
20704 for (int num122 = 0; num122 < 3; num122++)
20705 {
20706 float num123 = velocity.X / 3f * (float)num122;
20707 float num124 = velocity.Y / 3f * (float)num122;
20708 int num125 = 14;
20709 int num126 = Dust.NewDust(new Vector2(base.position.X + (float)num125, base.position.Y + (float)num125), width - num125 * 2, height - num125 * 2, 170, 0f, 0f, 100);
20710 Main.dust[num126].noGravity = true;
20712 dust2.velocity *= 0.1f;
20713 dust2 = Main.dust[num126];
20714 dust2.velocity += velocity * 0.5f;
20715 Main.dust[num126].position.X -= num123;
20716 Main.dust[num126].position.Y -= num124;
20717 }
20718 if (Main.rand.Next(8) == 0)
20719 {
20720 int num127 = 16;
20721 int num128 = Dust.NewDust(new Vector2(base.position.X + (float)num127, base.position.Y + (float)num127), width - num127 * 2, height - num127 * 2, 170, 0f, 0f, 100, default(Color), 0.5f);
20723 dust2.velocity *= 0.25f;
20724 dust2 = Main.dust[num128];
20725 dust2.velocity += velocity * 0.5f;
20726 }
20727 }
20728 else
20729 {
20730 this.ai[0] += 1f;
20731 }
20732 return;
20733 }
20734 float num129 = 0.02f;
20735 float num130 = 0.2f;
20736 if (type == 22)
20737 {
20738 num129 = 0.01f;
20739 num130 = 0.15f;
20740 }
20741 scale -= num129;
20742 if (scale <= 0f)
20743 {
20744 Kill();
20745 }
20746 if (this.ai[0] > 3f)
20747 {
20748 velocity.Y += num130;
20749 for (int num131 = 0; num131 < 1; num131++)
20750 {
20751 for (int num132 = 0; num132 < 3; num132++)
20752 {
20753 float num133 = velocity.X / 3f * (float)num132;
20754 float num134 = velocity.Y / 3f * (float)num132;
20755 int num135 = 6;
20756 int num136 = Dust.NewDust(new Vector2(base.position.X + (float)num135, base.position.Y + (float)num135), width - num135 * 2, height - num135 * 2, 172, 0f, 0f, 100, default(Color), 1.2f);
20757 Main.dust[num136].noGravity = true;
20759 dust2.velocity *= 0.3f;
20760 dust2 = Main.dust[num136];
20761 dust2.velocity += velocity * 0.5f;
20762 Main.dust[num136].position.X -= num133;
20763 Main.dust[num136].position.Y -= num134;
20764 }
20765 if (Main.rand.Next(8) == 0)
20766 {
20767 int num137 = 6;
20768 int num138 = Dust.NewDust(new Vector2(base.position.X + (float)num137, base.position.Y + (float)num137), width - num137 * 2, height - num137 * 2, 172, 0f, 0f, 100, default(Color), 0.75f);
20770 dust2.velocity *= 0.5f;
20771 dust2 = Main.dust[num138];
20772 dust2.velocity += velocity * 0.5f;
20773 }
20774 }
20775 }
20776 else
20777 {
20778 this.ai[0] += 1f;
20779 }
20780 }
20781 else if (aiStyle == 13)
20782 {
20783 bool flag6 = Main.player[owner].dead;
20784 if (!flag6)
20785 {
20786 float num139 = (Main.player[owner].Center - base.Center).Length();
20787 flag6 = num139 > 2000f;
20788 }
20789 if (flag6)
20790 {
20791 Kill();
20792 return;
20793 }
20794 if (type != 481)
20795 {
20796 int dummyItemTime = 5;
20797 Main.player[owner].SetDummyItemTime(dummyItemTime);
20798 }
20799 if (alpha == 0)
20800 {
20801 if (base.position.X + (float)(width / 2) > Main.player[owner].position.X + (float)(Main.player[owner].width / 2))
20802 {
20803 Main.player[owner].ChangeDir(1);
20804 }
20805 else
20806 {
20807 Main.player[owner].ChangeDir(-1);
20808 }
20809 }
20810 if (type == 481)
20811 {
20812 if (this.ai[0] == 0f)
20813 {
20814 extraUpdates = 1;
20815 }
20816 else
20817 {
20818 extraUpdates = 2;
20819 }
20820 }
20821 Vector2 vector17 = new Vector2(base.position.X + (float)width * 0.5f, base.position.Y + (float)height * 0.5f);
20822 float num140 = Main.player[owner].position.X + (float)(Main.player[owner].width / 2) - vector17.X;
20823 float num141 = Main.player[owner].position.Y + (float)(Main.player[owner].height / 2) - vector17.Y;
20824 float num142 = (float)Math.Sqrt(num140 * num140 + num141 * num141);
20825 if (this.ai[0] == 0f)
20826 {
20827 if (num142 > 700f)
20828 {
20829 this.ai[0] = 1f;
20830 }
20831 else if (type == 262 && num142 > 500f)
20832 {
20833 this.ai[0] = 1f;
20834 }
20835 else if (type == 271 && num142 > 200f)
20836 {
20837 this.ai[0] = 1f;
20838 }
20839 else if (type == 273 && (Main.remixWorld ? (num142 > 300f) : (num142 > 150f)))
20840 {
20841 this.ai[0] = 1f;
20842 }
20843 else if (type == 481 && num142 > 525f)
20844 {
20845 this.ai[0] = 1f;
20846 }
20847 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 1.57f;
20848 this.ai[1] += 1f;
20849 if (this.ai[1] > 5f)
20850 {
20851 alpha = 0;
20852 }
20853 if (type == 262 && this.ai[1] > 8f)
20854 {
20855 this.ai[1] = 8f;
20856 }
20857 if (type == 271 && this.ai[1] > 8f)
20858 {
20859 this.ai[1] = 8f;
20860 }
20861 if (type == 273 && this.ai[1] > 8f)
20862 {
20863 this.ai[1] = 8f;
20864 }
20865 if (type == 481 && this.ai[1] > 8f)
20866 {
20867 this.ai[1] = 8f;
20868 }
20869 if (type == 404 && this.ai[1] > 8f)
20870 {
20871 this.ai[1] = 0f;
20872 }
20873 if (this.ai[1] >= 10f)
20874 {
20875 this.ai[1] = 15f;
20876 velocity.Y += 0.3f;
20877 }
20878 if (type == 262 && velocity.X < 0f)
20879 {
20880 spriteDirection = -1;
20881 }
20882 else if (type == 262)
20883 {
20884 spriteDirection = 1;
20885 }
20886 if (type == 271 && velocity.X < 0f)
20887 {
20888 spriteDirection = -1;
20889 }
20890 else if (type == 271)
20891 {
20892 spriteDirection = 1;
20893 }
20894 }
20895 else if (this.ai[0] == 1f)
20896 {
20897 tileCollide = false;
20898 rotation = (float)Math.Atan2(num141, num140) - 1.57f;
20899 float num143 = 20f;
20900 if (type == 262)
20901 {
20902 num143 = 30f;
20903 }
20904 if (num142 < 50f)
20905 {
20906 Kill();
20907 }
20908 num142 = num143 / num142;
20909 num140 *= num142;
20910 num141 *= num142;
20911 velocity.X = num140;
20912 velocity.Y = num141;
20913 if (type == 262 && velocity.X < 0f)
20914 {
20915 spriteDirection = 1;
20916 }
20917 else if (type == 262)
20918 {
20919 spriteDirection = -1;
20920 }
20921 if (type == 271 && velocity.X < 0f)
20922 {
20923 spriteDirection = 1;
20924 }
20925 else if (type == 271)
20926 {
20927 spriteDirection = -1;
20928 }
20929 }
20930 }
20931 else if (aiStyle == 14)
20932 {
20933 if (type == 870 && this.ai[1] > 0f)
20934 {
20935 aiStyle = 170;
20936 }
20937 if (type == 473 && Main.netMode != 2)
20938 {
20939 localAI[0] += 1f;
20940 if (localAI[0] >= 10f)
20941 {
20942 localAI[0] = 0f;
20943 int num144 = 30;
20944 if ((base.Center - Main.player[Main.myPlayer].Center).Length() < (float)(Main.screenWidth + num144 * 16))
20945 {
20946 Main.instance.SpelunkerProjectileHelper.AddSpotToCheck(base.Center);
20947 }
20948 }
20949 }
20950 if (type == 352)
20951 {
20952 if (localAI[1] == 0f)
20953 {
20954 localAI[1] = 1f;
20955 }
20956 alpha += (int)(25f * localAI[1]);
20957 if (alpha <= 0)
20958 {
20959 alpha = 0;
20960 localAI[1] = 1f;
20961 }
20962 else if (alpha >= 255)
20963 {
20964 alpha = 255;
20965 localAI[1] = -1f;
20966 }
20967 scale += localAI[1] * 0.01f;
20968 }
20969 if (type == 346)
20970 {
20971 if (localAI[0] == 0f)
20972 {
20973 localAI[0] = 1f;
20975 }
20976 frame = (int)this.ai[1];
20977 if (frame == 0)
20978 {
20979 Lighting.AddLight(base.Center, 0.25f, 0.2f, 0f);
20980 }
20981 else
20982 {
20983 Lighting.AddLight(base.Center, 0.15f, 0.15f, 0.15f);
20984 }
20985 if (owner == Main.myPlayer && timeLeft == 1)
20986 {
20987 for (int num145 = 0; num145 < 5; num145++)
20988 {
20989 float num146 = 10f;
20990 Vector2 vector18 = new Vector2(base.Center.X, base.Center.Y);
20991 float num147 = Main.rand.Next(-20, 21);
20992 float num148 = Main.rand.Next(-20, 0);
20993 float num149 = (float)Math.Sqrt(num147 * num147 + num148 * num148);
20994 num149 = num146 / num149;
20995 num147 *= num149;
20996 num148 *= num149;
20997 num147 *= 1f + (float)Main.rand.Next(-30, 31) * 0.01f;
20998 num148 *= 1f + (float)Main.rand.Next(-30, 31) * 0.01f;
20999 int num150 = NewProjectile(GetProjectileSource_FromThis(), vector18.X, vector18.Y, num147, num148, 347, 40, 0f, Main.myPlayer, 0f, this.ai[1]);
21000 }
21001 }
21002 }
21003 if (type == 196)
21004 {
21005 int num151 = Main.rand.Next(1, 3);
21006 for (int num152 = 0; num152 < num151; num152++)
21007 {
21008 int num153 = Dust.NewDust(base.position, width, height, 31, 0f, 0f, 100);
21010 dust2.alpha += Main.rand.Next(100);
21011 dust2 = Main.dust[num153];
21012 dust2.velocity *= 0.3f;
21013 Main.dust[num153].velocity.X += (float)Main.rand.Next(-10, 11) * 0.025f;
21014 Main.dust[num153].velocity.Y -= 0.4f + (float)Main.rand.Next(-3, 14) * 0.15f;
21015 Main.dust[num153].fadeIn = 1.25f + (float)Main.rand.Next(20) * 0.15f;
21016 }
21017 }
21018 if (type == 53)
21019 {
21020 try
21021 {
21022 int num154 = (int)(base.position.X / 16f) - 1;
21023 int num155 = (int)((base.position.X + (float)width) / 16f) + 2;
21024 int num156 = (int)(base.position.Y / 16f) - 1;
21025 int num157 = (int)((base.position.Y + (float)height) / 16f) + 2;
21026 if (num154 < 0)
21027 {
21028 num154 = 0;
21029 }
21030 if (num155 > Main.maxTilesX)
21031 {
21033 }
21034 if (num156 < 0)
21035 {
21036 num156 = 0;
21037 }
21038 if (num157 > Main.maxTilesY)
21039 {
21041 }
21042 Vector2 vector19 = default(Vector2);
21043 for (int num158 = num154; num158 < num155; num158++)
21044 {
21045 for (int num159 = num156; num159 < num157; num159++)
21046 {
21047 if (Main.tile[num158, num159] != null && Main.tile[num158, num159].nactive() && Main.tileSolid[Main.tile[num158, num159].type] && !Main.tileSolidTop[Main.tile[num158, num159].type])
21048 {
21049 vector19.X = num158 * 16;
21050 vector19.Y = num159 * 16;
21051 if (base.position.X + (float)width > vector19.X && base.position.X < vector19.X + 16f && base.position.Y + (float)height > vector19.Y && base.position.Y < vector19.Y + 16f)
21052 {
21053 velocity.X = 0f;
21054 velocity.Y = -0.2f;
21055 }
21056 }
21057 }
21058 }
21059 }
21060 catch
21061 {
21062 }
21063 }
21064 if (type == 277)
21065 {
21066 if (alpha > 0)
21067 {
21068 alpha -= 30;
21069 if (alpha < 0)
21070 {
21071 alpha = 0;
21072 }
21073 }
21074 if (Main.expertMode)
21075 {
21076 float num160 = 12f;
21077 int num161 = Player.FindClosest(base.Center, 1, 1);
21078 Vector2 vector20 = Main.player[num161].Center - base.Center;
21079 vector20.Normalize();
21080 vector20 *= num160;
21081 int num162 = 200;
21082 velocity.X = (velocity.X * (float)(num162 - 1) + vector20.X) / (float)num162;
21083 if (velocity.Length() > 16f)
21084 {
21086 velocity *= 16f;
21087 }
21088 }
21089 }
21090 if (type == 261)
21091 {
21092 if (localAI[1] == 0f)
21093 {
21094 localAI[1] = 1f;
21095 localAI[0] = 80f;
21096 }
21097 rotation += velocity.X * 0.05f;
21098 if (velocity.Y != 0f)
21099 {
21100 rotation += (float)spriteDirection * 0.01f;
21101 }
21102 this.ai[0]++;
21103 if (this.ai[0] > 15f)
21104 {
21105 if (velocity.Y == 0f && velocity.X != 0f)
21106 {
21107 velocity.X *= 0.97f;
21108 Math.Abs(velocity.X);
21109 _ = 2f;
21110 if (Math.Abs(velocity.X) <= 0.01f)
21111 {
21112 Kill();
21113 }
21114 }
21115 this.ai[0] = 15f;
21116 velocity.Y += 0.2f;
21117 }
21118 if (localAI[0] > 0f)
21119 {
21120 localAI[0]--;
21121 int num163 = 5;
21122 int maxValue = num163;
21123 if (localAI[0] < 20f)
21124 {
21126 }
21127 if (localAI[0] < 10f)
21128 {
21130 }
21131 if (Main.rand.Next(maxValue) == 0)
21132 {
21133 Dust dust8 = Dust.NewDustPerfect(base.Center + Main.rand.NextVector2Circular(width / 2, height / 2), 31);
21134 Dust dust2 = dust8;
21135 dust2.velocity *= 0.33f;
21136 dust8.scale = 0.7f;
21137 }
21138 if (Main.rand.Next(maxValue) == 0)
21139 {
21140 Dust dust9 = Dust.NewDustPerfect(base.Center + Main.rand.NextVector2Circular(width / 2, height / 2), 228, Main.rand.NextVector2Circular(3f, 3f));
21141 dust9.scale = 0.6f;
21142 Dust dust2 = dust9;
21143 dust2.velocity *= 0.33f;
21144 }
21145 }
21146 }
21147 else if (type == 277)
21148 {
21149 this.ai[0] += 1f;
21150 if (this.ai[0] > 15f)
21151 {
21152 this.ai[0] = 15f;
21153 if (velocity.Y == 0f && velocity.X != 0f)
21154 {
21155 velocity.X *= 0.97f;
21156 if ((double)velocity.X > -0.01 && (double)velocity.X < 0.01)
21157 {
21158 Kill();
21159 }
21160 }
21161 velocity.Y += 0.2f;
21162 }
21163 rotation += velocity.X * 0.05f;
21164 }
21165 else if (type == 378)
21166 {
21167 if (localAI[0] == 0f)
21168 {
21170 localAI[0] += 1f;
21171 }
21172 Rectangle rectangle2 = new Rectangle((int)base.position.X, (int)base.position.Y, width, height);
21173 for (int num164 = 0; num164 < 200; num164++)
21174 {
21175 if (Main.npc[num164].CanBeChasedBy(this, ignoreDontTakeDamage: true))
21176 {
21177 Rectangle value2 = new Rectangle((int)Main.npc[num164].position.X, (int)Main.npc[num164].position.Y, Main.npc[num164].width, Main.npc[num164].height);
21178 if (rectangle2.Intersects(value2))
21179 {
21180 Kill();
21181 return;
21182 }
21183 }
21184 }
21185 this.ai[0] += 1f;
21186 if (this.ai[0] > 10f)
21187 {
21188 this.ai[0] = 90f;
21189 if (velocity.Y == 0f && velocity.X != 0f)
21190 {
21191 velocity.X *= 0.96f;
21192 if ((double)velocity.X > -0.01 && (double)velocity.X < 0.01)
21193 {
21194 Kill();
21195 }
21196 }
21197 velocity.Y += 0.2f;
21198 }
21199 rotation += velocity.X * 0.1f;
21200 }
21201 else if (type == 483)
21202 {
21203 this.ai[0] += 1f;
21204 if (this.ai[0] > 5f)
21205 {
21206 if (owner == Main.myPlayer && this.ai[0] > (float)Main.rand.Next(20, 130))
21207 {
21208 Kill();
21209 }
21210 if (velocity.Y == 0f && velocity.X != 0f)
21211 {
21212 velocity.X *= 0.97f;
21213 if ((double)velocity.X > -0.01 && (double)velocity.X < 0.01)
21214 {
21215 velocity.X = 0f;
21216 netUpdate = true;
21217 }
21218 }
21219 velocity.Y += 0.3f;
21220 velocity.X *= 0.99f;
21221 }
21222 rotation += velocity.X * 0.05f;
21223 }
21224 else if (type == 538)
21225 {
21226 this.ai[0] += 1f;
21227 if (this.ai[0] > 60f || velocity.Y >= 0f)
21228 {
21229 alpha += 6;
21230 velocity *= 0.5f;
21231 }
21232 else if (this.ai[0] > 5f)
21233 {
21234 velocity.Y += 0.1f;
21235 velocity.X *= 1.025f;
21236 alpha -= 23;
21237 scale = 0.8f * (255f - (float)alpha) / 255f;
21238 if (alpha < 0)
21239 {
21240 alpha = 0;
21241 }
21242 }
21243 if (alpha >= 255 && this.ai[0] > 5f)
21244 {
21245 Kill();
21246 return;
21247 }
21248 }
21249 else
21250 {
21251 this.ai[0] += 1f;
21252 if (this.ai[0] > 5f)
21253 {
21254 this.ai[0] = 5f;
21255 if (velocity.Y == 0f && velocity.X != 0f)
21256 {
21257 velocity.X *= 0.97f;
21258 if ((double)velocity.X > -0.01 && (double)velocity.X < 0.01)
21259 {
21260 velocity.X = 0f;
21261 netUpdate = true;
21262 }
21263 }
21264 velocity.Y += 0.2f;
21265 }
21266 rotation += velocity.X * 0.1f;
21267 }
21268 if (type == 538)
21269 {
21270 if (localAI[1] == 0f)
21271 {
21272 localAI[1] = 1f;
21273 SoundEngine.PlaySound(4, (int)base.position.X, (int)base.position.Y, 7);
21274 }
21275 if (velocity.Y < 0f && this.ai[0] < 60f)
21276 {
21277 if (Main.rand.Next(4) == 0)
21278 {
21279 int num165 = Dust.NewDust(base.position, width, height, 180, 0f, 0f, 100);
21280 Main.dust[num165].position = base.Center;
21282 dust2.scale += (float)Main.rand.Next(50) * 0.01f;
21283 Main.dust[num165].noGravity = true;
21284 Main.dust[num165].velocity.Y -= 2f;
21285 }
21286 if (Main.rand.Next(6) == 0)
21287 {
21288 int num166 = Dust.NewDust(base.position, width, height, 176, 0f, 0f, 100);
21289 Main.dust[num166].position = base.Center;
21291 dust2.scale += 0.3f + (float)Main.rand.Next(50) * 0.01f;
21292 Main.dust[num166].noGravity = true;
21293 dust2 = Main.dust[num166];
21294 dust2.velocity *= 0.1f;
21295 }
21296 }
21297 }
21298 if (type == 450)
21299 {
21300 if (this.ai[1] == 0f)
21301 {
21302 this.ai[1] = 1f;
21304 }
21305 if (Main.rand.Next(2) == 0)
21306 {
21307 int num167 = Dust.NewDust(base.position, width, height, 228, 0f, 0f, 100);
21308 Main.dust[num167].position.X -= 2f;
21309 Main.dust[num167].position.Y += 2f;
21311 dust2.scale += (float)Main.rand.Next(50) * 0.01f;
21312 Main.dust[num167].noGravity = true;
21313 Main.dust[num167].velocity.Y -= 2f;
21314 }
21315 if (Main.rand.Next(4) == 0)
21316 {
21317 int num168 = Dust.NewDust(base.position, width, height, 228, 0f, 0f, 100);
21318 Main.dust[num168].position.X -= 2f;
21319 Main.dust[num168].position.Y += 2f;
21321 dust2.scale += 0.3f + (float)Main.rand.Next(50) * 0.01f;
21322 Main.dust[num168].noGravity = true;
21323 dust2 = Main.dust[num168];
21324 dust2.velocity *= 0.1f;
21325 }
21326 if (++frameCounter >= 3)
21327 {
21328 frameCounter = 0;
21329 if (++frame >= 5)
21330 {
21331 frame = 0;
21332 }
21333 }
21334 if ((double)velocity.Y < 0.25 && (double)velocity.Y > 0.15)
21335 {
21336 velocity.X *= 0.8f;
21337 }
21338 rotation = (0f - velocity.X) * 0.05f;
21339 }
21340 if (type == 480)
21341 {
21342 alpha = 255;
21343 int num169 = Dust.NewDust(base.position, width, height, 75, 0f, 0f, 100);
21344 Main.dust[num169].position.X -= 2f;
21345 Main.dust[num169].position.Y += 2f;
21347 dust2.scale += (float)Main.rand.Next(50) * 0.01f;
21348 Main.dust[num169].noGravity = true;
21349 Main.dust[num169].velocity.Y -= 2f;
21350 if (Main.rand.Next(2) == 0)
21351 {
21352 int num170 = Dust.NewDust(base.position, width, height, 75, 0f, 0f, 100);
21353 Main.dust[num170].position.X -= 2f;
21354 Main.dust[num170].position.Y += 2f;
21355 dust2 = Main.dust[num170];
21356 dust2.scale += 0.3f + (float)Main.rand.Next(50) * 0.01f;
21357 Main.dust[num170].noGravity = true;
21358 dust2 = Main.dust[num170];
21359 dust2.velocity *= 0.1f;
21360 }
21361 }
21362 if (type >= 326 && type <= 328)
21363 {
21364 if (wet)
21365 {
21366 Kill();
21367 }
21368 if (this.ai[1] == 0f && type >= 326 && type <= 328)
21369 {
21370 this.ai[1] = 1f;
21372 }
21373 if (Main.rand.Next(3) != 0)
21374 {
21375 Dust dust10 = Dust.NewDustDirect(base.position, width, height, 6);
21376 dust10.velocity.Y -= 2f;
21377 dust10.noGravity = true;
21378 Dust dust2 = dust10;
21379 dust2.scale += Main.rand.NextFloat() * 0.8f + 0.3f;
21380 dust2 = dust10;
21381 dust2.velocity += velocity * 1f;
21382 }
21383 if ((double)velocity.Y < 0.25 && (double)velocity.Y > 0.15)
21384 {
21385 velocity.X *= 0.8f;
21386 }
21387 rotation = (0f - velocity.X) * 0.05f;
21388 }
21389 if (type >= 400 && type <= 402)
21390 {
21391 if (wet)
21392 {
21393 Kill();
21394 }
21395 if (this.ai[1] == 0f && type >= 326 && type <= 328)
21396 {
21397 this.ai[1] = 1f;
21399 }
21400 int num171 = Dust.NewDust(base.position, width, height, 6, 0f, 0f, 100);
21401 Main.dust[num171].position.X -= 2f;
21402 Main.dust[num171].position.Y += 2f;
21404 dust2.scale += (float)Main.rand.Next(50) * 0.01f;
21405 Main.dust[num171].noGravity = true;
21406 Main.dust[num171].velocity.Y -= 2f;
21407 if (Main.rand.Next(2) == 0)
21408 {
21409 int num172 = Dust.NewDust(base.position, width, height, 6, 0f, 0f, 100);
21410 Main.dust[num172].position.X -= 2f;
21411 Main.dust[num172].position.Y += 2f;
21412 dust2 = Main.dust[num172];
21413 dust2.scale += 0.3f + (float)Main.rand.Next(50) * 0.01f;
21414 Main.dust[num172].noGravity = true;
21415 dust2 = Main.dust[num172];
21416 dust2.velocity *= 0.1f;
21417 }
21418 if ((double)velocity.Y < 0.25 && (double)velocity.Y > 0.15)
21419 {
21420 velocity.X *= 0.8f;
21421 }
21422 rotation = (0f - velocity.X) * 0.05f;
21423 }
21424 if (velocity.Y > 16f)
21425 {
21426 velocity.Y = 16f;
21427 }
21428 }
21429 else if (aiStyle == 15)
21430 {
21431 AI_015_Flails();
21432 }
21433 else if (aiStyle == 16)
21434 {
21435 AI_016();
21436 }
21437 else if (aiStyle == 17)
21438 {
21439 if (velocity.Y == 0f)
21440 {
21441 velocity.X *= 0.98f;
21442 }
21443 rotation += velocity.X * 0.1f;
21444 velocity.Y += 0.2f;
21445 if (Main.getGoodWorld && Math.Abs(velocity.X) + Math.Abs(velocity.Y) < 1f)
21446 {
21447 damage = 0;
21448 knockBack = 0f;
21449 }
21450 if (owner != Main.myPlayer)
21451 {
21452 return;
21453 }
21454 int num173 = (int)((base.position.X + (float)(width / 2)) / 16f);
21455 int num174 = (int)((base.position.Y + (float)height - 4f) / 16f);
21456 if (Main.tile[num173, num174] == null)
21457 {
21458 return;
21459 }
21460 int style = 0;
21461 if (type >= 201 && type <= 205)
21462 {
21463 style = type - 200;
21464 }
21465 if (type >= 527 && type <= 531)
21466 {
21467 style = type - 527 + 6;
21468 }
21469 bool flag7 = false;
21470 TileObject objectData = default(TileObject);
21472 {
21474 }
21475 if (flag7)
21476 {
21478 SoundEngine.PlaySound(0, num173 * 16, num174 * 16);
21480 if (num175 >= 0)
21481 {
21483 NetMessage.SendData(47, -1, -1, null, num175, 0f, (int)(byte)new BitsByte(b1: true));
21484 }
21485 Kill();
21486 }
21487 }
21488 else if (aiStyle == 18)
21489 {
21490 if (this.ai[1] == 0f && type == 44)
21491 {
21492 this.ai[1] = 1f;
21494 }
21495 if (type == 263 || type == 274)
21496 {
21497 if (type == 274 && velocity.X < 0f)
21498 {
21499 spriteDirection = -1;
21500 }
21501 rotation += (float)direction * 0.05f;
21502 rotation += (float)direction * 0.5f * ((float)timeLeft / 180f);
21503 if (type == 274)
21504 {
21505 velocity *= 0.96f;
21506 }
21507 else
21508 {
21509 velocity *= 0.95f;
21510 }
21511 return;
21512 }
21513 rotation += (float)direction * 0.8f;
21514 this.ai[0] += 1f;
21515 if (!(this.ai[0] < 30f))
21516 {
21517 if (this.ai[0] < 100f)
21518 {
21519 velocity *= 1.06f;
21520 }
21521 else
21522 {
21523 this.ai[0] = 200f;
21524 }
21525 }
21526 for (int num176 = 0; num176 < 2; num176++)
21527 {
21528 int num177 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 27, 0f, 0f, 100);
21529 Main.dust[num177].noGravity = true;
21530 }
21531 }
21532 else if (aiStyle == 19)
21533 {
21534 AI_019_Spears();
21535 }
21536 else if (aiStyle == 20)
21537 {
21538 timeLeft = 60;
21539 if (type == 252)
21540 {
21541 frameCounter++;
21542 if (frameCounter >= 4)
21543 {
21544 frameCounter = 0;
21545 frame++;
21546 }
21547 if (frame > 3)
21548 {
21549 frame = 0;
21550 }
21551 }
21552 if (type == 509)
21553 {
21554 frameCounter++;
21555 if (frameCounter >= 2)
21556 {
21557 frameCounter = 0;
21558 frame++;
21559 }
21560 if (frame > 1)
21561 {
21562 frame = 0;
21563 }
21564 }
21565 if (soundDelay <= 0)
21566 {
21568 soundDelay = 30;
21569 }
21570 Vector2 vector21 = Main.player[owner].RotatedRelativePoint(Main.player[owner].MountedCenter);
21571 if (Main.myPlayer == owner)
21572 {
21573 if (Main.player[owner].channel)
21574 {
21575 float num178 = Main.player[owner].inventory[Main.player[owner].selectedItem].shootSpeed * scale;
21577 float num179 = (float)Main.mouseX + Main.screenPosition.X - vector22.X;
21578 float num180 = (float)Main.mouseY + Main.screenPosition.Y - vector22.Y;
21579 if (Main.player[owner].gravDir == -1f)
21580 {
21581 num180 = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - vector22.Y;
21582 }
21583 float num181 = (float)Math.Sqrt(num179 * num179 + num180 * num180);
21584 num181 = (float)Math.Sqrt(num179 * num179 + num180 * num180);
21585 num181 = num178 / num181;
21586 num179 *= num181;
21587 num180 *= num181;
21588 if (num179 != velocity.X || num180 != velocity.Y)
21589 {
21590 netUpdate = true;
21591 }
21592 velocity.X = num179;
21593 velocity.Y = num180;
21594 }
21595 else
21596 {
21597 Kill();
21598 }
21599 }
21600 if (velocity.X > 0f)
21601 {
21602 Main.player[owner].ChangeDir(1);
21603 }
21604 else if (velocity.X < 0f)
21605 {
21606 Main.player[owner].ChangeDir(-1);
21607 }
21609 Main.player[owner].ChangeDir(direction);
21610 Main.player[owner].heldProj = whoAmI;
21611 Main.player[owner].SetDummyItemTime(2);
21612 base.position.X = vector21.X - (float)(width / 2);
21613 base.position.Y = vector21.Y - (float)(height / 2);
21614 rotation = (float)(Math.Atan2(velocity.Y, velocity.X) + 1.5700000524520874);
21615 if (Main.player[owner].direction == 1)
21616 {
21617 Main.player[owner].itemRotation = (float)Math.Atan2(velocity.Y * (float)direction, velocity.X * (float)direction);
21618 }
21619 else
21620 {
21621 Main.player[owner].itemRotation = (float)Math.Atan2(velocity.Y * (float)direction, velocity.X * (float)direction);
21622 }
21623 velocity.X *= 1f + (float)Main.rand.Next(-3, 4) * 0.01f;
21624 if (Main.rand.Next(6) == 0)
21625 {
21626 int num182 = Dust.NewDust(base.position + velocity * Main.rand.Next(6, 10) * 0.1f, width, height, 31, 0f, 0f, 80, default(Color), 1.4f);
21627 Main.dust[num182].position.X -= 4f;
21628 Main.dust[num182].noGravity = true;
21630 dust2.velocity *= 0.2f;
21631 Main.dust[num182].velocity.Y = (float)(-Main.rand.Next(7, 13)) * 0.15f;
21632 }
21633 }
21634 else if (aiStyle == 21)
21635 {
21636 rotation = velocity.X * 0.1f;
21638 if (Main.rand.Next(3) == 0)
21639 {
21640 int num183 = Dust.NewDust(base.position, width, height, 27, 0f, 0f, 80);
21641 Main.dust[num183].noGravity = true;
21643 dust2.velocity *= 0.2f;
21644 }
21645 if (this.ai[1] == 1f)
21646 {
21647 this.ai[1] = 0f;
21648 Main.musicPitch = this.ai[0];
21650 }
21651 }
21652 else if (aiStyle == 22)
21653 {
21654 if (velocity.X == 0f && velocity.Y == 0f)
21655 {
21656 alpha = 255;
21657 }
21658 Dust dust2;
21659 if (this.ai[1] < 0f)
21660 {
21661 if (timeLeft > 60)
21662 {
21663 timeLeft = 60;
21664 }
21665 if (velocity.X > 0f)
21666 {
21667 rotation += 0.3f;
21668 }
21669 else
21670 {
21671 rotation -= 0.3f;
21672 }
21673 int num184 = (int)(base.position.X / 16f) - 1;
21674 int num185 = (int)((base.position.X + (float)width) / 16f) + 2;
21675 int num186 = (int)(base.position.Y / 16f) - 1;
21676 int num187 = (int)((base.position.Y + (float)height) / 16f) + 2;
21677 if (num184 < 0)
21678 {
21679 num184 = 0;
21680 }
21681 if (num185 > Main.maxTilesX)
21682 {
21684 }
21685 if (num186 < 0)
21686 {
21687 num186 = 0;
21688 }
21689 if (num187 > Main.maxTilesY)
21690 {
21692 }
21693 int num188 = (int)base.position.X + 4;
21694 int num189 = (int)base.position.Y + 4;
21695 Vector2 vector23 = default(Vector2);
21696 for (int num190 = num184; num190 < num185; num190++)
21697 {
21698 for (int num191 = num186; num191 < num187; num191++)
21699 {
21700 if (Main.tile[num190, num191] != null && Main.tile[num190, num191].active() && Main.tile[num190, num191].type != 127 && Main.tileSolid[Main.tile[num190, num191].type] && !Main.tileSolidTop[Main.tile[num190, num191].type])
21701 {
21702 vector23.X = num190 * 16;
21703 vector23.Y = num191 * 16;
21704 if ((float)(num188 + 8) > vector23.X && (float)num188 < vector23.X + 16f && (float)(num189 + 8) > vector23.Y && (float)num189 < vector23.Y + 16f)
21705 {
21706 Kill();
21707 }
21708 }
21709 }
21710 }
21711 int num192 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 67);
21712 Main.dust[num192].noGravity = true;
21713 dust2 = Main.dust[num192];
21714 dust2.velocity *= 0.3f;
21715 return;
21716 }
21717 if (this.ai[0] < 0f)
21718 {
21719 if (this.ai[0] == -1f)
21720 {
21721 for (int num193 = 0; num193 < 10; num193++)
21722 {
21723 int num194 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 67, 0f, 0f, 0, default(Color), 1.1f);
21724 Main.dust[num194].noGravity = true;
21725 dust2 = Main.dust[num194];
21726 dust2.velocity *= 1.3f;
21727 }
21728 }
21729 else if (Main.rand.Next(30) == 0)
21730 {
21731 int num195 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 67, 0f, 0f, 100);
21732 dust2 = Main.dust[num195];
21733 dust2.velocity *= 0.2f;
21734 }
21735 int num196 = (int)base.position.X / 16;
21736 int num197 = (int)base.position.Y / 16;
21737 if (Main.tile[num196, num197] == null || !Main.tile[num196, num197].active())
21738 {
21739 Kill();
21740 }
21741 this.ai[0] -= 1f;
21742 if (this.ai[0] <= -900f && (Main.myPlayer == owner || Main.netMode == 2) && Main.tile[num196, num197].active() && Main.tile[num196, num197].type == 127)
21743 {
21745 if (Main.netMode == 1)
21746 {
21747 NetMessage.SendData(17, -1, -1, null, 0, num196, num197);
21748 }
21749 Kill();
21750 }
21751 return;
21752 }
21753 int num198 = (int)(base.position.X / 16f) - 1;
21754 int num199 = (int)((base.position.X + (float)width) / 16f) + 2;
21755 int num200 = (int)(base.position.Y / 16f) - 1;
21756 int num201 = (int)((base.position.Y + (float)height) / 16f) + 2;
21757 if (num198 < 0)
21758 {
21759 num198 = 0;
21760 }
21761 if (num199 > Main.maxTilesX)
21762 {
21764 }
21765 if (num200 < 0)
21766 {
21767 num200 = 0;
21768 }
21769 if (num201 > Main.maxTilesY)
21770 {
21772 }
21773 int num202 = (int)base.position.X + 4;
21774 int num203 = (int)base.position.Y + 4;
21775 Vector2 vector24 = default(Vector2);
21776 for (int num204 = num198; num204 < num199; num204++)
21777 {
21778 for (int num205 = num200; num205 < num201; num205++)
21779 {
21780 if (Main.tile[num204, num205] != null && Main.tile[num204, num205].nactive() && Main.tile[num204, num205].type != 127 && Main.tileSolid[Main.tile[num204, num205].type] && !Main.tileSolidTop[Main.tile[num204, num205].type])
21781 {
21782 vector24.X = num204 * 16;
21783 vector24.Y = num205 * 16;
21784 if ((float)(num202 + 8) > vector24.X && (float)num202 < vector24.X + 16f && (float)(num203 + 8) > vector24.Y && (float)num203 < vector24.Y + 16f)
21785 {
21786 Kill();
21787 }
21788 }
21789 }
21790 }
21791 if (lavaWet)
21792 {
21793 Kill();
21794 }
21795 int num206 = (int)(base.Center.X / 16f);
21796 int num207 = (int)(base.Center.Y / 16f);
21797 if (WorldGen.InWorld(num206, num207) && Main.tile[num206, num207] != null && Main.tile[num206, num207].liquid > 0 && Main.tile[num206, num207].shimmer())
21798 {
21799 Kill();
21800 }
21801 if (!active)
21802 {
21803 return;
21804 }
21805 int num208 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 67);
21806 Main.dust[num208].noGravity = true;
21807 dust2 = Main.dust[num208];
21808 dust2.velocity *= 0.3f;
21809 int num209 = (int)this.ai[0];
21810 int num210 = (int)this.ai[1];
21812 {
21813 if (Math.Abs(velocity.X) > Math.Abs(velocity.Y))
21814 {
21815 if (base.Center.Y < (float)(num210 * 16 + 8) && WorldGen.InWorld(num209, num210 - 1) && !WorldGen.SolidTile(num209, num210 - 1))
21816 {
21817 num210--;
21818 }
21819 else if (WorldGen.InWorld(num209, num210 + 1) && !WorldGen.SolidTile(num209, num210 + 1))
21820 {
21821 num210++;
21822 }
21823 else if (WorldGen.InWorld(num209, num210 - 1) && !WorldGen.SolidTile(num209, num210 - 1))
21824 {
21825 num210--;
21826 }
21827 else if (base.Center.X < (float)(num209 * 16 + 8) && WorldGen.InWorld(num209 - 1, num210) && !WorldGen.SolidTile(num209 - 1, num210))
21828 {
21829 num209--;
21830 }
21831 else if (WorldGen.InWorld(num209 + 1, num210) && !WorldGen.SolidTile(num209 + 1, num210))
21832 {
21833 num209++;
21834 }
21835 else if (WorldGen.InWorld(num209 - 1, num210) && !WorldGen.SolidTile(num209 - 1, num210))
21836 {
21837 num209--;
21838 }
21839 }
21840 else if (base.Center.X < (float)(num209 * 16 + 8) && WorldGen.InWorld(num209 - 1, num210) && !WorldGen.SolidTile(num209 - 1, num210))
21841 {
21842 num209--;
21843 }
21844 else if (WorldGen.InWorld(num209 + 1, num210) && !WorldGen.SolidTile(num209 + 1, num210))
21845 {
21846 num209++;
21847 }
21848 else if (WorldGen.InWorld(num209 - 1, num210) && !WorldGen.SolidTile(num209 - 1, num210))
21849 {
21850 num209--;
21851 }
21852 else if (base.Center.Y < (float)(num210 * 16 + 8) && WorldGen.InWorld(num209, num210 - 1) && !WorldGen.SolidTile(num209, num210 - 1))
21853 {
21854 num210--;
21855 }
21856 else if (WorldGen.InWorld(num209, num210 + 1) && !WorldGen.SolidTile(num209, num210 + 1))
21857 {
21858 num210++;
21859 }
21860 else if (WorldGen.InWorld(num209, num210 - 1) && !WorldGen.SolidTile(num209, num210 - 1))
21861 {
21862 num210--;
21863 }
21864 }
21865 if (velocity.X > 0f)
21866 {
21867 rotation += 0.3f;
21868 }
21869 else
21870 {
21871 rotation -= 0.3f;
21872 }
21873 if (Main.myPlayer != owner)
21874 {
21875 return;
21876 }
21877 int num211 = (int)((base.position.X + (float)(width / 2)) / 16f);
21878 int num212 = (int)((base.position.Y + (float)(height / 2)) / 16f);
21879 bool flag8 = false;
21880 if (num211 == num209 && num212 == num210)
21881 {
21882 flag8 = true;
21883 }
21884 if (((velocity.X <= 0f && num211 <= num209) || (velocity.X >= 0f && num211 >= num209)) && ((velocity.Y <= 0f && num212 <= num210) || (velocity.Y >= 0f && num212 >= num210)))
21885 {
21886 flag8 = true;
21887 }
21888 if (!flag8)
21889 {
21890 return;
21891 }
21893 {
21894 if (Main.netMode == 1)
21895 {
21896 NetMessage.SendData(17, -1, -1, null, 1, num209, num210, 127f);
21897 }
21898 damage = 0;
21899 this.ai[0] = -1f;
21900 velocity *= 0f;
21901 alpha = 255;
21902 base.position.X = num209 * 16;
21903 base.position.Y = num210 * 16;
21904 netUpdate = true;
21905 }
21906 else
21907 {
21908 this.ai[1] = -1f;
21909 }
21910 }
21911 else if (aiStyle == 23)
21912 {
21913 if (type == 188)
21914 {
21915 if (this.ai[0] < 8f)
21916 {
21917 this.ai[0] = 8f;
21918 }
21919 localAI[0]++;
21920 }
21921 if (timeLeft > 60)
21922 {
21923 timeLeft = 60;
21924 }
21925 if (this.ai[0] > 7f)
21926 {
21927 float num213 = 1f;
21928 if (this.ai[0] == 8f)
21929 {
21930 num213 = 0.25f;
21931 }
21932 else if (this.ai[0] == 9f)
21933 {
21934 num213 = 0.5f;
21935 }
21936 else if (this.ai[0] == 10f)
21937 {
21938 num213 = 0.75f;
21939 }
21940 this.ai[0] += 1f;
21941 int num214 = 6;
21942 if (type == 101)
21943 {
21944 num214 = 75;
21945 }
21946 if (num214 == 6 || Main.rand.Next(2) == 0)
21947 {
21948 for (int num215 = 0; num215 < 1; num215++)
21949 {
21950 int num216 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, num214, velocity.X * 0.2f, velocity.Y * 0.2f, 100);
21951 Dust dust2;
21952 if (Main.rand.Next(3) != 0 || (num214 == 75 && Main.rand.Next(3) == 0))
21953 {
21954 Main.dust[num216].noGravity = true;
21955 dust2 = Main.dust[num216];
21956 dust2.scale *= 3f;
21957 Main.dust[num216].velocity.X *= 2f;
21958 Main.dust[num216].velocity.Y *= 2f;
21959 }
21960 if (type == 188)
21961 {
21962 dust2 = Main.dust[num216];
21963 dust2.scale *= 1.25f;
21964 }
21965 else
21966 {
21967 dust2 = Main.dust[num216];
21968 dust2.scale *= 1.5f;
21969 }
21970 Main.dust[num216].velocity.X *= 1.2f;
21971 Main.dust[num216].velocity.Y *= 1.2f;
21972 dust2 = Main.dust[num216];
21973 dust2.scale *= num213;
21974 if (num214 == 75)
21975 {
21976 dust2 = Main.dust[num216];
21977 dust2.velocity += velocity;
21978 if (!Main.dust[num216].noGravity)
21979 {
21980 dust2 = Main.dust[num216];
21981 dust2.velocity *= 0.5f;
21982 }
21983 }
21984 }
21985 }
21986 }
21987 else
21988 {
21989 this.ai[0] += 1f;
21990 }
21991 rotation += 0.3f * (float)direction;
21992 }
21993 else if (aiStyle == 24)
21994 {
21995 light = scale * 0.5f;
21996 rotation += velocity.X * 0.2f;
21997 this.ai[1] += 1f;
21998 if (type == 94)
21999 {
22000 if (Main.rand.Next(4) == 0)
22001 {
22002 int num217 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 70);
22003 Main.dust[num217].noGravity = true;
22005 dust2.velocity *= 0.5f;
22006 dust2 = Main.dust[num217];
22007 dust2.scale *= 0.9f;
22008 }
22009 velocity *= 0.985f;
22010 if (this.ai[1] > 130f)
22011 {
22012 scale -= 0.05f;
22013 if ((double)scale <= 0.2)
22014 {
22015 scale = 0.2f;
22016 Kill();
22017 }
22018 }
22019 return;
22020 }
22021 velocity *= 0.96f;
22022 if (this.ai[1] > 15f)
22023 {
22024 scale -= 0.05f;
22025 if ((double)scale <= 0.2)
22026 {
22027 scale = 0.2f;
22028 Kill();
22029 }
22030 }
22031 }
22032 else if (aiStyle == 25)
22033 {
22034 if (type == 1013)
22035 {
22036 localAI[0]++;
22037 }
22038 if (type == 1014)
22039 {
22040 frame = Main.tileFrame[665];
22041 }
22042 if (this.ai[0] != 0f && velocity.Y <= 0f && velocity.X == 0f)
22043 {
22044 float num218 = 0.5f;
22045 int i2 = (int)((base.position.X - 8f) / 16f);
22046 int num219 = (int)(base.position.Y / 16f);
22047 bool flag9 = false;
22048 bool flag10 = false;
22050 {
22051 flag9 = true;
22052 }
22053 i2 = (int)((base.position.X + (float)width + 8f) / 16f);
22055 {
22056 flag10 = true;
22057 }
22058 if (flag9)
22059 {
22060 velocity.X = num218;
22061 }
22062 else if (flag10)
22063 {
22064 velocity.X = 0f - num218;
22065 }
22066 else
22067 {
22068 i2 = (int)((base.position.X - 8f - 16f) / 16f);
22069 num219 = (int)(base.position.Y / 16f);
22070 flag9 = false;
22071 flag10 = false;
22073 {
22074 flag9 = true;
22075 }
22076 i2 = (int)((base.position.X + (float)width + 8f + 16f) / 16f);
22078 {
22079 flag10 = true;
22080 }
22081 if (flag9)
22082 {
22083 velocity.X = num218;
22084 }
22085 else if (flag10)
22086 {
22087 velocity.X = 0f - num218;
22088 }
22089 else
22090 {
22091 i2 = (int)((base.position.X - 8f - 32f) / 16f);
22092 num219 = (int)(base.position.Y / 16f);
22093 flag9 = false;
22094 flag10 = false;
22096 {
22097 flag9 = true;
22098 }
22099 i2 = (int)((base.position.X + (float)width + 8f + 32f) / 16f);
22101 {
22102 flag10 = true;
22103 }
22104 if (!flag9 && !flag10)
22105 {
22106 if ((int)(base.Center.X / 16f) % 2 == 0)
22107 {
22108 flag9 = true;
22109 }
22110 else
22111 {
22112 flag10 = true;
22113 }
22114 }
22115 if (flag9)
22116 {
22117 velocity.X = num218;
22118 }
22119 else if (flag10)
22120 {
22121 velocity.X = 0f - num218;
22122 }
22123 }
22124 }
22125 }
22126 rotation += velocity.X * 0.06f;
22127 this.ai[0] = 1f;
22128 if (velocity.Y > 16f)
22129 {
22130 velocity.Y = 16f;
22131 }
22132 if (type == 1021)
22133 {
22134 if (Math.Abs(velocity.Y) <= 1f)
22135 {
22136 if (velocity.X > 0f && (double)velocity.X < 3.5)
22137 {
22138 velocity.X += 0.025f;
22139 }
22140 if (velocity.X < 0f && (double)velocity.X > -3.5)
22141 {
22142 velocity.X -= 0.025f;
22143 }
22144 }
22145 }
22146 else if (velocity.Y <= 6f)
22147 {
22148 if (velocity.X > 0f && velocity.X < 7f)
22149 {
22150 velocity.X += 0.05f;
22151 }
22152 if (velocity.X < 0f && velocity.X > -7f)
22153 {
22154 velocity.X -= 0.05f;
22155 }
22156 }
22157 if (type == 1021)
22158 {
22159 velocity.Y += 0.06f;
22160 }
22161 else
22162 {
22163 velocity.Y += 0.3f;
22164 }
22165 if (type == 655 && wet)
22166 {
22167 Kill();
22168 }
22169 }
22170 else if (aiStyle == 26)
22171 {
22172 AI_026();
22173 }
22174 else if (aiStyle == 27)
22175 {
22176 if (type == 115)
22177 {
22178 this.ai[0] += 1f;
22179 if (this.ai[0] < 30f)
22180 {
22181 velocity *= 1.125f;
22182 }
22183 }
22184 if (type == 115 && localAI[1] < 5f)
22185 {
22186 localAI[1] = 5f;
22187 for (int num220 = 5; num220 < 25; num220++)
22188 {
22189 float num221 = velocity.X * (30f / (float)num220);
22190 float num222 = velocity.Y * (30f / (float)num220);
22191 num221 *= 80f;
22192 num222 *= 80f;
22193 int num223 = Dust.NewDust(new Vector2(base.position.X - num221, base.position.Y - num222), 8, 8, 27, oldVelocity.X, oldVelocity.Y, 100, default(Color), 0.9f);
22195 dust2.velocity *= 0.25f;
22196 dust2 = Main.dust[num223];
22197 dust2.velocity -= velocity * 5f;
22198 }
22199 }
22200 if (localAI[1] > 7f && type == 173)
22201 {
22202 int num224 = Main.rand.Next(3);
22203 int num225 = Dust.NewDust(new Vector2(base.position.X - velocity.X * 4f + 2f, base.position.Y + 2f - velocity.Y * 4f), 8, 8, num224 switch
22204 {
22205 0 => 15,
22206 1 => 57,
22207 _ => 58,
22208 }, 0f, 0f, 100, default(Color), 1.25f);
22210 dust2.velocity *= 0.1f;
22211 }
22212 if (localAI[1] > 7f && type == 132)
22213 {
22214 int num226 = Dust.NewDust(new Vector2(base.position.X - velocity.X * 4f + 2f, base.position.Y + 2f - velocity.Y * 4f), 8, 8, 107, oldVelocity.X, oldVelocity.Y, 100, default(Color), 1.25f);
22216 dust2.velocity *= -0.25f;
22217 num226 = Dust.NewDust(new Vector2(base.position.X - velocity.X * 4f + 2f, base.position.Y + 2f - velocity.Y * 4f), 8, 8, 107, oldVelocity.X, oldVelocity.Y, 100, default(Color), 1.25f);
22218 dust2 = Main.dust[num226];
22219 dust2.velocity *= -0.25f;
22220 dust2 = Main.dust[num226];
22221 dust2.position -= velocity * 0.5f;
22222 }
22223 if (localAI[1] < 15f)
22224 {
22225 localAI[1] += 1f;
22226 }
22227 else
22228 {
22229 if (type == 114 || type == 115)
22230 {
22231 int num227 = Dust.NewDust(new Vector2(base.position.X, base.position.Y + 4f), 8, 8, 27, oldVelocity.X, oldVelocity.Y, 100, default(Color), 0.6f);
22233 dust2.velocity *= -0.25f;
22234 }
22235 else if (type == 116)
22236 {
22237 int num228 = Dust.NewDust(new Vector2(base.position.X - velocity.X * 5f + 2f, base.position.Y + 2f - velocity.Y * 5f), 8, 8, 64, oldVelocity.X, oldVelocity.Y, 100, default(Color), 1.5f);
22239 dust2.velocity *= -0.25f;
22240 Main.dust[num228].noGravity = true;
22241 }
22242 if (localAI[0] == 0f)
22243 {
22244 scale -= 0.02f;
22245 alpha += 30;
22246 if (alpha >= 250)
22247 {
22248 alpha = 255;
22249 localAI[0] = 1f;
22250 }
22251 }
22252 else if (localAI[0] == 1f)
22253 {
22254 scale += 0.02f;
22255 alpha -= 30;
22256 if (alpha <= 0)
22257 {
22258 alpha = 0;
22259 localAI[0] = 0f;
22260 }
22261 }
22262 }
22263 if (this.ai[1] == 0f)
22264 {
22265 this.ai[1] = 1f;
22266 if (type == 132)
22267 {
22269 }
22270 else
22271 {
22273 }
22274 }
22275 if (type == 157)
22276 {
22277 rotation += (float)direction * 0.4f;
22279 }
22280 else
22281 {
22282 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 0.785f;
22283 }
22284 if (velocity.Y > 16f)
22285 {
22286 velocity.Y = 16f;
22287 }
22288 }
22289 else if (aiStyle == 28)
22290 {
22291 if (type == 967)
22292 {
22293 localAI[0]++;
22294 if (localAI[0] >= 5f && timeLeft % 3 == 0)
22295 {
22296 localAI[0] = 5f;
22297 int num229 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 219, velocity.X, velocity.Y, 0, default(Color), 0.35f + (float)Main.rand.Next(-5, 5) * 0.01f);
22298 Main.dust[num229].noGravity = true;
22299 Main.dust[num229].velocity = velocity * 1.5f;
22300 }
22301 if (++frameCounter > 6)
22302 {
22303 frameCounter = 0;
22304 frame++;
22305 if (frame >= Main.projFrames[type])
22306 {
22307 frame = 0;
22308 }
22309 }
22310 }
22311 if (type == 177)
22312 {
22313 for (int num230 = 0; num230 < 3; num230++)
22314 {
22315 int num231 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 137, velocity.X, velocity.Y, Main.rand.Next(0, 101), default(Color), 1f + (float)Main.rand.Next(-20, 40) * 0.01f);
22316 Main.dust[num231].noGravity = true;
22318 dust2.velocity *= 0.3f;
22319 }
22320 }
22321 if (type == 118)
22322 {
22323 for (int num232 = 0; num232 < 2; num232++)
22324 {
22325 int num233 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 92, velocity.X, velocity.Y, 50, default(Color), 1.2f);
22326 Main.dust[num233].noGravity = true;
22328 dust2.velocity *= 0.3f;
22329 }
22330 }
22331 if (type == 119 || type == 128 || type == 359)
22332 {
22333 for (int num234 = 0; num234 < 3; num234++)
22334 {
22335 int num235 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 92, velocity.X, velocity.Y, 50, default(Color), 1.2f);
22336 Main.dust[num235].noGravity = true;
22338 dust2.velocity *= 0.3f;
22339 }
22340 }
22341 if (type == 309)
22342 {
22343 for (int num236 = 0; num236 < 3; num236++)
22344 {
22345 int num237 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 185, velocity.X, velocity.Y, 50, default(Color), 1.2f);
22346 Main.dust[num237].noGravity = true;
22348 dust2.velocity *= 0.3f;
22349 }
22350 }
22351 if (type == 129)
22352 {
22353 for (int num238 = 0; num238 < 6; num238++)
22354 {
22355 int num239 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 106, velocity.X, velocity.Y, 100);
22356 Main.dust[num239].noGravity = true;
22358 dust2.velocity *= 0.1f + (float)Main.rand.Next(4) * 0.1f;
22359 dust2 = Main.dust[num239];
22360 dust2.scale *= 1f + (float)Main.rand.Next(5) * 0.1f;
22361 }
22362 }
22363 if (this.ai[1] != 0f)
22364 {
22365 return;
22366 }
22367 this.ai[1] = 1f;
22368 if (type == 967)
22369 {
22370 for (int num240 = 0; num240 < 10; num240++)
22371 {
22372 int num241 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 219, velocity.X, velocity.Y, 0, default(Color), 0.4f + (float)Main.rand.Next(-20, 40) * 0.01f);
22373 Main.dust[num241].noGravity = true;
22374 Main.dust[num241].velocity = (velocity * 0.5f).RotatedByRandom(0.5);
22375 }
22377 }
22378 else
22379 {
22381 }
22382 }
22383 else if (aiStyle == 29)
22384 {
22385 if (type == 619)
22386 {
22387 int num242 = (int)this.ai[0];
22388 for (int num243 = 0; num243 < 3; num243++)
22389 {
22390 int num244 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 254, velocity.X, velocity.Y, num242, default(Color), 1.2f);
22391 Main.dust[num244].position = (Main.dust[num244].position + base.Center) / 2f;
22392 Main.dust[num244].noGravity = true;
22394 dust2.velocity *= 0.5f;
22395 }
22396 for (int num245 = 0; num245 < 2; num245++)
22397 {
22398 int num244 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 255, velocity.X, velocity.Y, num242, default(Color), 0.4f);
22399 switch (num245)
22400 {
22401 case 0:
22402 Main.dust[num244].position = (Main.dust[num244].position + base.Center * 5f) / 6f;
22403 break;
22404 case 1:
22405 Main.dust[num244].position = (Main.dust[num244].position + (base.Center + velocity / 2f) * 5f) / 6f;
22406 break;
22407 }
22409 dust2.velocity *= 0.1f;
22410 Main.dust[num244].noGravity = true;
22411 Main.dust[num244].fadeIn = 1f;
22412 }
22413 }
22414 else if (type == 620)
22415 {
22416 int num246 = (int)this.ai[0];
22417 this.ai[1] += 1f;
22418 float num247 = (60f - this.ai[1]) / 60f;
22419 if (this.ai[1] > 40f)
22420 {
22421 Kill();
22422 }
22423 velocity.Y += 0.2f;
22424 if (velocity.Y > 18f)
22425 {
22426 velocity.Y = 18f;
22427 }
22428 velocity.X *= 0.98f;
22429 for (int num248 = 0; num248 < 2; num248++)
22430 {
22431 int num249 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, num246, velocity.X, velocity.Y, 50, default(Color), 1.1f);
22432 Main.dust[num249].position = (Main.dust[num249].position + base.Center) / 2f;
22433 Main.dust[num249].noGravity = true;
22435 dust2.velocity *= 0.3f;
22436 dust2 = Main.dust[num249];
22437 dust2.scale *= num247;
22438 }
22439 for (int num250 = 0; num250 < 1; num250++)
22440 {
22441 int num249 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, num246, velocity.X, velocity.Y, 50, default(Color), 0.6f);
22442 Main.dust[num249].position = (Main.dust[num249].position + base.Center * 5f) / 6f;
22444 dust2.velocity *= 0.1f;
22445 Main.dust[num249].noGravity = true;
22446 Main.dust[num249].fadeIn = 0.9f * num247;
22447 dust2 = Main.dust[num249];
22448 dust2.scale *= num247;
22449 }
22450 }
22451 else if (type == 521)
22452 {
22453 for (int num251 = 0; num251 < 3; num251++)
22454 {
22455 int num252 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 254, velocity.X, velocity.Y, 50, default(Color), 1.2f);
22456 Main.dust[num252].position = (Main.dust[num252].position + base.Center) / 2f;
22457 Main.dust[num252].noGravity = true;
22459 dust2.velocity *= 0.5f;
22460 }
22461 for (int num253 = 0; num253 < 2; num253++)
22462 {
22463 int num252 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 255, velocity.X, velocity.Y, 50, default(Color), 0.4f);
22464 switch (num253)
22465 {
22466 case 0:
22467 Main.dust[num252].position = (Main.dust[num252].position + base.Center * 5f) / 6f;
22468 break;
22469 case 1:
22470 Main.dust[num252].position = (Main.dust[num252].position + (base.Center + velocity / 2f) * 5f) / 6f;
22471 break;
22472 }
22474 dust2.velocity *= 0.1f;
22475 Main.dust[num252].noGravity = true;
22476 Main.dust[num252].fadeIn = 1f;
22477 }
22478 }
22479 else if (type == 522)
22480 {
22481 this.ai[1] += 1f;
22482 float num254 = (60f - this.ai[1]) / 60f;
22483 if (this.ai[1] > 40f)
22484 {
22485 Kill();
22486 }
22487 velocity.Y += 0.2f;
22488 if (velocity.Y > 18f)
22489 {
22490 velocity.Y = 18f;
22491 }
22492 velocity.X *= 0.98f;
22493 for (int num255 = 0; num255 < 2; num255++)
22494 {
22495 int num256 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 254, velocity.X, velocity.Y, 50, default(Color), 1.1f);
22496 Main.dust[num256].position = (Main.dust[num256].position + base.Center) / 2f;
22497 Main.dust[num256].noGravity = true;
22499 dust2.velocity *= 0.3f;
22500 dust2 = Main.dust[num256];
22501 dust2.scale *= num254;
22502 }
22503 for (int num257 = 0; num257 < 1; num257++)
22504 {
22505 int num256 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 255, velocity.X, velocity.Y, 50, default(Color), 0.6f);
22506 Main.dust[num256].position = (Main.dust[num256].position + base.Center * 5f) / 6f;
22508 dust2.velocity *= 0.1f;
22509 Main.dust[num256].noGravity = true;
22510 Main.dust[num256].fadeIn = 0.9f * num254;
22511 dust2 = Main.dust[num256];
22512 dust2.scale *= num254;
22513 }
22514 }
22515 else if (type == 731)
22516 {
22517 if (++frameCounter >= 4)
22518 {
22519 frameCounter = 0;
22520 if (++frame >= Main.projFrames[type])
22521 {
22522 frame = 0;
22523 }
22524 }
22525 alpha -= 15;
22526 if (alpha < 0)
22527 {
22528 alpha = 0;
22529 }
22530 this.ai[0]++;
22531 if ((int)this.ai[0] % 2 != 0 && Main.rand.Next(4) == 0)
22532 {
22533 this.ai[0]++;
22534 }
22535 float num258 = 5f;
22536 switch ((int)this.ai[0])
22537 {
22538 case 10:
22539 velocity.Y -= num258;
22540 break;
22541 case 12:
22542 velocity.Y += num258;
22543 break;
22544 case 18:
22545 velocity.Y += num258;
22546 break;
22547 case 20:
22548 velocity.Y -= num258;
22549 this.ai[0] = 0f;
22550 break;
22551 }
22552 if (Main.rand.Next(3) == 0)
22553 {
22554 Dust dust11 = Dust.NewDustDirect(base.position, width, height, 226, velocity.X, velocity.Y, 50, default(Color), 0.4f);
22555 dust11.noGravity = true;
22556 dust11.velocity = dust11.velocity * 0f + velocity * 0.5f;
22557 if (Main.rand.Next(3) != 0)
22558 {
22559 Dust dust2 = dust11;
22560 dust2.velocity *= 1.4f;
22561 }
22562 }
22563 Lighting.AddLight(base.Center, 0.2f, 0.5f, 0.7f);
22564 }
22565 else
22566 {
22567 int num259 = type - 121 + 86;
22568 if (type == 597)
22569 {
22570 num259 = 262;
22571 }
22572 for (int num260 = 0; num260 < 2; num260++)
22573 {
22574 int num261 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, num259, velocity.X, velocity.Y, 50, default(Color), 1.2f);
22575 Main.dust[num261].noGravity = true;
22577 dust2.velocity *= 0.3f;
22578 }
22579 if (this.ai[1] == 0f)
22580 {
22581 this.ai[1] = 1f;
22583 }
22584 }
22585 }
22586 else if (aiStyle == 30)
22587 {
22588 if (type == 907)
22589 {
22590 float num262 = 100f;
22591 float num263 = num262 - 50f;
22592 if (Main.rand.Next(Math.Max(4, 8 - (int)velocity.Length())) == 0)
22593 {
22594 int num264 = 5;
22595 int num265 = Dust.NewDust(base.position + new Vector2(num264, num264), width - num264 * 2, height - num264 * 2, 43, 0f, 0f, 254, new Color(255, 255, 0));
22596 Main.dust[num265].velocity = velocity * 0.75f;
22597 }
22598 if (this.ai[0] > num263)
22599 {
22600 velocity *= 0.9f;
22601 rotation *= 0.9f;
22602 }
22603 else
22604 {
22605 rotation += 0.2f;
22606 if (rotation > (float)Math.PI * 2f)
22607 {
22608 rotation -= (float)Math.PI * 2f;
22609 }
22610 }
22611 float num266 = this.ai[0];
22612 this.ai[0]++;
22613 if (Main.myPlayer == owner && this.ai[0] < num263 && this.ai[0] % 10f == 0f)
22614 {
22615 float num267 = (float)Math.PI / 2f * (float)((this.ai[0] % 20f != 0f) ? 1 : (-1));
22616 num267 *= (float)((whoAmI % 2 != 0) ? 1 : (-1));
22617 num267 += (float)Main.rand.Next(-5, 5) * MathHelper.Lerp(0.2f, 0.03f, this.ai[0] / num263);
22618 Vector2 v3 = velocity.RotatedBy(num267);
22619 v3 = v3.SafeNormalize(Vector2.Zero);
22620 v3 *= Math.Max(2.5f, (num263 - this.ai[0]) / num263 * (7f + (-2f + (float)Main.rand.Next(2) * 2f)));
22621 int num268 = NewProjectile(GetProjectileSource_FromThis(), base.Center, v3, 335, damage, knockBack * 0.25f, owner, 0f, Main.rand.Next(4));
22622 }
22623 if (num266 <= num263 && this.ai[0] > num263)
22624 {
22625 netUpdate = true;
22626 }
22627 if (this.ai[0] > num262)
22628 {
22629 Kill();
22630 }
22631 }
22632 else if (type == 335)
22633 {
22634 int num269 = (frame = (int)this.ai[1]);
22635 if (this.ai[0] < 0f)
22636 {
22637 velocity.Y += 0.25f;
22638 if (velocity.Y > 14f)
22639 {
22640 velocity.Y = 14f;
22641 }
22642 }
22643 else
22644 {
22645 if (Main.rand.Next(Math.Max(4, 8 - (int)velocity.Length())) == 0)
22646 {
22648 switch (num269)
22649 {
22650 case 0:
22651 newColor = new Color(255, 100, 100);
22652 break;
22653 case 1:
22654 newColor = new Color(100, 255, 100);
22655 break;
22656 case 2:
22657 newColor = new Color(100, 100, 255);
22658 break;
22659 case 3:
22660 newColor = new Color(255, 255, 100);
22661 break;
22662 }
22663 int num270 = 5;
22664 int num271 = Dust.NewDust(base.position + new Vector2(num270, num270), width - num270 * 2, height - num270 * 2, 43, 0f, 0f, 254, newColor);
22665 Main.dust[num271].velocity = velocity * 0.75f;
22666 }
22667 velocity *= 0.95f;
22668 }
22669 if (this.ai[0] >= 0f && velocity.Length() < 0.25f)
22670 {
22671 if (velocity != Vector2.Zero)
22672 {
22674 if (Main.netMode != 1)
22675 {
22676 this.ai[0] = 50f;
22677 netUpdate = true;
22678 }
22679 }
22680 this.ai[0]--;
22681 }
22682 localAI[0]++;
22683 rotation = (float)Math.Sin(localAI[0] / 10f);
22684 }
22685 else
22686 {
22687 velocity *= 0.8f;
22688 rotation += 0.2f;
22689 alpha += 4;
22690 if (alpha >= 255)
22691 {
22692 Kill();
22693 }
22694 }
22695 }
22696 else if (aiStyle == 31)
22697 {
22698 bool flag11 = this.ai[1] == 1f;
22699 short num272 = 110;
22700 int num273 = 0;
22701 switch (type)
22702 {
22703 default:
22704 num272 = 110;
22705 num273 = 0;
22706 break;
22707 case 147:
22708 num272 = 112;
22709 num273 = 1;
22710 break;
22711 case 146:
22712 num272 = 111;
22713 num273 = 2;
22714 break;
22715 case 148:
22716 num272 = 113;
22717 num273 = 3;
22718 break;
22719 case 149:
22720 num272 = 114;
22721 num273 = 4;
22722 break;
22723 case 1015:
22724 num272 = 311;
22725 num273 = 5;
22726 break;
22727 case 1016:
22728 num272 = 312;
22729 num273 = 6;
22730 break;
22731 case 1017:
22732 num272 = 313;
22733 num273 = 7;
22734 break;
22735 }
22736 if (owner == Main.myPlayer)
22737 {
22738 int size = 2;
22739 if (flag11)
22740 {
22741 size = 3;
22742 }
22743 Point point = base.Center.ToTileCoordinates();
22744 WorldGen.Convert(point.X, point.Y, num273, size);
22745 }
22746 if (timeLeft > 133)
22747 {
22748 timeLeft = 133;
22749 }
22750 int num274 = 7;
22751 if (flag11)
22752 {
22753 num274 = 3;
22754 }
22755 if (this.ai[0] > (float)num274)
22756 {
22757 float num275 = 1f;
22758 if (this.ai[0] == (float)(num274 + 1))
22759 {
22760 num275 = 0.2f;
22761 }
22762 else if (this.ai[0] == (float)(num274 + 2))
22763 {
22764 num275 = 0.4f;
22765 }
22766 else if (this.ai[0] == (float)(num274 + 3))
22767 {
22768 num275 = 0.6f;
22769 }
22770 else if (this.ai[0] == (float)(num274 + 4))
22771 {
22772 num275 = 0.8f;
22773 }
22774 int num276 = 0;
22775 if (flag11)
22776 {
22777 num275 *= 1.2f;
22778 num276 = (int)(12f * num275);
22779 }
22780 this.ai[0]++;
22781 for (int num277 = 0; num277 < 1; num277++)
22782 {
22783 int num278 = Dust.NewDust(new Vector2(base.position.X - (float)num276, base.position.Y - (float)num276), width + num276 * 2, height + num276 * 2, num272, velocity.X * 0.2f, velocity.Y * 0.2f, 100);
22784 Main.dust[num278].noGravity = true;
22786 dust2.scale *= 1.75f;
22787 Main.dust[num278].velocity.X *= 2f;
22788 Main.dust[num278].velocity.Y *= 2f;
22789 dust2 = Main.dust[num278];
22790 dust2.scale *= num275;
22791 }
22792 }
22793 else
22794 {
22795 this.ai[0]++;
22796 }
22797 rotation += 0.3f * (float)direction;
22798 }
22799 else if (aiStyle == 32)
22800 {
22801 timeLeft = 10;
22802 this.ai[0] += 1f;
22803 if (this.ai[0] >= 20f)
22804 {
22805 this.ai[0] = 18f;
22806 Rectangle rectangle3 = new Rectangle((int)base.position.X, (int)base.position.Y, width, height);
22807 for (int num279 = 0; num279 < 255; num279++)
22808 {
22809 Entity entity = Main.player[num279];
22810 if (entity.active && rectangle3.Intersects(entity.Hitbox))
22811 {
22812 this.ai[0] = 0f;
22813 velocity.Y = -4.5f;
22814 if (velocity.X > 2f)
22815 {
22816 velocity.X = 2f;
22817 }
22818 if (velocity.X < -2f)
22819 {
22820 velocity.X = -2f;
22821 }
22822 velocity.X = (velocity.X + (float)entity.direction * 1.75f) / 2f;
22823 velocity.X += entity.velocity.X * 3f;
22824 velocity.Y += entity.velocity.Y;
22825 if (velocity.X > 6f)
22826 {
22827 velocity.X = 6f;
22828 }
22829 if (velocity.X < -6f)
22830 {
22831 velocity.X = -6f;
22832 }
22833 if (velocity.Length() > 16f)
22834 {
22835 velocity = velocity.SafeNormalize(Vector2.Zero) * 16f;
22836 }
22837 netUpdate = true;
22838 this.ai[1] += 1f;
22839 }
22840 }
22841 for (int num280 = 0; num280 < 1000; num280++)
22842 {
22843 if (num280 == whoAmI)
22844 {
22845 continue;
22846 }
22847 Entity entity = Main.projectile[num280];
22848 if (entity.active && rectangle3.Intersects(entity.Hitbox))
22849 {
22850 this.ai[0] = 0f;
22851 velocity.Y = -4.5f;
22852 if (velocity.X > 2f)
22853 {
22854 velocity.X = 2f;
22855 }
22856 if (velocity.X < -2f)
22857 {
22858 velocity.X = -2f;
22859 }
22860 velocity.X = (velocity.X + (float)entity.direction * 1.75f) / 2f;
22861 velocity.X += entity.velocity.X * 3f;
22862 velocity.Y += entity.velocity.Y;
22863 if (velocity.X > 6f)
22864 {
22865 velocity.X = 6f;
22866 }
22867 if (velocity.X < -6f)
22868 {
22869 velocity.X = -6f;
22870 }
22871 if (velocity.Length() > 16f)
22872 {
22873 velocity = velocity.SafeNormalize(Vector2.Zero) * 16f;
22874 }
22875 netUpdate = true;
22876 this.ai[1] += 1f;
22877 }
22878 }
22879 }
22880 if (velocity.X == 0f && velocity.Y == 0f)
22881 {
22882 Kill();
22883 }
22884 rotation += 0.02f * velocity.X;
22885 if (velocity.Y == 0f)
22886 {
22887 velocity.X *= 0.98f;
22888 }
22889 else if (wet)
22890 {
22891 velocity.X *= 0.99f;
22892 }
22893 else
22894 {
22895 velocity.X *= 0.995f;
22896 }
22897 if ((double)velocity.X > -0.03 && (double)velocity.X < 0.03)
22898 {
22899 velocity.X = 0f;
22900 }
22901 if (wet)
22902 {
22903 this.ai[1] = 0f;
22904 if (velocity.Y > 0f)
22905 {
22906 velocity.Y *= 0.95f;
22907 }
22908 velocity.Y -= 0.1f;
22909 if (velocity.Y < -4f)
22910 {
22911 velocity.Y = -4f;
22912 }
22913 if (velocity.X == 0f)
22914 {
22915 Kill();
22916 }
22917 }
22918 else
22919 {
22920 velocity.Y += 0.1f;
22921 }
22922 if (velocity.Y > 10f)
22923 {
22924 velocity.Y = 10f;
22925 }
22926 }
22927 else if (aiStyle == 33)
22928 {
22929 if (alpha > 0)
22930 {
22931 alpha -= 50;
22932 if (alpha < 0)
22933 {
22934 alpha = 0;
22935 }
22936 }
22937 float num281 = 4f;
22938 float num282 = this.ai[0];
22939 float num283 = this.ai[1];
22940 if (num282 == 0f && num283 == 0f)
22941 {
22942 num282 = 1f;
22943 }
22944 float num284 = (float)Math.Sqrt(num282 * num282 + num283 * num283);
22945 num284 = num281 / num284;
22946 num282 *= num284;
22947 num283 *= num284;
22948 if (alpha < 70)
22949 {
22950 short num285 = 127;
22951 switch (type)
22952 {
22953 case 163:
22954 num285 = 127;
22955 break;
22956 case 310:
22957 num285 = 187;
22958 break;
22959 case 1008:
22960 num285 = 169;
22961 break;
22962 case 1009:
22963 num285 = 75;
22964 break;
22965 case 1010:
22966 num285 = 66;
22967 break;
22968 case 1011:
22969 num285 = 310;
22970 break;
22971 }
22972 int num286 = Dust.NewDust(new Vector2(base.position.X, base.position.Y - 2f), 6, 6, num285, velocity.X, velocity.Y, 100, default(Color), 1.6f);
22973 Main.dust[num286].noGravity = true;
22974 Main.dust[num286].position.X -= num282 * 1f;
22975 Main.dust[num286].position.Y -= num283 * 1f;
22976 Main.dust[num286].velocity.X -= num282;
22977 Main.dust[num286].velocity.Y -= num283;
22978 if (type == 1010)
22979 {
22980 Main.dust[num286].color = Main.hslToRgb(Main.GlobalTimeWrappedHourly * 0.6f % 1f, 1f, 0.5f);
22982 dust2.scale *= 0.5f;
22983 dust2 = Main.dust[num286];
22984 dust2.velocity *= 0.75f;
22985 }
22986 }
22987 if (localAI[0] == 0f)
22988 {
22989 this.ai[0] = velocity.X;
22990 this.ai[1] = velocity.Y;
22991 localAI[1] += 1f;
22992 if (localAI[1] >= 30f)
22993 {
22994 velocity.Y += 0.09f;
22995 localAI[1] = 30f;
22996 }
22997 }
22998 else
22999 {
23000 if (!Collision.SolidCollision(base.position, width, height))
23001 {
23002 localAI[0] = 0f;
23003 localAI[1] = 30f;
23004 }
23005 if (type == 1008 && Main.netMode != 2)
23006 {
23007 int num287 = 30;
23008 if ((base.Center - Main.player[Main.myPlayer].Center).Length() < (float)(Main.screenWidth + num287 * 16))
23009 {
23010 Main.instance.SpelunkerProjectileHelper.AddSpotToCheck(base.Center);
23011 }
23012 }
23013 damage = 0;
23014 }
23015 if (velocity.Y > 16f)
23016 {
23017 velocity.Y = 16f;
23018 }
23019 rotation = (float)Math.Atan2(this.ai[1], this.ai[0]) + 1.57f;
23020 }
23021 else if (aiStyle == 34)
23022 {
23023 rotation = velocity.ToRotation() + (float)Math.PI / 2f;
23024 if (this.ai[1] == 1f)
23025 {
23026 this.ai[0]++;
23027 if (this.ai[0] == 1f)
23028 {
23029 for (int num288 = 0; num288 < 8; num288++)
23030 {
23031 int num289 = Dust.NewDust(base.position, width, height, 6, 0f, 0f, 100, default(Color), 1.8f);
23032 Main.dust[num289].noGravity = true;
23034 dust2.velocity *= 3f;
23035 Main.dust[num289].fadeIn = 0.5f;
23036 dust2 = Main.dust[num289];
23037 dust2.position += velocity / 2f;
23038 dust2 = Main.dust[num289];
23039 dust2.velocity += velocity / 4f + Main.player[owner].velocity * 0.1f;
23040 }
23041 }
23042 if (this.ai[0] > 2f)
23043 {
23044 int num290 = Dust.NewDust(new Vector2(base.position.X + 2f, base.position.Y + 20f), 8, 8, 6, velocity.X, velocity.Y, 100, default(Color), 1.2f);
23045 Main.dust[num290].noGravity = true;
23047 dust2.velocity *= 0.2f;
23048 Main.dust[num290].position = Main.dust[num290].position.RotatedBy(rotation, base.Center);
23049 num290 = Dust.NewDust(new Vector2(base.position.X + 2f, base.position.Y + 15f), 8, 8, 6, velocity.X, velocity.Y, 100, default(Color), 1.2f);
23050 Main.dust[num290].noGravity = true;
23051 dust2 = Main.dust[num290];
23052 dust2.velocity *= 0.2f;
23053 Main.dust[num290].position = Main.dust[num290].position.RotatedBy(rotation, base.Center);
23054 num290 = Dust.NewDust(new Vector2(base.position.X + 2f, base.position.Y + 10f), 8, 8, 6, velocity.X, velocity.Y, 100, default(Color), 1.2f);
23055 Main.dust[num290].noGravity = true;
23056 dust2 = Main.dust[num290];
23057 dust2.velocity *= 0.2f;
23058 Main.dust[num290].position = Main.dust[num290].position.RotatedBy(rotation, base.Center);
23059 }
23060 }
23061 else if (type >= 415 && type <= 418)
23062 {
23063 this.ai[0]++;
23064 if (this.ai[0] > 4f)
23065 {
23066 int num291 = Dust.NewDust(new Vector2(base.position.X + 2f, base.position.Y + 20f), 8, 8, 6, velocity.X, velocity.Y, 100, default(Color), 1.2f);
23067 Main.dust[num291].noGravity = true;
23069 dust2.velocity *= 0.2f;
23070 Main.dust[num291].position = Main.dust[num291].position.RotatedBy(rotation, base.Center);
23071 }
23072 }
23073 else
23074 {
23075 int num292 = Dust.NewDust(new Vector2(base.position.X + 2f, base.position.Y + 20f), 8, 8, 6, velocity.X, velocity.Y, 100, default(Color), 1.2f);
23076 Main.dust[num292].noGravity = true;
23078 dust2.velocity *= 0.2f;
23079 Main.dust[num292].position = Main.dust[num292].position.RotatedBy(rotation, base.Center);
23080 }
23081 }
23082 else if (aiStyle == 35)
23083 {
23084 this.ai[0] += 1f;
23085 if (this.ai[0] > 30f)
23086 {
23087 velocity.Y += 0.2f;
23088 velocity.X *= 0.985f;
23089 if (velocity.Y > 14f)
23090 {
23091 velocity.Y = 14f;
23092 }
23093 }
23094 rotation += (Math.Abs(velocity.X) + Math.Abs(velocity.Y)) * (float)direction * 0.02f;
23095 if (owner != Main.myPlayer)
23096 {
23097 return;
23098 }
23100 bool flag12 = false;
23101 if (vector25 != velocity)
23102 {
23103 flag12 = true;
23104 }
23105 else
23106 {
23107 int num293 = (int)(base.Center.X + velocity.X) / 16;
23108 int num294 = (int)(base.Center.Y + velocity.Y) / 16;
23109 if (Main.tile[num293, num294] != null && Main.tile[num293, num294].active() && Main.tile[num293, num294].bottomSlope())
23110 {
23111 flag12 = true;
23112 base.position.Y = num294 * 16 + 16 + 8;
23113 base.position.X = num293 * 16 + 8;
23114 }
23115 }
23116 if (!flag12)
23117 {
23118 return;
23119 }
23120 int num295 = 213;
23121 if (type == 475)
23122 {
23123 num295 = 353;
23124 }
23125 if (type == 506)
23126 {
23127 num295 = 366;
23128 }
23129 if (type == 505)
23130 {
23131 num295 = 365;
23132 }
23133 int num296 = (int)(base.position.X + (float)(width / 2)) / 16;
23134 int num297 = (int)(base.position.Y + (float)(height / 2)) / 16;
23135 base.position += vector25;
23136 int num298 = 10;
23137 if (Main.tile[num296, num297] == null)
23138 {
23139 return;
23140 }
23141 for (; WorldGen.IsRope(num296, num297); num297++)
23142 {
23143 }
23144 bool flag13 = false;
23145 while (num298 > 0)
23146 {
23147 bool flag14 = false;
23148 if (Main.tile[num296, num297] == null)
23149 {
23150 break;
23151 }
23152 if (Main.tile[num296, num297].active())
23153 {
23154 if (Main.tile[num296, num297].type == 314 || TileID.Sets.Platforms[Main.tile[num296, num297].type])
23155 {
23156 flag13 = !flag13;
23157 }
23158 else if (Main.tileCut[Main.tile[num296, num297].type] || Main.tile[num296, num297].type == 165)
23159 {
23160 flag13 = false;
23162 NetMessage.SendData(17, -1, -1, null, 0, num296, num297);
23163 }
23164 }
23165 if (!Main.tile[num296, num297].active())
23166 {
23167 flag13 = false;
23168 flag14 = true;
23170 NetMessage.SendData(17, -1, -1, null, 1, num296, num297, num295);
23171 this.ai[1] += 1f;
23172 }
23173 else if (!flag13)
23174 {
23175 num298 = 0;
23176 }
23177 if (flag14)
23178 {
23179 num298--;
23180 }
23181 num297++;
23182 }
23183 Kill();
23184 }
23185 else if (aiStyle == 36)
23186 {
23187 if (type != 307 && wet && !honeyWet && !shimmerWet)
23188 {
23189 Kill();
23190 }
23191 if (alpha > 0)
23192 {
23193 alpha -= 50;
23194 }
23195 else
23196 {
23197 extraUpdates = 0;
23198 }
23199 if (alpha < 0)
23200 {
23201 alpha = 0;
23202 }
23203 if (type == 307)
23204 {
23205 rotation = (float)Math.Atan2(velocity.Y, velocity.X) - 1.57f;
23206 frameCounter++;
23207 if (frameCounter >= 6)
23208 {
23209 frame++;
23210 frameCounter = 0;
23211 }
23212 if (frame >= 2)
23213 {
23214 frame = 0;
23215 }
23216 for (int num299 = 0; num299 < 3; num299++)
23217 {
23218 float num300 = velocity.X / 3f * (float)num299;
23219 float num301 = velocity.Y / 3f * (float)num299;
23220 int num302 = Dust.NewDust(base.position, width, height, 184);
23221 Main.dust[num302].position.X = base.Center.X - num300;
23222 Main.dust[num302].position.Y = base.Center.Y - num301;
23224 dust2.velocity *= 0f;
23225 Main.dust[num302].scale = 0.5f;
23226 }
23227 }
23228 else
23229 {
23230 if (type == 316)
23231 {
23232 if (velocity.X > 0f)
23233 {
23234 spriteDirection = -1;
23235 }
23236 else if (velocity.X < 0f)
23237 {
23238 spriteDirection = 1;
23239 }
23240 }
23241 else if (velocity.X > 0f)
23242 {
23243 spriteDirection = 1;
23244 }
23245 else if (velocity.X < 0f)
23246 {
23247 spriteDirection = -1;
23248 }
23249 rotation = velocity.X * 0.1f;
23250 frameCounter++;
23251 if (frameCounter >= 3)
23252 {
23253 frame++;
23254 frameCounter = 0;
23255 }
23256 if (frame >= 3)
23257 {
23258 frame = 0;
23259 }
23260 }
23261 float num303 = base.position.X;
23262 float num304 = base.position.Y;
23263 float num305 = 100000f;
23264 bool flag15 = false;
23265 this.ai[0] += 1f;
23266 if (this.ai[0] > 30f)
23267 {
23268 this.ai[0] = 30f;
23269 for (int num306 = 0; num306 < 200; num306++)
23270 {
23271 if (Main.npc[num306].CanBeChasedBy(this) && (!Main.npc[num306].wet || Main.npc[num306].type == 370 || type == 307))
23272 {
23273 float num307 = Main.npc[num306].position.X + (float)(Main.npc[num306].width / 2);
23274 float num308 = Main.npc[num306].position.Y + (float)(Main.npc[num306].height / 2);
23275 float num309 = Math.Abs(base.position.X + (float)(width / 2) - num307) + Math.Abs(base.position.Y + (float)(height / 2) - num308);
23276 if (num309 < 800f && num309 < num305 && Collision.CanHit(base.position, width, height, Main.npc[num306].position, Main.npc[num306].width, Main.npc[num306].height))
23277 {
23278 num305 = num309;
23279 num303 = num307;
23280 num304 = num308;
23281 flag15 = true;
23282 }
23283 }
23284 }
23285 }
23286 if (!flag15)
23287 {
23288 num303 = base.position.X + (float)(width / 2) + velocity.X * 100f;
23289 num304 = base.position.Y + (float)(height / 2) + velocity.Y * 100f;
23290 }
23291 else if (type == 307)
23292 {
23293 friendly = true;
23294 }
23295 float num310 = 6f;
23296 float num311 = 0.1f;
23297 if (type == 189)
23298 {
23299 num310 = 9f;
23300 num311 = 0.2f;
23301 }
23302 if (type == 307)
23303 {
23304 num310 = 13f;
23305 num311 = 0.35f;
23306 }
23307 if (type == 316)
23308 {
23309 if (flag15)
23310 {
23311 num310 = 13f;
23312 num311 = 0.325f;
23313 }
23314 else
23315 {
23316 num310 = 10f;
23317 num311 = 0.25f;
23318 }
23319 }
23320 if (type == 566)
23321 {
23322 num310 = 6.8f;
23323 num311 = 0.14f;
23324 }
23325 Vector2 vector26 = new Vector2(base.position.X + (float)width * 0.5f, base.position.Y + (float)height * 0.5f);
23326 float num312 = num303 - vector26.X;
23327 float num313 = num304 - vector26.Y;
23328 float num314 = (float)Math.Sqrt(num312 * num312 + num313 * num313);
23329 float num315 = num314;
23330 num314 = num310 / num314;
23331 num312 *= num314;
23332 num313 *= num314;
23333 if (velocity.X < num312)
23334 {
23335 velocity.X += num311;
23336 if (velocity.X < 0f && num312 > 0f)
23337 {
23338 velocity.X += num311 * 2f;
23339 }
23340 }
23341 else if (velocity.X > num312)
23342 {
23343 velocity.X -= num311;
23344 if (velocity.X > 0f && num312 < 0f)
23345 {
23346 velocity.X -= num311 * 2f;
23347 }
23348 }
23349 if (velocity.Y < num313)
23350 {
23351 velocity.Y += num311;
23352 if (velocity.Y < 0f && num313 > 0f)
23353 {
23354 velocity.Y += num311 * 2f;
23355 }
23356 }
23357 else if (velocity.Y > num313)
23358 {
23359 velocity.Y -= num311;
23360 if (velocity.Y > 0f && num313 < 0f)
23361 {
23362 velocity.Y -= num311 * 2f;
23363 }
23364 }
23365 }
23366 else if (aiStyle == 37)
23367 {
23368 if (this.ai[1] == 0f)
23369 {
23370 this.ai[1] = 1f;
23371 localAI[0] = base.Center.X - velocity.X * 1.5f;
23372 localAI[1] = base.Center.Y - velocity.Y * 1.5f;
23373 }
23374 Vector2 vector27 = new Vector2(localAI[0], localAI[1]);
23375 rotation = (base.Center - vector27).ToRotation() - (float)Math.PI / 2f;
23376 if (this.ai[0] == 0f)
23377 {
23378 if (Collision.SolidCollision(base.position, width, height))
23379 {
23380 velocity *= -1f;
23381 this.ai[0] += 1f;
23382 return;
23383 }
23384 float num316 = Vector2.Distance(base.Center, vector27);
23385 if (num316 > 300f)
23386 {
23387 velocity *= -1f;
23388 this.ai[0] += 1f;
23389 }
23390 }
23391 else if (Collision.SolidCollision(base.position, width, height) || Vector2.Distance(base.Center, vector27) < velocity.Length())
23392 {
23393 Kill();
23394 }
23395 }
23396 else if (aiStyle == 38)
23397 {
23398 this.ai[0] += 1f;
23399 if (this.ai[0] >= 6f)
23400 {
23401 this.ai[0] = 0f;
23403 if (Main.myPlayer == owner)
23404 {
23406 }
23407 }
23408 }
23409 else if (aiStyle == 39)
23410 {
23411 alpha -= 50;
23412 if (alpha < 0)
23413 {
23414 alpha = 0;
23415 }
23416 if (!active || !Main.player[owner].active || Main.player[owner].dead || Vector2.Distance(Main.player[owner].Center, base.Center) > 2000f)
23417 {
23418 Kill();
23419 return;
23420 }
23421 if (active && alpha == 0)
23422 {
23423 Main.player[owner].SetDummyItemTime(5);
23424 if (base.Center.X > Main.player[owner].Center.X)
23425 {
23426 Main.player[owner].ChangeDir(1);
23427 }
23428 else
23429 {
23430 Main.player[owner].ChangeDir(-1);
23431 }
23432 }
23433 Vector2 center = base.Center;
23434 float num317 = Main.player[owner].Center.X - center.X;
23435 float num318 = Main.player[owner].Center.Y - center.Y;
23436 float num319 = (float)Math.Sqrt(num317 * num317 + num318 * num318);
23437 if (!Main.player[owner].channel && active && alpha == 0)
23438 {
23439 this.ai[0] = 1f;
23440 this.ai[1] = -1f;
23441 }
23442 if (this.ai[1] > 0f && num319 > 1500f)
23443 {
23444 this.ai[1] = 0f;
23445 this.ai[0] = 1f;
23446 }
23447 if (this.ai[1] > 0f)
23448 {
23449 tileCollide = false;
23450 int num320 = (int)this.ai[1] - 1;
23451 if (Main.npc[num320].active && Main.npc[num320].life > 0)
23452 {
23453 float num321 = 16f;
23454 center = base.Center;
23455 num317 = Main.npc[num320].Center.X - center.X;
23456 num318 = Main.npc[num320].Center.Y - center.Y;
23457 num319 = (float)Math.Sqrt(num317 * num317 + num318 * num318);
23458 if (num319 < num321)
23459 {
23460 velocity.X = num317;
23461 velocity.Y = num318;
23462 if (num319 > num321 / 3f)
23463 {
23464 if (velocity.X < 0f)
23465 {
23466 spriteDirection = -1;
23467 rotation = (float)Math.Atan2(0f - velocity.Y, 0f - velocity.X);
23468 }
23469 else
23470 {
23471 spriteDirection = 1;
23472 rotation = (float)Math.Atan2(velocity.Y, velocity.X);
23473 }
23474 if (type == 190)
23475 {
23476 velocity.X = 0f;
23477 velocity.Y = 0f;
23478 }
23479 }
23480 }
23481 else
23482 {
23483 if (num319 == 0f)
23484 {
23485 num319 = 0.0001f;
23486 }
23487 num319 = num321 / num319;
23488 num317 *= num319;
23489 num318 *= num319;
23490 velocity.X = num317;
23491 velocity.Y = num318;
23492 if (velocity.X < 0f)
23493 {
23494 spriteDirection = -1;
23495 rotation = (float)Math.Atan2(0f - velocity.Y, 0f - velocity.X);
23496 }
23497 else
23498 {
23499 spriteDirection = 1;
23500 rotation = (float)Math.Atan2(velocity.Y, velocity.X);
23501 }
23502 }
23503 if (type == 190)
23504 {
23505 base.position += Main.npc[num320].velocity;
23506 for (int num322 = 0; num322 < 1000; num322++)
23507 {
23508 if (num322 != whoAmI && Main.projectile[num322].active && Main.projectile[num322].owner == owner && Main.projectile[num322].type == 190 && Vector2.Distance(base.Center, Main.projectile[num322].Center) < 8f)
23509 {
23510 if (base.position.X < Main.projectile[num322].position.X)
23511 {
23512 velocity.X -= 4f;
23513 }
23514 else
23515 {
23516 velocity.X += 4f;
23517 }
23518 if (base.position.Y < Main.projectile[num322].position.Y)
23519 {
23520 velocity.Y -= 4f;
23521 }
23522 else
23523 {
23524 velocity.Y += 4f;
23525 }
23526 }
23527 }
23528 }
23529 if (Main.myPlayer == owner)
23530 {
23531 float num323 = this.ai[0];
23532 this.ai[0] = 1f;
23533 if (num323 != this.ai[0])
23534 {
23535 netUpdate = true;
23536 }
23537 }
23538 }
23539 else if (Main.myPlayer == owner)
23540 {
23541 float num324 = this.ai[1];
23542 this.ai[1] = 0f;
23543 if (num324 != this.ai[1])
23544 {
23545 netUpdate = true;
23546 }
23547 float num325 = base.position.X;
23548 float num326 = base.position.Y;
23549 float num327 = 3000f;
23550 int num328 = -1;
23551 for (int num329 = 0; num329 < 200; num329++)
23552 {
23553 if (Main.npc[num329].CanBeChasedBy(this))
23554 {
23555 float x = Main.npc[num329].Center.X;
23556 float y = Main.npc[num329].Center.Y;
23557 float num330 = Math.Abs(base.Center.X - x) + Math.Abs(base.Center.Y - y);
23558 if (num330 < num327 && Collision.CanHit(base.position, width, height, Main.npc[num329].position, Main.npc[num329].width, Main.npc[num329].height))
23559 {
23560 num327 = num330;
23561 num325 = x;
23562 num326 = y;
23563 num328 = num329;
23564 }
23565 }
23566 }
23567 if (num328 >= 0)
23568 {
23569 float num331 = 16f;
23570 center = base.Center;
23571 num317 = num325 - center.X;
23572 num318 = num326 - center.Y;
23573 num319 = (float)Math.Sqrt(num317 * num317 + num318 * num318);
23574 if (num319 == 0f)
23575 {
23576 num319 = 0.0001f;
23577 }
23578 num319 = num331 / num319;
23579 num317 *= num319;
23580 num318 *= num319;
23581 velocity.X = num317;
23582 velocity.Y = num318;
23583 this.ai[0] = 0f;
23584 this.ai[1] = num328 + 1;
23585 netUpdate = true;
23586 }
23587 }
23588 }
23589 else if (this.ai[0] == 0f)
23590 {
23591 if (Main.myPlayer == owner && num319 > 700f)
23592 {
23593 this.ai[0] = 1f;
23594 netUpdate = true;
23595 }
23596 if (velocity.X < 0f)
23597 {
23598 spriteDirection = -1;
23599 rotation = (float)Math.Atan2(0f - velocity.Y, 0f - velocity.X);
23600 }
23601 else
23602 {
23603 spriteDirection = 1;
23604 rotation = (float)Math.Atan2(velocity.Y, velocity.X);
23605 }
23606 }
23607 else if (this.ai[0] == 1f)
23608 {
23609 tileCollide = false;
23610 if (velocity.X < 0f)
23611 {
23612 spriteDirection = 1;
23613 rotation = (float)Math.Atan2(0f - velocity.Y, 0f - velocity.X);
23614 }
23615 else
23616 {
23617 spriteDirection = -1;
23618 rotation = (float)Math.Atan2(velocity.Y, velocity.X);
23619 }
23620 if (velocity.X < 0f)
23621 {
23622 spriteDirection = -1;
23623 rotation = (float)Math.Atan2(0f - velocity.Y, 0f - velocity.X);
23624 }
23625 else
23626 {
23627 spriteDirection = 1;
23628 rotation = (float)Math.Atan2(velocity.Y, velocity.X);
23629 }
23630 float num332 = 20f;
23631 if (Main.myPlayer == owner && num319 < 70f)
23632 {
23633 Kill();
23634 }
23635 num319 = num332 / num319;
23636 num317 *= num319;
23637 num318 *= num319;
23638 velocity.X = num317;
23639 velocity.Y = num318;
23640 if (type == 190)
23641 {
23642 base.position += Main.player[owner].velocity;
23643 }
23644 }
23645 frameCounter++;
23646 if (frameCounter >= 4)
23647 {
23648 frame++;
23649 frameCounter = 0;
23650 }
23651 if (frame >= 4)
23652 {
23653 frame = 0;
23654 }
23655 }
23656 else if (aiStyle == 40)
23657 {
23658 localAI[0] += 1f;
23659 if (localAI[0] > 3f)
23660 {
23661 localAI[0] = 100f;
23662 alpha -= 50;
23663 if (alpha < 0)
23664 {
23665 alpha = 0;
23666 }
23667 }
23668 frameCounter++;
23669 if (frameCounter >= 3)
23670 {
23671 frame++;
23672 frameCounter = 0;
23673 }
23674 if (frame >= 5)
23675 {
23676 frame = 0;
23677 }
23678 velocity.X += this.ai[0];
23679 velocity.Y += this.ai[1];
23680 localAI[1] += 1f;
23681 if (localAI[1] == 50f)
23682 {
23683 localAI[1] = 51f;
23684 this.ai[0] = (float)Main.rand.Next(-100, 101) * 6E-05f;
23685 this.ai[1] = (float)Main.rand.Next(-100, 101) * 6E-05f;
23686 }
23687 if (Math.Abs(velocity.X) + Math.Abs(velocity.Y) > 16f)
23688 {
23689 velocity.X *= 0.95f;
23690 velocity.Y *= 0.95f;
23691 }
23692 if (Math.Abs(velocity.X) + Math.Abs(velocity.Y) < 12f)
23693 {
23694 velocity.X *= 1.05f;
23695 velocity.Y *= 1.05f;
23696 }
23697 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 3.14f;
23698 }
23699 else if (aiStyle == 41)
23700 {
23701 if (localAI[0] == 0f)
23702 {
23703 localAI[0] = 1f;
23704 frame = Main.rand.Next(3);
23705 }
23706 rotation += velocity.X * 0.01f;
23707 }
23708 else if (aiStyle == 42)
23709 {
23710 if (!Main.player[owner].crystalLeaf)
23711 {
23712 Kill();
23713 return;
23714 }
23715 base.position.X = Main.player[owner].Center.X - (float)(width / 2);
23716 base.position.Y = Main.player[owner].Center.Y - (float)(height / 2) + Main.player[owner].gfxOffY - 60f;
23717 if (Main.player[owner].gravDir == -1f)
23718 {
23719 base.position.Y += 120f;
23720 rotation = 3.14f;
23721 }
23722 else
23723 {
23724 rotation = 0f;
23725 }
23726 base.position.X = (int)base.position.X;
23727 base.position.Y = (int)base.position.Y;
23728 float num333 = (float)(int)Main.mouseTextColor / 200f - 0.35f;
23729 num333 *= 0.2f;
23730 scale = num333 + 0.95f;
23731 if (owner != Main.myPlayer || Main.player[owner].crystalLeafCooldown != 0)
23732 {
23733 return;
23734 }
23735 float x2 = base.position.X;
23736 float y2 = base.position.Y;
23737 float num334 = 700f;
23738 NPC nPC = null;
23739 for (int num335 = 0; num335 < 200; num335++)
23740 {
23741 if (Main.npc[num335].CanBeChasedBy(this))
23742 {
23743 float num336 = Main.npc[num335].position.X + (float)(Main.npc[num335].width / 2);
23744 float num337 = Main.npc[num335].position.Y + (float)(Main.npc[num335].height / 2);
23745 float num338 = Math.Abs(base.position.X + (float)(width / 2) - num336) + Math.Abs(base.position.Y + (float)(height / 2) - num337);
23746 if (num338 < num334 && Collision.CanHit(base.position, width, height, Main.npc[num335].position, Main.npc[num335].width, Main.npc[num335].height))
23747 {
23748 num334 = num338;
23749 nPC = Main.npc[num335];
23750 }
23751 }
23752 }
23753 if (nPC != null)
23754 {
23755 float num339 = 12f;
23756 Vector2 vector28 = new Vector2(base.position.X + (float)width * 0.5f, base.position.Y + (float)height * 0.5f);
23757 float num340 = x2 - vector28.X;
23758 float num341 = y2 - vector28.Y;
23759 float num342 = (float)Math.Sqrt(num340 * num340 + num341 * num341);
23760 float num343 = num342;
23761 num342 = num339 / num342;
23762 num340 *= num342;
23763 num341 *= num342;
23764 int num344 = 180;
23765 Utils.ChaseResults chaseResults = Utils.GetChaseResults(base.Center, num339 * (float)num344, nPC.Center, nPC.velocity);
23766 if (chaseResults.InterceptionHappens && chaseResults.InterceptionTime <= 180f)
23767 {
23768 Vector2 vector29 = chaseResults.ChaserVelocity / num344;
23769 num340 = vector29.X;
23770 num341 = vector29.Y;
23771 }
23773 Main.player[owner].crystalLeafCooldown = 40;
23774 }
23775 }
23776 else if (aiStyle == 43)
23777 {
23778 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 3.14f;
23779 if (soundDelay == 0 && type == 227)
23780 {
23781 soundDelay = -1;
23782 SoundEngine.PlaySound(6, (int)base.position.X, (int)base.position.Y);
23783 for (int num345 = 0; num345 < 8; num345++)
23784 {
23785 int num346 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 157);
23786 Main.dust[num346].noGravity = true;
23788 dust2.velocity *= 3f;
23789 Main.dust[num346].scale = 1.5f;
23790 dust2 = Main.dust[num346];
23791 dust2.velocity += velocity * Main.rand.NextFloat();
23792 }
23793 }
23794 float num347 = 1f - (float)timeLeft / 180f;
23795 float num348 = ((num347 * -6f * 0.85f + 0.33f) % 1f + 1f) % 1f;
23796 Color value3 = Main.hslToRgb(num348, 1f, 0.5f);
23797 value3 = Color.Lerp(value3, Color.Red, Utils.Remap(num348, 0.33f, 0.7f, 0f, 1f));
23798 value3 = Color.Lerp(value3, Color.Lerp(Color.LimeGreen, Color.Gold, 0.3f), (float)(int)value3.R / 255f * 1f);
23799 if (frameCounter++ >= 1)
23800 {
23801 frameCounter = 0;
23803 {
23804 PositionInWorld = base.Center,
23805 MovementVector = velocity,
23806 UniqueInfoPiece = (byte)(Main.rgbToHsl(value3).X * 255f)
23807 });
23808 }
23809 Lighting.AddLight(base.Center, new Vector3(0.05f, 0.2f, 0.1f) * 1.5f);
23810 if (Main.rand.Next(5) == 0)
23811 {
23812 Dust dust12 = Dust.NewDustDirect(new Vector2(base.position.X, base.position.Y), width, height, 63);
23813 dust12.noGravity = true;
23814 Dust dust2 = dust12;
23815 dust2.velocity *= 0.1f;
23816 dust12.scale = 1.5f;
23817 dust2 = dust12;
23818 dust2.velocity += velocity * Main.rand.NextFloat();
23819 dust12.color = value3;
23820 dust12.color.A /= 4;
23821 dust12.alpha = 100;
23822 dust12.noLight = true;
23823 }
23824 }
23825 else if (aiStyle == 44)
23826 {
23827 int num349 = 6;
23828 if (type == 228)
23829 {
23830 velocity *= 0.96f;
23831 alpha += 2;
23832 if (alpha > 200)
23833 {
23834 Kill();
23835 }
23836 }
23837 else if (type == 732)
23838 {
23839 num349 = 3;
23840 alpha += 20;
23841 if (alpha > 255)
23842 {
23843 Kill();
23844 }
23845 if (Main.rand.Next(5) == 0)
23846 {
23847 Dust dust13 = Dust.NewDustDirect(base.position, width, height, 226, 0f, 0f, 150, default(Color), 0.8f);
23848 dust13.noGravity = true;
23849 Dust dust2 = dust13;
23850 dust2.velocity *= 1.2f;
23851 }
23852 rotation = velocity.ToRotation();
23853 Lighting.AddLight(base.Center, 0.3f, 0.6f, 0.8f);
23854 }
23855 else if (type == 229)
23856 {
23857 if (this.ai[0] == 0f)
23858 {
23860 }
23861 this.ai[0] += 1f;
23862 if (this.ai[0] > 20f)
23863 {
23864 velocity.Y += 0.3f;
23865 velocity.X *= 0.98f;
23866 }
23867 }
23868 if (++frameCounter >= num349)
23869 {
23870 frameCounter = 0;
23871 if (++frame >= Main.projFrames[type])
23872 {
23873 frame = 0;
23874 }
23875 }
23876 }
23877 else if (aiStyle == 45)
23878 {
23879 if (type == 237 || type == 243)
23880 {
23881 float num350 = this.ai[0];
23882 float num351 = this.ai[1];
23883 if (num350 != 0f && num351 != 0f)
23884 {
23885 bool flag16 = false;
23886 bool flag17 = false;
23887 if (velocity.X == 0f || (velocity.X < 0f && base.Center.X < num350) || (velocity.X > 0f && base.Center.X > num350))
23888 {
23889 velocity.X = 0f;
23890 flag16 = true;
23891 }
23892 if (velocity.Y == 0f || (velocity.Y < 0f && base.Center.Y < num351) || (velocity.Y > 0f && base.Center.Y > num351))
23893 {
23894 velocity.Y = 0f;
23895 flag17 = true;
23896 }
23897 if (owner == Main.myPlayer && flag16 && flag17)
23898 {
23899 Kill();
23900 }
23901 }
23902 rotation += velocity.X * 0.02f;
23903 frameCounter++;
23904 if (frameCounter > 4)
23905 {
23906 frameCounter = 0;
23907 frame++;
23908 if (frame > 3)
23909 {
23910 frame = 0;
23911 }
23912 }
23913 }
23914 else if (type == 238 || type == 244)
23915 {
23916 bool flag18 = true;
23917 int num352 = (int)base.Center.X;
23918 int num353 = (int)(base.position.Y + (float)height);
23919 if (Collision.SolidTiles(new Vector2(num352, num353), 2, 20))
23920 {
23921 flag18 = false;
23922 }
23923 frameCounter++;
23924 if (frameCounter > 8)
23925 {
23926 frameCounter = 0;
23927 frame++;
23928 if ((!flag18 && frame > 2) || frame > 5)
23929 {
23930 frame = 0;
23931 }
23932 }
23933 this.ai[1] += 1f;
23934 if (type == 244 && this.ai[1] >= 18000f)
23935 {
23936 alpha += 5;
23937 if (alpha > 255)
23938 {
23939 alpha = 255;
23940 Kill();
23941 }
23942 }
23943 else if (type == 238 && this.ai[1] >= 18000f)
23944 {
23945 alpha += 5;
23946 if (alpha > 255)
23947 {
23948 alpha = 255;
23949 Kill();
23950 }
23951 }
23952 else if (flag18)
23953 {
23954 this.ai[0] += 1f;
23955 if (type == 244)
23956 {
23957 if (this.ai[0] > 10f)
23958 {
23959 this.ai[0] = 0f;
23960 if (owner == Main.myPlayer)
23961 {
23962 num352 += Main.rand.Next(-14, 15);
23964 }
23965 }
23966 }
23967 else if (this.ai[0] > 8f)
23968 {
23969 this.ai[0] = 0f;
23970 if (owner == Main.myPlayer)
23971 {
23972 num352 += Main.rand.Next(-14, 15);
23974 }
23975 }
23976 }
23977 localAI[0] += 1f;
23978 if (!(localAI[0] >= 10f))
23979 {
23980 return;
23981 }
23982 localAI[0] = 0f;
23983 int num354 = 0;
23984 int num355 = 0;
23985 float num356 = 0f;
23986 int num357 = type;
23987 for (int num358 = 0; num358 < 1000; num358++)
23988 {
23989 if (Main.projectile[num358].active && Main.projectile[num358].owner == owner && Main.projectile[num358].type == num357 && Main.projectile[num358].ai[1] < 18000f)
23990 {
23991 num354++;
23992 if (Main.projectile[num358].ai[1] > num356)
23993 {
23994 num355 = num358;
23995 num356 = Main.projectile[num358].ai[1];
23996 }
23997 }
23998 }
23999 if (type == 244)
24000 {
24001 if (num354 > 1)
24002 {
24003 Main.projectile[num355].netUpdate = true;
24004 Main.projectile[num355].ai[1] = 18000f;
24005 }
24006 }
24007 else if (num354 > 2)
24008 {
24009 Main.projectile[num355].netUpdate = true;
24010 Main.projectile[num355].ai[1] = 18000f;
24011 }
24012 }
24013 else if (type == 239 || type == 245 || type == 264)
24014 {
24015 int num359 = (int)(base.Center.X / 16f);
24016 int num360 = (int)((base.position.Y + (float)height) / 16f);
24017 if (WorldGen.InWorld(num359, num360) && Main.tile[num359, num360] != null && Main.tile[num359, num360].liquid == byte.MaxValue && Main.tile[num359, num360].shimmer() && velocity.Y > 0f)
24018 {
24019 velocity.Y *= -1f;
24020 netUpdate = true;
24021 }
24022 if (type == 239)
24023 {
24024 alpha = 50;
24025 }
24026 else if (type == 245)
24027 {
24028 alpha = 100;
24029 }
24030 else if (type == 264)
24031 {
24032 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 1.57f;
24033 }
24034 }
24035 }
24036 else if (aiStyle == 46)
24037 {
24038 int num361 = (int)(base.Center.X / 16f);
24039 int num362 = (int)(base.Center.Y / 16f);
24040 if (WorldGen.InWorld(num361, num362) && Main.tile[num361, num362] != null && Main.tile[num361, num362].liquid > 0 && Main.tile[num361, num362].shimmer())
24041 {
24042 Kill();
24043 }
24044 int num363 = 2400;
24045 if (type == 250)
24046 {
24047 Point point2 = base.Center.ToTileCoordinates();
24048 if (!WorldGen.InWorld(point2.X, point2.Y, 2) || Main.tile[point2.X, point2.Y] == null)
24049 {
24050 Kill();
24051 return;
24052 }
24053 if (owner == Main.myPlayer)
24054 {
24055 localAI[0] += 1f;
24056 if (localAI[0] > 4f)
24057 {
24058 localAI[0] = 3f;
24059 NewProjectile(GetProjectileSource_FromThis(), base.Center.X, base.Center.Y, velocity.X * 0.001f, velocity.Y * 0.001f, 251, damage, knockBack, owner);
24060 }
24061 if (timeLeft > num363)
24062 {
24063 timeLeft = num363;
24064 }
24065 }
24066 float num364 = 1f;
24067 if (velocity.Y < 0f)
24068 {
24069 num364 -= velocity.Y / 3f;
24070 }
24071 this.ai[0] += num364;
24072 if (this.ai[0] > 30f)
24073 {
24074 velocity.Y += 0.5f;
24075 if (velocity.Y > 0f)
24076 {
24077 velocity.X *= 0.95f;
24078 }
24079 else
24080 {
24081 velocity.X *= 1.05f;
24082 }
24083 }
24084 float x3 = velocity.X;
24085 float y3 = velocity.Y;
24086 float num365 = (float)Math.Sqrt(x3 * x3 + y3 * y3);
24087 num365 = 15.95f * scale / num365;
24088 x3 *= num365;
24089 y3 *= num365;
24090 velocity.X = x3;
24091 velocity.Y = y3;
24092 rotation = (float)Math.Atan2(velocity.Y, velocity.X) - 1.57f;
24093 return;
24094 }
24095 if (localAI[0] == 0f)
24096 {
24097 if (velocity.X > 0f)
24098 {
24099 spriteDirection = -1;
24100 rotation = (float)Math.Atan2(velocity.Y, velocity.X) - 1.57f;
24101 }
24102 else
24103 {
24104 spriteDirection = 1;
24105 rotation = (float)Math.Atan2(velocity.Y, velocity.X) - 1.57f;
24106 }
24107 localAI[0] = 1f;
24108 timeLeft = num363;
24109 }
24110 velocity.X *= 0.98f;
24111 velocity.Y *= 0.98f;
24112 if (rotation == 0f)
24113 {
24114 alpha = 255;
24115 }
24116 else if (timeLeft < 10)
24117 {
24118 alpha = 255 - (int)(255f * (float)timeLeft / 10f);
24119 }
24120 else if (timeLeft > num363 - 10)
24121 {
24122 int num366 = num363 - timeLeft;
24123 alpha = 255 - (int)(255f * (float)num366 / 10f);
24124 }
24125 else
24126 {
24127 alpha = 0;
24128 }
24129 }
24130 else if (aiStyle == 47)
24131 {
24133 }
24134 else if (aiStyle == 48)
24135 {
24136 if (type == 255)
24137 {
24138 for (int num367 = 0; num367 < 4; num367++)
24139 {
24140 Vector2 vector30 = base.position;
24141 vector30 -= velocity * ((float)num367 * 0.25f);
24142 alpha = 255;
24143 int num368 = Dust.NewDust(vector30, 1, 1, 160);
24144 Main.dust[num368].position = vector30;
24145 Main.dust[num368].position.X += width / 2;
24146 Main.dust[num368].position.Y += height / 2;
24147 Main.dust[num368].scale = (float)Main.rand.Next(70, 110) * 0.013f;
24149 dust2.velocity *= 0.2f;
24150 }
24151 return;
24152 }
24153 if (type == 433)
24154 {
24155 for (int num369 = 0; num369 < 2; num369++)
24156 {
24157 Vector2 vector31 = base.position;
24158 vector31 -= velocity * ((float)num369 * 0.25f);
24159 alpha = 255;
24160 int num370 = Dust.NewDust(vector31, 1, 1, 160);
24161 Main.dust[num370].position = vector31;
24162 Main.dust[num370].position.X += width / 2;
24163 Main.dust[num370].position.Y += height / 2;
24164 if (Main.rand.Next(2) == 0)
24165 {
24166 Main.dust[num370].color = Color.LimeGreen;
24167 }
24168 else
24169 {
24171 }
24172 Main.dust[num370].scale = (float)Main.rand.Next(70, 110) * 0.013f;
24174 dust2.velocity *= 0.2f;
24175 }
24176 return;
24177 }
24178 if (type == 290)
24179 {
24180 if (localAI[0] == 0f)
24181 {
24183 }
24184 localAI[0] += 1f;
24185 if (localAI[0] > 3f)
24186 {
24187 for (int num371 = 0; num371 < 3; num371++)
24188 {
24189 Vector2 vector32 = base.position;
24190 vector32 -= velocity * ((float)num371 * 0.3334f);
24191 alpha = 255;
24192 int num372 = Dust.NewDust(vector32, 1, 1, 173);
24193 Main.dust[num372].position = vector32;
24194 Main.dust[num372].scale = (float)Main.rand.Next(70, 110) * 0.013f;
24196 dust2.velocity *= 0.2f;
24197 }
24198 }
24199 return;
24200 }
24201 if (type == 294)
24202 {
24203 localAI[0] += 1f;
24204 if (localAI[0] > 9f)
24205 {
24206 for (int num373 = 0; num373 < 4; num373++)
24207 {
24208 Vector2 vector33 = base.position;
24209 vector33 -= velocity * ((float)num373 * 0.25f);
24210 alpha = 255;
24211 int num374 = Dust.NewDust(vector33, 1, 1, 173);
24212 Main.dust[num374].position = vector33;
24213 Main.dust[num374].scale = (float)Main.rand.Next(70, 110) * 0.013f;
24215 dust2.velocity *= 0.2f;
24216 }
24217 }
24218 return;
24219 }
24220 localAI[0] += 1f;
24221 if (localAI[0] > 3f)
24222 {
24223 for (int num375 = 0; num375 < 4; num375++)
24224 {
24225 Vector2 vector34 = base.position;
24226 vector34 -= velocity * ((float)num375 * 0.25f);
24227 alpha = 255;
24228 int num376 = Dust.NewDust(vector34, 1, 1, 162);
24229 Main.dust[num376].position = vector34;
24230 Main.dust[num376].position.X += width / 2;
24231 Main.dust[num376].position.Y += height / 2;
24232 Main.dust[num376].scale = (float)Main.rand.Next(70, 110) * 0.013f;
24234 dust2.velocity *= 0.2f;
24235 }
24236 }
24237 }
24238 else if (aiStyle == 49)
24239 {
24240 if (this.ai[0] == -2f)
24241 {
24242 hostile = true;
24243 Kill();
24244 return;
24245 }
24246 if (this.ai[0] == -3f)
24247 {
24248 Kill();
24249 return;
24250 }
24251 if (soundDelay == 0)
24252 {
24253 soundDelay = 3000;
24255 }
24256 if (this.ai[0] >= 0f)
24257 {
24258 if (velocity.X > 0f)
24259 {
24260 direction = 1;
24261 }
24262 else if (velocity.X < 0f)
24263 {
24264 direction = -1;
24265 }
24267 this.ai[0] += 1f;
24268 rotation += velocity.X * 0.05f + (float)direction * 0.05f;
24269 if (this.ai[0] >= 18f)
24270 {
24271 velocity.Y += 0.28f;
24272 velocity.X *= 0.99f;
24273 }
24274 if ((double)velocity.Y > 15.9)
24275 {
24276 velocity.Y = 15.9f;
24277 }
24278 if (!(this.ai[0] > 2f))
24279 {
24280 return;
24281 }
24282 alpha = 0;
24283 if (this.ai[0] == 3f)
24284 {
24285 for (int num377 = 0; num377 < 10; num377++)
24286 {
24287 int num378 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 31, 0f, 0f, 100, default(Color), 1.5f);
24289 dust2.velocity *= 0.5f;
24290 dust2 = Main.dust[num378];
24291 dust2.velocity += velocity * 0.1f;
24292 }
24293 for (int num379 = 0; num379 < 5; num379++)
24294 {
24295 int num380 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 6, 0f, 0f, 100, default(Color), 2f);
24296 Main.dust[num380].noGravity = true;
24298 dust2.velocity *= 3f;
24299 dust2 = Main.dust[num380];
24300 dust2.velocity += velocity * 0.2f;
24301 num380 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 6, 0f, 0f, 100);
24302 dust2 = Main.dust[num380];
24303 dust2.velocity *= 2f;
24304 dust2 = Main.dust[num380];
24305 dust2.velocity += velocity * 0.3f;
24306 }
24307 for (int num381 = 0; num381 < 1; num381++)
24308 {
24309 int num382 = Gore.NewGore(new Vector2(base.position.X - 10f, base.position.Y - 10f), default(Vector2), Main.rand.Next(61, 64));
24310 Gore gore = Main.gore[num382];
24311 gore.position += velocity * 1.25f;
24312 Main.gore[num382].scale = 1.5f;
24313 gore = Main.gore[num382];
24314 gore.velocity += velocity * 0.5f;
24315 gore = Main.gore[num382];
24316 gore.velocity *= 0.02f;
24317 }
24318 }
24319 }
24320 else if (this.ai[0] == -1f)
24321 {
24322 rotation = 0f;
24323 velocity.X *= 0.95f;
24324 velocity.Y += 0.2f;
24325 }
24326 }
24327 else if (aiStyle == 50)
24328 {
24329 if (type == 291)
24330 {
24331 if (localAI[0] == 0f)
24332 {
24334 localAI[0] += 1f;
24335 }
24336 bool flag19 = false;
24337 bool flag20 = false;
24338 if (velocity.X < 0f && base.position.X < this.ai[0])
24339 {
24340 flag19 = true;
24341 }
24342 if (velocity.X > 0f && base.position.X > this.ai[0])
24343 {
24344 flag19 = true;
24345 }
24346 if (velocity.Y < 0f && base.position.Y < this.ai[1])
24347 {
24348 flag20 = true;
24349 }
24350 if (velocity.Y > 0f && base.position.Y > this.ai[1])
24351 {
24352 flag20 = true;
24353 }
24354 if (flag19 && flag20)
24355 {
24356 Kill();
24357 }
24358 for (int num383 = 0; num383 < 10; num383++)
24359 {
24360 int num384 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 174, 0f, 0f, 100, default(Color), 1.2f);
24361 Main.dust[num384].noGravity = true;
24363 dust2.velocity *= 0.5f;
24364 dust2 = Main.dust[num384];
24365 dust2.velocity += velocity * 0.1f;
24366 }
24367 return;
24368 }
24369 if (type == 295)
24370 {
24371 for (int num385 = 0; num385 < 8; num385++)
24372 {
24373 int num386 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 174, 0f, 0f, 100, default(Color), 1.2f);
24374 Main.dust[num386].noGravity = true;
24376 dust2.velocity *= 0.5f;
24377 dust2 = Main.dust[num386];
24378 dust2.velocity += velocity * 0.1f;
24379 }
24380 return;
24381 }
24382 if (localAI[0] == 0f)
24383 {
24385 localAI[0] += 1f;
24386 }
24387 this.ai[0] += 1f;
24388 if (type == 296)
24389 {
24390 this.ai[0] += 3f;
24391 }
24392 float num387 = 25f;
24393 if (this.ai[0] > 540f)
24394 {
24395 num387 -= (this.ai[0] - 180f) / 2f;
24396 }
24397 if (num387 <= 0f)
24398 {
24399 num387 = 0f;
24400 Kill();
24401 }
24402 if (type == 296)
24403 {
24404 num387 *= 0.7f;
24405 }
24406 for (int num388 = 0; (float)num388 < num387; num388++)
24407 {
24408 float num389 = Main.rand.Next(-10, 11);
24409 float num390 = Main.rand.Next(-10, 11);
24410 float num391 = Main.rand.Next(3, 9);
24411 float num392 = (float)Math.Sqrt(num389 * num389 + num390 * num390);
24412 num392 = num391 / num392;
24413 num389 *= num392;
24414 num390 *= num392;
24415 int num393 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 174, 0f, 0f, 100, default(Color), 1.5f);
24416 Main.dust[num393].noGravity = true;
24417 Main.dust[num393].position.X = base.Center.X;
24418 Main.dust[num393].position.Y = base.Center.Y;
24419 Main.dust[num393].position.X += Main.rand.Next(-10, 11);
24420 Main.dust[num393].position.Y += Main.rand.Next(-10, 11);
24421 Main.dust[num393].velocity.X = num389;
24422 Main.dust[num393].velocity.Y = num390;
24423 }
24424 }
24425 else if (aiStyle == 51)
24426 {
24427 if (type == 297)
24428 {
24429 localAI[0] += 1f;
24430 if (localAI[0] > 4f)
24431 {
24432 for (int num394 = 0; num394 < 5; num394++)
24433 {
24434 int num395 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 175, 0f, 0f, 100, default(Color), 2f);
24435 Main.dust[num395].noGravity = true;
24437 dust2.velocity *= 0f;
24438 }
24439 }
24440 }
24441 else
24442 {
24443 if (localAI[0] == 0f)
24444 {
24446 localAI[0] += 1f;
24447 }
24448 for (int num396 = 0; num396 < 9; num396++)
24449 {
24450 int num397 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 175, 0f, 0f, 100, default(Color), 1.3f);
24451 Main.dust[num397].noGravity = true;
24453 dust2.velocity *= 0f;
24454 }
24455 }
24456 float num398 = base.Center.X;
24457 float num399 = base.Center.Y;
24458 float num400 = 400f;
24459 bool flag21 = false;
24460 int num401 = 0;
24461 if (type == 297)
24462 {
24463 for (int num402 = 0; num402 < 200; num402++)
24464 {
24465 if (Main.npc[num402].CanBeChasedBy(this) && Distance(Main.npc[num402].Center) < num400 && Collision.CanHit(base.Center, 1, 1, Main.npc[num402].Center, 1, 1))
24466 {
24467 float num403 = Main.npc[num402].position.X + (float)(Main.npc[num402].width / 2);
24468 float num404 = Main.npc[num402].position.Y + (float)(Main.npc[num402].height / 2);
24469 float num405 = Math.Abs(base.position.X + (float)(width / 2) - num403) + Math.Abs(base.position.Y + (float)(height / 2) - num404);
24470 if (num405 < num400)
24471 {
24472 num400 = num405;
24473 num398 = num403;
24474 num399 = num404;
24475 flag21 = true;
24476 num401 = num402;
24477 }
24478 }
24479 }
24480 }
24481 else
24482 {
24483 num400 = 200f;
24484 for (int num406 = 0; num406 < 255; num406++)
24485 {
24486 if (Main.player[num406].active && !Main.player[num406].dead)
24487 {
24488 float num407 = Main.player[num406].position.X + (float)(Main.player[num406].width / 2);
24489 float num408 = Main.player[num406].position.Y + (float)(Main.player[num406].height / 2);
24490 float num409 = Math.Abs(base.position.X + (float)(width / 2) - num407) + Math.Abs(base.position.Y + (float)(height / 2) - num408);
24491 if (num409 < num400)
24492 {
24493 num400 = num409;
24494 num398 = num407;
24495 num399 = num408;
24496 flag21 = true;
24497 num401 = num406;
24498 }
24499 }
24500 }
24501 }
24502 if (flag21)
24503 {
24504 float num410 = 3f;
24505 if (type == 297)
24506 {
24507 num410 = 6f;
24508 }
24509 Vector2 vector35 = new Vector2(base.position.X + (float)width * 0.5f, base.position.Y + (float)height * 0.5f);
24510 float num411 = num398 - vector35.X;
24511 float num412 = num399 - vector35.Y;
24512 float num413 = (float)Math.Sqrt(num411 * num411 + num412 * num412);
24513 float num414 = num413;
24514 num413 = num410 / num413;
24515 num411 *= num413;
24516 num412 *= num413;
24517 if (type == 297)
24518 {
24519 velocity.X = (velocity.X * 20f + num411) / 21f;
24520 velocity.Y = (velocity.Y * 20f + num412) / 21f;
24521 }
24522 else
24523 {
24524 velocity.X = (velocity.X * 100f + num411) / 101f;
24525 velocity.Y = (velocity.Y * 100f + num412) / 101f;
24526 }
24527 }
24528 }
24529 else if (aiStyle == 52)
24530 {
24531 int num415 = (int)this.ai[0];
24532 float num416 = 4f;
24533 Vector2 vector36 = new Vector2(base.position.X + (float)width * 0.5f, base.position.Y + (float)height * 0.5f);
24534 float num417 = Main.player[num415].Center.X - vector36.X;
24535 float num418 = Main.player[num415].Center.Y - vector36.Y;
24536 float num419 = (float)Math.Sqrt(num417 * num417 + num418 * num418);
24537 float num420 = num419;
24538 if (num419 < 50f && base.position.X < Main.player[num415].position.X + (float)Main.player[num415].width && base.position.X + (float)width > Main.player[num415].position.X && base.position.Y < Main.player[num415].position.Y + (float)Main.player[num415].height && base.position.Y + (float)height > Main.player[num415].position.Y)
24539 {
24540 if (owner == Main.myPlayer && !Main.player[Main.myPlayer].moonLeech)
24541 {
24542 int num421 = (int)this.ai[1];
24543 Main.player[num415].HealEffect(num421, broadcast: false);
24545 player3.statLife += num421;
24546 if (Main.player[num415].statLife > Main.player[num415].statLifeMax2)
24547 {
24548 Main.player[num415].statLife = Main.player[num415].statLifeMax2;
24549 }
24550 NetMessage.SendData(66, -1, -1, null, num415, num421);
24551 }
24552 Kill();
24553 }
24554 num419 = num416 / num419;
24555 num417 *= num419;
24556 num418 *= num419;
24557 velocity.X = (velocity.X * 15f + num417) / 16f;
24558 velocity.Y = (velocity.Y * 15f + num418) / 16f;
24559 if (type == 305)
24560 {
24561 for (int num422 = 0; num422 < 3; num422++)
24562 {
24563 float num423 = velocity.X * 0.334f * (float)num422;
24564 float num424 = (0f - velocity.Y * 0.334f) * (float)num422;
24565 int num425 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 183, 0f, 0f, 100, default(Color), 1.1f);
24566 Main.dust[num425].noGravity = true;
24568 dust2.velocity *= 0f;
24569 Main.dust[num425].position.X -= num423;
24570 Main.dust[num425].position.Y -= num424;
24571 }
24572 }
24573 else
24574 {
24575 for (int num426 = 0; num426 < 5; num426++)
24576 {
24577 float num427 = velocity.X * 0.2f * (float)num426;
24578 float num428 = (0f - velocity.Y * 0.2f) * (float)num426;
24579 int num429 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 175, 0f, 0f, 100, default(Color), 1.3f);
24580 Main.dust[num429].noGravity = true;
24582 dust2.velocity *= 0f;
24583 Main.dust[num429].position.X -= num427;
24584 Main.dust[num429].position.Y -= num428;
24585 }
24586 }
24587 }
24588 else if (aiStyle == 53)
24589 {
24590 if (localAI[0] == 0f)
24591 {
24592 localAI[1] = 1f;
24593 localAI[0] = 1f;
24594 this.ai[0] = 120f;
24595 int num430 = 80;
24597 if (type == 308)
24598 {
24599 for (int num431 = 0; num431 < num430; num431++)
24600 {
24601 int num432 = Dust.NewDust(new Vector2(base.position.X, base.position.Y + 16f), width, height - 16, 185);
24603 dust2.velocity *= 2f;
24604 Main.dust[num432].noGravity = true;
24605 dust2 = Main.dust[num432];
24606 dust2.scale *= 1.15f;
24607 }
24608 }
24609 if (type == 377)
24610 {
24611 frame = 4;
24612 num430 = 40;
24613 for (int num433 = 0; num433 < num430; num433++)
24614 {
24615 int num434 = Dust.NewDust(base.position + Vector2.UnitY * 16f, width, height - 16, 171, 0f, 0f, 100);
24616 Main.dust[num434].scale = (float)Main.rand.Next(1, 10) * 0.1f;
24617 Main.dust[num434].noGravity = true;
24618 Main.dust[num434].fadeIn = 1.5f;
24620 dust2.velocity *= 0.75f;
24621 }
24622 }
24623 if (type == 966)
24624 {
24625 this.ai[1] = -1f;
24626 frame = 0;
24627 num430 = 30;
24628 int num435 = 25;
24629 int num436 = 30;
24630 for (int num437 = 0; num437 < num430; num437++)
24631 {
24632 int num438 = Dust.NewDust(base.Center - new Vector2(num435, num436), num435 * 2, num436 * 2, 219);
24634 dust2.velocity *= 2f;
24635 Main.dust[num438].noGravity = true;
24636 dust2 = Main.dust[num438];
24637 dust2.scale *= 0.5f;
24638 }
24639 }
24640 }
24641 velocity.X = 0f;
24642 velocity.Y += 0.2f;
24643 if (velocity.Y > 16f)
24644 {
24645 velocity.Y = 16f;
24646 }
24647 bool flag22 = false;
24648 float num439 = base.Center.X;
24649 float num440 = base.Center.Y;
24650 float num441 = 1000f;
24651 int num442 = -1;
24653 if (ownerMinionAttackTargetNPC != null && ownerMinionAttackTargetNPC.CanBeChasedBy(this))
24654 {
24655 float num443 = ownerMinionAttackTargetNPC.position.X + (float)(ownerMinionAttackTargetNPC.width / 2);
24656 float num444 = ownerMinionAttackTargetNPC.position.Y + (float)(ownerMinionAttackTargetNPC.height / 2);
24657 float num445 = Math.Abs(base.position.X + (float)(width / 2) - num443) + Math.Abs(base.position.Y + (float)(height / 2) - num444);
24659 {
24660 num441 = num445;
24661 num439 = num443;
24662 num440 = num444;
24663 flag22 = true;
24665 }
24666 }
24667 if (!flag22)
24668 {
24669 for (int num446 = 0; num446 < 200; num446++)
24670 {
24671 if (Main.npc[num446].CanBeChasedBy(this))
24672 {
24673 float num447 = Main.npc[num446].position.X + (float)(Main.npc[num446].width / 2);
24674 float num448 = Main.npc[num446].position.Y + (float)(Main.npc[num446].height / 2);
24675 float num449 = Math.Abs(base.position.X + (float)(width / 2) - num447) + Math.Abs(base.position.Y + (float)(height / 2) - num448);
24676 if (num449 < num441 && Collision.CanHit(base.position, width, height, Main.npc[num446].position, Main.npc[num446].width, Main.npc[num446].height))
24677 {
24678 num441 = num449;
24679 num439 = num447;
24680 num440 = num448;
24681 flag22 = true;
24682 num442 = Main.npc[num446].whoAmI;
24683 }
24684 }
24685 }
24686 }
24687 if (flag22)
24688 {
24689 if (type == 966 && this.ai[1] != (float)num442)
24690 {
24691 this.ai[1] = num442;
24692 netUpdate = true;
24693 }
24694 float num450 = num439;
24695 float num451 = num440;
24696 num439 -= base.Center.X;
24697 num440 -= base.Center.Y;
24698 int num452 = 0;
24699 if (type != 966)
24700 {
24701 if (frameCounter > 0)
24702 {
24703 frameCounter--;
24704 }
24705 if (frameCounter <= 0)
24706 {
24707 int num453 = spriteDirection;
24708 if (num439 < 0f)
24709 {
24710 spriteDirection = -1;
24711 }
24712 else
24713 {
24714 spriteDirection = 1;
24715 }
24716 num452 = ((!(num440 > 0f)) ? ((Math.Abs(num440) > Math.Abs(num439) * 3f) ? 4 : ((Math.Abs(num440) > Math.Abs(num439) * 2f) ? 3 : ((!(Math.Abs(num439) > Math.Abs(num440) * 3f)) ? ((Math.Abs(num439) > Math.Abs(num440) * 2f) ? 1 : 2) : 0))) : 0);
24717 int num454 = frame;
24718 if (type == 308)
24719 {
24720 frame = num452 * 2;
24721 }
24722 else if (type == 377)
24723 {
24724 frame = num452;
24725 }
24726 if (this.ai[0] > 40f && localAI[1] == 0f && type == 308)
24727 {
24728 frame++;
24729 }
24730 if (num454 != frame || num453 != spriteDirection)
24731 {
24732 frameCounter = 8;
24733 if (this.ai[0] <= 0f)
24734 {
24735 frameCounter = 4;
24736 }
24737 }
24738 }
24739 }
24740 if (this.ai[0] <= 0f)
24741 {
24742 float num455 = 60f;
24743 if (type == 966)
24744 {
24745 num455 = 90f;
24746 }
24747 localAI[1] = 0f;
24748 this.ai[0] = num455;
24749 netUpdate = true;
24750 if (Main.myPlayer == owner)
24751 {
24752 float num456 = 6f;
24753 int num457 = 309;
24754 if (type == 308)
24755 {
24756 num457 = 309;
24757 num456 = 9f;
24758 }
24759 if (type == 377)
24760 {
24761 num457 = 378;
24762 num456 = 9f;
24763 }
24764 if (type == 966)
24765 {
24766 num457 = 967;
24767 num456 = 12.5f;
24768 }
24769 Vector2 vector37 = new Vector2(base.position.X + (float)width * 0.5f, base.position.Y + (float)height * 0.5f);
24770 if (type == 966)
24771 {
24772 vector37.Y -= 16f;
24773 }
24774 else
24775 {
24776 switch (num452)
24777 {
24778 case 0:
24779 vector37.Y += 12f;
24780 vector37.X += 24 * spriteDirection;
24781 break;
24782 case 1:
24783 vector37.Y += 0f;
24784 vector37.X += 24 * spriteDirection;
24785 break;
24786 case 2:
24787 vector37.Y -= 2f;
24788 vector37.X += 24 * spriteDirection;
24789 break;
24790 case 3:
24791 vector37.Y -= 6f;
24792 vector37.X += 14 * spriteDirection;
24793 break;
24794 case 4:
24795 vector37.Y -= 14f;
24796 vector37.X += 2 * spriteDirection;
24797 break;
24798 }
24799 }
24800 if (type != 966 && spriteDirection < 0)
24801 {
24802 vector37.X += 10f;
24803 }
24804 float num458 = num450 - vector37.X;
24805 float num459 = num451 - vector37.Y;
24806 float num460 = (float)Math.Sqrt(num458 * num458 + num459 * num459);
24807 float num461 = num460;
24808 num460 = num456 / num460;
24809 num458 *= num460;
24810 num459 *= num460;
24811 int num462 = damage;
24813 }
24814 }
24815 }
24816 else
24817 {
24818 if (type == 966 && this.ai[1] != -1f)
24819 {
24820 this.ai[1] = -1f;
24821 netUpdate = true;
24822 }
24823 if (type != 966 && this.ai[0] <= 60f && (frame == 1 || frame == 3 || frame == 5 || frame == 7 || frame == 9))
24824 {
24825 frame--;
24826 }
24827 }
24828 if (this.ai[0] > 0f)
24829 {
24830 this.ai[0] -= 1f;
24831 }
24832 }
24833 else if (aiStyle == 54)
24834 {
24835 if (type == 317)
24836 {
24837 if (Main.player[Main.myPlayer].dead)
24838 {
24839 Main.player[Main.myPlayer].raven = false;
24840 }
24841 if (Main.player[Main.myPlayer].raven)
24842 {
24843 timeLeft = 2;
24844 }
24845 }
24846 for (int num464 = 0; num464 < 1000; num464++)
24847 {
24848 if (num464 != whoAmI && Main.projectile[num464].active && Main.projectile[num464].owner == owner && Main.projectile[num464].type == type && Math.Abs(base.position.X - Main.projectile[num464].position.X) + Math.Abs(base.position.Y - Main.projectile[num464].position.Y) < (float)width)
24849 {
24850 if (base.position.X < Main.projectile[num464].position.X)
24851 {
24852 velocity.X -= 0.05f;
24853 }
24854 else
24855 {
24856 velocity.X += 0.05f;
24857 }
24858 if (base.position.Y < Main.projectile[num464].position.Y)
24859 {
24860 velocity.Y -= 0.05f;
24861 }
24862 else
24863 {
24864 velocity.Y += 0.05f;
24865 }
24866 }
24867 }
24868 float num465 = base.position.X;
24869 float num466 = base.position.Y;
24870 float num467 = 900f;
24871 bool flag23 = false;
24872 int num468 = 500;
24873 if (this.ai[1] != 0f || friendly)
24874 {
24875 num468 = 1400;
24876 }
24877 if (Math.Abs(base.Center.X - Main.player[owner].Center.X) + Math.Abs(base.Center.Y - Main.player[owner].Center.Y) > (float)num468)
24878 {
24879 this.ai[0] = 1f;
24880 }
24881 if (this.ai[0] == 0f)
24882 {
24883 tileCollide = true;
24885 if (ownerMinionAttackTargetNPC2 != null && ownerMinionAttackTargetNPC2.CanBeChasedBy(this))
24886 {
24887 float num469 = ownerMinionAttackTargetNPC2.position.X + (float)(ownerMinionAttackTargetNPC2.width / 2);
24888 float num470 = ownerMinionAttackTargetNPC2.position.Y + (float)(ownerMinionAttackTargetNPC2.height / 2);
24889 float num471 = Math.Abs(base.position.X + (float)(width / 2) - num469) + Math.Abs(base.position.Y + (float)(height / 2) - num470);
24891 {
24892 num467 = num471;
24893 num465 = num469;
24894 num466 = num470;
24895 flag23 = true;
24896 }
24897 }
24898 if (!flag23)
24899 {
24900 for (int num472 = 0; num472 < 200; num472++)
24901 {
24902 if (Main.npc[num472].CanBeChasedBy(this))
24903 {
24904 float num473 = Main.npc[num472].position.X + (float)(Main.npc[num472].width / 2);
24905 float num474 = Main.npc[num472].position.Y + (float)(Main.npc[num472].height / 2);
24906 float num475 = Math.Abs(base.position.X + (float)(width / 2) - num473) + Math.Abs(base.position.Y + (float)(height / 2) - num474);
24907 if (num475 < num467 && Collision.CanHit(base.position, width, height, Main.npc[num472].position, Main.npc[num472].width, Main.npc[num472].height))
24908 {
24909 num467 = num475;
24910 num465 = num473;
24911 num466 = num474;
24912 flag23 = true;
24913 }
24914 }
24915 }
24916 }
24917 }
24918 else
24919 {
24920 tileCollide = false;
24921 }
24922 if (!flag23)
24923 {
24924 friendly = true;
24925 float num476 = 8f;
24926 if (this.ai[0] == 1f)
24927 {
24928 num476 = 12f;
24929 }
24930 Vector2 vector38 = new Vector2(base.position.X + (float)width * 0.5f, base.position.Y + (float)height * 0.5f);
24931 float num477 = Main.player[owner].Center.X - vector38.X;
24932 float num478 = Main.player[owner].Center.Y - vector38.Y - 60f;
24933 float num479 = (float)Math.Sqrt(num477 * num477 + num478 * num478);
24934 float num480 = num479;
24935 if (num479 < 100f && this.ai[0] == 1f && !Collision.SolidCollision(base.position, width, height))
24936 {
24937 this.ai[0] = 0f;
24938 }
24939 if (num479 > 2000f)
24940 {
24941 base.position.X = Main.player[owner].Center.X - (float)(width / 2);
24942 base.position.Y = Main.player[owner].Center.Y - (float)(width / 2);
24943 }
24944 if (type == 317 && num479 > 100f)
24945 {
24946 num476 = 12f;
24947 if (this.ai[0] == 1f)
24948 {
24949 num476 = 15f;
24950 }
24951 }
24952 if (num479 > 70f)
24953 {
24954 num479 = num476 / num479;
24955 num477 *= num479;
24956 num478 *= num479;
24957 velocity.X = (velocity.X * 20f + num477) / 21f;
24958 velocity.Y = (velocity.Y * 20f + num478) / 21f;
24959 }
24960 else
24961 {
24962 if (velocity.X == 0f && velocity.Y == 0f)
24963 {
24964 velocity.X = -0.15f;
24965 velocity.Y = -0.05f;
24966 }
24967 velocity *= 1.01f;
24968 }
24969 friendly = false;
24970 rotation = velocity.X * 0.05f;
24971 frameCounter++;
24972 if (frameCounter >= 4)
24973 {
24974 frameCounter = 0;
24975 frame++;
24976 }
24977 if (frame > 3)
24978 {
24979 frame = 0;
24980 }
24981 if ((double)Math.Abs(velocity.X) > 0.2)
24982 {
24984 }
24985 return;
24986 }
24987 if (this.ai[1] == -1f)
24988 {
24989 this.ai[1] = 17f;
24990 }
24991 if (this.ai[1] > 0f)
24992 {
24993 this.ai[1] -= 1f;
24994 }
24995 if (this.ai[1] == 0f)
24996 {
24997 friendly = true;
24998 float num481 = 16f;
24999 Vector2 vector39 = new Vector2(base.position.X + (float)width * 0.5f, base.position.Y + (float)height * 0.5f);
25000 float num482 = num465 - vector39.X;
25001 float num483 = num466 - vector39.Y;
25002 float num484 = (float)Math.Sqrt(num482 * num482 + num483 * num483);
25003 float num485 = num484;
25004 if (num484 < 100f)
25005 {
25006 num481 = 10f;
25007 }
25008 num484 = num481 / num484;
25009 num482 *= num484;
25010 num483 *= num484;
25011 velocity.X = (velocity.X * 14f + num482) / 15f;
25012 velocity.Y = (velocity.Y * 14f + num483) / 15f;
25013 }
25014 else
25015 {
25016 friendly = false;
25017 if (Math.Abs(velocity.X) + Math.Abs(velocity.Y) < 10f)
25018 {
25019 velocity *= 1.05f;
25020 }
25021 }
25022 rotation = velocity.X * 0.05f;
25023 frameCounter++;
25024 if (frameCounter >= 4)
25025 {
25026 frameCounter = 0;
25027 frame++;
25028 }
25029 if (frame < 4)
25030 {
25031 frame = 4;
25032 }
25033 if (frame > 7)
25034 {
25035 frame = 4;
25036 }
25037 if ((double)Math.Abs(velocity.X) > 0.2)
25038 {
25040 }
25041 }
25042 else if (aiStyle == 55)
25043 {
25044 frameCounter++;
25045 if (frameCounter > 0)
25046 {
25047 frame++;
25048 frameCounter = 0;
25049 if (frame > 2)
25050 {
25051 frame = 0;
25052 }
25053 }
25054 if (velocity.X < 0f)
25055 {
25056 spriteDirection = -1;
25057 rotation = (float)Math.Atan2(0f - velocity.Y, 0f - velocity.X);
25058 }
25059 else
25060 {
25061 spriteDirection = 1;
25062 rotation = (float)Math.Atan2(velocity.Y, velocity.X);
25063 }
25064 if (this.ai[0] >= 0f && this.ai[0] < 200f)
25065 {
25066 int num486 = (int)this.ai[0];
25067 NPC nPC2 = Main.npc[num486];
25068 if (nPC2.CanBeChasedBy(this) && !NPCID.Sets.CountsAsCritter[nPC2.type])
25069 {
25070 float num487 = 8f;
25071 Vector2 center2 = base.Center;
25072 float num488 = nPC2.Center.X - center2.X;
25073 float num489 = nPC2.Center.Y - center2.Y;
25074 float num490 = (float)Math.Sqrt(num488 * num488 + num489 * num489);
25075 float num491 = num490;
25076 num490 = num487 / num490;
25077 num488 *= num490;
25078 num489 *= num490;
25079 velocity.X = (velocity.X * 14f + num488) / 15f;
25080 velocity.Y = (velocity.Y * 14f + num489) / 15f;
25081 }
25082 else
25083 {
25084 float num492 = 1000f;
25085 for (int num493 = 0; num493 < 200; num493++)
25086 {
25087 NPC nPC3 = Main.npc[num493];
25088 if (nPC3.CanBeChasedBy(this) && !NPCID.Sets.CountsAsCritter[nPC3.type])
25089 {
25090 float x4 = nPC3.Center.X;
25091 float y4 = nPC3.Center.Y;
25092 float num494 = Math.Abs(base.Center.X - x4) + Math.Abs(base.Center.Y - y4);
25093 if (num494 < num492 && Collision.CanHit(base.position, width, height, nPC3.position, nPC3.width, nPC3.height))
25094 {
25095 num492 = num494;
25096 this.ai[0] = num493;
25097 }
25098 }
25099 }
25100 }
25101 int num495 = 8;
25102 int num496 = Dust.NewDust(new Vector2(base.position.X + (float)num495, base.position.Y + (float)num495), width - num495 * 2, height - num495 * 2, 6);
25104 dust2.velocity *= 0.5f;
25105 dust2 = Main.dust[num496];
25106 dust2.velocity += velocity * 0.5f;
25107 Main.dust[num496].noGravity = true;
25108 Main.dust[num496].noLight = true;
25109 Main.dust[num496].scale = 1.4f;
25110 }
25111 else
25112 {
25113 Kill();
25114 }
25115 }
25116 else if (aiStyle == 56)
25117 {
25118 if (localAI[0] == 0f)
25119 {
25120 localAI[0] = 1f;
25121 rotation = this.ai[0];
25122 spriteDirection = -(int)this.ai[1];
25123 }
25124 if (Math.Abs(velocity.X) + Math.Abs(velocity.Y) < 16f)
25125 {
25126 velocity *= 1.05f;
25127 }
25128 if (velocity.X < 0f)
25129 {
25130 direction = -1;
25131 }
25132 else
25133 {
25134 direction = 1;
25135 }
25136 rotation += (Math.Abs(velocity.X) + Math.Abs(velocity.Y)) * 0.025f * (float)direction;
25137 }
25138 else if (aiStyle == 57)
25139 {
25140 this.ai[0] += 1f;
25141 if (this.ai[0] > 30f)
25142 {
25143 this.ai[0] = 30f;
25144 velocity.Y += 0.25f;
25145 if (velocity.Y > 16f)
25146 {
25147 velocity.Y = 16f;
25148 }
25149 velocity.X *= 0.995f;
25150 }
25151 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 1.57f;
25152 alpha -= 50;
25153 if (alpha < 0)
25154 {
25155 alpha = 0;
25156 }
25157 if (owner == Main.myPlayer)
25158 {
25159 if (localAI[1] == 0f)
25160 {
25161 localAI[1] = Main.rand.Next(7);
25162 }
25163 localAI[0]++;
25164 int num497 = 8;
25165 if (localAI[1] > 0f)
25166 {
25167 num497 += (int)localAI[1];
25168 }
25169 if (localAI[0] >= (float)num497)
25170 {
25171 localAI[0] = 0f;
25172 localAI[1] = -1f;
25173 NewProjectile(GetProjectileSource_FromThis(), base.Center.X, base.Center.Y, 0f, 0f, 344, (int)((float)damage * 0.7f), knockBack * 0.55f, owner, 0f, Main.rand.Next(3));
25174 }
25175 }
25176 }
25177 else if (aiStyle == 58)
25178 {
25179 alpha -= 50;
25180 if (alpha < 0)
25181 {
25182 alpha = 0;
25183 }
25184 if (this.ai[0] == 0f)
25185 {
25186 frame = 0;
25187 this.ai[1] += 1f;
25188 if (this.ai[1] > 30f)
25189 {
25190 velocity.Y += 0.1f;
25191 }
25192 if (velocity.Y >= 0f)
25193 {
25194 this.ai[0] = 1f;
25195 }
25196 }
25197 if (this.ai[0] == 1f)
25198 {
25199 frame = 1;
25200 velocity.Y += 0.1f;
25201 if (velocity.Y > 3f)
25202 {
25203 velocity.Y = 3f;
25204 }
25205 velocity.X *= 0.99f;
25206 }
25207 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 1.57f;
25208 }
25209 else if (aiStyle == 59)
25210 {
25211 this.ai[1] += 1f;
25212 if (this.ai[1] >= 60f)
25213 {
25214 friendly = true;
25215 int num498 = (int)this.ai[0];
25216 if (Main.myPlayer == owner && (num498 == -1 || !Main.npc[num498].CanBeChasedBy(this)))
25217 {
25218 num498 = -1;
25219 int[] array = new int[200];
25220 int num499 = 0;
25221 for (int num500 = 0; num500 < 200; num500++)
25222 {
25223 if (Main.npc[num500].CanBeChasedBy(this))
25224 {
25225 float num501 = Math.Abs(Main.npc[num500].position.X + (float)(Main.npc[num500].width / 2) - base.position.X + (float)(width / 2)) + Math.Abs(Main.npc[num500].position.Y + (float)(Main.npc[num500].height / 2) - base.position.Y + (float)(height / 2));
25226 if (num501 < 800f)
25227 {
25228 array[num499] = num500;
25229 num499++;
25230 }
25231 }
25232 }
25233 if (num499 == 0)
25234 {
25235 Kill();
25236 return;
25237 }
25238 num498 = array[Main.rand.Next(num499)];
25239 this.ai[0] = num498;
25240 netUpdate = true;
25241 }
25242 if (num498 != -1)
25243 {
25244 float num502 = 4f;
25245 Vector2 vector40 = new Vector2(base.position.X + (float)width * 0.5f, base.position.Y + (float)height * 0.5f);
25246 float num503 = Main.npc[num498].Center.X - vector40.X;
25247 float num504 = Main.npc[num498].Center.Y - vector40.Y;
25248 float num505 = (float)Math.Sqrt(num503 * num503 + num504 * num504);
25249 float num506 = num505;
25250 num505 = num502 / num505;
25251 num503 *= num505;
25252 num504 *= num505;
25253 int num507 = 30;
25254 velocity.X = (velocity.X * (float)(num507 - 1) + num503) / (float)num507;
25255 velocity.Y = (velocity.Y * (float)(num507 - 1) + num504) / (float)num507;
25256 }
25257 }
25258 for (int num508 = 0; num508 < 5; num508++)
25259 {
25260 float num509 = velocity.X * 0.2f * (float)num508;
25261 float num510 = (0f - velocity.Y * 0.2f) * (float)num508;
25262 int num511 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 175, 0f, 0f, 100, default(Color), 1.3f);
25263 Main.dust[num511].noGravity = true;
25265 dust2.velocity *= 0f;
25266 Main.dust[num511].position.X -= num509;
25267 Main.dust[num511].position.Y -= num510;
25268 }
25269 }
25270 else if (aiStyle == 60)
25271 {
25272 scale -= 0.015f;
25273 if (scale <= 0f)
25274 {
25275 velocity *= 5f;
25277 Kill();
25278 }
25279 if (this.ai[0] > 3f)
25280 {
25281 int num512 = 103;
25282 if (type == 406)
25283 {
25284 num512 = 137;
25285 }
25286 if (owner == Main.myPlayer)
25287 {
25288 Rectangle rectangle4 = new Rectangle((int)base.position.X, (int)base.position.Y, width, height);
25289 for (int num513 = 0; num513 < 200; num513++)
25290 {
25291 if (Main.npc[num513].active && !Main.npc[num513].dontTakeDamage && Main.npc[num513].lifeMax > 1)
25292 {
25293 Rectangle value4 = new Rectangle((int)Main.npc[num513].position.X, (int)Main.npc[num513].position.Y, Main.npc[num513].width, Main.npc[num513].height);
25294 if (rectangle4.Intersects(value4))
25295 {
25296 Main.npc[num513].AddBuff(num512, 1500);
25297 Kill();
25298 }
25299 }
25300 }
25301 for (int num514 = 0; num514 < 255; num514++)
25302 {
25303 if (num514 != owner && Main.player[num514].active && !Main.player[num514].dead)
25304 {
25305 Rectangle value5 = new Rectangle((int)Main.player[num514].position.X, (int)Main.player[num514].position.Y, Main.player[num514].width, Main.player[num514].height);
25306 if (rectangle4.Intersects(value5))
25307 {
25308 Main.player[num514].AddBuff(num512, 1500, quiet: false);
25309 Kill();
25310 }
25311 }
25312 }
25313 }
25314 this.ai[0] += this.ai[1];
25315 if (this.ai[0] > 30f)
25316 {
25317 velocity.Y += 0.1f;
25318 }
25319 if (type == 358)
25320 {
25321 for (int num515 = 0; num515 < 1; num515++)
25322 {
25323 for (int num516 = 0; num516 < 6; num516++)
25324 {
25325 float num517 = velocity.X / 6f * (float)num516;
25326 float num518 = velocity.Y / 6f * (float)num516;
25327 int num519 = 6;
25328 int num520 = Dust.NewDust(new Vector2(base.position.X + (float)num519, base.position.Y + (float)num519), width - num519 * 2, height - num519 * 2, 211, 0f, 0f, 75, default(Color), 1.2f);
25329 Dust dust2;
25330 if (Main.rand.Next(2) == 0)
25331 {
25332 dust2 = Main.dust[num520];
25333 dust2.alpha += 25;
25334 }
25335 if (Main.rand.Next(2) == 0)
25336 {
25337 dust2 = Main.dust[num520];
25338 dust2.alpha += 25;
25339 }
25340 if (Main.rand.Next(2) == 0)
25341 {
25342 dust2 = Main.dust[num520];
25343 dust2.alpha += 25;
25344 }
25345 Main.dust[num520].noGravity = true;
25346 dust2 = Main.dust[num520];
25347 dust2.velocity *= 0.3f;
25348 dust2 = Main.dust[num520];
25349 dust2.velocity += velocity * 0.5f;
25350 Main.dust[num520].position = base.Center;
25351 Main.dust[num520].position.X -= num517;
25352 Main.dust[num520].position.Y -= num518;
25353 dust2 = Main.dust[num520];
25354 dust2.velocity *= 0.2f;
25355 }
25356 if (Main.rand.Next(4) == 0)
25357 {
25358 int num521 = 6;
25359 int num522 = Dust.NewDust(new Vector2(base.position.X + (float)num521, base.position.Y + (float)num521), width - num521 * 2, height - num521 * 2, 211, 0f, 0f, 75, default(Color), 0.65f);
25361 dust2.velocity *= 0.5f;
25362 dust2 = Main.dust[num522];
25363 dust2.velocity += velocity * 0.5f;
25364 }
25365 }
25366 }
25367 if (type != 406)
25368 {
25369 return;
25370 }
25371 int num523 = 175;
25372 Color newColor2 = new Color(0, 80, 255, 100);
25373 for (int num524 = 0; num524 < 6; num524++)
25374 {
25376 int num525 = 6;
25377 int num526 = Dust.NewDust(base.position + Vector2.One * 6f, width - num525 * 2, height - num525 * 2, 4, 0f, 0f, num523, newColor2, 1.2f);
25378 Dust dust2;
25379 if (Main.rand.Next(2) == 0)
25380 {
25381 dust2 = Main.dust[num526];
25382 dust2.alpha += 25;
25383 }
25384 if (Main.rand.Next(2) == 0)
25385 {
25386 dust2 = Main.dust[num526];
25387 dust2.alpha += 25;
25388 }
25389 if (Main.rand.Next(2) == 0)
25390 {
25391 dust2 = Main.dust[num526];
25392 dust2.alpha += 25;
25393 }
25394 Main.dust[num526].noGravity = true;
25395 dust2 = Main.dust[num526];
25396 dust2.velocity *= 0.3f;
25397 dust2 = Main.dust[num526];
25398 dust2.velocity += velocity * 0.5f;
25399 Main.dust[num526].position = base.Center;
25400 Main.dust[num526].position.X -= vector41.X;
25401 Main.dust[num526].position.Y -= vector41.Y;
25402 dust2 = Main.dust[num526];
25403 dust2.velocity *= 0.2f;
25404 }
25405 if (Main.rand.Next(4) == 0)
25406 {
25407 int num527 = 6;
25408 int num528 = Dust.NewDust(base.position + Vector2.One * 6f, width - num527 * 2, height - num527 * 2, 4, 0f, 0f, num523, newColor2, 1.2f);
25410 dust2.velocity *= 0.5f;
25411 dust2 = Main.dust[num528];
25412 dust2.velocity += velocity * 0.5f;
25413 }
25414 }
25415 else
25416 {
25417 this.ai[0] += 1f;
25418 }
25419 }
25420 else if (aiStyle == 61)
25421 {
25423 }
25424 else if (aiStyle == 62)
25425 {
25426 AI_062();
25427 }
25428 else if (aiStyle == 63)
25429 {
25430 if (!Main.player[owner].active)
25431 {
25432 active = false;
25433 return;
25434 }
25435 Vector2 center3 = base.position;
25436 bool flag24 = false;
25437 float num529 = 2000f;
25438 for (int num530 = 0; num530 < 200; num530++)
25439 {
25440 NPC nPC4 = Main.npc[num530];
25441 if (nPC4.CanBeChasedBy(this))
25442 {
25443 float num531 = Vector2.Distance(nPC4.Center, base.Center);
25444 if (!(num531 >= num529) && Collision.CanHit(base.position, width, height, nPC4.position, nPC4.width, nPC4.height))
25445 {
25446 num529 = num531;
25447 center3 = nPC4.Center;
25448 flag24 = true;
25449 }
25450 }
25451 }
25452 if (!flag24)
25453 {
25454 velocity.X *= 0.95f;
25455 }
25456 else
25457 {
25458 float num532 = 5f;
25459 float num533 = 0.08f;
25460 if (velocity.Y == 0f)
25461 {
25462 bool flag25 = false;
25463 if (base.Center.Y - 50f > center3.Y)
25464 {
25465 flag25 = true;
25466 }
25467 if (flag25)
25468 {
25469 velocity.Y = -6f;
25470 }
25471 }
25472 else
25473 {
25474 num532 = 8f;
25475 num533 = 0.12f;
25476 }
25477 velocity.X += (float)Math.Sign(center3.X - base.Center.X) * num533;
25478 if (velocity.X < 0f - num532)
25479 {
25480 velocity.X = 0f - num532;
25481 }
25482 if (velocity.X > num532)
25483 {
25484 velocity.X = num532;
25485 }
25486 }
25487 float num534 = 0f;
25489 if (velocity.Y != 0f)
25490 {
25491 frame = 3;
25492 }
25493 else
25494 {
25495 if (Math.Abs(velocity.X) > 0.2f)
25496 {
25497 frameCounter++;
25498 }
25499 if (frameCounter >= 9)
25500 {
25501 frameCounter = 0;
25502 }
25503 if (frameCounter >= 6)
25504 {
25505 frame = 2;
25506 }
25507 else if (frameCounter >= 3)
25508 {
25509 frame = 1;
25510 }
25511 else
25512 {
25513 frame = 0;
25514 }
25515 }
25516 if (velocity.X != 0f)
25517 {
25519 }
25521 velocity.Y += 0.2f;
25522 if (velocity.Y > 16f)
25523 {
25524 velocity.Y = 16f;
25525 }
25526 }
25527 else if (aiStyle == 64)
25528 {
25529 int num535 = 10;
25530 int num536 = 15;
25531 float num537 = 1f;
25532 int num538 = 150;
25533 int num539 = 42;
25534 if (type == 386)
25535 {
25536 num535 = 16;
25537 num536 = 16;
25538 num537 = 1.5f;
25539 }
25540 if (velocity.X != 0f)
25541 {
25543 }
25544 frameCounter++;
25545 if (frameCounter > 2)
25546 {
25547 frame++;
25548 frameCounter = 0;
25549 }
25550 if (frame >= 6)
25551 {
25552 frame = 0;
25553 }
25554 if (localAI[0] == 0f && Main.myPlayer == owner)
25555 {
25556 localAI[0] = 1f;
25557 base.position.X += width / 2;
25558 base.position.Y += height / 2;
25559 scale = ((float)(num535 + num536) - this.ai[1]) * num537 / (float)(num536 + num535);
25560 width = (int)((float)num538 * scale);
25561 height = (int)((float)num539 * scale);
25562 base.position.X -= width / 2;
25563 base.position.Y -= height / 2;
25564 netUpdate = true;
25565 }
25566 if (this.ai[1] != -1f)
25567 {
25568 scale = ((float)(num535 + num536) - this.ai[1]) * num537 / (float)(num536 + num535);
25569 width = (int)((float)num538 * scale);
25570 height = (int)((float)num539 * scale);
25571 }
25572 if (!Collision.SolidCollision(base.position, width, height))
25573 {
25574 alpha -= 30;
25575 if (alpha < 60)
25576 {
25577 alpha = 60;
25578 }
25579 if (type == 386 && alpha < 100)
25580 {
25581 alpha = 100;
25582 }
25583 }
25584 else
25585 {
25586 alpha += 30;
25587 if (alpha > 150)
25588 {
25589 alpha = 150;
25590 }
25591 }
25592 if (this.ai[0] > 0f)
25593 {
25594 this.ai[0]--;
25595 }
25596 if (this.ai[0] == 1f && this.ai[1] > 0f && owner == Main.myPlayer)
25597 {
25598 netUpdate = true;
25599 Vector2 center4 = base.Center;
25600 center4.Y -= (float)num539 * scale / 2f;
25601 float num540 = ((float)(num535 + num536) - this.ai[1] + 1f) * num537 / (float)(num536 + num535);
25602 center4.Y -= (float)num539 * num540 / 2f;
25603 center4.Y += 2f;
25605 int num541 = 4;
25606 if (type == 386)
25607 {
25608 num541 = 2;
25609 }
25610 if ((int)this.ai[1] % num541 == 0 && this.ai[1] != 0f)
25611 {
25612 int num542 = 372;
25613 if (type == 386)
25614 {
25615 num542 = 373;
25616 }
25617 int num543 = NPC.NewNPC(GetNPCSource_FromThis(), (int)center4.X, (int)center4.Y, num542);
25618 Main.npc[num543].velocity = velocity;
25619 Main.npc[num543].netUpdate = true;
25620 if (type == 386)
25621 {
25622 Main.npc[num543].ai[2] = width;
25623 Main.npc[num543].ai[3] = -1.5f;
25624 }
25625 }
25626 }
25627 if (this.ai[0] <= 0f)
25628 {
25629 float num544 = (float)Math.PI / 30f;
25630 float num545 = (float)width / 5f;
25631 if (type == 386)
25632 {
25633 num545 *= 2f;
25634 }
25635 float num546 = (float)(Math.Cos(num544 * (0f - this.ai[0])) - 0.5) * num545;
25636 base.position.X -= num546 * (float)(-direction);
25637 this.ai[0]--;
25638 num546 = (float)(Math.Cos(num544 * (0f - this.ai[0])) - 0.5) * num545;
25639 base.position.X += num546 * (float)(-direction);
25640 }
25641 }
25642 else if (aiStyle == 65)
25643 {
25644 if (this.ai[1] > 0f)
25645 {
25646 int num547 = (int)this.ai[1] - 1;
25647 if (num547 < 255)
25648 {
25649 localAI[0]++;
25650 if (localAI[0] > 10f)
25651 {
25652 int num548 = 6;
25653 for (int num549 = 0; num549 < num548; num549++)
25654 {
25655 Vector2 spinningpoint = Vector2.Normalize(velocity) * new Vector2((float)width / 2f, height) * 0.75f;
25656 spinningpoint = spinningpoint.RotatedBy((double)(num549 - (num548 / 2 - 1)) * Math.PI / (double)num548) + base.Center;
25657 Vector2 vector42 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - (float)Math.PI / 2f).ToRotationVector2() * Main.rand.Next(3, 8);
25658 int num550 = Dust.NewDust(spinningpoint + vector42, 0, 0, 172, vector42.X * 2f, vector42.Y * 2f, 100, default(Color), 1.4f);
25659 Main.dust[num550].noGravity = true;
25660 Main.dust[num550].noLight = true;
25662 dust2.velocity /= 4f;
25663 dust2 = Main.dust[num550];
25664 dust2.velocity -= velocity;
25665 }
25666 alpha -= 5;
25667 if (alpha < 100)
25668 {
25669 alpha = 100;
25670 }
25671 rotation += velocity.X * 0.1f;
25672 frame = (int)(localAI[0] / 3f) % 3;
25673 }
25674 Vector2 value6 = Main.player[num547].Center - base.Center;
25675 float num551 = 4f;
25676 if (this.ai[2] == 1f)
25677 {
25678 num551 += 12f;
25679 }
25680 num551 += localAI[0] / 20f;
25682 if (value6.Length() < 50f)
25683 {
25684 Kill();
25685 }
25686 }
25687 }
25688 else
25689 {
25690 float num552 = (float)Math.PI / 15f;
25691 float num553 = 4f;
25692 float num554 = (float)(Math.Cos(num552 * this.ai[0]) - 0.5) * num553;
25693 velocity.Y -= num554;
25694 this.ai[0]++;
25695 num554 = (float)(Math.Cos(num552 * this.ai[0]) - 0.5) * num553;
25696 velocity.Y += num554;
25697 localAI[0]++;
25698 if (localAI[0] > 10f)
25699 {
25700 alpha -= 5;
25701 if (alpha < 100)
25702 {
25703 alpha = 100;
25704 }
25705 rotation += velocity.X * 0.1f;
25706 frame = (int)(localAI[0] / 3f) % 3;
25707 }
25708 }
25709 if (wet)
25710 {
25711 base.position.Y -= 16f;
25712 Kill();
25713 }
25714 }
25715 else if (aiStyle == 66)
25716 {
25717 float num555 = 0f;
25718 float num556 = 0f;
25719 float num557 = 0f;
25720 float num558 = 0f;
25721 bool flag26 = type == 387 || type == 388;
25722 if (flag26)
25723 {
25724 num555 = 2000f;
25725 num556 = 800f;
25726 num557 = 1200f;
25727 num558 = 150f;
25728 if (Main.player[owner].dead)
25729 {
25730 Main.player[owner].twinsMinion = false;
25731 }
25732 if (Main.player[owner].twinsMinion)
25733 {
25734 timeLeft = 2;
25735 }
25736 }
25737 if (type == 533)
25738 {
25739 num555 = 2000f;
25740 num556 = 900f;
25741 num557 = 1500f;
25742 num558 = 450f;
25743 if (Main.player[owner].dead)
25744 {
25745 Main.player[owner].DeadlySphereMinion = false;
25746 }
25747 if (Main.player[owner].DeadlySphereMinion)
25748 {
25749 timeLeft = 2;
25750 }
25751 localAI[2] = Utils.Clamp(localAI[2] - 1f, 0f, 60f);
25752 }
25753 float num559 = 0.05f;
25754 for (int num560 = 0; num560 < 1000; num560++)
25755 {
25756 bool flag27 = (Main.projectile[num560].type == 387 || Main.projectile[num560].type == 388) && (type == 387 || type == 388);
25757 if (!flag27)
25758 {
25759 flag27 = type == 533 && Main.projectile[num560].type == 533;
25760 }
25761 if (num560 != whoAmI && Main.projectile[num560].active && Main.projectile[num560].owner == owner && flag27 && Math.Abs(base.position.X - Main.projectile[num560].position.X) + Math.Abs(base.position.Y - Main.projectile[num560].position.Y) < (float)width)
25762 {
25763 if (base.position.X < Main.projectile[num560].position.X)
25764 {
25765 velocity.X -= num559;
25766 }
25767 else
25768 {
25769 velocity.X += num559;
25770 }
25771 if (base.position.Y < Main.projectile[num560].position.Y)
25772 {
25773 velocity.Y -= num559;
25774 }
25775 else
25776 {
25777 velocity.Y += num559;
25778 }
25779 }
25780 }
25781 if (type == 533)
25782 {
25783 if ((int)this.ai[0] % 3 != 2)
25784 {
25785 Lighting.AddLight(base.Center, 0.8f, 0.3f, 0.1f);
25786 }
25787 else
25788 {
25789 Lighting.AddLight(base.Center, 0.3f, 0.5f, 0.7f);
25790 }
25791 }
25792 bool flag28 = false;
25793 if (this.ai[0] == 2f && type == 388)
25794 {
25795 this.ai[1]++;
25796 extraUpdates = 1;
25797 rotation = velocity.ToRotation() + (float)Math.PI;
25798 frameCounter++;
25799 if (frameCounter > 1)
25800 {
25801 frame++;
25802 frameCounter = 0;
25803 }
25804 if (frame > 2)
25805 {
25806 frame = 0;
25807 }
25808 if (this.ai[1] > 40f)
25809 {
25810 this.ai[1] = 1f;
25811 this.ai[0] = 0f;
25812 extraUpdates = 0;
25813 numUpdates = 0;
25814 netUpdate = true;
25815 }
25816 else
25817 {
25818 flag28 = true;
25819 }
25820 }
25821 if (type == 533 && this.ai[0] >= 3f && this.ai[0] <= 5f)
25822 {
25823 int num561 = 2;
25824 flag28 = true;
25825 velocity *= 0.9f;
25826 this.ai[1]++;
25827 int num562 = (int)this.ai[1] / num561 + (int)(this.ai[0] - 3f) * 8;
25828 if (num562 < 4)
25829 {
25830 frame = 17 + num562;
25831 }
25832 else if (num562 < 5)
25833 {
25834 frame = 0;
25835 }
25836 else if (num562 < 8)
25837 {
25838 frame = 1 + num562 - 5;
25839 }
25840 else if (num562 < 11)
25841 {
25842 frame = 11 - num562;
25843 }
25844 else if (num562 < 12)
25845 {
25846 frame = 0;
25847 }
25848 else if (num562 < 16)
25849 {
25850 frame = num562 - 2;
25851 }
25852 else if (num562 < 20)
25853 {
25854 frame = 29 - num562;
25855 }
25856 else if (num562 < 21)
25857 {
25858 frame = 0;
25859 }
25860 else
25861 {
25862 frame = num562 - 4;
25863 }
25864 if (this.ai[1] > (float)(num561 * 8))
25865 {
25866 this.ai[0] -= 3f;
25867 this.ai[1] = 0f;
25868 }
25869 }
25870 if (type == 533 && this.ai[0] >= 6f && this.ai[0] <= 8f)
25871 {
25872 this.ai[1]++;
25873 MaxUpdates = 2;
25874 if (this.ai[0] == 7f)
25875 {
25876 rotation = velocity.ToRotation() + (float)Math.PI;
25877 }
25878 else
25879 {
25880 rotation += (float)Math.PI / 6f;
25881 }
25882 int num563 = 0;
25883 switch ((int)this.ai[0])
25884 {
25885 case 6:
25886 frame = 5;
25887 num563 = 40;
25888 break;
25889 case 7:
25890 frame = 13;
25891 num563 = 30;
25892 break;
25893 case 8:
25894 frame = 17;
25895 num563 = 30;
25896 break;
25897 }
25898 if (this.ai[1] > (float)num563)
25899 {
25900 this.ai[1] = 1f;
25901 this.ai[0] -= 6f;
25902 localAI[0]++;
25903 extraUpdates = 0;
25904 numUpdates = 0;
25905 netUpdate = true;
25906 }
25907 else
25908 {
25909 flag28 = true;
25910 }
25911 if (this.ai[0] == 8f)
25912 {
25913 for (int num564 = 0; num564 < 4; num564++)
25914 {
25915 int num565 = Utils.SelectRandom<int>(Main.rand, 226, 228, 75);
25916 int num566 = Dust.NewDust(base.Center, 0, 0, num565);
25918 Vector2 vector43 = Vector2.One.RotatedBy((float)num564 * ((float)Math.PI / 2f)).RotatedBy(rotation);
25919 dust14.position = base.Center + vector43 * 10f;
25920 dust14.velocity = vector43 * 1f;
25921 dust14.scale = 0.6f + Main.rand.NextFloat() * 0.5f;
25922 dust14.noGravity = true;
25923 }
25924 }
25925 }
25926 if (flag28)
25927 {
25928 return;
25929 }
25930 Vector2 center5 = base.position;
25932 bool flag29 = false;
25933 if (this.ai[0] != 1f && flag26)
25934 {
25935 tileCollide = true;
25936 }
25937 if (type == 533 && this.ai[0] < 9f)
25938 {
25939 tileCollide = true;
25940 }
25941 if (tileCollide && WorldGen.SolidTile(Framing.GetTileSafely((int)base.Center.X / 16, (int)base.Center.Y / 16)))
25942 {
25943 tileCollide = false;
25944 }
25946 if (ownerMinionAttackTargetNPC3 != null && ownerMinionAttackTargetNPC3.CanBeChasedBy(this))
25947 {
25948 float num567 = Vector2.Distance(ownerMinionAttackTargetNPC3.Center, base.Center);
25949 float num568 = num555 * 3f;
25951 {
25952 num555 = num567;
25954 flag29 = true;
25955 }
25956 }
25957 if (!flag29)
25958 {
25959 for (int num569 = 0; num569 < 200; num569++)
25960 {
25961 NPC nPC5 = Main.npc[num569];
25962 if (nPC5.CanBeChasedBy(this))
25963 {
25964 float num570 = Vector2.Distance(nPC5.Center, base.Center);
25965 if (!(num570 >= num555) && Collision.CanHitLine(base.position, width, height, nPC5.position, nPC5.width, nPC5.height))
25966 {
25967 num555 = num570;
25968 center5 = nPC5.Center;
25969 zero = nPC5.velocity;
25970 flag29 = true;
25971 }
25972 }
25973 }
25974 }
25975 float num571 = num556;
25976 if (flag29)
25977 {
25978 num571 = num557;
25979 }
25981 if (Vector2.Distance(player4.Center, base.Center) > num571)
25982 {
25983 if (flag26)
25984 {
25985 this.ai[0] = 1f;
25986 }
25987 if (type == 533 && this.ai[0] < 9f)
25988 {
25989 this.ai[0] += 3 * (3 - (int)(this.ai[0] / 3f));
25990 }
25991 tileCollide = false;
25992 netUpdate = true;
25993 }
25994 if (flag26 && flag29 && this.ai[0] == 0f)
25995 {
25996 Vector2 vector44 = center5 - base.Center;
25997 float num572 = vector44.Length();
25998 vector44.Normalize();
25999 if (num572 > 200f)
26000 {
26001 float num573 = 6f;
26002 if (type == 388)
26003 {
26004 num573 = 14f;
26005 }
26006 vector44 *= num573;
26007 velocity = (velocity * 40f + vector44) / 41f;
26008 }
26009 else
26010 {
26011 float num574 = 4f;
26012 vector44 *= 0f - num574;
26013 velocity = (velocity * 40f + vector44) / 41f;
26014 }
26015 }
26016 else
26017 {
26018 bool flag30 = false;
26019 if (!flag30 && flag26)
26020 {
26021 flag30 = this.ai[0] == 1f;
26022 }
26023 if (!flag30 && type == 533)
26024 {
26025 flag30 = this.ai[0] >= 9f;
26026 }
26027 float num575 = 6f;
26028 float num576 = 40f;
26029 if (type == 533)
26030 {
26031 num575 = 12f;
26032 }
26033 if (flag30)
26034 {
26035 num575 = 15f;
26036 }
26037 Vector2 center6 = base.Center;
26038 Vector2 vector45 = player4.Center - center6 + new Vector2(0f, -60f);
26039 float num577 = vector45.Length();
26040 float num578 = num577;
26041 if (num577 > 200f && num575 < 8f)
26042 {
26043 num575 = 8f;
26044 }
26045 if (num575 < Math.Abs(Main.player[owner].velocity.X) + Math.Abs(Main.player[owner].velocity.Y))
26046 {
26047 num576 = 30f;
26048 num575 = Math.Abs(Main.player[owner].velocity.X) + Math.Abs(Main.player[owner].velocity.Y);
26049 if (num577 > 200f)
26050 {
26051 num576 = 20f;
26052 num575 += 4f;
26053 }
26054 else if (num577 > 100f)
26055 {
26056 num575 += 3f;
26057 }
26058 }
26059 if (flag30 && num577 > 300f)
26060 {
26061 num575 += 6f;
26062 num576 -= 10f;
26063 }
26064 if (num577 < num558 && flag30 && !Collision.SolidCollision(base.position, width, height))
26065 {
26066 if (type == 387 || type == 388)
26067 {
26068 this.ai[0] = 0f;
26069 }
26070 if (type == 533)
26071 {
26072 this.ai[0] -= 9f;
26073 }
26074 netUpdate = true;
26075 }
26076 if (num577 > 2000f)
26077 {
26078 base.position.X = Main.player[owner].Center.X - (float)(width / 2);
26079 base.position.Y = Main.player[owner].Center.Y - (float)(height / 2);
26080 netUpdate = true;
26081 }
26082 if (num577 > 70f)
26083 {
26085 vector45.Normalize();
26086 vector45 *= num575;
26087 velocity = (velocity * num576 + vector45) / (num576 + 1f);
26088 }
26089 else if (velocity.X == 0f && velocity.Y == 0f)
26090 {
26091 velocity.X = -0.15f;
26092 velocity.Y = -0.05f;
26093 }
26094 if (velocity.Length() > num575)
26095 {
26096 velocity *= 0.95f;
26097 }
26098 }
26099 if (type == 388)
26100 {
26101 rotation = velocity.ToRotation() + (float)Math.PI;
26102 }
26103 if (type == 387)
26104 {
26105 if (this.ai[0] != 1f && flag29)
26106 {
26107 rotation = (center5 - base.Center).ToRotation() + (float)Math.PI;
26108 }
26109 else
26110 {
26111 rotation = velocity.ToRotation() + (float)Math.PI;
26112 }
26113 }
26114 if (type == 533 && (this.ai[0] < 3f || this.ai[0] >= 9f))
26115 {
26116 rotation += velocity.X * 0.04f;
26117 }
26118 if (type == 388 || type == 387)
26119 {
26120 frameCounter++;
26121 if (frameCounter > 3)
26122 {
26123 frame++;
26124 frameCounter = 0;
26125 }
26126 if (frame > 2)
26127 {
26128 frame = 0;
26129 }
26130 }
26131 else if (type == 533)
26132 {
26133 if (this.ai[0] < 3f || this.ai[0] >= 9f)
26134 {
26135 frameCounter++;
26136 if (frameCounter >= 24)
26137 {
26138 frameCounter = 0;
26139 }
26140 int num579 = frameCounter / 4;
26141 frame = 4 + num579;
26142 switch ((int)this.ai[0])
26143 {
26144 case 0:
26145 case 9:
26146 frame = 4 + num579;
26147 break;
26148 case 1:
26149 case 10:
26150 num579 = frameCounter / 8;
26151 frame = 14 + num579;
26152 break;
26153 case 2:
26154 case 11:
26155 num579 = frameCounter / 3;
26156 if (num579 >= 4)
26157 {
26158 num579 -= 4;
26159 }
26160 frame = 17 + num579;
26161 break;
26162 }
26163 }
26164 if (this.ai[0] == 2f && Main.rand.Next(2) == 0)
26165 {
26166 for (int num580 = 0; num580 < 4; num580++)
26167 {
26168 if (Main.rand.Next(2) != 0)
26169 {
26170 int num581 = Utils.SelectRandom<int>(Main.rand, 226, 228, 75);
26171 int num582 = Dust.NewDust(base.Center, 0, 0, num581);
26173 Vector2 vector47 = Vector2.One.RotatedBy((float)num580 * ((float)Math.PI / 2f)).RotatedBy(rotation);
26174 dust15.position = base.Center + vector47 * 10f;
26175 dust15.velocity = vector47 * 1f;
26176 dust15.scale = 0.3f + Main.rand.NextFloat() * 0.5f;
26177 dust15.noGravity = true;
26178 dust15.customData = this;
26179 dust15.noLight = true;
26180 }
26181 }
26182 }
26183 }
26184 if (this.ai[1] > 0f && flag26)
26185 {
26186 this.ai[1] += Main.rand.Next(1, 4);
26187 }
26188 if (this.ai[1] > 90f && type == 387)
26189 {
26190 this.ai[1] = 0f;
26191 netUpdate = true;
26192 }
26193 if (this.ai[1] > 40f && type == 388)
26194 {
26195 this.ai[1] = 0f;
26196 netUpdate = true;
26197 }
26198 if (this.ai[1] > 0f && type == 533)
26199 {
26200 this.ai[1]++;
26201 int num583 = 10;
26202 if (this.ai[1] > (float)num583)
26203 {
26204 this.ai[1] = 0f;
26205 netUpdate = true;
26206 }
26207 }
26208 if (this.ai[0] == 0f && flag26)
26209 {
26210 if (type == 387)
26211 {
26212 float num584 = 8f;
26213 int num585 = 389;
26214 if (flag29 && this.ai[1] == 0f)
26215 {
26216 this.ai[1]++;
26217 if (Main.myPlayer == owner && Collision.CanHitLine(base.position, width, height, center5, 0, 0))
26218 {
26219 Vector2 vector48 = center5 - base.Center;
26220 vector48.Normalize();
26221 vector48 *= num584;
26222 int num586 = NewProjectile(GetProjectileSource_FromThis(), base.Center.X, base.Center.Y, vector48.X, vector48.Y, num585, (int)((float)damage * 1.15f), 0f, Main.myPlayer);
26223 Main.projectile[num586].timeLeft = 300;
26224 netUpdate = true;
26225 }
26226 }
26227 }
26228 if (type == 388 && this.ai[1] == 0f && flag29 && num555 < 500f)
26229 {
26230 this.ai[1]++;
26231 if (Main.myPlayer == owner)
26232 {
26233 this.ai[0] = 2f;
26234 Vector2 v4 = center5 - base.Center;
26235 v4 = v4.SafeNormalize(velocity);
26236 float num587 = 8f;
26237 velocity = v4 * num587;
26239 netUpdate = true;
26240 }
26241 }
26242 }
26243 else
26244 {
26245 if (type != 533 || !(this.ai[0] < 9f))
26246 {
26247 return;
26248 }
26249 int num588 = 0;
26250 num588 = 800;
26251 if (!(this.ai[1] == 0f && flag29) || !(num555 < (float)num588))
26252 {
26253 return;
26254 }
26255 this.ai[1]++;
26256 if (Main.myPlayer != owner)
26257 {
26258 return;
26259 }
26260 if (localAI[0] >= 3f)
26261 {
26262 this.ai[0] += 4f;
26263 if (this.ai[0] == 6f)
26264 {
26265 this.ai[0] = 3f;
26266 }
26267 localAI[0] = 0f;
26268 }
26269 else
26270 {
26271 this.ai[0] += 6f;
26272 Vector2 v5 = center5 - base.Center;
26273 v5 = v5.SafeNormalize(Vector2.Zero);
26274 float num589 = ((this.ai[0] == 8f) ? 12f : 10f);
26275 velocity = v5 * num589;
26277 netUpdate = true;
26278 }
26279 }
26280 }
26281 else if (aiStyle == 67)
26282 {
26284 }
26285 else if (aiStyle == 68)
26286 {
26287 rotation += 0.25f * (float)direction;
26288 bool flag31 = type == 399;
26289 bool flag32 = type == 669;
26290 this.ai[0] += 1f;
26291 if (this.ai[0] >= 3f)
26292 {
26293 alpha -= 40;
26294 if (alpha < 0)
26295 {
26296 alpha = 0;
26297 }
26298 }
26299 if (this.ai[0] >= 15f)
26300 {
26301 velocity.Y += 0.2f;
26302 if (velocity.Y > 16f)
26303 {
26304 velocity.Y = 16f;
26305 }
26306 velocity.X *= 0.99f;
26307 }
26308 if (alpha == 0)
26309 {
26310 if (flag31)
26311 {
26312 Vector2 spinningpoint2 = new Vector2(4f, -8f);
26313 float num590 = rotation;
26314 if (direction == -1)
26315 {
26316 spinningpoint2.X = -4f;
26317 }
26319 for (int num591 = 0; num591 < 1; num591++)
26320 {
26321 int num592 = Dust.NewDust(base.Center + spinningpoint2 - Vector2.One * 5f, 4, 4, 6);
26322 Main.dust[num592].scale = 1.5f;
26323 Main.dust[num592].noGravity = true;
26324 Main.dust[num592].velocity = Main.dust[num592].velocity * 0.25f + Vector2.Normalize(spinningpoint2) * 1f;
26325 Main.dust[num592].velocity = Main.dust[num592].velocity.RotatedBy(-(float)Math.PI / 2f * (float)direction);
26326 }
26327 }
26328 if (flag32)
26329 {
26330 for (int num593 = 0; num593 < 2; num593++)
26331 {
26332 Vector2 spinningpoint3 = new Vector2(MathHelper.Lerp(-8f, 8f, Main.rand.NextFloat()), -4f);
26333 float num594 = rotation;
26335 int num595 = Dust.NewDust(base.Center + spinningpoint3 - Vector2.One * 5f, 4, 4, 4);
26336 Main.dust[num595].scale = 0.8f - Main.rand.NextFloat() * 0.2f;
26337 Main.dust[num595].velocity = Main.dust[num595].velocity * 0.25f + Vector2.Normalize(spinningpoint3) * 1f;
26338 Main.dust[num595].velocity = Main.dust[num595].velocity.RotatedBy(-(float)Math.PI / 2f * (float)direction);
26339 Main.dust[num595].color = Utils.SelectRandom<Color>(Main.rand, new Color(255, 255, 255, 110), new Color(245, 200, 30, 110));
26340 }
26341 }
26342 }
26344 if (timeLeft <= 3)
26345 {
26346 tileCollide = false;
26347 alpha = 255;
26348 base.position.X += width / 2;
26349 base.position.Y += height / 2;
26350 width = 80;
26351 height = 80;
26352 base.position.X -= width / 2;
26353 base.position.Y -= height / 2;
26354 knockBack = 8f;
26355 }
26356 if (wet && timeLeft > 3)
26357 {
26358 timeLeft = 3;
26359 }
26360 }
26361 else if (aiStyle == 69)
26362 {
26363 Vector2 vector49 = Main.player[owner].Center - base.Center;
26364 rotation = vector49.ToRotation() - 1.57f;
26365 if (Main.player[owner].dead)
26366 {
26367 Kill();
26368 return;
26369 }
26370 Main.player[owner].SetDummyItemTime(10);
26371 _ = vector49.X;
26372 _ = 0f;
26373 if (vector49.X < 0f)
26374 {
26375 Main.player[owner].ChangeDir(1);
26376 direction = 1;
26377 }
26378 else
26379 {
26380 Main.player[owner].ChangeDir(-1);
26381 direction = -1;
26382 }
26383 Main.player[owner].itemRotation = (vector49 * -1f * direction).ToRotation();
26384 spriteDirection = ((!(vector49.X > 0f)) ? 1 : (-1));
26385 if (this.ai[0] == 0f && vector49.Length() > 400f)
26386 {
26387 this.ai[0] = 1f;
26388 }
26389 if (this.ai[0] == 1f || this.ai[0] == 2f)
26390 {
26391 float num596 = vector49.Length();
26392 if (num596 > 1500f)
26393 {
26394 Kill();
26395 return;
26396 }
26397 if (num596 > 600f)
26398 {
26399 this.ai[0] = 2f;
26400 }
26401 tileCollide = false;
26402 float num597 = 20f;
26403 if (this.ai[0] == 2f)
26404 {
26405 num597 = 40f;
26406 }
26408 if (vector49.Length() < num597)
26409 {
26410 Kill();
26411 return;
26412 }
26413 }
26414 this.ai[1]++;
26415 if (this.ai[1] > 5f)
26416 {
26417 alpha = 0;
26418 }
26419 if ((int)this.ai[1] % 4 == 0 && owner == Main.myPlayer)
26420 {
26422 spinningpoint4.Normalize();
26423 spinningpoint4 *= (float)Main.rand.Next(45, 65) * 0.1f;
26424 spinningpoint4 = spinningpoint4.RotatedBy((Main.rand.NextDouble() - 0.5) * 1.5707963705062866);
26426 }
26427 }
26428 else if (aiStyle == 70)
26429 {
26430 if (this.ai[0] == 0f)
26431 {
26432 float num598 = 650f;
26433 int num599 = -1;
26434 for (int num600 = 0; num600 < 200; num600++)
26435 {
26436 NPC nPC6 = Main.npc[num600];
26437 float num601 = (nPC6.Center - base.Center).Length();
26438 if (!(num601 >= num598) && nPC6.CanBeChasedBy(this) && Collision.CanHit(base.position, width, height, nPC6.position, nPC6.width, nPC6.height))
26439 {
26440 num599 = num600;
26441 num598 = num601;
26442 }
26443 }
26444 this.ai[0] = num599 + 1;
26445 if (this.ai[0] == 0f)
26446 {
26447 this.ai[0] = -15f;
26448 }
26449 if (this.ai[0] > 0f)
26450 {
26451 float num602 = (float)Main.rand.Next(35, 75) / 30f;
26452 velocity = (velocity * 20f + Vector2.Normalize(Main.npc[(int)this.ai[0] - 1].Center - base.Center + new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101))) * num602) / 21f;
26453 netUpdate = true;
26454 }
26455 }
26456 else if (this.ai[0] > 0f)
26457 {
26458 Vector2 vector50 = Vector2.Normalize(Main.npc[(int)this.ai[0] - 1].Center - base.Center);
26459 velocity = (velocity * 40f + vector50 * 12f) / 41f;
26460 }
26461 else
26462 {
26463 this.ai[0]++;
26464 alpha -= 25;
26465 if (alpha < 50)
26466 {
26467 alpha = 50;
26468 }
26469 velocity *= 0.95f;
26470 }
26471 if (this.ai[1] == 0f)
26472 {
26473 this.ai[1] = (float)Main.rand.Next(80, 121) / 100f;
26474 netUpdate = true;
26475 }
26476 scale = this.ai[1];
26477 }
26478 else if (aiStyle == 71)
26479 {
26480 localAI[1]++;
26481 if (localAI[1] > 10f && Main.rand.Next(3) == 0)
26482 {
26483 int num603 = 6;
26484 for (int num604 = 0; num604 < num603; num604++)
26485 {
26487 spinningpoint5 = spinningpoint5.RotatedBy((double)(num604 - (num603 / 2 - 1)) * Math.PI / (double)num603) + base.Center;
26488 Vector2 vector51 = ((float)(Main.rand.NextDouble() * 3.1415927410125732) - (float)Math.PI / 2f).ToRotationVector2() * Main.rand.Next(3, 8);
26489 int num605 = Dust.NewDust(spinningpoint5 + vector51, 0, 0, 217, vector51.X * 2f, vector51.Y * 2f, 100, default(Color), 1.4f);
26490 Main.dust[num605].noGravity = true;
26491 Main.dust[num605].noLight = true;
26493 dust2.velocity /= 4f;
26494 dust2 = Main.dust[num605];
26495 dust2.velocity -= velocity;
26496 }
26497 alpha -= 5;
26498 if (alpha < 50)
26499 {
26500 alpha = 50;
26501 }
26502 rotation += velocity.X * 0.1f;
26503 frame = (int)(localAI[1] / 3f) % 3;
26504 Lighting.AddLight((int)base.Center.X / 16, (int)base.Center.Y / 16, 0.1f, 0.4f, 0.6f);
26505 }
26506 int num606 = -1;
26507 Vector2 vector52 = base.Center;
26508 float num607 = 500f;
26509 if (localAI[0] > 0f)
26510 {
26511 localAI[0]--;
26512 }
26513 if (this.ai[0] == 0f && localAI[0] == 0f)
26514 {
26515 for (int num608 = 0; num608 < 200; num608++)
26516 {
26517 NPC nPC7 = Main.npc[num608];
26518 if (nPC7.CanBeChasedBy(this) && (this.ai[0] == 0f || this.ai[0] == (float)(num608 + 1)))
26519 {
26520 Vector2 center7 = nPC7.Center;
26522 if (num609 < num607 && Collision.CanHit(base.position, width, height, nPC7.position, nPC7.width, nPC7.height))
26523 {
26524 num607 = num609;
26525 vector52 = center7;
26526 num606 = num608;
26527 }
26528 }
26529 }
26530 if (num606 >= 0)
26531 {
26532 this.ai[0] = num606 + 1;
26533 netUpdate = true;
26534 }
26535 num606 = -1;
26536 }
26537 if (localAI[0] == 0f && this.ai[0] == 0f)
26538 {
26539 localAI[0] = 30f;
26540 }
26541 bool flag33 = false;
26542 if (this.ai[0] != 0f)
26543 {
26544 int num610 = (int)(this.ai[0] - 1f);
26545 if (Main.npc[num610].active && !Main.npc[num610].dontTakeDamage && Main.npc[num610].immune[owner] == 0)
26546 {
26547 float num611 = Main.npc[num610].position.X + (float)(Main.npc[num610].width / 2);
26548 float num612 = Main.npc[num610].position.Y + (float)(Main.npc[num610].height / 2);
26549 float num613 = Math.Abs(base.position.X + (float)(width / 2) - num611) + Math.Abs(base.position.Y + (float)(height / 2) - num612);
26550 if (num613 < 1000f)
26551 {
26552 flag33 = true;
26553 vector52 = Main.npc[num610].Center;
26554 }
26555 }
26556 else
26557 {
26558 this.ai[0] = 0f;
26559 flag33 = false;
26560 netUpdate = true;
26561 }
26562 }
26563 if (flag33)
26564 {
26565 Vector2 v6 = vector52 - base.Center;
26566 float num614 = velocity.ToRotation();
26567 float num615 = v6.ToRotation();
26568 double num616 = num615 - num614;
26569 if (num616 > Math.PI)
26570 {
26571 num616 -= Math.PI * 2.0;
26572 }
26573 if (num616 < -Math.PI)
26574 {
26575 num616 += Math.PI * 2.0;
26576 }
26577 velocity = velocity.RotatedBy(num616 * 0.10000000149011612);
26578 }
26579 float num617 = velocity.Length();
26581 velocity *= num617 + 0.0025f;
26582 }
26583 else if (aiStyle == 72)
26584 {
26585 localAI[0]++;
26586 if (localAI[0] > 3f)
26587 {
26588 alpha -= 25;
26589 if (alpha < 50)
26590 {
26591 alpha = 50;
26592 }
26593 }
26594 velocity *= 0.96f;
26595 if (this.ai[1] == 0f)
26596 {
26597 this.ai[1] = (float)Main.rand.Next(60, 121) / 100f;
26598 netUpdate = true;
26599 }
26600 scale = this.ai[1];
26601 base.position = base.Center;
26602 int num618 = 14;
26603 int num619 = 14;
26604 width = (int)((float)num618 * this.ai[1]);
26605 height = (int)((float)num619 * this.ai[1]);
26606 base.position -= new Vector2(width / 2, height / 2);
26607 }
26608 else if (aiStyle == 73)
26609 {
26610 int num620 = (int)this.ai[0];
26611 int num621 = (int)this.ai[1];
26613 if (tile2 == null || !tile2.active() || tile2.type != 338)
26614 {
26615 Kill();
26616 return;
26617 }
26618 float num622 = 2f;
26619 float num623 = (float)timeLeft / 60f;
26620 if (num623 < 1f)
26621 {
26622 num622 *= num623;
26623 }
26624 if (type == 419)
26625 {
26626 for (int num624 = 0; num624 < 2; num624++)
26627 {
26628 Vector2 spinningpoint6 = new Vector2(0f, 0f - num622);
26629 spinningpoint6 *= 0.85f + (float)Main.rand.NextDouble() * 0.2f;
26630 spinningpoint6 = spinningpoint6.RotatedBy((Main.rand.NextDouble() - 0.5) * 1.5707963705062866);
26631 int num625 = Dust.NewDust(base.position, width, height, 222, 0f, 0f, 100);
26633 dust16.scale = 1f + (float)Main.rand.NextDouble() * 0.3f;
26634 Dust dust2 = dust16;
26635 dust2.velocity *= 0.5f;
26636 if (dust16.velocity.Y > 0f)
26637 {
26638 dust16.velocity.Y *= -1f;
26639 }
26640 dust2 = dust16;
26641 dust2.position -= new Vector2(2 + Main.rand.Next(-2, 3), 0f);
26642 dust2 = dust16;
26643 dust2.velocity += spinningpoint6;
26644 dust16.scale = 0.6f;
26645 dust16.fadeIn = dust16.scale + 0.2f;
26646 dust16.velocity.Y *= 2f;
26647 }
26648 }
26649 if (type == 420)
26650 {
26651 for (int num626 = 0; num626 < 2; num626++)
26652 {
26653 Vector2 spinningpoint7 = new Vector2(0f, 0f - num622);
26654 spinningpoint7 *= 0.85f + (float)Main.rand.NextDouble() * 0.2f;
26655 spinningpoint7 = spinningpoint7.RotatedBy((Main.rand.NextDouble() - 0.5) * 1.5707963705062866);
26656 int num627 = 219;
26657 if (Main.rand.Next(5) == 0)
26658 {
26659 num627 = 222;
26660 }
26661 int num628 = Dust.NewDust(base.position, width, height, num627, 0f, 0f, 100);
26663 dust17.scale = 1f + (float)Main.rand.NextDouble() * 0.3f;
26664 Dust dust2 = dust17;
26665 dust2.velocity *= 0.5f;
26666 if (dust17.velocity.Y > 0f)
26667 {
26668 dust17.velocity.Y *= -1f;
26669 }
26670 dust2 = dust17;
26671 dust2.position -= new Vector2(2 + Main.rand.Next(-2, 3), 0f);
26672 dust2 = dust17;
26673 dust2.velocity += spinningpoint7;
26674 dust17.velocity.X *= 0.5f;
26675 dust17.scale = 0.6f;
26676 dust17.fadeIn = dust17.scale + 0.2f;
26677 dust17.velocity.Y *= 2f;
26678 }
26679 }
26680 if (type == 421)
26681 {
26682 for (int num629 = 0; num629 < 2; num629++)
26683 {
26684 Vector2 spinningpoint8 = new Vector2(0f, 0f - num622);
26685 spinningpoint8 *= 0.85f + (float)Main.rand.NextDouble() * 0.2f;
26686 spinningpoint8 = spinningpoint8.RotatedBy((Main.rand.NextDouble() - 0.5) * 0.7853981852531433);
26687 int num630 = Dust.NewDust(base.position, width, height, 221, 0f, 0f, 100);
26689 dust18.scale = 1f + (float)Main.rand.NextDouble() * 0.3f;
26690 Dust dust2 = dust18;
26691 dust2.velocity *= 0.1f;
26692 if (dust18.velocity.Y > 0f)
26693 {
26694 dust18.velocity.Y *= -1f;
26695 }
26696 dust2 = dust18;
26697 dust2.position -= new Vector2(2 + Main.rand.Next(-2, 3), 0f);
26698 dust2 = dust18;
26699 dust2.velocity += spinningpoint8;
26700 dust18.scale = 0.6f;
26701 dust18.fadeIn = dust18.scale + 0.2f;
26702 dust18.velocity.Y *= 2.5f;
26703 }
26704 if (timeLeft % 10 == 0)
26705 {
26706 float num631 = 0.85f + (float)Main.rand.NextDouble() * 0.2f;
26707 for (int num632 = 0; num632 < 9; num632++)
26708 {
26709 Vector2 vector53 = new Vector2((float)(num632 - 4) / 5f, (0f - num622) * num631);
26710 int num633 = Dust.NewDust(base.position, width, height, 222, 0f, 0f, 100);
26712 dust19.scale = 0.7f + (float)Main.rand.NextDouble() * 0.3f;
26713 Dust dust2 = dust19;
26714 dust2.velocity *= 0f;
26715 if (dust19.velocity.Y > 0f)
26716 {
26717 dust19.velocity.Y *= -1f;
26718 }
26719 dust2 = dust19;
26720 dust2.position -= new Vector2(2 + Main.rand.Next(-2, 3), 0f);
26721 dust2 = dust19;
26722 dust2.velocity += vector53;
26723 dust19.scale = 0.6f;
26724 dust19.fadeIn = dust19.scale + 0.2f;
26725 dust19.velocity.Y *= 2f;
26726 }
26727 }
26728 }
26729 if (type != 422)
26730 {
26731 return;
26732 }
26733 for (int num634 = 0; num634 < 2; num634++)
26734 {
26735 Vector2 spinningpoint9 = new Vector2(0f, 0f - num622);
26736 spinningpoint9 *= 0.85f + (float)Main.rand.NextDouble() * 0.2f;
26737 spinningpoint9 = spinningpoint9.RotatedBy((Main.rand.NextDouble() - 0.5) * 1.5707963705062866);
26738 int num635 = Dust.NewDust(base.position, width, height, 219 + Main.rand.Next(5), 0f, 0f, 100);
26740 dust20.scale = 1f + (float)Main.rand.NextDouble() * 0.3f;
26741 Dust dust2 = dust20;
26742 dust2.velocity *= 0.5f;
26743 if (dust20.velocity.Y > 0f)
26744 {
26745 dust20.velocity.Y *= -1f;
26746 }
26747 dust2 = dust20;
26748 dust2.position -= new Vector2(2 + Main.rand.Next(-2, 3), 0f);
26749 dust2 = dust20;
26750 dust2.velocity += spinningpoint9;
26751 dust20.scale = 0.6f;
26752 dust20.fadeIn = dust20.scale + 0.2f;
26753 dust20.velocity.Y *= 2f;
26754 }
26755 }
26756 else if (aiStyle == 74)
26757 {
26758 if (extraUpdates == 1)
26759 {
26760 localAI[0] *= localAI[1];
26761 localAI[1] -= 0.001f;
26762 if ((double)localAI[0] < 0.01)
26763 {
26764 Kill();
26765 }
26766 }
26767 }
26768 else if (aiStyle == 75)
26769 {
26770 AI_075();
26771 }
26772 else if (aiStyle == 76)
26773 {
26775 player5.heldProj = whoAmI;
26776 if (type == 441)
26777 {
26778 if (player5.mount.Type != 9)
26779 {
26780 Kill();
26781 return;
26782 }
26783 }
26784 else if (type == 453 && player5.mount.Type != 8)
26785 {
26786 Kill();
26787 return;
26788 }
26789 if (Main.myPlayer == owner)
26790 {
26791 base.position.X = Main.screenPosition.X + (float)Main.mouseX;
26792 base.position.Y = Main.screenPosition.Y + (float)Main.mouseY;
26793 if (this.ai[0] != base.position.X - player5.position.X || this.ai[1] != base.position.Y - player5.position.Y)
26794 {
26795 netUpdate = true;
26796 }
26797 this.ai[0] = base.position.X - player5.position.X;
26798 this.ai[1] = base.position.Y - player5.position.Y;
26799 player5.mount.AimAbility(player5, base.position);
26800 if (!player5.channel)
26801 {
26802 player5.mount.UseAbility(player5, base.position, toggleOn: false);
26803 Kill();
26804 }
26805 return;
26806 }
26807 base.position.X = player5.position.X + this.ai[0];
26808 base.position.Y = player5.position.Y + this.ai[1];
26809 if (type == 441)
26810 {
26811 if (!player5.mount.AbilityCharging)
26812 {
26813 player5.mount.StartAbilityCharge(player5);
26814 }
26815 }
26816 else if (type == 453 && !player5.mount.AbilityActive)
26817 {
26818 player5.mount.UseAbility(player5, base.position, toggleOn: false);
26819 }
26820 player5.mount.AimAbility(player5, base.position);
26821 }
26822 else if (aiStyle == 77)
26823 {
26826 if (activeSound != null)
26827 {
26828 if (activeSound.Volume == 0f)
26829 {
26830 activeSound.Stop();
26831 float[] array2 = localAI;
26833 array2[0] = ((SlotId)(ref invalid)).ToFloat();
26834 }
26835 activeSound.Volume = Math.Max(0f, activeSound.Volume - 0.05f);
26836 }
26837 else
26838 {
26839 float[] array3 = localAI;
26841 array3[0] = ((SlotId)(ref invalid)).ToFloat();
26842 }
26843 if (this.ai[1] == 1f)
26844 {
26845 friendly = false;
26846 if (alpha < 255)
26847 {
26848 alpha += 51;
26849 }
26850 if (alpha >= 255)
26851 {
26852 alpha = 255;
26853 Kill();
26854 return;
26855 }
26856 }
26857 else
26858 {
26859 if (alpha > 0)
26860 {
26861 alpha -= 50;
26862 }
26863 if (alpha < 0)
26864 {
26865 alpha = 0;
26866 }
26867 }
26868 float num636 = 30f;
26869 float num637 = num636 * 4f;
26870 this.ai[0]++;
26871 if (this.ai[0] > num637)
26872 {
26873 this.ai[0] = 0f;
26874 }
26875 Vector2 vector54 = -Vector2.UnitY.RotatedBy((float)Math.PI * 2f * this.ai[0] / num636);
26876 float val = 0.75f + vector54.Y * 0.25f;
26877 float val2 = 0.8f - vector54.Y * 0.2f;
26878 float num638 = Math.Max(val, val2);
26879 base.position += new Vector2(width, height) / 2f;
26880 width = (height = (int)(80f * num638));
26881 base.position -= new Vector2(width, height) / 2f;
26882 frameCounter++;
26883 if (frameCounter >= 3)
26884 {
26885 frameCounter = 0;
26886 frame++;
26887 if (frame >= 4)
26888 {
26889 frame = 0;
26890 }
26891 }
26892 for (int num639 = 0; num639 < 1; num639++)
26893 {
26894 float num640 = 55f * num638;
26895 float num641 = 11f * num638;
26896 float num642 = 0.5f;
26897 int num643 = Dust.NewDust(base.position, width, height, 226, 0f, 0f, 100, default(Color), 0.5f);
26898 Main.dust[num643].noGravity = true;
26900 dust2.velocity *= 2f;
26901 Main.dust[num643].position = ((float)Main.rand.NextDouble() * ((float)Math.PI * 2f)).ToRotationVector2() * (num641 + num642 * (float)Main.rand.NextDouble() * num640) + base.Center;
26902 Main.dust[num643].velocity = Main.dust[num643].velocity / 2f + Vector2.Normalize(Main.dust[num643].position - base.Center);
26903 if (Main.rand.Next(2) == 0)
26904 {
26905 num643 = Dust.NewDust(base.position, width, height, 226, 0f, 0f, 100, default(Color), 0.9f);
26906 Main.dust[num643].noGravity = true;
26907 dust2 = Main.dust[num643];
26908 dust2.velocity *= 1.2f;
26909 Main.dust[num643].position = ((float)Main.rand.NextDouble() * ((float)Math.PI * 2f)).ToRotationVector2() * (num641 + num642 * (float)Main.rand.NextDouble() * num640) + base.Center;
26910 Main.dust[num643].velocity = Main.dust[num643].velocity / 2f + Vector2.Normalize(Main.dust[num643].position - base.Center);
26911 }
26912 if (Main.rand.Next(4) == 0)
26913 {
26914 num643 = Dust.NewDust(base.position, width, height, 226, 0f, 0f, 100, default(Color), 0.7f);
26915 Main.dust[num643].noGravity = true;
26916 dust2 = Main.dust[num643];
26917 dust2.velocity *= 1.2f;
26918 Main.dust[num643].position = ((float)Main.rand.NextDouble() * ((float)Math.PI * 2f)).ToRotationVector2() * (num641 + num642 * (float)Main.rand.NextDouble() * num640) + base.Center;
26919 Main.dust[num643].velocity = Main.dust[num643].velocity / 2f + Vector2.Normalize(Main.dust[num643].position - base.Center);
26920 }
26921 }
26922 }
26923 else if (aiStyle == 78)
26924 {
26925 if (alpha > 0)
26926 {
26927 alpha -= 30;
26928 }
26929 if (alpha < 0)
26930 {
26931 alpha = 0;
26932 }
26933 Vector2 v7 = this.ai[0].ToRotationVector2();
26934 float num644 = velocity.ToRotation();
26935 float num645 = v7.ToRotation();
26936 double num646 = num645 - num644;
26937 if (num646 > Math.PI)
26938 {
26939 num646 -= Math.PI * 2.0;
26940 }
26941 if (num646 < -Math.PI)
26942 {
26943 num646 += Math.PI * 2.0;
26944 }
26945 velocity = velocity.RotatedBy(num646 * 0.05000000074505806);
26946 velocity *= 0.96f;
26947 rotation = velocity.ToRotation() - (float)Math.PI / 2f;
26948 if (Main.myPlayer == owner && timeLeft > 60)
26949 {
26950 timeLeft = 60;
26951 }
26952 }
26953 else if (aiStyle == 79)
26954 {
26955 bool flag34 = true;
26956 int num647 = (int)this.ai[0] - 1;
26957 if (type == 447 && (this.ai[0] == 0f || ((!Main.npc[num647].active || Main.npc[num647].type != 392) && (!Main.npc[num647].active || Main.npc[num647].type != 395 || !(Main.npc[num647].ai[3] % 120f >= 60f) || Main.npc[num647].ai[0] != 2f))))
26958 {
26959 flag34 = false;
26960 }
26961 if (!flag34)
26962 {
26963 Kill();
26964 return;
26965 }
26966 NPC nPC8 = Main.npc[num647];
26967 float num648 = nPC8.Center.Y + 46f;
26968 float num649 = num648;
26969 if (type == 447)
26970 {
26971 int target = nPC8.target;
26972 if (nPC8.type == 392)
26973 {
26974 target = Main.npc[(int)nPC8.ai[0]].target;
26975 }
26976 Player player6 = Main.player[target];
26977 if (player6 != null && player6.active && !player6.dead)
26978 {
26979 num649 = player6.Bottom.Y;
26980 }
26981 }
26982 num649 /= 16f;
26983 int num650 = (int)nPC8.Center.X / 16;
26984 int num651 = (int)num648 / 16;
26985 int num652 = 0;
26986 if ((float)num651 >= num649 && Main.tile[num650, num651].nactive() && Main.tileSolid[Main.tile[num650, num651].type] && !Main.tileSolidTop[Main.tile[num650, num651].type])
26987 {
26988 num652 = 1;
26989 }
26990 else
26991 {
26992 for (; num652 < 150 && num651 + num652 < Main.maxTilesY; num652++)
26993 {
26994 int num653 = num651 + num652;
26995 if ((float)num653 >= num649 && Main.tile[num650, num653].nactive() && Main.tileSolid[Main.tile[num650, num653].type] && !Main.tileSolidTop[Main.tile[num650, num653].type])
26996 {
26997 num652--;
26998 break;
26999 }
27000 }
27001 }
27002 base.position.X = nPC8.Center.X - (float)(width / 2);
27003 base.position.Y = num648;
27004 height = (num652 + 1) * 16;
27005 int num654 = (int)base.position.Y + height;
27006 if (Main.tile[num650, num654 / 16].nactive() && Main.tileSolid[Main.tile[num650, num654 / 16].type] && !Main.tileSolidTop[Main.tile[num650, num654 / 16].type])
27007 {
27008 int num655 = num654 % 16;
27009 height -= num655 - 2;
27010 }
27011 if (type == 447)
27012 {
27013 for (int num656 = 0; num656 < 2; num656++)
27014 {
27015 int num657 = Dust.NewDust(new Vector2(base.position.X, base.position.Y + (float)height - 16f), width, 16, 228);
27016 Main.dust[num657].noGravity = true;
27018 dust2.velocity *= 0.5f;
27019 Main.dust[num657].velocity.X -= (float)num656 - nPC8.velocity.X * 2f / 3f;
27020 Main.dust[num657].scale = 2.8f;
27021 }
27022 if (Main.rand.Next(5) == 0)
27023 {
27024 int num658 = Dust.NewDust(new Vector2(base.position.X + (float)(width / 2) - (float)(width / 2 * Math.Sign(nPC8.velocity.X)) - 4f, base.position.Y + (float)height - 16f), 4, 16, 31, 0f, 0f, 100, default(Color), 1.5f);
27026 dust2.velocity *= 0.5f;
27027 Main.dust[num658].velocity.X -= nPC8.velocity.X / 2f;
27028 Main.dust[num658].velocity.Y = 0f - Math.Abs(Main.dust[num658].velocity.Y);
27029 }
27030 }
27031 if (type == 447 && ++frameCounter >= 5)
27032 {
27033 frameCounter = 0;
27034 if (++frame >= 4)
27035 {
27036 frame = 0;
27037 }
27038 }
27039 }
27040 else if (aiStyle == 80)
27041 {
27042 if (this.ai[0] == 0f && this.ai[1] > 0f)
27043 {
27044 this.ai[1]--;
27045 }
27046 else if (this.ai[0] == 0f && this.ai[1] == 0f)
27047 {
27048 this.ai[0] = 1f;
27049 this.ai[1] = (int)Player.FindClosest(base.position, width, height);
27050 netUpdate = true;
27051 float num659 = velocity.Length();
27053 for (int num660 = 0; num660 < 8; num660++)
27054 {
27055 Vector2 spinningpoint10 = Vector2.UnitX * -8f;
27056 spinningpoint10 += -Vector2.UnitY.RotatedBy((float)num660 * (float)Math.PI / 4f) * new Vector2(2f, 8f);
27057 spinningpoint10 = spinningpoint10.RotatedBy(rotation - (float)Math.PI / 2f);
27058 int num661 = Dust.NewDust(base.Center, 0, 0, 228);
27059 Main.dust[num661].scale = 1.5f;
27060 Main.dust[num661].noGravity = true;
27061 Main.dust[num661].position = base.Center + spinningpoint10;
27062 Main.dust[num661].velocity = velocity * 0f;
27063 }
27064 }
27065 else if (this.ai[0] == 1f)
27066 {
27067 tileCollide = true;
27068 localAI[1]++;
27069 float num662 = 180f;
27070 float num663 = 0f;
27071 float num664 = 30f;
27072 if (localAI[1] == num662)
27073 {
27074 Kill();
27075 return;
27076 }
27077 if (localAI[1] >= num663 && localAI[1] < num663 + num664)
27078 {
27079 Vector2 v8 = Main.player[(int)this.ai[1]].Center - base.Center;
27080 float num665 = velocity.ToRotation();
27081 float num666 = v8.ToRotation();
27082 double num667 = num666 - num665;
27083 if (num667 > Math.PI)
27084 {
27085 num667 -= Math.PI * 2.0;
27086 }
27087 if (num667 < -Math.PI)
27088 {
27089 num667 += Math.PI * 2.0;
27090 }
27091 velocity = velocity.RotatedBy(num667 * 0.20000000298023224);
27092 }
27093 if (localAI[1] % 5f == 0f)
27094 {
27095 for (int num668 = 0; num668 < 4; num668++)
27096 {
27097 Vector2 spinningpoint11 = Vector2.UnitX * -8f;
27098 spinningpoint11 += -Vector2.UnitY.RotatedBy((float)num668 * (float)Math.PI / 4f) * new Vector2(2f, 4f);
27099 spinningpoint11 = spinningpoint11.RotatedBy(rotation - (float)Math.PI / 2f);
27100 int num669 = Dust.NewDust(base.Center, 0, 0, 228);
27101 Main.dust[num669].scale = 1.5f;
27102 Main.dust[num669].noGravity = true;
27103 Main.dust[num669].position = base.Center + spinningpoint11;
27104 Main.dust[num669].velocity = velocity * 0f;
27105 }
27106 }
27107 }
27108 rotation = velocity.ToRotation() + (float)Math.PI / 2f;
27109 if (++frameCounter >= 3)
27110 {
27111 frameCounter = 0;
27112 if (++frame >= 3)
27113 {
27114 frame = 0;
27115 }
27116 }
27117 for (int num670 = 0; (float)num670 < 1f + this.ai[0]; num670++)
27118 {
27119 Vector2 vector55 = Vector2.UnitY.RotatedBy(rotation) * 8f * (num670 + 1);
27120 int num671 = Dust.NewDust(base.Center, 0, 0, 228);
27121 Main.dust[num671].position = base.Center + vector55;
27122 Main.dust[num671].scale = 1f;
27123 Main.dust[num671].noGravity = true;
27124 }
27125 for (int num672 = 0; num672 < 255; num672++)
27126 {
27128 if (player7.active && !player7.dead && Vector2.Distance(player7.Center, base.Center) <= 42f)
27129 {
27130 Kill();
27131 break;
27132 }
27133 }
27134 }
27135 else if (aiStyle == 81)
27136 {
27137 int num673 = penetrate;
27138 if (this.ai[0] == 0f)
27139 {
27140 tileCollide = true;
27141 localAI[0]++;
27142 if (localAI[0] > 7f)
27143 {
27144 int num674 = Utils.SelectRandom<int>(Main.rand, 226, 229);
27145 Vector2 center8 = base.Center;
27146 Vector2 spinningpoint12 = new Vector2(-16f, 16f);
27147 float num675 = 1f;
27148 spinningpoint12 += new Vector2(-16f, 16f);
27150 int num676 = 4;
27151 int num677 = Dust.NewDust(center8 + spinningpoint12 + Vector2.One * -num676, num676 * 2, num676 * 2, num674, 0f, 0f, 100, default(Color), num675);
27153 dust2.velocity *= 0.1f;
27154 if (Main.rand.Next(6) != 0)
27155 {
27156 Main.dust[num677].noGravity = true;
27157 }
27158 }
27159 float num678 = 0.01f;
27160 int num679 = 5;
27161 int num680 = num679 * 15;
27162 int num681 = 0;
27163 if (localAI[0] > 7f)
27164 {
27165 if (localAI[1] == 0f)
27166 {
27167 scale -= num678;
27168 alpha += num679;
27169 if (alpha > num680)
27170 {
27171 alpha = num680;
27172 localAI[1] = 1f;
27173 }
27174 }
27175 else if (localAI[1] == 1f)
27176 {
27177 scale += num678;
27178 alpha -= num679;
27179 if (alpha <= num681)
27180 {
27181 alpha = num681;
27182 localAI[1] = 0f;
27183 }
27184 }
27185 }
27186 rotation = velocity.ToRotation() + (float)Math.PI / 4f;
27187 }
27188 else if (this.ai[0] >= 1f && this.ai[0] < (float)(1 + num673))
27189 {
27190 tileCollide = false;
27191 alpha += 15;
27192 velocity *= 0.98f;
27193 localAI[0] = 0f;
27194 int num682 = -1;
27195 Vector2 vector56 = base.Center;
27196 float num683 = 250f;
27197 for (int num684 = 0; num684 < 200; num684++)
27198 {
27199 NPC nPC9 = Main.npc[num684];
27200 if (nPC9.CanBeChasedBy(this))
27201 {
27202 Vector2 center9 = nPC9.Center;
27203 float num685 = Vector2.Distance(center9, base.Center);
27204 if (num685 < num683)
27205 {
27206 num683 = num685;
27207 vector56 = center9;
27208 num682 = num684;
27209 }
27210 }
27211 }
27212 if (alpha >= 255)
27213 {
27214 if (this.ai[0] == 1f)
27215 {
27216 Kill();
27217 return;
27218 }
27219 if (num682 >= 0)
27220 {
27221 netUpdate = true;
27222 this.ai[0] += num673;
27223 base.position = vector56 + ((float)Main.rand.NextDouble() * ((float)Math.PI * 2f)).ToRotationVector2() * 100f - new Vector2(width, height) / 2f;
27224 velocity = Vector2.Normalize(vector56 - base.Center) * 15f;
27225 rotation = velocity.ToRotation() + (float)Math.PI / 4f;
27226 }
27227 else
27228 {
27229 Kill();
27230 }
27231 }
27232 if (active && num682 >= 0)
27233 {
27234 base.position += Main.npc[num682].velocity;
27235 }
27236 if (Main.rand.Next(3) == 0)
27237 {
27238 int num686 = Utils.SelectRandom<int>(Main.rand, 226, 229);
27239 Vector2 center10 = base.Center;
27240 Vector2 vector57 = new Vector2(-16f, 16f);
27242 float num687 = 0.6f;
27243 vector57 += new Vector2(-16f, 16f);
27244 vector57 = vector57.RotatedBy(rotation);
27245 int num688 = 4;
27246 int num689 = Dust.NewDust(center10 + vector57 + Vector2.One * -num688, num688 * 2, num688 * 2, num686, 0f, 0f, 100, default(Color), num687);
27248 dust2.velocity *= 0.1f;
27249 Main.dust[num689].noGravity = true;
27250 }
27251 }
27252 else if (this.ai[0] >= (float)(1 + num673) && this.ai[0] < (float)(1 + num673 * 2))
27253 {
27254 scale = 0.9f;
27255 tileCollide = false;
27256 rotation = velocity.ToRotation() + (float)Math.PI / 4f;
27257 this.ai[1]++;
27258 if (this.ai[1] >= 15f)
27259 {
27260 alpha += 51;
27261 velocity *= 0.8f;
27262 if (alpha >= 255)
27263 {
27264 Kill();
27265 }
27266 }
27267 else
27268 {
27269 alpha -= 125;
27270 if (alpha < 0)
27271 {
27272 alpha = 0;
27273 }
27274 velocity *= 0.98f;
27275 }
27276 localAI[0]++;
27277 int num690 = -1;
27278 Vector2 center11 = base.Center;
27279 float num691 = 250f;
27280 for (int num692 = 0; num692 < 200; num692++)
27281 {
27282 NPC nPC10 = Main.npc[num692];
27283 if (nPC10.CanBeChasedBy(this))
27284 {
27285 Vector2 center12 = nPC10.Center;
27286 float num693 = Vector2.Distance(center12, base.Center);
27287 if (num693 < num691)
27288 {
27289 num691 = num693;
27291 num690 = num692;
27292 }
27293 }
27294 }
27295 if (num690 >= 0)
27296 {
27297 base.position += Main.npc[num690].velocity;
27298 }
27299 int num694 = Utils.SelectRandom<int>(Main.rand, 226, 229);
27300 Vector2 center13 = base.Center;
27301 Vector2 spinningpoint13 = new Vector2(-16f, 16f);
27302 float num695 = 0.6f;
27303 spinningpoint13 += new Vector2(-16f, 16f);
27305 int num696 = 4;
27306 int num697 = Dust.NewDust(center13 + spinningpoint13 + Vector2.One * -num696, num696 * 2, num696 * 2, num694, 0f, 0f, 100, default(Color), num695);
27308 dust2.velocity *= 0.1f;
27309 Main.dust[num697].noGravity = true;
27310 }
27311 float num698 = (float)alpha / 255f;
27312 Lighting.AddLight((int)base.Center.X / 16, (int)base.Center.Y / 16, 0.3f * num698, 0.4f * num698, 1f * num698);
27313 }
27314 else if (aiStyle == 82)
27315 {
27316 alpha -= 40;
27317 if (alpha < 0)
27318 {
27319 alpha = 0;
27320 }
27321 if (this.ai[0] == 0f)
27322 {
27323 localAI[0]++;
27324 if (localAI[0] >= 45f)
27325 {
27326 localAI[0] = 0f;
27327 this.ai[0] = 1f;
27328 this.ai[1] = 0f - this.ai[1];
27329 netUpdate = true;
27330 }
27331 velocity.X = velocity.RotatedBy(this.ai[1]).X;
27332 velocity.X = MathHelper.Clamp(velocity.X, -6f, 6f);
27333 velocity.Y -= 0.08f;
27334 if (velocity.Y > 0f)
27335 {
27336 velocity.Y -= 0.2f;
27337 }
27338 if (velocity.Y < -7f)
27339 {
27340 velocity.Y = -7f;
27341 }
27342 }
27343 else if (this.ai[0] == 1f)
27344 {
27345 localAI[0]++;
27346 if (localAI[0] >= 90f)
27347 {
27348 localAI[0] = 0f;
27349 this.ai[0] = 2f;
27350 this.ai[1] = (int)Player.FindClosest(base.position, width, height);
27351 netUpdate = true;
27352 }
27353 velocity.X = velocity.RotatedBy(this.ai[1]).X;
27354 velocity.X = MathHelper.Clamp(velocity.X, -6f, 6f);
27355 velocity.Y -= 0.08f;
27356 if (velocity.Y > 0f)
27357 {
27358 velocity.Y -= 0.2f;
27359 }
27360 if (velocity.Y < -7f)
27361 {
27362 velocity.Y = -7f;
27363 }
27364 }
27365 else if (this.ai[0] == 2f)
27366 {
27367 Vector2 value7 = Main.player[(int)this.ai[1]].Center - base.Center;
27368 if (value7.Length() < 30f)
27369 {
27370 Kill();
27371 return;
27372 }
27373 value7.Normalize();
27374 value7 *= 14f;
27375 value7 = Vector2.Lerp(velocity, value7, 0.6f);
27376 if (value7.Y < 6f)
27377 {
27378 value7.Y = 6f;
27379 }
27380 float num699 = 0.4f;
27381 if (velocity.X < value7.X)
27382 {
27383 velocity.X += num699;
27384 if (velocity.X < 0f && value7.X > 0f)
27385 {
27386 velocity.X += num699;
27387 }
27388 }
27389 else if (velocity.X > value7.X)
27390 {
27391 velocity.X -= num699;
27392 if (velocity.X > 0f && value7.X < 0f)
27393 {
27394 velocity.X -= num699;
27395 }
27396 }
27397 if (velocity.Y < value7.Y)
27398 {
27399 velocity.Y += num699;
27400 if (velocity.Y < 0f && value7.Y > 0f)
27401 {
27402 velocity.Y += num699;
27403 }
27404 }
27405 else if (velocity.Y > value7.Y)
27406 {
27407 velocity.Y -= num699;
27408 if (velocity.Y > 0f && value7.Y < 0f)
27409 {
27410 velocity.Y -= num699;
27411 }
27412 }
27413 }
27414 if (alpha < 40)
27415 {
27416 int num700 = Dust.NewDust(base.Center - Vector2.One * 5f, 10, 10, 229, (0f - velocity.X) / 3f, (0f - velocity.Y) / 3f, 150, Color.Transparent, 1.2f);
27417 Main.dust[num700].noGravity = true;
27418 }
27419 rotation = velocity.ToRotation() + (float)Math.PI / 2f;
27420 }
27421 else if (aiStyle == 83)
27422 {
27423 if (alpha > 200)
27424 {
27425 alpha = 200;
27426 }
27427 alpha -= 5;
27428 if (alpha < 0)
27429 {
27430 alpha = 0;
27431 }
27432 float num701 = (float)alpha / 255f;
27433 scale = 1f - num701;
27434 if (this.ai[0] >= 0f)
27435 {
27436 this.ai[0]++;
27437 }
27438 if (this.ai[0] == -1f)
27439 {
27440 frame = 1;
27441 extraUpdates = 1;
27442 }
27443 else if (this.ai[0] < 30f)
27444 {
27445 base.position = Main.npc[(int)this.ai[1]].Center - new Vector2(width, height) / 2f - velocity;
27446 }
27447 else
27448 {
27449 velocity *= 0.96f;
27450 if (++frameCounter >= 6)
27451 {
27452 frameCounter = 0;
27453 if (++frame >= 2)
27454 {
27455 frame = 0;
27456 }
27457 }
27458 }
27459 if (alpha >= 40)
27460 {
27461 return;
27462 }
27463 for (int num702 = 0; num702 < 2; num702++)
27464 {
27465 float num703 = (float)Main.rand.NextDouble() * 1f - 0.5f;
27466 if (num703 < -0.5f)
27467 {
27468 num703 = -0.5f;
27469 }
27470 if (num703 > 0.5f)
27471 {
27472 num703 = 0.5f;
27473 }
27474 Vector2 vector58 = new Vector2((float)(-width) * 0.65f * scale, 0f).RotatedBy(num703 * ((float)Math.PI * 2f)).RotatedBy(velocity.ToRotation());
27475 int num704 = Dust.NewDust(base.Center - Vector2.One * 5f, 10, 10, 229, (0f - velocity.X) / 3f, (0f - velocity.Y) / 3f, 150, Color.Transparent, 0.7f);
27476 Main.dust[num704].velocity = Vector2.Zero;
27477 Main.dust[num704].position = base.Center + vector58;
27478 Main.dust[num704].noGravity = true;
27479 }
27480 }
27481 else if (aiStyle == 84)
27482 {
27483 Vector2? vector59 = null;
27484 if (velocity.HasNaNs() || velocity == Vector2.Zero)
27485 {
27487 }
27488 if (type == 455 && Main.npc[(int)this.ai[1]].active && Main.npc[(int)this.ai[1]].type == 396)
27489 {
27490 if (Main.npc[(int)this.ai[1]].ai[0] == -2f)
27491 {
27492 Kill();
27493 return;
27494 }
27495 Vector2 vector60 = Utils.Vector2FromElipse(elipseSizes: new Vector2(27f, 59f) * Main.npc[(int)this.ai[1]].localAI[1], angleVector: Main.npc[(int)this.ai[1]].localAI[0].ToRotationVector2());
27496 base.position = Main.npc[(int)this.ai[1]].Center + vector60 - new Vector2(width, height) / 2f;
27497 }
27498 else if (type == 455 && Main.npc[(int)this.ai[1]].active && Main.npc[(int)this.ai[1]].type == 400)
27499 {
27500 Vector2 vector61 = Utils.Vector2FromElipse(elipseSizes: new Vector2(30f, 30f) * Main.npc[(int)this.ai[1]].localAI[1], angleVector: Main.npc[(int)this.ai[1]].localAI[0].ToRotationVector2());
27501 base.position = Main.npc[(int)this.ai[1]].Center + vector61 - new Vector2(width, height) / 2f;
27502 }
27503 else if (type == 537 && Main.npc[(int)this.ai[1]].active && Main.npc[(int)this.ai[1]].type == 411)
27504 {
27505 Vector2 vector62 = new Vector2(Main.npc[(int)this.ai[1]].direction * 6, -4f);
27506 base.position = Main.npc[(int)this.ai[1]].Center + vector62 - base.Size / 2f + new Vector2(0f, 0f - Main.npc[(int)this.ai[1]].gfxOffY);
27507 }
27508 else if (type == 461 && Main.projectile[(int)this.ai[1]].active && Main.projectile[(int)this.ai[1]].type == 460)
27509 {
27510 Vector2 vector63 = Vector2.Normalize(Main.projectile[(int)this.ai[1]].velocity);
27511 base.position = Main.projectile[(int)this.ai[1]].Center + vector63 * 16f - new Vector2(width, height) / 2f + new Vector2(0f, 0f - Main.projectile[(int)this.ai[1]].gfxOffY);
27512 velocity = Vector2.Normalize(Main.projectile[(int)this.ai[1]].velocity);
27513 }
27514 else if (type == 642 && Main.projectile[(int)this.ai[1]].active && Main.projectile[(int)this.ai[1]].type == 641)
27515 {
27516 Projectile projectile = Main.projectile[(int)this.ai[1]];
27517 base.Center = projectile.Center;
27518 Vector2 vector64 = this.ai[0].ToRotationVector2().RotatedBy((float)(-projectile.direction) * ((float)Math.PI / 3f) / 50f);
27519 this.ai[0] = vector64.ToRotation();
27521 }
27522 else
27523 {
27524 if (type != 632 || !Main.projectile[(int)this.ai[1]].active || Main.projectile[(int)this.ai[1]].type != 633)
27525 {
27526 Kill();
27527 return;
27528 }
27529 float num705 = (float)(int)this.ai[0] - 2.5f;
27530 Vector2 vector65 = Vector2.Normalize(Main.projectile[(int)this.ai[1]].velocity);
27531 Projectile projectile2 = Main.projectile[(int)this.ai[1]];
27532 float num706 = num705 * ((float)Math.PI / 6f);
27533 float num707 = 20f;
27535 float num708 = 1f;
27536 float num709 = 15f;
27537 float num710 = -2f;
27538 if (projectile2.ai[0] < 180f)
27539 {
27540 num708 = 1f - projectile2.ai[0] / 180f;
27541 num709 = 20f - projectile2.ai[0] / 180f * 14f;
27542 if (projectile2.ai[0] < 120f)
27543 {
27544 num707 = 20f - 4f * (projectile2.ai[0] / 120f);
27545 Opacity = projectile2.ai[0] / 120f * 0.4f;
27546 }
27547 else
27548 {
27549 num707 = 16f - 10f * ((projectile2.ai[0] - 120f) / 60f);
27550 Opacity = 0.4f + (projectile2.ai[0] - 120f) / 60f * 0.6f;
27551 }
27552 num710 = -22f + projectile2.ai[0] / 180f * 20f;
27553 }
27554 else
27555 {
27556 num708 = 0f;
27557 num707 = 1.75f;
27558 num709 = 6f;
27559 Opacity = 1f;
27560 num710 = -2f;
27561 }
27562 float num711 = (projectile2.ai[0] + num705 * num707) / (num707 * 6f) * ((float)Math.PI * 2f);
27563 num706 = Vector2.UnitY.RotatedBy(num711).Y * ((float)Math.PI / 6f) * num708;
27564 zero2 = (Vector2.UnitY.RotatedBy(num711) * new Vector2(4f, num709)).RotatedBy(projectile2.velocity.ToRotation());
27565 base.position = projectile2.Center + vector65 * 16f - base.Size / 2f + new Vector2(0f, 0f - Main.projectile[(int)this.ai[1]].gfxOffY);
27566 base.position += projectile2.velocity.ToRotation().ToRotationVector2() * num710;
27567 base.position += zero2;
27568 velocity = Vector2.Normalize(projectile2.velocity).RotatedBy(num706);
27569 scale = 1.4f * (1f - num708);
27570 damage = projectile2.damage;
27571 if (projectile2.ai[0] >= 180f)
27572 {
27573 damage *= 3;
27574 vector59 = projectile2.Center;
27575 }
27576 if (!Collision.CanHitLine(Main.player[owner].Center, 0, 0, projectile2.Center, 0, 0))
27577 {
27578 vector59 = Main.player[owner].Center;
27579 }
27580 friendly = projectile2.ai[0] > 30f;
27581 }
27582 if (velocity.HasNaNs() || velocity == Vector2.Zero)
27583 {
27585 }
27586 if (type == 461)
27587 {
27588 this.ai[0]++;
27589 if (this.ai[0] >= 300f)
27590 {
27591 Kill();
27592 return;
27593 }
27594 scale = (float)Math.Sin(this.ai[0] * (float)Math.PI / 300f) * 10f;
27595 if (scale > 1f)
27596 {
27597 scale = 1f;
27598 }
27599 }
27600 if (type == 455)
27601 {
27602 if (localAI[0] == 0f)
27603 {
27604 SoundEngine.PlaySound(29, (int)base.position.X, (int)base.position.Y, 104);
27605 }
27606 float num712 = 1f;
27607 if (Main.npc[(int)this.ai[1]].type == 400)
27608 {
27609 num712 = 0.4f;
27610 }
27611 localAI[0]++;
27612 if (localAI[0] >= 180f)
27613 {
27614 Kill();
27615 return;
27616 }
27617 scale = (float)Math.Sin(localAI[0] * (float)Math.PI / 180f) * 10f * num712;
27618 if (scale > num712)
27619 {
27620 scale = num712;
27621 }
27622 }
27623 if (type == 642)
27624 {
27625 float num713 = 1f;
27626 localAI[0]++;
27627 if (localAI[0] >= 50f)
27628 {
27629 Kill();
27630 return;
27631 }
27632 scale = (float)Math.Sin(localAI[0] * (float)Math.PI / 50f) * 10f * num713;
27633 if (scale > num713)
27634 {
27635 scale = num713;
27636 }
27637 }
27638 if (type == 537)
27639 {
27640 float num714 = 0.8f;
27641 localAI[0]++;
27642 if (localAI[0] >= 90f)
27643 {
27644 Kill();
27645 return;
27646 }
27647 scale = (float)Math.Sin(localAI[0] * (float)Math.PI / 90f) * 10f * num714;
27648 if (scale > num714)
27649 {
27650 scale = num714;
27651 }
27652 }
27653 float num715 = velocity.ToRotation();
27654 if (type == 455)
27655 {
27656 num715 += this.ai[0];
27657 }
27658 rotation = num715 - (float)Math.PI / 2f;
27659 velocity = num715.ToRotationVector2();
27660 float num716 = 0f;
27661 float num717 = 0f;
27662 Vector2 samplingPoint = base.Center;
27663 if (vector59.HasValue)
27664 {
27665 samplingPoint = vector59.Value;
27666 }
27667 if (type == 455)
27668 {
27669 num716 = 3f;
27670 num717 = width;
27671 }
27672 else if (type == 461)
27673 {
27674 num716 = 2f;
27675 num717 = 0f;
27676 }
27677 else if (type == 642)
27678 {
27679 num716 = 2f;
27680 num717 = 0f;
27681 }
27682 else if (type == 632)
27683 {
27684 num716 = 2f;
27685 num717 = 0f;
27686 }
27687 else if (type == 537)
27688 {
27689 num716 = 2f;
27690 num717 = 0f;
27691 }
27692 float[] array4 = new float[(int)num716];
27694 float num718 = 0f;
27695 for (int num719 = 0; num719 < array4.Length; num719++)
27696 {
27697 num718 += array4[num719];
27698 }
27699 num718 /= num716;
27700 float amount = 0.5f;
27701 if (type == 455)
27702 {
27703 NPC nPC11 = Main.npc[(int)this.ai[1]];
27704 if (nPC11.type == 396)
27705 {
27706 Player player8 = Main.player[nPC11.target];
27707 if (!Collision.CanHitLine(nPC11.position, nPC11.width, nPC11.height, player8.position, player8.width, player8.height))
27708 {
27709 num718 = Math.Min(2400f, Vector2.Distance(nPC11.Center, player8.Center) + 150f);
27710 amount = 0.75f;
27711 }
27712 }
27713 }
27714 if (type == 632)
27715 {
27716 amount = 0.75f;
27717 }
27719 if (type == 455)
27720 {
27721 Vector2 vector66 = base.Center + velocity * (localAI[1] - 14f);
27722 for (int num720 = 0; num720 < 2; num720++)
27723 {
27724 float num721 = velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? (-1f) : 1f) * ((float)Math.PI / 2f);
27725 float num722 = (float)Main.rand.NextDouble() * 2f + 2f;
27726 Vector2 vector67 = new Vector2((float)Math.Cos(num721) * num722, (float)Math.Sin(num721) * num722);
27727 int num723 = Dust.NewDust(vector66, 0, 0, 229, vector67.X, vector67.Y);
27728 Main.dust[num723].noGravity = true;
27729 Main.dust[num723].scale = 1.7f;
27730 }
27731 if (Main.rand.Next(5) == 0)
27732 {
27733 Vector2 vector68 = velocity.RotatedBy(1.5707963705062866) * ((float)Main.rand.NextDouble() - 0.5f) * width;
27734 int num724 = Dust.NewDust(vector66 + vector68 - Vector2.One * 4f, 8, 8, 31, 0f, 0f, 100, default(Color), 1.5f);
27736 dust2.velocity *= 0.5f;
27737 Main.dust[num724].velocity.Y = 0f - Math.Abs(Main.dust[num724].velocity.Y);
27738 }
27739 DelegateMethods.v3_1 = new Vector3(0.3f, 0.65f, 0.7f);
27740 Utils.PlotTileLine(base.Center, base.Center + velocity * localAI[1], (float)width * scale, DelegateMethods.CastLight);
27741 }
27742 else if (type == 642)
27743 {
27744 Vector2 vector69 = base.Center + velocity * (localAI[1] - 14f);
27745 for (int num725 = 0; num725 < 2; num725++)
27746 {
27747 float num726 = velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? (-1f) : 1f) * ((float)Math.PI / 2f);
27748 float num727 = (float)Main.rand.NextDouble() * 2f + 2f;
27749 Vector2 vector70 = new Vector2((float)Math.Cos(num726) * num727, (float)Math.Sin(num726) * num727);
27750 int num728 = Dust.NewDust(vector69, 0, 0, 229, vector70.X, vector70.Y);
27751 Main.dust[num728].noGravity = true;
27752 Main.dust[num728].scale = 1.7f;
27753 }
27754 if (Main.rand.Next(5) == 0)
27755 {
27756 Vector2 vector71 = velocity.RotatedBy(1.5707963705062866) * ((float)Main.rand.NextDouble() - 0.5f) * width;
27757 int num729 = Dust.NewDust(vector69 + vector71 - Vector2.One * 4f, 8, 8, 31, 0f, 0f, 100, default(Color), 1.5f);
27759 dust2.velocity *= 0.5f;
27760 Main.dust[num729].velocity.Y = 0f - Math.Abs(Main.dust[num729].velocity.Y);
27761 }
27762 DelegateMethods.v3_1 = new Vector3(0.3f, 0.65f, 0.7f);
27763 Utils.PlotTileLine(base.Center, base.Center + velocity * localAI[1], (float)width * scale, DelegateMethods.CastLight);
27764 }
27765 if (type == 461)
27766 {
27767 Vector2 vector72 = base.Center + velocity * (localAI[1] - 8f);
27768 for (int num730 = 0; num730 < 2; num730++)
27769 {
27770 float num731 = velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? (-1f) : 1f) * ((float)Math.PI / 2f);
27771 float num732 = (float)Main.rand.NextDouble() * 0.8f + 1f;
27772 Vector2 vector73 = new Vector2((float)Math.Cos(num731) * num732, (float)Math.Sin(num731) * num732);
27773 int num733 = Dust.NewDust(vector72, 0, 0, 226, vector73.X, vector73.Y);
27774 Main.dust[num733].noGravity = true;
27775 Main.dust[num733].scale = 1.2f;
27776 }
27777 if (Main.rand.Next(5) == 0)
27778 {
27779 Vector2 vector74 = velocity.RotatedBy(1.5707963705062866) * ((float)Main.rand.NextDouble() - 0.5f) * width;
27780 int num734 = Dust.NewDust(vector72 + vector74 - Vector2.One * 4f, 8, 8, 31, 0f, 0f, 100, default(Color), 1.5f);
27782 dust2.velocity *= 0.5f;
27783 Main.dust[num734].velocity.Y = 0f - Math.Abs(Main.dust[num734].velocity.Y);
27784 }
27785 DelegateMethods.v3_1 = new Vector3(0.4f, 0.85f, 0.9f);
27786 Utils.PlotTileLine(base.Center, base.Center + velocity * localAI[1], (float)width * scale, DelegateMethods.CastLight);
27787 }
27788 if (type == 537)
27789 {
27790 float num735 = MathHelper.Clamp(MathHelper.Lerp(0f, 1f, localAI[0] / 30f), 0f, 1f);
27791 Vector2 vector75 = base.Center + velocity * (localAI[1] - 8f);
27792 int num736 = (int)(2f * num735);
27793 if (num736 > 0)
27794 {
27795 for (int num737 = 0; num737 < num736; num737++)
27796 {
27797 float num738 = velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? (-1f) : 1f) * ((float)Math.PI / 2f);
27798 float num739 = (float)Main.rand.NextDouble() * 0.8f + 1f;
27799 Vector2 vector76 = new Vector2((float)Math.Cos(num738) * num739, (float)Math.Sin(num738) * num739);
27800 int num740 = Dust.NewDust(vector75, 0, 0, 226, vector76.X, vector76.Y);
27801 Main.dust[num740].noGravity = true;
27802 Main.dust[num740].scale = 1.2f;
27803 }
27804 }
27805 int maxValue2 = 5 + (int)((1f - num735) * 5f);
27806 if (Main.rand.Next(maxValue2) == 0)
27807 {
27808 Vector2 vector77 = velocity.RotatedBy(1.5707963705062866) * ((float)Main.rand.NextDouble() - 0.5f) * width;
27809 int num741 = Dust.NewDust(vector75 + vector77 - Vector2.One * 4f, 8, 8, 31, 0f, 0f, 100, default(Color), 1.5f);
27811 dust2.velocity *= 0.5f;
27812 Main.dust[num741].velocity.Y = 0f - Math.Abs(Main.dust[num741].velocity.Y);
27813 }
27814 DelegateMethods.v3_1 = new Vector3(0.4f, 0.85f, 0.9f);
27815 Utils.PlotTileLine(base.Center, base.Center + velocity * localAI[1], (float)width * scale, DelegateMethods.CastLight);
27816 }
27817 if (type != 632 || !(Math.Abs(localAI[1] - num718) < 100f) || !(scale > 0.15f))
27818 {
27819 return;
27820 }
27821 float laserLuminance = 0.5f;
27822 float laserAlphaMultiplier = 0f;
27825 color.A = (byte)((float)(int)color.A * laserAlphaMultiplier);
27826 Color color2 = color;
27827 Vector2 vector78 = base.Center + velocity * (localAI[1] - 14.5f * scale);
27829 for (int num742 = 0; num742 < 2; num742++)
27830 {
27831 float num743 = velocity.ToRotation() + ((Main.rand.Next(2) == 1) ? (-1f) : 1f) * ((float)Math.PI / 2f);
27832 float num744 = (float)Main.rand.NextDouble() * 0.8f + 1f;
27833 Vector2 vector79 = new Vector2((float)Math.Cos(num743) * num744, (float)Math.Sin(num743) * num744);
27834 int num745 = Dust.NewDust(vector78, 0, 0, 267, vector79.X, vector79.Y);
27835 Main.dust[num745].color = color;
27836 Main.dust[num745].scale = 1.2f;
27837 if (scale > 1f)
27838 {
27840 dust2.velocity *= scale;
27841 dust2 = Main.dust[num745];
27842 dust2.scale *= scale;
27843 }
27844 Main.dust[num745].noGravity = true;
27845 if (scale != 1.4f && num745 != 6000)
27846 {
27848 dust21.color = Color.White;
27849 Dust dust2 = dust21;
27850 dust2.scale /= 2f;
27851 }
27852 float hue = (x5 + Main.rand.NextFloat() * 0.4f) % 1f;
27853 Main.dust[num745].color = Color.Lerp(color, Main.hslToRgb(hue, 1f, 0.75f), scale / 1.4f);
27854 }
27855 if (Main.rand.Next(5) == 0)
27856 {
27857 Vector2 vector80 = velocity.RotatedBy(1.5707963705062866) * ((float)Main.rand.NextDouble() - 0.5f) * width;
27858 int num746 = Dust.NewDust(vector78 + vector80 - Vector2.One * 4f, 8, 8, 31, 0f, 0f, 100, default(Color), 1.5f);
27860 dust2.velocity *= 0.5f;
27861 Main.dust[num746].velocity.Y = 0f - Math.Abs(Main.dust[num746].velocity.Y);
27862 }
27863 DelegateMethods.v3_1 = color.ToVector3() * 0.3f;
27864 float value8 = 0.1f * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 20f);
27865 Vector2 size2 = new Vector2(velocity.Length() * localAI[1], (float)width * scale);
27866 float num747 = velocity.ToRotation();
27867 if (Main.netMode != 2)
27868 {
27869 ((WaterShaderData)Filters.Scene["WaterDistortion"].GetShader()).QueueRipple(base.position + new Vector2(size2.X * 0.5f, 0f).RotatedBy(num747), new Color(0.5f, 0.1f * (float)Math.Sign(value8) + 0.5f, 0f, 1f) * Math.Abs(value8), size2, RippleShape.Square, num747);
27870 }
27871 Utils.PlotTileLine(base.Center, base.Center + velocity * localAI[1], (float)width * scale, DelegateMethods.CastLight);
27872 }
27873 else if (aiStyle == 85)
27874 {
27875 Vector2 vector81 = new Vector2(0f, 216f);
27876 alpha -= 15;
27877 if (alpha < 0)
27878 {
27879 alpha = 0;
27880 }
27881 int num748 = (int)Math.Abs(this.ai[0]) - 1;
27882 int num749 = (int)this.ai[1];
27883 if (!Main.npc[num748].active || Main.npc[num748].type != 396)
27884 {
27885 Kill();
27886 return;
27887 }
27888 localAI[0]++;
27889 if (localAI[0] >= 330f && this.ai[0] > 0f && Main.netMode != 1)
27890 {
27891 this.ai[0] *= -1f;
27892 netUpdate = true;
27893 }
27894 if (Main.netMode != 1 && this.ai[0] > 0f && (!Main.player[(int)this.ai[1]].active || Main.player[(int)this.ai[1]].dead))
27895 {
27896 this.ai[0] *= -1f;
27897 netUpdate = true;
27898 }
27899 rotation = (Main.npc[(int)Math.Abs(this.ai[0]) - 1].Center - Main.player[(int)this.ai[1]].Center + vector81).ToRotation() + (float)Math.PI / 2f;
27900 if (this.ai[0] > 0f)
27901 {
27902 Vector2 value9 = Main.player[(int)this.ai[1]].Center - base.Center;
27903 if (value9.X != 0f || value9.Y != 0f)
27904 {
27905 velocity = Vector2.Normalize(value9) * Math.Min(16f, value9.Length());
27906 }
27907 else
27908 {
27910 }
27911 if (value9.Length() < 20f && localAI[1] == 0f)
27912 {
27913 localAI[1] = 1f;
27914 int timeToAdd = 840;
27915 if (Main.expertMode)
27916 {
27917 timeToAdd = 960;
27918 }
27919 if (!Main.player[num749].creativeGodMode)
27920 {
27921 Main.player[num749].AddBuff(145, timeToAdd);
27922 }
27923 }
27924 }
27925 else
27926 {
27927 Vector2 value10 = Main.npc[(int)Math.Abs(this.ai[0]) - 1].Center - base.Center + vector81;
27928 if (value10.X != 0f || value10.Y != 0f)
27929 {
27930 velocity = Vector2.Normalize(value10) * Math.Min(16f, value10.Length());
27931 }
27932 else
27933 {
27935 }
27936 if (value10.Length() < 20f)
27937 {
27938 Kill();
27939 }
27940 }
27941 }
27942 else if (aiStyle == 86)
27943 {
27944 if (localAI[1] == 0f)
27945 {
27946 localAI[1] = 1f;
27948 }
27949 this.ai[0]++;
27950 if (this.ai[1] == 1f)
27951 {
27952 if (this.ai[0] >= 130f)
27953 {
27954 alpha += 10;
27955 }
27956 else
27957 {
27958 alpha -= 10;
27959 }
27960 if (alpha < 0)
27961 {
27962 alpha = 0;
27963 }
27964 if (alpha > 255)
27965 {
27966 alpha = 255;
27967 }
27968 if (this.ai[0] >= 150f)
27969 {
27970 Kill();
27971 return;
27972 }
27973 if (this.ai[0] % 30f == 0f && Main.netMode != 1)
27974 {
27975 Vector2 vector82 = rotation.ToRotationVector2();
27977 }
27978 rotation += (float)Math.PI / 30f;
27979 Lighting.AddLight(base.Center, 0.3f, 0.75f, 0.9f);
27980 return;
27981 }
27982 base.position -= velocity;
27983 if (this.ai[0] >= 40f)
27984 {
27985 alpha += 3;
27986 }
27987 else
27988 {
27989 alpha -= 40;
27990 }
27991 if (alpha < 0)
27992 {
27993 alpha = 0;
27994 }
27995 if (alpha > 255)
27996 {
27997 alpha = 255;
27998 }
27999 if (this.ai[0] >= 45f)
28000 {
28001 Kill();
28002 return;
28003 }
28004 Vector2 vector83 = new Vector2(0f, -720f).RotatedBy(velocity.ToRotation());
28005 float num750 = this.ai[0] % 45f / 45f;
28007 for (int num751 = 0; num751 < 6; num751++)
28008 {
28009 Vector2 vector84 = base.Center + spinningpoint14.RotatedBy((float)num751 * ((float)Math.PI * 2f) / 6f);
28010 Lighting.AddLight(vector84, 0.3f, 0.75f, 0.9f);
28011 for (int num752 = 0; num752 < 2; num752++)
28012 {
28013 int num753 = Dust.NewDust(vector84 + Utils.RandomVector2(Main.rand, -8f, 8f) / 2f, 8, 8, 197, 0f, 0f, 100, Color.Transparent);
28014 Main.dust[num753].noGravity = true;
28015 }
28016 }
28017 }
28018 else if (aiStyle == 87)
28019 {
28020 base.position.Y = this.ai[0];
28021 height = (int)this.ai[1];
28022 if (base.Center.X > Main.player[owner].Center.X)
28023 {
28024 direction = 1;
28025 }
28026 else
28027 {
28028 direction = -1;
28029 }
28030 velocity.X = (float)direction * 1E-06f;
28031 if (owner == Main.myPlayer)
28032 {
28033 for (int num754 = 0; num754 < 1000; num754++)
28034 {
28035 if (Main.projectile[num754].active && num754 != whoAmI && Main.projectile[num754].type == type && Main.projectile[num754].owner == owner && Main.projectile[num754].timeLeft > timeLeft)
28036 {
28037 Kill();
28038 return;
28039 }
28040 }
28041 }
28042 float num755 = (float)(width * height) * 0.0045f;
28043 for (int num756 = 0; (float)num756 < num755; num756++)
28044 {
28045 int num757 = Dust.NewDust(base.position, width, height, 75, 0f, 0f, 100);
28046 Main.dust[num757].noGravity = true;
28048 dust2.velocity *= 0.5f;
28049 Main.dust[num757].velocity.Y -= 0.5f;
28050 Main.dust[num757].scale = 1.4f;
28051 Main.dust[num757].position.X += 6f;
28052 Main.dust[num757].position.Y -= 2f;
28053 }
28054 }
28055 else if (aiStyle == 88)
28056 {
28057 if (type == 465)
28058 {
28059 if (localAI[1] == 0f)
28060 {
28062 localAI[1] = 1f;
28063 }
28064 if (this.ai[0] < 180f)
28065 {
28066 alpha -= 5;
28067 if (alpha < 0)
28068 {
28069 alpha = 0;
28070 }
28071 }
28072 else
28073 {
28074 alpha += 5;
28075 if (alpha > 255)
28076 {
28077 alpha = 255;
28078 Kill();
28079 return;
28080 }
28081 }
28082 this.ai[0]++;
28083 if (this.ai[0] % 30f == 0f && this.ai[0] < 180f && Main.netMode != 1)
28084 {
28085 int[] array5 = new int[5];
28086 Vector2[] array6 = new Vector2[5];
28087 int num758 = 0;
28088 float num759 = 2000f;
28089 for (int num760 = 0; num760 < 255; num760++)
28090 {
28091 if (!Main.player[num760].active || Main.player[num760].dead)
28092 {
28093 continue;
28094 }
28095 Vector2 center14 = Main.player[num760].Center;
28096 float num761 = Vector2.Distance(center14, base.Center);
28097 if (num761 < num759 && Collision.CanHit(base.Center, 1, 1, center14, 1, 1))
28098 {
28099 array5[num758] = num760;
28101 int num38 = num758 + 1;
28102 num758 = num38;
28103 if (num38 >= array6.Length)
28104 {
28105 break;
28106 }
28107 }
28108 }
28109 for (int num762 = 0; num762 < num758; num762++)
28110 {
28111 Vector2 vector85 = array6[num762] - base.Center;
28112 float ai = Main.rand.Next(100);
28113 Vector2 vector86 = Vector2.Normalize(vector85.RotatedByRandom(0.7853981852531433)) * 7f;
28114 NewProjectile(GetProjectileSource_FromThis(), base.Center.X, base.Center.Y, vector86.X, vector86.Y, 466, damage, 0f, Main.myPlayer, vector85.ToRotation(), ai);
28115 }
28116 }
28117 Lighting.AddLight(base.Center, 0.4f, 0.85f, 0.9f);
28118 if (++frameCounter >= 4)
28119 {
28120 frameCounter = 0;
28121 if (++frame >= Main.projFrames[type])
28122 {
28123 frame = 0;
28124 }
28125 }
28126 if (alpha >= 150 || !(this.ai[0] < 180f))
28127 {
28128 return;
28129 }
28130 for (int num763 = 0; num763 < 1; num763++)
28131 {
28132 float num764 = (float)Main.rand.NextDouble() * 1f - 0.5f;
28133 if (num764 < -0.5f)
28134 {
28135 num764 = -0.5f;
28136 }
28137 if (num764 > 0.5f)
28138 {
28139 num764 = 0.5f;
28140 }
28141 Vector2 vector87 = new Vector2((float)(-width) * 0.2f * scale, 0f).RotatedBy(num764 * ((float)Math.PI * 2f)).RotatedBy(velocity.ToRotation());
28142 int num765 = Dust.NewDust(base.Center - Vector2.One * 5f, 10, 10, 226, (0f - velocity.X) / 3f, (0f - velocity.Y) / 3f, 150, Color.Transparent, 0.7f);
28143 Main.dust[num765].position = base.Center + vector87;
28144 Main.dust[num765].velocity = Vector2.Normalize(Main.dust[num765].position - base.Center) * 2f;
28145 Main.dust[num765].noGravity = true;
28146 }
28147 for (int num766 = 0; num766 < 1; num766++)
28148 {
28149 float num767 = (float)Main.rand.NextDouble() * 1f - 0.5f;
28150 if (num767 < -0.5f)
28151 {
28152 num767 = -0.5f;
28153 }
28154 if (num767 > 0.5f)
28155 {
28156 num767 = 0.5f;
28157 }
28158 Vector2 vector88 = new Vector2((float)(-width) * 0.6f * scale, 0f).RotatedBy(num767 * ((float)Math.PI * 2f)).RotatedBy(velocity.ToRotation());
28159 int num768 = Dust.NewDust(base.Center - Vector2.One * 5f, 10, 10, 226, (0f - velocity.X) / 3f, (0f - velocity.Y) / 3f, 150, Color.Transparent, 0.7f);
28160 Main.dust[num768].velocity = Vector2.Zero;
28161 Main.dust[num768].position = base.Center + vector88;
28162 Main.dust[num768].noGravity = true;
28163 }
28164 }
28165 else if (type == 466)
28166 {
28167 frameCounter++;
28168 Lighting.AddLight(base.Center, 0.3f, 0.45f, 0.5f);
28169 if (velocity == Vector2.Zero)
28170 {
28171 if (frameCounter >= extraUpdates * 2)
28172 {
28173 frameCounter = 0;
28174 bool flag35 = true;
28175 for (int num769 = 1; num769 < oldPos.Length; num769++)
28176 {
28177 if (oldPos[num769] != oldPos[0])
28178 {
28179 flag35 = false;
28180 }
28181 }
28182 if (flag35)
28183 {
28184 Kill();
28185 return;
28186 }
28187 }
28188 if (Main.rand.Next(extraUpdates) == 0)
28189 {
28190 for (int num770 = 0; num770 < 2; num770++)
28191 {
28192 float num771 = rotation + ((Main.rand.Next(2) == 1) ? (-1f) : 1f) * ((float)Math.PI / 2f);
28193 float num772 = (float)Main.rand.NextDouble() * 0.8f + 1f;
28194 Vector2 vector89 = new Vector2((float)Math.Cos(num771) * num772, (float)Math.Sin(num771) * num772);
28195 int num773 = Dust.NewDust(base.Center, 0, 0, 226, vector89.X, vector89.Y);
28196 Main.dust[num773].noGravity = true;
28197 Main.dust[num773].scale = 1.2f;
28198 }
28199 if (Main.rand.Next(5) == 0)
28200 {
28201 Vector2 vector90 = velocity.RotatedBy(1.5707963705062866) * ((float)Main.rand.NextDouble() - 0.5f) * width;
28202 int num774 = Dust.NewDust(base.Center + vector90 - Vector2.One * 4f, 8, 8, 31, 0f, 0f, 100, default(Color), 1.5f);
28204 dust2.velocity *= 0.5f;
28205 Main.dust[num774].velocity.Y = 0f - Math.Abs(Main.dust[num774].velocity.Y);
28206 }
28207 }
28208 }
28209 else
28210 {
28211 if (frameCounter < extraUpdates * 2)
28212 {
28213 return;
28214 }
28215 frameCounter = 0;
28216 float num775 = velocity.Length();
28217 UnifiedRandom unifiedRandom = new UnifiedRandom((int)this.ai[1]);
28218 int num776 = 0;
28220 while (true)
28221 {
28222 int num777 = unifiedRandom.Next();
28223 this.ai[1] = num777;
28224 num777 %= 100;
28225 float f = (float)num777 / 100f * ((float)Math.PI * 2f);
28226 Vector2 vector91 = f.ToRotationVector2();
28227 if (vector91.Y > 0f)
28228 {
28229 vector91.Y *= -1f;
28230 }
28231 bool flag36 = false;
28232 if (vector91.Y > -0.02f)
28233 {
28234 flag36 = true;
28235 }
28236 if (vector91.X * (float)(extraUpdates + 1) * 2f * num775 + localAI[0] > 40f)
28237 {
28238 flag36 = true;
28239 }
28240 if (vector91.X * (float)(extraUpdates + 1) * 2f * num775 + localAI[0] < -40f)
28241 {
28242 flag36 = true;
28243 }
28244 if (flag36)
28245 {
28246 if (num776++ >= 100)
28247 {
28249 localAI[1] = 1f;
28250 break;
28251 }
28252 continue;
28253 }
28255 break;
28256 }
28257 if (velocity != Vector2.Zero)
28258 {
28259 localAI[0] += spinningpoint15.X * (float)(extraUpdates + 1) * 2f * num775;
28260 velocity = spinningpoint15.RotatedBy(this.ai[0] + (float)Math.PI / 2f) * num775;
28261 rotation = velocity.ToRotation() + (float)Math.PI / 2f;
28262 }
28263 }
28264 }
28265 else
28266 {
28267 if (type != 580)
28268 {
28269 return;
28270 }
28271 if (localAI[1] == 0f && this.ai[0] >= 900f)
28272 {
28273 this.ai[0] -= 1000f;
28274 localAI[1] = -1f;
28275 }
28276 frameCounter++;
28277 Lighting.AddLight(base.Center, 0.3f, 0.45f, 0.5f);
28278 if (velocity == Vector2.Zero)
28279 {
28280 if (frameCounter >= extraUpdates * 2)
28281 {
28282 frameCounter = 0;
28283 bool flag37 = true;
28284 for (int num778 = 1; num778 < oldPos.Length; num778++)
28285 {
28286 if (oldPos[num778] != oldPos[0])
28287 {
28288 flag37 = false;
28289 }
28290 }
28291 if (flag37)
28292 {
28293 Kill();
28294 return;
28295 }
28296 }
28297 if (Main.rand.Next(extraUpdates) == 0 && (velocity != Vector2.Zero || Main.rand.Next((localAI[1] == 2f) ? 2 : 6) == 0))
28298 {
28299 for (int num779 = 0; num779 < 2; num779++)
28300 {
28301 float num780 = rotation + ((Main.rand.Next(2) == 1) ? (-1f) : 1f) * ((float)Math.PI / 2f);
28302 float num781 = (float)Main.rand.NextDouble() * 0.8f + 1f;
28303 Vector2 vector92 = new Vector2((float)Math.Cos(num780) * num781, (float)Math.Sin(num780) * num781);
28304 int num782 = Dust.NewDust(base.Center, 0, 0, 226, vector92.X, vector92.Y);
28305 Main.dust[num782].noGravity = true;
28306 Main.dust[num782].scale = 1.2f;
28307 }
28308 if (Main.rand.Next(5) == 0)
28309 {
28310 Vector2 vector93 = velocity.RotatedBy(1.5707963705062866) * ((float)Main.rand.NextDouble() - 0.5f) * width;
28311 int num783 = Dust.NewDust(base.Center + vector93 - Vector2.One * 4f, 8, 8, 31, 0f, 0f, 100, default(Color), 1.5f);
28313 dust2.velocity *= 0.5f;
28314 Main.dust[num783].velocity.Y = 0f - Math.Abs(Main.dust[num783].velocity.Y);
28315 }
28316 }
28317 }
28318 else
28319 {
28320 if (frameCounter < extraUpdates * 2)
28321 {
28322 return;
28323 }
28324 frameCounter = 0;
28325 float num784 = velocity.Length();
28326 UnifiedRandom unifiedRandom2 = new UnifiedRandom((int)this.ai[1]);
28327 int num785 = 0;
28329 while (true)
28330 {
28331 int num786 = unifiedRandom2.Next();
28332 this.ai[1] = num786;
28333 num786 %= 100;
28334 float f2 = (float)num786 / 100f * ((float)Math.PI * 2f);
28335 Vector2 vector94 = f2.ToRotationVector2();
28336 if (vector94.Y > 0f)
28337 {
28338 vector94.Y *= -1f;
28339 }
28340 bool flag38 = false;
28341 if (vector94.Y > -0.02f)
28342 {
28343 flag38 = true;
28344 }
28345 if (vector94.X * (float)(extraUpdates + 1) * 2f * num784 + localAI[0] > 40f)
28346 {
28347 flag38 = true;
28348 }
28349 if (vector94.X * (float)(extraUpdates + 1) * 2f * num784 + localAI[0] < -40f)
28350 {
28351 flag38 = true;
28352 }
28353 if (flag38)
28354 {
28355 if (num785++ >= 100)
28356 {
28358 if (localAI[1] < 1f)
28359 {
28360 localAI[1] += 2f;
28361 }
28362 break;
28363 }
28364 continue;
28365 }
28367 break;
28368 }
28369 if (!(velocity != Vector2.Zero))
28370 {
28371 return;
28372 }
28373 localAI[0] += spinningpoint16.X * (float)(extraUpdates + 1) * 2f * num784;
28374 velocity = spinningpoint16.RotatedBy(this.ai[0] + (float)Math.PI / 2f) * num784;
28375 rotation = velocity.ToRotation() + (float)Math.PI / 2f;
28376 if (Main.rand.Next(4) == 0 && Main.netMode != 1 && localAI[1] == 0f)
28377 {
28378 float num787 = (float)Main.rand.Next(-3, 4) * ((float)Math.PI / 3f) / 3f;
28379 Vector2 vector95 = this.ai[0].ToRotationVector2().RotatedBy(num787) * velocity.Length();
28380 if (!Collision.CanHitLine(base.Center, 0, 0, base.Center + vector95 * 50f, 0, 0))
28381 {
28382 NewProjectile(GetProjectileSource_FromThis(), base.Center.X - vector95.X, base.Center.Y - vector95.Y, vector95.X, vector95.Y, type, damage, knockBack, owner, vector95.ToRotation() + 1000f, this.ai[1]);
28383 }
28384 }
28385 }
28386 }
28387 }
28388 else if (aiStyle == 89)
28389 {
28390 if (this.ai[1] == -1f)
28391 {
28392 alpha += 12;
28393 }
28394 else if (this.ai[0] < 300f)
28395 {
28396 alpha -= 5;
28397 }
28398 else
28399 {
28400 alpha += 12;
28401 }
28402 if (alpha < 0)
28403 {
28404 alpha = 0;
28405 }
28406 if (alpha > 255)
28407 {
28408 alpha = 255;
28409 }
28410 scale = 1f - (float)alpha / 255f;
28411 scale *= 0.6f;
28412 rotation += (float)Math.PI / 210f;
28413 if (localAI[1] == 0f)
28414 {
28415 localAI[1] = 1f;
28417 }
28418 if (alpha == 0)
28419 {
28420 for (int num788 = 0; num788 < 2; num788++)
28421 {
28422 float num789 = Main.rand.Next(2, 4);
28423 float num790 = scale;
28424 if (num788 == 1)
28425 {
28426 num790 *= 0.42f;
28427 num789 *= -0.75f;
28428 }
28429 Vector2 vector96 = new Vector2(Main.rand.Next(-10, 11), Main.rand.Next(-10, 11));
28430 vector96.Normalize();
28431 int num791 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 228, 0f, 0f, 100, default(Color), 2f);
28432 Main.dust[num791].noGravity = true;
28433 Main.dust[num791].noLight = true;
28434 Main.dust[num791].position = base.Center + vector96 * 204f * num790;
28435 if (Main.rand.Next(8) == 0)
28436 {
28437 Main.dust[num791].velocity = vector96 * (0f - num789) * 2f;
28439 dust2.scale += 0.5f;
28440 }
28441 else
28442 {
28443 Main.dust[num791].velocity = vector96 * (0f - num789);
28444 }
28445 }
28446 }
28447 this.ai[0]++;
28448 if (this.ai[0] >= 60f)
28449 {
28450 int num792 = (int)(this.ai[0] - 0f) / 60;
28451 float num793 = scale * 0.4f;
28452 for (int num794 = 0; num794 < 1; num794++)
28453 {
28454 float num795 = Main.rand.Next(1, 3);
28455 Vector2 vector97 = new Vector2(Main.rand.Next(-10, 11), Main.rand.Next(-10, 11));
28456 vector97.Normalize();
28457 int num796 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 228, 0f, 0f, 100, default(Color), 2f);
28458 Main.dust[num796].noGravity = true;
28459 Main.dust[num796].noLight = true;
28460 Main.dust[num796].position = base.Center;
28461 if (Main.rand.Next(2) == 0)
28462 {
28463 Main.dust[num796].velocity = vector97 * num795 * 2f;
28465 dust2.scale += 0.5f;
28466 }
28467 else
28468 {
28469 Main.dust[num796].velocity = vector97 * num795;
28470 }
28471 Main.dust[num796].fadeIn = 2f;
28472 }
28473 }
28474 if (this.ai[0] == 300f && this.ai[1] != -1f && Main.netMode != 1)
28475 {
28476 if (!NPC.AnyNPCs(454))
28477 {
28478 this.ai[1] = NPC.NewNPC(GetNPCSource_FromThis(), (int)base.Center.X, (int)base.Center.Y, 454);
28479 }
28480 else
28481 {
28482 this.ai[1] = NPC.NewNPC(GetNPCSource_FromThis(), (int)base.Center.X, (int)base.Center.Y, 521);
28483 }
28484 }
28485 else if (this.ai[0] == 320f)
28486 {
28487 Kill();
28488 return;
28489 }
28490 bool flag39 = false;
28491 if (this.ai[1] == -1f)
28492 {
28493 if (alpha == 255)
28494 {
28495 flag39 = true;
28496 }
28497 }
28498 else
28499 {
28500 flag39 = !(this.ai[1] >= 0f) || !Main.npc[(int)this.ai[1]].active;
28501 if ((flag39 || Main.npc[(int)this.ai[1]].type != 439) && (flag39 || Main.npc[(int)this.ai[1]].type != 454) && (flag39 || Main.npc[(int)this.ai[1]].type != 521))
28502 {
28503 flag39 = true;
28504 }
28505 }
28506 if (flag39)
28507 {
28508 Kill();
28509 }
28510 else
28511 {
28512 Lighting.AddLight(base.Center, 1.1f, 0.9f, 0.4f);
28513 }
28514 }
28515 else if (aiStyle == 90)
28516 {
28517 if (Main.player[owner].dead)
28518 {
28519 Kill();
28520 }
28521 if (Main.player[owner].magicLantern)
28522 {
28523 timeLeft = 2;
28524 }
28525 if (tileCollide)
28526 {
28527 if (!Collision.CanHit(base.position, width, height, Main.player[owner].Center, 1, 1))
28528 {
28529 tileCollide = false;
28530 }
28531 else if (!Collision.SolidCollision(base.position, width, height) && Collision.CanHitLine(base.position, width, height, Main.player[owner].Center, 1, 1))
28532 {
28533 tileCollide = true;
28534 }
28535 }
28536 direction = Main.player[owner].direction;
28538 Lighting.AddLight(base.position, 0.35f, 0.35f, 0.1f);
28539 localAI[0] += 1f;
28540 if (localAI[0] >= 10f)
28541 {
28542 localAI[0] = 0f;
28543 int num797 = 17;
28544 if ((base.Center - Main.player[Main.myPlayer].Center).Length() < (float)(Main.screenWidth + num797 * 16))
28545 {
28546 int num798 = (int)base.Center.X / 16;
28547 int num799 = (int)base.Center.Y / 16;
28548 for (int num800 = num798 - num797; num800 <= num798 + num797; num800++)
28549 {
28550 for (int num801 = num799 - num797; num801 <= num799 + num797; num801++)
28551 {
28553 {
28554 int num802 = Dust.NewDust(new Vector2(num800 * 16, num801 * 16), 16, 16, 204, 0f, 0f, 150, default(Color), 0.3f);
28555 Main.dust[num802].fadeIn = 0.75f;
28557 dust2.velocity *= 0.1f;
28558 Main.dust[num802].noLight = true;
28559 }
28560 }
28561 }
28562 }
28563 }
28564 Vector2 vector98 = Main.player[owner].Center - base.Center;
28565 vector98.X += 40 * direction;
28566 vector98.Y -= 40f;
28567 float num803 = vector98.Length();
28568 if (num803 > 1000f)
28569 {
28570 base.Center = Main.player[owner].Center;
28571 }
28572 float num804 = 3f;
28573 float num805 = 4f;
28574 if (num803 > 200f)
28575 {
28576 num805 += (num803 - 200f) * 0.1f;
28577 tileCollide = false;
28578 }
28579 if (num803 < num805)
28580 {
28581 velocity *= 0.25f;
28582 num805 = num803;
28583 }
28584 if (vector98.X != 0f || vector98.Y != 0f)
28585 {
28586 vector98.Normalize();
28587 vector98 *= num805;
28588 }
28589 velocity = (velocity * (num804 - 1f) + vector98) / num804;
28590 if (velocity.Length() > 6f)
28591 {
28592 float num806 = (float)Math.Atan2(velocity.Y, velocity.X) + 1.57f;
28593 if ((double)Math.Abs(rotation - num806) >= 3.14)
28594 {
28595 if (num806 < rotation)
28596 {
28597 rotation -= 6.28f;
28598 }
28599 else
28600 {
28601 rotation += 6.28f;
28602 }
28603 }
28604 rotation = (rotation * 4f + num806) / 5f;
28605 frameCounter++;
28606 if (frameCounter > 4)
28607 {
28608 frameCounter = 0;
28609 frame++;
28610 if (frame > 7)
28611 {
28612 frame = 4;
28613 }
28614 }
28615 if (frame < 4)
28616 {
28617 frame = 7;
28618 }
28619 return;
28620 }
28621 if ((double)rotation > 3.14)
28622 {
28623 rotation -= 6.28f;
28624 }
28625 if ((double)rotation > -0.01 && (double)rotation < 0.01)
28626 {
28627 rotation = 0f;
28628 }
28629 else
28630 {
28631 rotation *= 0.9f;
28632 }
28633 frameCounter++;
28634 if (frameCounter > 6)
28635 {
28636 frameCounter = 0;
28637 frame++;
28638 if (frame > 3)
28639 {
28640 frame = 0;
28641 }
28642 }
28643 }
28644 else if (aiStyle == 91)
28645 {
28646 Vector2 center15 = base.Center;
28647 scale = 1f - localAI[0];
28648 width = (int)(20f * scale);
28649 height = width;
28650 base.position.X = center15.X - (float)(width / 2);
28651 base.position.Y = center15.Y - (float)(height / 2);
28652 if ((double)localAI[0] < 0.1)
28653 {
28654 localAI[0] += 0.01f;
28655 }
28656 else
28657 {
28658 localAI[0] += 0.025f;
28659 }
28660 if (localAI[0] >= 0.95f)
28661 {
28662 Kill();
28663 }
28664 velocity.X += this.ai[0] * 1.5f;
28665 velocity.Y += this.ai[1] * 1.5f;
28666 if (velocity.Length() > 16f)
28667 {
28669 velocity *= 16f;
28670 }
28671 this.ai[0] *= 1.05f;
28672 this.ai[1] *= 1.05f;
28673 if (scale < 1f)
28674 {
28675 for (int num807 = 0; (float)num807 < scale * 10f; num807++)
28676 {
28677 int num808 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 27, velocity.X, velocity.Y, 100, default(Color), 1.1f);
28678 Main.dust[num808].position = (Main.dust[num808].position + base.Center) / 2f;
28679 Main.dust[num808].noGravity = true;
28681 dust2.velocity *= 0.1f;
28682 dust2 = Main.dust[num808];
28683 dust2.velocity -= velocity * (1.3f - scale);
28684 Main.dust[num808].fadeIn = 100 + owner;
28685 dust2 = Main.dust[num808];
28686 dust2.scale += scale * 0.75f;
28687 }
28688 }
28689 }
28690 else if (aiStyle == 92)
28691 {
28692 bool flag40 = type == 1007;
28693 bool flag41 = type >= 511 && type <= 513;
28694 tileCollide = false;
28695 if (Main.netMode != 1 && flag40 && localAI[0] == 0f)
28696 {
28697 if (direction == 0)
28698 {
28699 direction = 1;
28700 }
28702 {
28703 PositionInWorld = base.Center,
28704 MovementVector = Vector2.Zero
28705 });
28706 }
28707 this.ai[0] += 1f;
28708 if (this.ai[1] >= 1f)
28709 {
28710 this.ai[0] += 2f;
28711 }
28712 float num809 = 260f;
28713 if (flag40)
28714 {
28715 num809 = 80f;
28716 }
28717 if (this.ai[0] > num809)
28718 {
28719 Kill();
28720 this.ai[0] = num809;
28721 return;
28722 }
28723 float fromValue = this.ai[0] / num809;
28724 if (flag40)
28725 {
28726 scale = Utils.Remap(fromValue, 0f, 0.95f, 1f, 6f);
28727 Vector2 center16 = base.Center;
28728 width = (int)(50f * scale);
28729 height = (int)(50f * scale);
28730 base.Center = center16;
28731 Opacity = MathHelper.Clamp(Utils.Remap(fromValue, 0f, 0.25f, 0f, 1f) * Utils.Remap(fromValue, 0.75f, 1f, 1f, 0f), 0f, 1f) * 0.85f;
28732 }
28733 else
28734 {
28735 Opacity = Utils.Remap(fromValue, 0f, 0.3f, 0f, 1f) * Utils.Remap(fromValue, 0.3f, 1f, 1f, 0f) * 0.7f;
28736 }
28737 localAI[0] += direction;
28738 rotation = (float)whoAmI * 0.4002029f + localAI[0] * ((float)Math.PI * 2f) / 480f;
28739 if (flag40)
28740 {
28742 }
28743 else
28744 {
28745 velocity *= 0.96f;
28746 }
28747 if (flag41)
28748 {
28749 Rectangle rectangle5 = new Rectangle((int)base.position.X, (int)base.position.Y, width, height);
28750 for (int num810 = 0; num810 < 1000; num810++)
28751 {
28752 if (num810 == whoAmI)
28753 {
28754 continue;
28755 }
28757 if (!projectile3.active || projectile3.type < 511 || projectile3.type > 513)
28758 {
28759 continue;
28760 }
28761 Rectangle value11 = new Rectangle((int)projectile3.position.X, (int)projectile3.position.Y, projectile3.width, projectile3.height);
28762 if (!rectangle5.Intersects(value11))
28763 {
28764 continue;
28765 }
28766 Vector2 vector99 = projectile3.Center - base.Center;
28767 if (vector99 == Vector2.Zero)
28768 {
28769 if (num810 < whoAmI)
28770 {
28771 vector99.X = -1f;
28772 vector99.Y = 1f;
28773 }
28774 else
28775 {
28776 vector99.X = 1f;
28777 vector99.Y = -1f;
28778 }
28779 }
28780 Vector2 vector100 = vector99.SafeNormalize(Vector2.UnitX) * 0.005f;
28782 projectile3.velocity = Vector2.Lerp(projectile3.velocity, projectile3.velocity + vector100, 0.6f);
28783 }
28784 }
28785 Vector2 vector101 = velocity.SafeNormalize(Vector2.Zero);
28786 Vector2 pos = base.Center + vector101 * 16f;
28788 {
28790 }
28791 if (!flag40)
28792 {
28793 return;
28794 }
28795 int num811 = 20;
28796 int num812 = 2940;
28797 float num813 = MathHelper.Clamp(Utils.Remap(fromValue, 0f, 0.2f, 0f, 1f), 0f, 1f) * 180f;
28798 if (localAI[1] > 0f)
28799 {
28800 localAI[1]--;
28801 }
28802 if (!(localAI[1] <= 0f))
28803 {
28804 return;
28805 }
28806 localAI[1] = 15f;
28807 if (Main.netMode != 2)
28808 {
28810 if (localPlayer.active && !localPlayer.DeadOrGhost && localPlayer.Center.Distance(base.Center) <= num813)
28811 {
28812 localPlayer.AddBuff(num811, num812);
28813 }
28814 }
28815 if (Main.netMode == 1)
28816 {
28817 return;
28818 }
28819 for (int num814 = 0; num814 < 200; num814++)
28820 {
28821 NPC nPC12 = Main.npc[num814];
28822 if (nPC12.active && !nPC12.buffImmune[num811] && nPC12.Center.Distance(base.Center) <= num813)
28823 {
28824 nPC12.AddBuff(num811, num812);
28825 }
28826 }
28827 }
28828 else if (aiStyle == 93)
28829 {
28830 if (alpha > 0)
28831 {
28832 alpha -= 25;
28833 if (alpha <= 0)
28834 {
28835 alpha = 0;
28836 }
28837 }
28838 if (velocity.Y > 18f)
28839 {
28840 velocity.Y = 18f;
28841 }
28842 if (this.ai[0] == 0f)
28843 {
28844 this.ai[1] += 1f;
28845 if (this.ai[1] > 20f)
28846 {
28847 velocity.Y += 0.1f;
28848 velocity.X *= 0.992f;
28849 }
28850 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 1.57f;
28851 return;
28852 }
28853 tileCollide = false;
28854 if (this.ai[0] == 1f)
28855 {
28856 tileCollide = false;
28857 velocity *= 0.6f;
28858 }
28859 else
28860 {
28861 tileCollide = false;
28862 int num815 = (int)(0f - this.ai[0]);
28863 num815--;
28864 base.position = Main.npc[num815].Center - velocity;
28865 base.position.X -= width / 2;
28866 base.position.Y -= height / 2;
28867 if (!Main.npc[num815].active || Main.npc[num815].life < 0)
28868 {
28869 tileCollide = true;
28870 this.ai[0] = 0f;
28871 this.ai[1] = 20f;
28872 velocity = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101));
28873 velocity.Normalize();
28874 velocity *= 6f;
28875 netUpdate = true;
28876 }
28877 else if (velocity.Length() > (float)((Main.npc[num815].width + Main.npc[num815].height) / 3))
28878 {
28879 velocity *= 0.99f;
28880 }
28881 }
28882 if (this.ai[0] != 0f)
28883 {
28884 this.ai[1] += 1f;
28885 if (this.ai[1] > 90f)
28886 {
28887 Kill();
28888 }
28889 }
28890 }
28891 else if (aiStyle == 94)
28892 {
28893 if (++frameCounter >= 4)
28894 {
28895 frameCounter = 0;
28896 if (++frame >= Main.projFrames[type])
28897 {
28898 frame = 0;
28899 }
28900 }
28901 this.ai[0]++;
28902 if (this.ai[0] <= 40f)
28903 {
28904 alpha -= 5;
28905 if (alpha < 0)
28906 {
28907 alpha = 0;
28908 }
28909 velocity *= 0.85f;
28910 if (this.ai[0] == 40f)
28911 {
28912 netUpdate = true;
28913 switch (Main.rand.Next(3))
28914 {
28915 case 0:
28916 this.ai[1] = 10f;
28917 break;
28918 case 1:
28919 this.ai[1] = 15f;
28920 break;
28921 case 2:
28922 this.ai[1] = 30f;
28923 break;
28924 }
28925 }
28926 }
28927 else if (this.ai[0] <= 60f)
28928 {
28929 velocity = Vector2.Zero;
28930 if (this.ai[0] == 60f)
28931 {
28932 netUpdate = true;
28933 }
28934 }
28935 else if (this.ai[0] <= 210f)
28936 {
28937 if (Main.netMode != 1 && (localAI[0] += 1f) >= this.ai[1])
28938 {
28939 localAI[0] = 0f;
28940 int num816 = Item.NewItem(GetItemSource_FromThis(), (int)base.Center.X, (int)base.Center.Y, 0, 0, 73);
28941 Main.item[num816].velocity = Vector2.UnitY.RotatedByRandom(6.2831854820251465) * new Vector2(3f, 2f) * (Main.rand.NextFloat() * 0.5f + 0.5f) - Vector2.UnitY * 1f;
28942 }
28943 if (this.ai[0] == 210f)
28944 {
28945 netUpdate = true;
28946 }
28947 }
28948 else
28949 {
28950 scale -= 1f / 30f;
28951 alpha += 15;
28952 if (this.ai[0] == 239f)
28953 {
28954 netUpdate = true;
28955 }
28956 if (this.ai[0] == 240f)
28957 {
28958 Kill();
28959 }
28960 }
28961 if (alpha < 90 && Main.rand.Next(3) == 0)
28962 {
28963 Vector2 vector102 = new Vector2(width, height) * scale * 0.85f;
28964 vector102 /= 2f;
28965 Vector2 vector103 = Vector2.UnitY.RotatedByRandom(6.2831854820251465) * vector102;
28966 int num817 = Dust.NewDust(base.Center + vector103, 0, 0, 246);
28967 Main.dust[num817].position = base.Center + vector103;
28968 Main.dust[num817].velocity = Vector2.Zero;
28969 }
28970 float num818 = 0.8f;
28971 float num819 = 0.70980394f;
28972 float num820 = 24f / 85f;
28973 Lighting.AddLight(base.Center, num818 * 0.3f, num819 * 0.3f, num820 * 0.3f);
28974 }
28975 else if (aiStyle == 95)
28976 {
28977 if (localAI[0] > 2f)
28978 {
28979 alpha -= 20;
28980 if (alpha < 100)
28981 {
28982 alpha = 100;
28983 }
28984 }
28985 else
28986 {
28987 localAI[0] += 1f;
28988 }
28989 if (this.ai[0] > 30f)
28990 {
28991 if (velocity.Y > -8f)
28992 {
28993 velocity.Y -= 0.05f;
28994 }
28995 velocity.X *= 0.98f;
28996 }
28997 else
28998 {
28999 this.ai[0] += 1f;
29000 }
29001 rotation = velocity.X * 0.1f;
29002 if (wet)
29003 {
29004 if (velocity.Y > 0f)
29005 {
29006 velocity.Y *= 0.98f;
29007 }
29008 if (velocity.Y > -8f)
29009 {
29010 velocity.Y -= 0.2f;
29011 }
29012 velocity.X *= 0.94f;
29013 }
29014 }
29015 else if (aiStyle == 96)
29016 {
29017 this.ai[0] += 0.6f;
29018 if (this.ai[0] > 500f)
29019 {
29020 Kill();
29021 }
29022 for (int num821 = 0; num821 < 2; num821++)
29023 {
29024 if (Main.rand.Next(3) != 0)
29025 {
29026 int num822 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 170, 0f, 0f, 100);
29027 Main.dust[num822].position = (Main.dust[num822].position + base.Center) / 2f;
29028 Main.dust[num822].noGravity = true;
29030 dust2.velocity *= 0.1f;
29031 if (num821 == 1)
29032 {
29033 dust2 = Main.dust[num822];
29034 dust2.position += velocity / 2f;
29035 }
29036 float num823 = (800f - this.ai[0]) / 800f;
29037 dust2 = Main.dust[num822];
29038 dust2.scale *= num823 + 0.1f;
29039 }
29040 }
29041 velocity.Y += 0.008f;
29042 }
29043 else if (aiStyle == 97)
29044 {
29045 frameCounter++;
29046 float num824 = 4f;
29047 if ((float)frameCounter < num824 * 1f)
29048 {
29049 frame = 0;
29050 }
29051 else if ((float)frameCounter < num824 * 2f)
29052 {
29053 frame = 1;
29054 }
29055 else if ((float)frameCounter < num824 * 3f)
29056 {
29057 frame = 2;
29058 }
29059 else if ((float)frameCounter < num824 * 4f)
29060 {
29061 frame = 3;
29062 }
29063 else if ((float)frameCounter < num824 * 5f)
29064 {
29065 frame = 4;
29066 }
29067 else if ((float)frameCounter < num824 * 6f)
29068 {
29069 frame = 3;
29070 }
29071 else if ((float)frameCounter < num824 * 7f)
29072 {
29073 frame = 2;
29074 }
29075 else if ((float)frameCounter < num824 * 8f)
29076 {
29077 frame = 1;
29078 }
29079 else
29080 {
29081 frameCounter = 0;
29082 frame = 0;
29083 }
29084 Main.CurrentFrameFlags.HadAnActiveInteractibleProjectile = true;
29085 if (owner == Main.myPlayer)
29086 {
29087 for (int num825 = 0; num825 < 1000; num825++)
29088 {
29089 if (num825 != whoAmI && Main.projectile[num825].active && Main.projectile[num825].owner == owner && Main.projectile[num825].type == type)
29090 {
29091 if (timeLeft >= Main.projectile[num825].timeLeft)
29092 {
29093 Main.projectile[num825].Kill();
29094 }
29095 else
29096 {
29097 Kill();
29098 }
29099 }
29100 }
29101 }
29102 if (this.ai[0] == 0f)
29103 {
29104 if ((double)velocity.Length() < 0.1)
29105 {
29106 velocity.X = 0f;
29107 velocity.Y = 0f;
29108 this.ai[0] = 1f;
29109 this.ai[1] = 45f;
29110 return;
29111 }
29112 velocity *= 0.94f;
29113 if (velocity.X < 0f)
29114 {
29115 direction = -1;
29116 }
29117 else
29118 {
29119 direction = 1;
29120 }
29121 spriteDirection = direction;
29122 return;
29123 }
29124 if (Main.player[owner].Center.X < base.Center.X)
29125 {
29126 direction = -1;
29127 }
29128 else
29129 {
29130 direction = 1;
29131 }
29132 spriteDirection = direction;
29133 this.ai[1] += 1f;
29134 float num826 = 0.005f;
29135 if (this.ai[1] > 0f)
29136 {
29137 velocity.Y -= num826;
29138 }
29139 else
29140 {
29141 velocity.Y += num826;
29142 }
29143 if (this.ai[1] >= 90f)
29144 {
29145 this.ai[1] *= -1f;
29146 }
29147 }
29148 else if (aiStyle == 98)
29149 {
29150 Vector2 vector104 = new Vector2(this.ai[0], this.ai[1]);
29151 Vector2 value12 = vector104 - base.Center;
29152 if (value12.Length() < velocity.Length())
29153 {
29154 Kill();
29155 return;
29156 }
29157 value12.Normalize();
29158 value12 *= 15f;
29159 velocity = Vector2.Lerp(velocity, value12, 0.1f);
29160 for (int num827 = 0; num827 < 2; num827++)
29161 {
29162 int num828 = Dust.NewDust(base.Center, 0, 0, 228, 0f, 0f, 100);
29163 Main.dust[num828].noGravity = true;
29165 dust2.position += new Vector2(4f);
29166 dust2 = Main.dust[num828];
29167 dust2.scale += Main.rand.NextFloat() * 1f;
29168 }
29169 }
29170 else if (aiStyle == 99 && type >= 556 && type <= 561)
29171 {
29172 AI_099_1();
29173 }
29174 else if (aiStyle == 99)
29175 {
29176 AI_099_2();
29177 }
29178 else if (aiStyle == 100)
29179 {
29180 AI_100_Medusa();
29181 }
29182 else if (aiStyle == 101)
29183 {
29184 float num829 = 20f;
29185 localAI[0]++;
29186 alpha = (int)MathHelper.Lerp(0f, 255f, localAI[0] / num829);
29187 int num830 = (int)this.ai[0];
29188 int num831 = -1;
29189 int num832 = -1;
29190 switch (type)
29191 {
29192 case 536:
29193 num831 = 535;
29194 num832 = 0;
29195 break;
29196 case 591:
29197 num832 = 1;
29198 break;
29199 }
29200 switch (num832)
29201 {
29202 case 1:
29203 if (localAI[0] >= num829 || num830 < 0 || num830 > 255 || !Main.player[num830].active || Main.player[num830].dead)
29204 {
29205 Kill();
29206 return;
29207 }
29208 if (type == 591)
29209 {
29210 base.position -= velocity;
29211 base.position += Main.player[owner].position - Main.player[owner].oldPosition;
29212 rotation = velocity.ToRotation() + (float)Math.PI / 2f;
29213 if (Math.Sign(velocity.X) != Math.Sign(Main.player[num830].velocity.X) && Main.player[num830].velocity.X != 0f)
29214 {
29215 Kill();
29216 return;
29217 }
29218 }
29219 else
29220 {
29221 base.Center = Main.player[num830].Center - velocity;
29222 }
29223 break;
29224 case 0:
29225 if (localAI[0] >= num829 || num830 < 0 || num830 > 1000 || !Main.projectile[num830].active || Main.projectile[num830].type != num831)
29226 {
29227 Kill();
29228 return;
29229 }
29230 base.Center = Main.projectile[num830].Center - velocity;
29231 break;
29232 }
29233 rotation = velocity.ToRotation() + (float)Math.PI / 2f;
29234 }
29235 else if (aiStyle == 102)
29236 {
29237 int num833 = 0;
29238 float num834 = 0f;
29239 float x6 = 0f;
29240 float y5 = 0f;
29241 int num835 = -1;
29242 int num836 = 0;
29243 float num837 = 0f;
29244 bool flag42 = true;
29245 bool flag43 = false;
29246 bool flag44 = false;
29247 switch (type)
29248 {
29249 case 539:
29250 num833 = 407;
29251 num834 = 210f;
29252 x6 = 0.15f;
29253 y5 = 0.075f;
29254 num837 = 16f;
29255 break;
29256 case 573:
29257 num833 = 424;
29258 num834 = 90f;
29259 num837 = 20f;
29260 flag42 = false;
29261 flag43 = true;
29262 break;
29263 case 574:
29264 num833 = 420;
29265 num834 = 180f;
29266 x6 = 0.15f;
29267 y5 = 0.075f;
29268 num837 = 8f;
29269 flag42 = false;
29270 num835 = 576;
29271 num836 = 65;
29272 if (Main.expertMode)
29273 {
29274 num836 = 50;
29275 }
29276 flag44 = true;
29277 break;
29278 }
29279 if (flag44)
29280 {
29281 int num838 = (int)this.ai[1];
29282 if (!Main.npc[num838].active || Main.npc[num838].type != num833)
29283 {
29284 Kill();
29285 return;
29286 }
29287 timeLeft = 2;
29288 }
29289 this.ai[0]++;
29290 if (this.ai[0] < num834)
29291 {
29292 bool flag45 = true;
29293 int num839 = (int)this.ai[1];
29294 if (Main.npc[num839].active && Main.npc[num839].type == num833)
29295 {
29296 if (!flag43 && Main.npc[num839].oldPos[1] != Vector2.Zero)
29297 {
29298 base.position += Main.npc[num839].position - Main.npc[num839].oldPos[1];
29299 }
29300 }
29301 else
29302 {
29303 this.ai[0] = num834;
29304 flag45 = false;
29305 }
29306 if (flag45 && !flag43)
29307 {
29308 velocity += new Vector2(Math.Sign(Main.npc[num839].Center.X - base.Center.X), Math.Sign(Main.npc[num839].Center.Y - base.Center.Y)) * new Vector2(x6, y5);
29309 if (velocity.Length() > 6f)
29310 {
29311 velocity *= 6f / velocity.Length();
29312 }
29313 }
29314 if (type == 539)
29315 {
29316 if (Main.rand.Next(12) == 0)
29317 {
29318 int num840 = Dust.NewDust(base.Center, 8, 8, 180);
29319 Main.dust[num840].position = base.Center;
29321 dust2.velocity *= 0.2f;
29322 Main.dust[num840].noGravity = true;
29323 }
29324 if (++frameCounter >= 4)
29325 {
29326 frameCounter = 0;
29327 if (++frame >= Main.projFrames[type])
29328 {
29329 frame = 0;
29330 }
29331 }
29332 rotation = velocity.X * 0.1f;
29333 }
29334 if (type == 573)
29335 {
29336 if (Main.rand.Next(2) == 0)
29337 {
29338 int num841 = Dust.NewDust(base.Center, 8, 8, 242);
29339 Main.dust[num841].position = base.Center;
29340 Main.dust[num841].velocity = velocity;
29341 Main.dust[num841].noGravity = true;
29342 Main.dust[num841].scale = 1.5f;
29343 }
29344 alpha = 255;
29345 }
29346 if (type == 574)
29347 {
29348 if (Main.rand.Next(10) == 0)
29349 {
29350 int num842 = Dust.NewDust(base.Center, 8, 8, 242);
29351 Main.dust[num842].position = base.Center;
29352 Main.dust[num842].velocity = velocity;
29353 Main.dust[num842].noGravity = true;
29354 Main.dust[num842].scale = 1.5f;
29355 }
29356 if (flag45)
29357 {
29358 int target2 = Main.npc[num839].target;
29359 float num843 = velocity.ToRotation();
29360 if (Collision.CanHitLine(base.Center, 0, 0, Main.player[target2].Center, 0, 0))
29361 {
29362 num843 = DirectionTo(Main.player[target2].Center).ToRotation();
29363 }
29364 rotation = rotation.AngleLerp(num843 + (float)Math.PI / 2f, 0.2f);
29365 }
29366 frame = 1;
29367 }
29368 }
29369 if (this.ai[0] == num834)
29370 {
29371 bool flag46 = true;
29372 int num844 = -1;
29373 if (!flag42)
29374 {
29375 int num845 = (int)this.ai[1];
29376 if (Main.npc[num845].active && Main.npc[num845].type == num833)
29377 {
29378 num844 = Main.npc[num845].target;
29379 }
29380 else
29381 {
29382 flag46 = false;
29383 }
29384 }
29385 else
29386 {
29387 flag46 = false;
29388 }
29389 if (!flag46)
29390 {
29391 num844 = Player.FindClosest(base.position, width, height);
29392 }
29393 Vector2 value13 = Main.player[num844].Center - base.Center;
29394 value13.X += Main.rand.Next(-50, 51);
29395 value13.Y += Main.rand.Next(-50, 51);
29396 value13.X *= (float)Main.rand.Next(80, 121) * 0.01f;
29397 value13.Y *= (float)Main.rand.Next(80, 121) * 0.01f;
29399 if (vector105.HasNaNs())
29400 {
29402 }
29403 if (num835 == -1)
29404 {
29405 velocity = vector105 * num837;
29406 netUpdate = true;
29407 }
29408 else
29409 {
29410 if (Main.netMode != 1 && Collision.CanHitLine(base.Center, 0, 0, Main.player[num844].Center, 0, 0))
29411 {
29412 NewProjectile(GetProjectileSource_FromThis(), base.Center.X, base.Center.Y, vector105.X * num837, vector105.Y * num837, num835, num836, 1f, Main.myPlayer);
29413 }
29414 this.ai[0] = 0f;
29415 }
29416 }
29417 if (!(this.ai[0] >= num834))
29418 {
29419 return;
29420 }
29421 rotation = rotation.AngleLerp(velocity.ToRotation() + (float)Math.PI / 2f, 0.4f);
29422 if (type == 539)
29423 {
29424 if (++frameCounter >= 2)
29425 {
29426 frameCounter = 0;
29427 if (++frame >= Main.projFrames[type])
29428 {
29429 frame = 0;
29430 }
29431 }
29432 if (Main.rand.Next(2) == 0)
29433 {
29434 int num846 = Dust.NewDust(base.position, width, height, 180, 0f, 0f, 100);
29436 dust2.scale += (float)Main.rand.Next(50) * 0.01f;
29437 Main.dust[num846].noGravity = true;
29438 dust2 = Main.dust[num846];
29439 dust2.velocity *= 0.1f;
29440 Main.dust[num846].fadeIn = Main.rand.NextFloat() * 1.5f;
29441 }
29442 if (Main.rand.Next(3) == 0)
29443 {
29444 int num847 = Dust.NewDust(base.position, width, height, 176, 0f, 0f, 100);
29446 dust2.scale += 0.3f + (float)Main.rand.Next(50) * 0.01f;
29447 Main.dust[num847].noGravity = true;
29448 dust2 = Main.dust[num847];
29449 dust2.velocity *= 0.1f;
29450 Main.dust[num847].fadeIn = Main.rand.NextFloat() * 1.5f;
29451 }
29452 }
29453 if (type == 573)
29454 {
29455 if (Main.rand.Next(4) == 0)
29456 {
29457 int num848 = Dust.NewDust(base.Center, 8, 8, 242);
29458 Main.dust[num848].position = base.Center;
29460 dust2.velocity *= 0.2f;
29461 Main.dust[num848].noGravity = true;
29462 Main.dust[num848].scale = 1.5f;
29463 }
29464 alpha = 0;
29465 }
29466 }
29467 else if (aiStyle == 103)
29468 {
29469 scale = this.ai[1];
29470 this.ai[0]++;
29471 if (this.ai[0] >= 30f)
29472 {
29473 alpha += 25;
29474 if (alpha >= 250)
29475 {
29476 Kill();
29477 }
29478 }
29479 else
29480 {
29481 if (!(this.ai[0] >= 0f))
29482 {
29483 return;
29484 }
29485 alpha -= 25;
29486 if (alpha < 0)
29487 {
29488 alpha = 0;
29489 if (localAI[1] == 0f && Main.netMode != 1 && localAI[0] != 0f)
29490 {
29491 localAI[1] = 1f;
29492 NPC.NewNPC(GetNPCSource_FromThis(), (int)base.Center.X, (int)base.Bottom.Y, (int)localAI[0]);
29493 }
29494 }
29495 }
29496 }
29497 else if (aiStyle == 104)
29498 {
29499 if (this.ai[0] == 1f)
29500 {
29501 scale *= 0.995f;
29502 alpha += 3;
29503 if (alpha >= 250)
29504 {
29505 Kill();
29506 }
29507 }
29508 else
29509 {
29510 scale *= 1.01f;
29511 alpha -= 7;
29512 if (alpha < 0)
29513 {
29514 alpha = 0;
29515 this.ai[0] = 1f;
29516 }
29517 }
29518 frameCounter++;
29519 if (frameCounter > 6)
29520 {
29521 frameCounter = 0;
29522 frame++;
29523 if (frame > 3)
29524 {
29525 frame = 0;
29526 }
29527 }
29528 velocity.Y -= 0.03f;
29529 velocity.X *= 0.97f;
29530 }
29531 else if (aiStyle == 105)
29532 {
29533 float num849 = 1f - (float)alpha / 255f;
29534 num849 *= scale;
29535 Lighting.AddLight(base.Center, 0.2f * num849, 0.275f * num849, 0.075f * num849);
29536 localAI[0] += 1f;
29537 if (localAI[0] >= 90f)
29538 {
29539 localAI[0] *= -1f;
29540 }
29541 if (localAI[0] >= 0f)
29542 {
29543 scale += 0.003f;
29544 }
29545 else
29546 {
29547 scale -= 0.003f;
29548 }
29549 rotation += 0.0025f * scale;
29550 float num850 = 1f;
29551 float num851 = 1f;
29552 if (identity % 6 == 0)
29553 {
29554 num851 *= -1f;
29555 }
29556 if (identity % 6 == 1)
29557 {
29558 num850 *= -1f;
29559 }
29560 if (identity % 6 == 2)
29561 {
29562 num851 *= -1f;
29563 num850 *= -1f;
29564 }
29565 if (identity % 6 == 3)
29566 {
29567 num851 = 0f;
29568 }
29569 if (identity % 6 == 4)
29570 {
29571 num850 = 0f;
29572 }
29573 localAI[1] += 1f;
29574 if (localAI[1] > 60f)
29575 {
29576 localAI[1] = -180f;
29577 }
29578 if (localAI[1] >= -60f)
29579 {
29580 velocity.X += 0.002f * num851;
29581 velocity.Y += 0.002f * num850;
29582 }
29583 else
29584 {
29585 velocity.X -= 0.002f * num851;
29586 velocity.Y -= 0.002f * num850;
29587 }
29588 this.ai[0] += 1f;
29589 if (this.ai[0] > 5400f)
29590 {
29591 damage = 0;
29592 this.ai[1] = 1f;
29593 if (alpha < 255)
29594 {
29595 alpha += 5;
29596 if (alpha > 255)
29597 {
29598 alpha = 255;
29599 }
29600 }
29601 else if (owner == Main.myPlayer)
29602 {
29603 Kill();
29604 }
29605 }
29606 else
29607 {
29608 float num852 = (base.Center - Main.player[owner].Center).Length() / 100f;
29609 if (num852 > 4f)
29610 {
29611 num852 *= 1.1f;
29612 }
29613 if (num852 > 5f)
29614 {
29615 num852 *= 1.2f;
29616 }
29617 if (num852 > 6f)
29618 {
29619 num852 *= 1.3f;
29620 }
29621 if (num852 > 7f)
29622 {
29623 num852 *= 1.4f;
29624 }
29625 if (num852 > 8f)
29626 {
29627 num852 *= 1.5f;
29628 }
29629 if (num852 > 9f)
29630 {
29631 num852 *= 1.6f;
29632 }
29633 if (num852 > 10f)
29634 {
29635 num852 *= 1.7f;
29636 }
29637 if (!Main.player[owner].sporeSac)
29638 {
29639 num852 += 100f;
29640 }
29641 this.ai[0] += num852;
29642 if (alpha > 50)
29643 {
29644 alpha -= 10;
29645 if (alpha < 50)
29646 {
29647 alpha = 50;
29648 }
29649 }
29650 }
29651 bool flag47 = false;
29652 Vector2 vector106 = new Vector2(0f, 0f);
29653 float num853 = 340f;
29654 for (int num854 = 0; num854 < 200; num854++)
29655 {
29656 if (Main.npc[num854].CanBeChasedBy(this))
29657 {
29658 float num855 = Main.npc[num854].position.X + (float)(Main.npc[num854].width / 2);
29659 float num856 = Main.npc[num854].position.Y + (float)(Main.npc[num854].height / 2);
29660 float num857 = Math.Abs(base.position.X + (float)(width / 2) - num855) + Math.Abs(base.position.Y + (float)(height / 2) - num856);
29661 if (num857 < num853)
29662 {
29663 num853 = num857;
29664 vector106 = Main.npc[num854].Center;
29665 flag47 = true;
29666 }
29667 }
29668 }
29669 if (flag47)
29670 {
29671 Vector2 vector107 = vector106 - base.Center;
29672 vector107.Normalize();
29673 vector107 *= 4f;
29674 velocity = (velocity * 40f + vector107) / 41f;
29675 }
29676 else if ((double)velocity.Length() > 0.2)
29677 {
29678 velocity *= 0.98f;
29679 }
29680 }
29681 else if (aiStyle == 106)
29682 {
29683 rotation += velocity.X * 0.02f;
29684 if (velocity.X < 0f)
29685 {
29686 rotation -= Math.Abs(velocity.Y) * 0.02f;
29687 }
29688 else
29689 {
29690 rotation += Math.Abs(velocity.Y) * 0.02f;
29691 }
29692 velocity *= 0.98f;
29693 this.ai[0] += 1f;
29694 if (this.ai[0] >= 60f)
29695 {
29696 if (alpha < 255)
29697 {
29698 alpha += 5;
29699 if (alpha > 255)
29700 {
29701 alpha = 255;
29702 }
29703 }
29704 else if (owner == Main.myPlayer)
29705 {
29706 Kill();
29707 }
29708 }
29709 else if (alpha > 80)
29710 {
29711 alpha -= 30;
29712 if (alpha < 80)
29713 {
29714 alpha = 80;
29715 }
29716 }
29717 }
29718 else if (aiStyle == 107)
29719 {
29720 float num858 = 10f;
29721 float num859 = 5f;
29722 float num860 = 40f;
29723 if (type == 575)
29724 {
29725 if (timeLeft > 30 && alpha > 0)
29726 {
29727 alpha -= 25;
29728 }
29729 if (timeLeft > 30 && alpha < 128 && Collision.SolidCollision(base.position, width, height))
29730 {
29731 alpha = 128;
29732 }
29733 if (alpha < 0)
29734 {
29735 alpha = 0;
29736 }
29737 if (++frameCounter > 4)
29738 {
29739 frameCounter = 0;
29740 if (++frame >= 4)
29741 {
29742 frame = 0;
29743 }
29744 }
29745 Lighting.AddLight(base.Center, 0.5f, 0.1f, 0.3f);
29746 }
29747 else if (type == 596)
29748 {
29749 num858 = 10f;
29750 num859 = 7.5f;
29751 if (timeLeft > 30 && alpha > 0)
29752 {
29753 alpha -= 25;
29754 }
29755 if (timeLeft > 30 && alpha < 128 && Collision.SolidCollision(base.position, width, height))
29756 {
29757 alpha = 128;
29758 }
29759 if (alpha < 0)
29760 {
29761 alpha = 0;
29762 }
29763 if (++frameCounter > 4)
29764 {
29765 frameCounter = 0;
29766 if (++frame >= 4)
29767 {
29768 frame = 0;
29769 }
29770 }
29771 float num861 = 0.5f;
29772 if (timeLeft < 120)
29773 {
29774 num861 = 1.1f;
29775 }
29776 if (timeLeft < 60)
29777 {
29778 num861 = 1.6f;
29779 }
29780 this.ai[1]++;
29781 float num862 = this.ai[1] / 180f * ((float)Math.PI * 2f);
29782 for (float num863 = 0f; num863 < 3f; num863++)
29783 {
29784 if (Main.rand.Next(3) != 0)
29785 {
29786 return;
29787 }
29788 Dust dust22 = Main.dust[Dust.NewDust(base.Center, 0, 0, 27, 0f, -2f)];
29789 dust22.position = base.Center + Vector2.UnitY.RotatedBy(num863 * ((float)Math.PI * 2f) / 3f + this.ai[1]) * 10f;
29790 dust22.noGravity = true;
29791 dust22.velocity = DirectionFrom(dust22.position);
29792 dust22.scale = num861;
29793 dust22.fadeIn = 0.5f;
29794 dust22.alpha = 200;
29795 }
29796 if (timeLeft < 4)
29797 {
29798 int num864 = 30;
29799 if (Main.expertMode)
29800 {
29801 num864 = 22;
29802 }
29803 base.position = base.Center;
29804 width = (height = 60);
29805 base.Center = base.position;
29806 damage = num864;
29807 for (int num865 = 0; num865 < 10; num865++)
29808 {
29809 Dust dust22 = Main.dust[Dust.NewDust(base.position, width, height, Utils.SelectRandom<int>(Main.rand, 27, 6), 0f, -2f)];
29810 dust22.noGravity = true;
29811 if (dust22.position != base.Center)
29812 {
29813 dust22.velocity = DirectionTo(dust22.position) * 3f;
29814 }
29815 }
29816 }
29817 }
29818 int num866 = (int)this.ai[0];
29819 if (num866 >= 0 && Main.player[num866].active && !Main.player[num866].dead)
29820 {
29821 if (Distance(Main.player[num866].Center) > num860)
29822 {
29823 Vector2 vector108 = DirectionTo(Main.player[num866].Center);
29824 if (vector108.HasNaNs())
29825 {
29827 }
29828 velocity = (velocity * (num858 - 1f) + vector108 * num859) / num858;
29829 }
29830 }
29831 else
29832 {
29833 if (timeLeft > 30)
29834 {
29835 timeLeft = 30;
29836 }
29837 if (this.ai[0] != -1f)
29838 {
29839 this.ai[0] = -1f;
29840 netUpdate = true;
29841 }
29842 }
29843 }
29844 else if (aiStyle == 108)
29845 {
29846 bool flag48 = type == 579 || type == 578;
29847 if (flag48 && this.ai[1] == 1f && Main.netMode != 2)
29848 {
29849 this.ai[1] = 0f;
29850 for (int num867 = 0; num867 < 25; num867++)
29851 {
29852 int num868 = Utils.SelectRandom<int>(Main.rand, 229, 229, 161);
29853 Dust dust23 = Main.dust[Dust.NewDust(base.position, width, height, num868)];
29854 dust23.noGravity = true;
29855 dust23.scale = 1.75f + Main.rand.NextFloat() * 1.25f;
29856 dust23.fadeIn = 0.25f;
29857 Dust dust2 = dust23;
29858 dust2.velocity *= 3.5f + Main.rand.NextFloat() * 0.5f;
29859 dust23.noLight = true;
29860 }
29861 }
29862 if (flag48 && localAI[1] == 0f)
29863 {
29864 localAI[1] = 1f;
29866 }
29867 if (type == 578 && localAI[0] == 0f)
29868 {
29869 localAI[0] = 1f;
29870 int num869 = Player.FindClosest(base.Center, 0, 0);
29871 Vector2 vector109 = Main.player[num869].Center - base.Center;
29872 if (vector109 == Vector2.Zero)
29873 {
29875 }
29876 this.ai[1] = vector109.ToRotation();
29877 netUpdate = true;
29878 }
29879 this.ai[0]++;
29880 if (this.ai[0] <= 50f)
29881 {
29882 if (type == 579)
29883 {
29884 if (Main.rand.Next(4) == 0)
29885 {
29886 Vector2 vector110 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
29887 Dust dust24 = Main.dust[Dust.NewDust(base.Center - vector110 * 30f, 0, 0, 229)];
29888 dust24.noGravity = true;
29889 dust24.position = base.Center - vector110 * Main.rand.Next(10, 21);
29890 dust24.velocity = vector110.RotatedBy(1.5707963705062866) * 4f;
29891 dust24.scale = 0.5f + Main.rand.NextFloat();
29892 dust24.fadeIn = 0.5f;
29893 }
29894 if (Main.rand.Next(4) == 0)
29895 {
29896 Vector2 vector111 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
29897 Dust dust25 = Main.dust[Dust.NewDust(base.Center - vector111 * 30f, 0, 0, 240)];
29898 dust25.noGravity = true;
29899 dust25.position = base.Center - vector111 * 30f;
29900 dust25.velocity = vector111.RotatedBy(-1.5707963705062866) * 2f;
29901 dust25.scale = 0.5f + Main.rand.NextFloat();
29902 dust25.fadeIn = 0.5f;
29903 }
29904 }
29905 if (type == 578 && Main.rand.Next(2) == 0)
29906 {
29907 Vector2 vector112 = this.ai[1].ToRotationVector2();
29908 Vector2 vector113 = vector112.RotatedBy(1.5707963705062866) * (Main.rand.Next(2) == 0).ToDirectionInt() * Main.rand.Next(10, 21);
29909 Vector2 vector114 = vector112 * Main.rand.Next(-80, 81);
29911 vector115 /= 10f;
29912 int num870 = 229;
29913 Dust dust26 = Main.dust[Dust.NewDust(base.Center, 0, 0, num870)];
29914 dust26.noGravity = true;
29915 dust26.position = base.Center + vector113;
29916 dust26.velocity = vector115;
29917 dust26.scale = 0.5f + Main.rand.NextFloat();
29918 dust26.fadeIn = 0.5f;
29919 vector114 = vector112 * Main.rand.Next(40, 121);
29920 vector115 = vector114 - vector113 / 2f;
29921 vector115 /= 10f;
29922 dust26 = Main.dust[Dust.NewDust(base.Center, 0, 0, num870)];
29923 dust26.noGravity = true;
29924 dust26.position = base.Center + vector113 / 2f;
29925 dust26.velocity = vector115;
29926 dust26.scale = 1f + Main.rand.NextFloat();
29927 }
29928 if (type == 813)
29929 {
29930 if (Main.rand.Next(4) == 0)
29931 {
29932 Vector2 vector116 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
29933 Dust dust27 = Main.dust[Dust.NewDust(base.Center - vector116 * 30f, 0, 0, 5)];
29934 dust27.noGravity = true;
29935 dust27.position = base.Center - vector116 * Main.rand.Next(10, 21);
29936 dust27.velocity = vector116.RotatedBy(1.5707963705062866) * 4f;
29937 dust27.scale = 0.5f + Main.rand.NextFloat();
29938 dust27.fadeIn = 0.5f;
29939 }
29940 if (Main.rand.Next(4) == 0)
29941 {
29942 Vector2 vector117 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
29943 Dust dust28 = Main.dust[Dust.NewDust(base.Center - vector117 * 30f, 0, 0, 240)];
29944 dust28.noGravity = true;
29945 dust28.position = base.Center - vector117 * 30f;
29946 dust28.velocity = vector117.RotatedBy(-1.5707963705062866) * 2f;
29947 dust28.scale = 0.5f + Main.rand.NextFloat();
29948 dust28.fadeIn = 0.5f;
29949 }
29950 }
29951 }
29952 else if (this.ai[0] <= 90f)
29953 {
29954 if (this.ai[0] == 90f)
29955 {
29956 if (flag48)
29957 {
29959 }
29960 else
29961 {
29963 }
29964 }
29965 scale = (this.ai[0] - 50f) / 40f;
29966 alpha = 255 - (int)(255f * scale);
29967 rotation -= (float)Math.PI / 20f;
29968 if (type == 579)
29969 {
29970 if (Main.rand.Next(2) == 0)
29971 {
29972 Vector2 vector118 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
29973 Dust dust29 = Main.dust[Dust.NewDust(base.Center - vector118 * 30f, 0, 0, 229)];
29974 dust29.noGravity = true;
29975 dust29.position = base.Center - vector118 * Main.rand.Next(10, 21);
29976 dust29.velocity = vector118.RotatedBy(1.5707963705062866) * 6f;
29977 dust29.scale = 0.5f + Main.rand.NextFloat();
29978 dust29.fadeIn = 0.5f;
29979 dust29.customData = base.Center;
29980 }
29981 if (Main.rand.Next(2) == 0)
29982 {
29983 Vector2 vector119 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
29984 Dust dust30 = Main.dust[Dust.NewDust(base.Center - vector119 * 30f, 0, 0, 240)];
29985 dust30.noGravity = true;
29986 dust30.position = base.Center - vector119 * 30f;
29987 dust30.velocity = vector119.RotatedBy(-1.5707963705062866) * 3f;
29988 dust30.scale = 0.5f + Main.rand.NextFloat();
29989 dust30.fadeIn = 0.5f;
29990 dust30.customData = base.Center;
29991 }
29992 }
29993 if (type == 578)
29994 {
29995 Vector2 vector120 = this.ai[1].ToRotationVector2();
29996 Vector2 vector121 = vector120.RotatedBy(1.5707963705062866) * (Main.rand.Next(2) == 0).ToDirectionInt() * Main.rand.Next(10, 21);
29997 vector120 *= (float)Main.rand.Next(-80, 81);
29999 vector122 /= 10f;
30000 int num871 = Utils.SelectRandom<int>(Main.rand, 229, 229);
30001 Dust dust31 = Main.dust[Dust.NewDust(base.Center, 0, 0, num871)];
30002 dust31.noGravity = true;
30003 dust31.position = base.Center + vector121;
30004 dust31.velocity = vector122;
30005 dust31.scale = 0.5f + Main.rand.NextFloat();
30006 dust31.fadeIn = 0.5f;
30007 if (this.ai[0] == 90f && Main.netMode != 1)
30008 {
30009 Vector2 vector123 = this.ai[1].ToRotationVector2() * 8f;
30010 float ai2 = Main.rand.Next(80);
30011 NewProjectile(GetProjectileSource_FromThis(), base.Center.X - vector123.X, base.Center.Y - vector123.Y, vector123.X, vector123.Y, 580, 50, 1f, Main.myPlayer, this.ai[1], ai2);
30012 }
30013 }
30014 else if (type == 579)
30015 {
30016 if (this.ai[0] == 90f && Main.netMode != 1)
30017 {
30018 this.ai[1] = 1f;
30019 netUpdate = true;
30020 for (int num872 = 0; num872 < 2; num872++)
30021 {
30022 int num873 = NPC.NewNPC(GetNPCSource_FromThis(), (int)base.Center.X, (int)base.Center.Y, 427, whoAmI);
30023 Main.npc[num873].velocity = -Vector2.UnitY.RotatedByRandom(6.2831854820251465) * Main.rand.Next(4, 9) - Vector2.UnitY * 2f;
30024 Main.npc[num873].netUpdate = true;
30025 }
30026 }
30027 }
30028 else if (type == 813)
30029 {
30030 if (Main.rand.Next(2) == 0)
30031 {
30032 Vector2 vector124 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
30033 Dust dust32 = Main.dust[Dust.NewDust(base.Center - vector124 * 30f, 0, 0, 5)];
30034 dust32.noGravity = true;
30035 dust32.position = base.Center - vector124 * Main.rand.Next(10, 21);
30036 dust32.velocity = vector124.RotatedBy(1.5707963705062866) * 6f;
30037 dust32.scale = 0.5f + Main.rand.NextFloat();
30038 dust32.fadeIn = 0.5f;
30039 dust32.customData = base.Center;
30040 }
30041 if (Main.rand.Next(2) == 0)
30042 {
30043 Vector2 vector125 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
30044 Dust dust33 = Main.dust[Dust.NewDust(base.Center - vector125 * 30f, 0, 0, 240)];
30045 dust33.noGravity = true;
30046 dust33.position = base.Center - vector125 * 30f;
30047 dust33.velocity = vector125.RotatedBy(-1.5707963705062866) * 3f;
30048 dust33.scale = 0.5f + Main.rand.NextFloat();
30049 dust33.fadeIn = 0.5f;
30050 dust33.customData = base.Center;
30051 }
30052 if (this.ai[0] == 90f && Main.netMode != 1)
30053 {
30054 int num874 = NPC.NewNPC(GetNPCSource_FromThis(), (int)base.Center.X, (int)base.Center.Y, 619, whoAmI);
30055 Main.npc[num874].netUpdate = true;
30056 }
30057 }
30058 }
30059 else if (this.ai[0] <= 120f)
30060 {
30061 scale = 1f;
30062 alpha = 0;
30063 rotation -= (float)Math.PI / 60f;
30064 if (type == 813)
30065 {
30066 if (Main.rand.Next(2) == 0)
30067 {
30068 Vector2 vector126 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
30069 Dust dust34 = Main.dust[Dust.NewDust(base.Center - vector126 * 30f, 0, 0, 5)];
30070 dust34.noGravity = true;
30071 dust34.position = base.Center - vector126 * Main.rand.Next(10, 21);
30072 dust34.velocity = vector126.RotatedBy(1.5707963705062866) * 6f;
30073 dust34.scale = 0.5f + Main.rand.NextFloat();
30074 dust34.fadeIn = 0.5f;
30075 dust34.customData = base.Center;
30076 }
30077 else
30078 {
30079 Vector2 vector127 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
30080 Dust dust35 = Main.dust[Dust.NewDust(base.Center - vector127 * 30f, 0, 0, 240)];
30081 dust35.noGravity = true;
30082 dust35.position = base.Center - vector127 * 30f;
30083 dust35.velocity = vector127.RotatedBy(-1.5707963705062866) * 3f;
30084 dust35.scale = 0.5f + Main.rand.NextFloat();
30085 dust35.fadeIn = 0.5f;
30086 dust35.customData = base.Center;
30087 }
30088 }
30089 else if (Main.rand.Next(2) == 0)
30090 {
30091 Vector2 vector128 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
30092 Dust dust36 = Main.dust[Dust.NewDust(base.Center - vector128 * 30f, 0, 0, 229)];
30093 dust36.noGravity = true;
30094 dust36.position = base.Center - vector128 * Main.rand.Next(10, 21);
30095 dust36.velocity = vector128.RotatedBy(1.5707963705062866) * 6f;
30096 dust36.scale = 0.5f + Main.rand.NextFloat();
30097 dust36.fadeIn = 0.5f;
30098 dust36.customData = base.Center;
30099 }
30100 else
30101 {
30102 Vector2 vector129 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
30103 Dust dust37 = Main.dust[Dust.NewDust(base.Center - vector129 * 30f, 0, 0, 240)];
30104 dust37.noGravity = true;
30105 dust37.position = base.Center - vector129 * 30f;
30106 dust37.velocity = vector129.RotatedBy(-1.5707963705062866) * 3f;
30107 dust37.scale = 0.5f + Main.rand.NextFloat();
30108 dust37.fadeIn = 0.5f;
30109 dust37.customData = base.Center;
30110 }
30111 }
30112 else
30113 {
30114 scale = 1f - (this.ai[0] - 120f) / 60f;
30115 alpha = 255 - (int)(255f * scale);
30116 rotation -= (float)Math.PI / 30f;
30117 if (alpha >= 255)
30118 {
30119 Kill();
30120 }
30121 if (type == 813)
30122 {
30123 for (int num875 = 0; num875 < 2; num875++)
30124 {
30125 switch (Main.rand.Next(3))
30126 {
30127 case 0:
30128 {
30129 Vector2 vector131 = Vector2.UnitY.RotatedByRandom(6.2831854820251465) * scale;
30130 Dust dust39 = Main.dust[Dust.NewDust(base.Center - vector131 * 30f, 0, 0, 5)];
30131 dust39.noGravity = true;
30132 dust39.position = base.Center - vector131 * Main.rand.Next(10, 21);
30133 dust39.velocity = vector131.RotatedBy(1.5707963705062866) * 6f;
30134 dust39.scale = 0.5f + Main.rand.NextFloat();
30135 dust39.fadeIn = 0.5f;
30136 dust39.customData = base.Center;
30137 break;
30138 }
30139 case 1:
30140 {
30141 Vector2 vector130 = Vector2.UnitY.RotatedByRandom(6.2831854820251465) * scale;
30142 Dust dust38 = Main.dust[Dust.NewDust(base.Center - vector130 * 30f, 0, 0, 240)];
30143 dust38.noGravity = true;
30144 dust38.position = base.Center - vector130 * 30f;
30145 dust38.velocity = vector130.RotatedBy(-1.5707963705062866) * 3f;
30146 dust38.scale = 0.5f + Main.rand.NextFloat();
30147 dust38.fadeIn = 0.5f;
30148 dust38.customData = base.Center;
30149 break;
30150 }
30151 }
30152 }
30153 }
30154 else
30155 {
30156 for (int num876 = 0; num876 < 2; num876++)
30157 {
30158 switch (Main.rand.Next(3))
30159 {
30160 case 0:
30161 {
30162 Vector2 vector133 = Vector2.UnitY.RotatedByRandom(6.2831854820251465) * scale;
30163 Dust dust41 = Main.dust[Dust.NewDust(base.Center - vector133 * 30f, 0, 0, 229)];
30164 dust41.noGravity = true;
30165 dust41.position = base.Center - vector133 * Main.rand.Next(10, 21);
30166 dust41.velocity = vector133.RotatedBy(1.5707963705062866) * 6f;
30167 dust41.scale = 0.5f + Main.rand.NextFloat();
30168 dust41.fadeIn = 0.5f;
30169 dust41.customData = base.Center;
30170 break;
30171 }
30172 case 1:
30173 {
30174 Vector2 vector132 = Vector2.UnitY.RotatedByRandom(6.2831854820251465) * scale;
30175 Dust dust40 = Main.dust[Dust.NewDust(base.Center - vector132 * 30f, 0, 0, 240)];
30176 dust40.noGravity = true;
30177 dust40.position = base.Center - vector132 * 30f;
30178 dust40.velocity = vector132.RotatedBy(-1.5707963705062866) * 3f;
30179 dust40.scale = 0.5f + Main.rand.NextFloat();
30180 dust40.fadeIn = 0.5f;
30181 dust40.customData = base.Center;
30182 break;
30183 }
30184 }
30185 }
30186 }
30187 }
30188 if (type == 813 && Main.rand.NextFloat() < Opacity)
30189 {
30190 Dust dust42 = Dust.NewDustPerfect(base.Center + Main.rand.NextVector2Circular(3f, 20f), 90);
30191 dust42.velocity = Vector2.UnitY;
30192 dust42.noGravity = true;
30193 dust42.scale = scale;
30194 }
30195 }
30196 else if (aiStyle == 109)
30197 {
30198 if (localAI[1] == 0f)
30199 {
30200 localAI[1] = velocity.Length();
30201 }
30202 if (this.ai[0] == 0f)
30203 {
30204 localAI[0]++;
30205 if (localAI[0] > 30f)
30206 {
30207 this.ai[0] = 1f;
30208 localAI[0] = 0f;
30209 return;
30210 }
30211 }
30212 else if (this.ai[0] == 1f)
30213 {
30215 if (type != 582 || !Main.npc[(int)this.ai[1]].active || Main.npc[(int)this.ai[1]].type != 124)
30216 {
30217 Kill();
30218 return;
30219 }
30220 NPC.lazyNPCOwnedProjectileSearchArray[(int)this.ai[1]] = whoAmI;
30221 zero3 = Main.npc[(int)this.ai[1]].Center;
30222 tileCollide = false;
30223 float num877 = localAI[1];
30224 Vector2 value14 = zero3 - base.Center;
30225 if (value14.Length() < num877)
30226 {
30227 Kill();
30228 return;
30229 }
30230 value14.Normalize();
30231 value14 *= num877;
30232 velocity = Vector2.Lerp(velocity, value14, 0.04f);
30233 }
30234 rotation += (float)Math.PI / 10f;
30235 }
30236 else if (aiStyle == 110)
30237 {
30238 if (localAI[1] == 0f)
30239 {
30240 localAI[1] = velocity.Length();
30241 }
30243 if (Main.npc[(int)this.ai[0]].active && Main.npc[(int)this.ai[0]].townNPC)
30244 {
30245 zero4 = Main.npc[(int)this.ai[0]].Center;
30246 float num878 = localAI[1];
30247 Vector2 value15 = zero4 - base.Center;
30248 if (value15.Length() < num878 || base.Hitbox.Intersects(Main.npc[(int)this.ai[0]].Hitbox))
30249 {
30250 Kill();
30251 int num879 = Main.npc[(int)this.ai[0]].lifeMax - Main.npc[(int)this.ai[0]].life;
30252 if (num879 > 20)
30253 {
30254 num879 = 20;
30255 }
30256 if (num879 > 0)
30257 {
30258 NPC nPC13 = Main.npc[(int)this.ai[0]];
30259 nPC13.life += num879;
30260 Main.npc[(int)this.ai[0]].HealEffect(num879);
30261 }
30262 }
30263 else
30264 {
30265 value15.Normalize();
30266 value15 *= num878;
30267 if (value15.Y < velocity.Y)
30268 {
30269 value15.Y = velocity.Y;
30270 }
30271 value15.Y += 1f;
30272 velocity = Vector2.Lerp(velocity, value15, 0.04f);
30273 rotation += velocity.X * 0.05f;
30274 }
30275 }
30276 else
30277 {
30278 Kill();
30279 }
30280 }
30281 else if (aiStyle == 111)
30282 {
30283 AI_111_DryadsWard();
30284 }
30285 else if (aiStyle == 112)
30286 {
30287 if (type == 836)
30288 {
30289 if (localAI[0] == 0f)
30290 {
30291 localAI[0] = 1f;
30292 for (int num880 = 0; num880 < 3; num880++)
30293 {
30294 int num881 = Dust.NewDust(base.position, width, height, 31, 0f, 0f, 50, Color.White, 1.2f);
30296 dust2.velocity *= 0.3f;
30297 Main.dust[num881].noGravity = true;
30298 }
30299 }
30300 if (++frameCounter >= 6)
30301 {
30302 frameCounter = 0;
30303 if (++frame >= 4)
30304 {
30305 frame = 0;
30306 }
30307 }
30308 Player player9 = Main.player[(int)this.ai[1]];
30309 bool flag49 = player9.active && !player9.dead && Vector2.Distance(player9.Center, base.Center) < 800f;
30310 int num882 = (spriteDirection = ((Main.WindForVisuals > 0f) ? 1 : (-1)));
30311 direction = ((player9.Center.X > base.Center.X) ? 1 : (-1));
30312 bool flag50 = num882 != direction;
30313 float num883 = 2.5f;
30314 float num884 = 2f;
30315 if (flag50)
30316 {
30317 num883 = 1.5f;
30318 num884 = 1f;
30319 }
30320 if (flag49)
30321 {
30322 if (!flag50)
30323 {
30324 float num885 = player9.Center.X - base.Center.X;
30325 velocity.X += 0.05f * (float)direction * (0.6f + Math.Abs(Main.WindForVisuals));
30326 if (velocity.X > num883)
30327 {
30328 velocity.X -= 0.1f;
30329 }
30330 if (velocity.X < 0f - num883)
30331 {
30332 velocity.X += 0.1f;
30333 }
30334 }
30335 if (player9.Top.Y >= base.Center.Y || flag50)
30336 {
30337 velocity.Y += 0.05f;
30338 if (velocity.Y > num883)
30339 {
30340 velocity.Y -= 0.1f;
30341 }
30342 }
30343 else if (player9.Top.Y < base.Center.Y)
30344 {
30345 velocity.Y -= 0.1f;
30346 if (velocity.Y < 0f - num884)
30347 {
30348 velocity.Y += 0.2f;
30349 }
30350 }
30351 }
30352 else
30353 {
30354 velocity.Y += 0.2f;
30355 if (velocity.Y < 0f - num884)
30356 {
30357 velocity.Y += 0.2f;
30358 }
30359 if (velocity.Y > num884)
30360 {
30361 velocity.Y -= 0.2f;
30362 }
30363 }
30364 rotation = velocity.X * 0.125f;
30365 }
30366 if (type == 590)
30367 {
30368 if (++frameCounter >= 4)
30369 {
30370 int num886 = 0;
30371 int num887 = 3;
30372 if (this.ai[2] == 1f)
30373 {
30374 num886 = 3;
30375 num887 = 6;
30376 }
30377 frameCounter = 0;
30378 if (++frame >= num887)
30379 {
30380 frame = num886;
30381 }
30382 }
30383 if (alpha > 0)
30384 {
30385 alpha -= 15;
30386 }
30387 if (alpha < 0)
30388 {
30389 alpha = 0;
30390 }
30391 if (alpha == 0)
30392 {
30393 float num888 = (float)Main.rand.Next(28, 42) * 0.005f;
30394 num888 += (float)(270 - Main.mouseTextColor) / 500f;
30395 float num889 = 0.1f;
30396 float num890 = 0.3f + num888 / 2f;
30397 float num891 = 0.6f + num888;
30398 float num892 = 0.35f;
30399 num889 *= num892;
30400 num890 *= num892;
30401 num891 *= num892;
30403 }
30404 velocity = new Vector2(0f, (float)Math.Sin((float)Math.PI * 2f * this.ai[0] / 180f) * 0.15f);
30405 this.ai[0]++;
30406 if (this.ai[0] >= 180f)
30407 {
30408 this.ai[0] = 0f;
30409 }
30410 }
30411 if (type != 644)
30412 {
30413 return;
30414 }
30415 Color newColor3 = Main.hslToRgb(this.ai[0], 1f, 0.5f);
30416 int num893 = (int)this.ai[1];
30417 if (num893 < 0 || num893 >= 1000 || (!Main.projectile[num893].active && Main.projectile[num893].type != 643))
30418 {
30419 this.ai[1] = -1f;
30420 }
30421 else
30422 {
30423 DelegateMethods.v3_1 = newColor3.ToVector3() * 0.5f;
30424 Utils.PlotTileLine(base.Center, Main.projectile[num893].Center, 8f, DelegateMethods.CastLight);
30425 }
30426 if (localAI[0] == 0f)
30427 {
30428 localAI[0] = Main.rand.NextFloat() * 0.8f + 0.8f;
30429 direction = ((Main.rand.Next(2) > 0) ? 1 : (-1));
30430 }
30431 rotation = localAI[1] / 40f * ((float)Math.PI * 2f) * (float)direction;
30432 if (alpha > 0)
30433 {
30434 alpha -= 8;
30435 }
30436 if (alpha < 0)
30437 {
30438 alpha = 0;
30439 }
30440 if (alpha == 0)
30441 {
30442 Lighting.AddLight(base.Center, newColor3.ToVector3() * 0.5f);
30443 }
30444 for (int num894 = 0; num894 < 2; num894++)
30445 {
30446 if (Main.rand.Next(10) == 0)
30447 {
30448 Vector2 vector134 = Vector2.UnitY.RotatedBy((float)num894 * (float)Math.PI).RotatedBy(rotation);
30449 Dust dust43 = Main.dust[Dust.NewDust(base.Center, 0, 0, 267, 0f, 0f, 225, newColor3, 1.5f)];
30450 dust43.noGravity = true;
30451 dust43.noLight = true;
30452 dust43.scale = Opacity * localAI[0];
30453 dust43.position = base.Center;
30454 dust43.velocity = vector134 * 2.5f;
30455 }
30456 }
30457 for (int num895 = 0; num895 < 2; num895++)
30458 {
30459 if (Main.rand.Next(10) == 0)
30460 {
30461 Vector2 vector135 = Vector2.UnitY.RotatedBy((float)num895 * (float)Math.PI);
30462 Dust dust44 = Main.dust[Dust.NewDust(base.Center, 0, 0, 267, 0f, 0f, 225, newColor3, 1.5f)];
30463 dust44.noGravity = true;
30464 dust44.noLight = true;
30465 dust44.scale = Opacity * localAI[0];
30466 dust44.position = base.Center;
30467 dust44.velocity = vector135 * 2.5f;
30468 }
30469 }
30470 if (Main.rand.Next(10) == 0)
30471 {
30472 float num896 = 1f + Main.rand.NextFloat() * 2f;
30473 float fadeIn = 1f + Main.rand.NextFloat();
30474 float num897 = 1f + Main.rand.NextFloat();
30475 Vector2 vector136 = Utils.RandomVector2(Main.rand, -1f, 1f);
30476 if (vector136 != Vector2.Zero)
30477 {
30478 vector136.Normalize();
30479 }
30480 vector136 *= 20f + Main.rand.NextFloat() * 100f;
30481 Vector2 vec = base.Center + vector136;
30482 Point point3 = vec.ToTileCoordinates();
30483 bool flag51 = true;
30484 if (!WorldGen.InWorld(point3.X, point3.Y))
30485 {
30486 flag51 = false;
30487 }
30488 if (flag51 && WorldGen.SolidTile(point3.X, point3.Y))
30489 {
30490 flag51 = false;
30491 }
30492 if (flag51)
30493 {
30494 Dust dust45 = Main.dust[Dust.NewDust(vec, 0, 0, 267, 0f, 0f, 127, newColor3)];
30495 dust45.noGravity = true;
30496 dust45.position = vec;
30497 dust45.velocity = -Vector2.UnitY * num896 * (Main.rand.NextFloat() * 0.9f + 1.6f);
30498 dust45.fadeIn = fadeIn;
30499 dust45.scale = num897;
30500 dust45.noLight = true;
30501 if (dust45.dustIndex != 6000)
30502 {
30504 Dust dust2 = dust46;
30505 dust2.scale *= 0.65f;
30506 dust2 = dust46;
30507 dust2.fadeIn *= 0.65f;
30508 dust46.color = new Color(255, 255, 255, 255);
30509 }
30510 }
30511 }
30512 scale = Opacity / 2f * localAI[0];
30513 velocity = Vector2.Zero;
30514 localAI[1]++;
30515 if (localAI[1] >= 60f)
30516 {
30517 Kill();
30518 }
30519 if (localAI[1] == 30f)
30520 {
30521 DoRainbowCrystalStaffExplosion();
30522 if (Main.myPlayer == owner)
30523 {
30524 friendly = true;
30525 int num898 = width;
30526 int num899 = height;
30527 int num900 = penetrate;
30528 base.position = base.Center;
30529 width = (height = 60);
30530 base.Center = base.position;
30531 penetrate = -1;
30532 maxPenetrate = -1;
30533 Damage();
30534 penetrate = num900;
30535 base.position = base.Center;
30536 width = num898;
30537 height = num899;
30538 base.Center = base.position;
30539 friendly = false;
30540 }
30541 }
30542 }
30543 else if (aiStyle == 113)
30544 {
30545 int num901 = 25;
30546 if (type == 614)
30547 {
30548 num901 = 63;
30549 }
30550 if (alpha > 0)
30551 {
30552 alpha -= num901;
30553 }
30554 if (alpha < 0)
30555 {
30556 alpha = 0;
30557 }
30558 if (this.ai[0] == 0f)
30559 {
30560 if (type == 614)
30561 {
30562 int num902 = (int)this.ai[1];
30563 if (!Main.npc[num902].CanBeChasedBy(this))
30564 {
30565 Kill();
30566 return;
30567 }
30568 float num903 = velocity.ToRotation();
30569 Vector2 vector137 = Main.npc[num902].Center - base.Center;
30570 if (vector137 != Vector2.Zero)
30571 {
30572 vector137.Normalize();
30573 vector137 *= 14f;
30574 }
30575 float num904 = 5f;
30576 velocity = (velocity * (num904 - 1f) + vector137) / num904;
30577 }
30578 else
30579 {
30580 this.ai[1]++;
30581 if (this.ai[1] >= 45f)
30582 {
30583 float num905 = 0.98f;
30584 float num906 = 0.35f;
30585 if (type == 636)
30586 {
30587 num905 = 0.995f;
30588 num906 = 0.15f;
30589 }
30590 this.ai[1] = 45f;
30591 velocity.X *= num905;
30592 velocity.Y += num906;
30593 }
30594 rotation = velocity.ToRotation() + (float)Math.PI / 2f;
30595 }
30596 }
30597 if (this.ai[0] == 1f)
30598 {
30599 Vector2 center17 = base.Center;
30600 ignoreWater = true;
30601 tileCollide = false;
30602 int num907 = 15;
30603 if (type == 636)
30604 {
30605 num907 = 5 * MaxUpdates;
30606 }
30607 if (type == 971)
30608 {
30609 num907 = 9 * MaxUpdates;
30610 }
30611 if (type == 975)
30612 {
30613 num907 = 9 * MaxUpdates;
30614 }
30615 bool flag52 = false;
30616 bool flag53 = false;
30617 localAI[0]++;
30618 if (localAI[0] % 30f == 0f)
30619 {
30620 flag53 = true;
30621 }
30622 int num908 = (int)this.ai[1];
30623 if (localAI[0] >= (float)(60 * num907))
30624 {
30625 flag52 = true;
30626 }
30627 else if (num908 < 0 || num908 >= 200)
30628 {
30629 flag52 = true;
30630 }
30631 else if (Main.npc[num908].active && !Main.npc[num908].dontTakeDamage)
30632 {
30633 base.Center = Main.npc[num908].Center - velocity * 2f;
30634 gfxOffY = Main.npc[num908].gfxOffY;
30635 if (flag53)
30636 {
30637 Main.npc[num908].HitEffect(0, 1.0);
30638 }
30639 }
30640 else
30641 {
30642 flag52 = true;
30643 }
30644 if (flag52)
30645 {
30646 Kill();
30647 }
30648 if (!flag52 && type == 971)
30649 {
30650 if (num908 > 0 && num908 < 200 && timeLeft % 2 == 0)
30651 {
30652 Vector2 vector138 = center17 - velocity.SafeNormalize(Vector2.Zero) * 8f;
30653 Vector2 value16 = Main.npc[num908].velocity + new Vector2(Main.rand.NextFloatDirection() * 0.35f, 2.5f);
30654 Dust dust47 = Dust.NewDustPerfect(vector138, 4, value16, 0, new Color(120, 50, 120), 0.65f);
30655 dust47.fadeIn = 0.25f;
30656 dust47.noGravity = true;
30657 }
30658 if (localAI[1] == 0f)
30659 {
30660 localAI[1] = 1f;
30661 rotation = velocity.ToRotation() + (float)Math.PI / 2f;
30662 }
30663 }
30664 if (!flag52 && type == 975)
30665 {
30666 if (num908 > 0 && num908 < 200 && timeLeft % 2 == 0)
30667 {
30669 Vector2 vector140 = velocity.SafeNormalize(Vector2.Zero) * -7f + velocity.SafeNormalize(Vector2.Zero).RotatedByRandom(0.19634954631328583);
30670 Dust dust48 = Dust.NewDustPerfect(vector139, 5, Vector2.Zero, 0, default(Color), 1.5f);
30671 dust48.scale = 1.1f;
30672 dust48.velocity = vector140 * 0.85f + new Vector2(0f, 0.85f);
30673 Vector2 spinningpoint17 = dust48.velocity;
30674 dust48.velocity = spinningpoint17.RotatedBy((float)Math.PI * 2f * Main.rand.NextFloatDirection() * 0.025f);
30675 dust48 = Dust.CloneDust(dust48.dustIndex);
30676 dust48.velocity = spinningpoint17.RotatedBy((float)Math.PI * 2f * Main.rand.NextFloatDirection() * 0.025f);
30677 Dust dust2 = dust48;
30678 dust2.position += dust48.velocity;
30679 if (Main.rand.Next(3) == 0)
30680 {
30681 dust48 = Dust.CloneDust(dust48.dustIndex);
30682 dust48.velocity = dust48.velocity.RotatedByRandom(0.39269909262657166) * 0.9f;
30683 }
30684 }
30685 if (localAI[1] == 0f)
30686 {
30687 localAI[1] = 1f;
30688 rotation = velocity.ToRotation() + (float)Math.PI / 2f;
30690 for (int num909 = 0; num909 < 10; num909++)
30691 {
30692 Vector2 vector142 = Main.rand.NextVector2CircularEdge(4f, 4f);
30693 Dust dust49 = Dust.NewDustPerfect(vector141, 5, Vector2.Zero, 0, default(Color), 1.5f);
30694 dust49.scale = 1.5f;
30695 dust49.velocity = vector142;
30696 dust49.noGravity = true;
30697 }
30698 }
30699 }
30700 }
30701 if (type == 614)
30702 {
30703 Lighting.AddLight(base.Center, 0.2f, 0.6f, 0.7f);
30704 }
30705 if (type == 636)
30706 {
30707 Lighting.AddLight(base.Center, 0.8f, 0.7f, 0.4f);
30708 }
30709 }
30710 else if (aiStyle == 114)
30711 {
30712 if (Main.netMode == 2 && localAI[0] == 0f)
30713 {
30715 localAI[0] = 1f;
30716 }
30717 timeLeft = 3;
30718 bool flag54 = false;
30719 if (owner != 255 && (!Main.player[owner].active || Main.player[owner].dead || Distance(Main.player[owner].Center) > 12800f))
30720 {
30721 flag54 = true;
30722 }
30723 if (!flag54 && !WorldGen.InWorld((int)base.Center.X / 16, (int)base.Center.Y / 16, Lighting.OffScreenTiles))
30724 {
30725 flag54 = true;
30726 }
30727 if (!flag54 && !PortalHelper.SupportedTilesAreFine(base.Center, this.ai[0]))
30728 {
30729 flag54 = true;
30730 }
30731 if (flag54)
30732 {
30733 Kill();
30734 return;
30735 }
30736 Color portalColor = PortalHelper.GetPortalColor(owner, (int)this.ai[1]);
30737 alpha -= 25;
30738 if (alpha < 0)
30739 {
30740 alpha = 0;
30741 }
30742 if (alpha == 0)
30743 {
30744 Lighting.AddLight(base.Center + velocity * 3f, portalColor.ToVector3() * 0.5f);
30745 }
30746 if (++frameCounter >= 6)
30747 {
30748 frameCounter = 0;
30749 if (++frame >= Main.projFrames[type])
30750 {
30751 frame = 0;
30752 }
30753 }
30754 rotation = this.ai[0] - (float)Math.PI / 2f;
30755 }
30756 else if (aiStyle == 115)
30757 {
30758 Lighting.AddLight(base.Center, new Vector3(0.075f, 0.3f, 0.15f));
30759 velocity *= 0.985f;
30760 rotation += velocity.X * 0.2f;
30761 if (velocity.X > 0f)
30762 {
30763 rotation += 0.08f;
30764 }
30765 else
30766 {
30767 rotation -= 0.08f;
30768 }
30769 this.ai[1] += 1f;
30770 if (this.ai[1] > 30f)
30771 {
30772 alpha += 10;
30773 if (alpha >= 255)
30774 {
30775 alpha = 255;
30776 Kill();
30777 }
30778 }
30779 }
30780 else if (aiStyle == 116)
30781 {
30782 if (localAI[0] == 0f)
30783 {
30784 rotation = this.ai[1];
30785 localAI[0] = 1f;
30786 }
30787 Player player10 = Main.player[owner];
30788 if (player10.setSolar)
30789 {
30790 timeLeft = 2;
30791 }
30792 float angle = (float)player10.miscCounter / 300f * ((float)Math.PI * 4f) + this.ai[1];
30794 rotation = rotation.AngleLerp(angle, 0.05f);
30795 alpha -= 15;
30796 if (alpha < 0)
30797 {
30798 alpha = 0;
30799 }
30800 velocity = rotation.ToRotationVector2() * 100f - player10.velocity;
30801 base.Center = player10.Center - velocity;
30802 }
30803 else if (aiStyle == 117)
30804 {
30805 this.ai[1] += 0.01f;
30806 scale = this.ai[1];
30807 this.ai[0]++;
30808 if (this.ai[0] >= (float)(3 * Main.projFrames[type]))
30809 {
30810 Kill();
30811 return;
30812 }
30813 if (++frameCounter >= 3)
30814 {
30815 frameCounter = 0;
30816 if (++frame >= Main.projFrames[type])
30817 {
30818 hide = true;
30819 }
30820 }
30821 alpha -= 63;
30822 if (alpha < 0)
30823 {
30824 alpha = 0;
30825 }
30826 bool flag55 = type == 612 || type == 953 || type == 978;
30827 bool flag56 = type == 624;
30828 if (flag55)
30829 {
30830 Lighting.AddLight(base.Center, 0.9f, 0.8f, 0.6f);
30831 }
30832 if (this.ai[0] != 1f)
30833 {
30834 return;
30835 }
30836 base.position = base.Center;
30837 width = (height = (int)(52f * scale));
30838 base.Center = base.position;
30839 Damage();
30840 if (flag55)
30841 {
30843 for (int num910 = 0; num910 < 4; num910++)
30844 {
30845 int num911 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 31, 0f, 0f, 100, default(Color), 1.5f);
30846 Main.dust[num911].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * width / 2f;
30847 }
30848 for (int num912 = 0; num912 < 10; num912++)
30849 {
30850 int num913 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 6, 0f, 0f, 200, default(Color), 2.7f);
30851 Main.dust[num913].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * width / 2f;
30852 Main.dust[num913].noGravity = true;
30854 dust2.velocity *= 3f;
30855 num913 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 6, 0f, 0f, 100, default(Color), 1.5f);
30856 Main.dust[num913].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * width / 2f;
30857 dust2 = Main.dust[num913];
30858 dust2.velocity *= 2f;
30859 Main.dust[num913].noGravity = true;
30860 Main.dust[num913].fadeIn = 2.5f;
30861 }
30862 for (int num914 = 0; num914 < 5; num914++)
30863 {
30864 int num915 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 6, 0f, 0f, 0, default(Color), 2.7f);
30865 Main.dust[num915].position = base.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy(velocity.ToRotation()) * width / 2f;
30866 Main.dust[num915].noGravity = true;
30868 dust2.velocity *= 3f;
30869 }
30870 for (int num916 = 0; num916 < 10; num916++)
30871 {
30872 int num917 = Dust.NewDust(new Vector2(base.position.X, base.position.Y), width, height, 31, 0f, 0f, 0, default(Color), 1.5f);
30873 Main.dust[num917].position = base.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy(velocity.ToRotation()) * width / 2f;
30874 Main.dust[num917].noGravity = true;
30876 dust2.velocity *= 3f;
30877 }
30878 }
30879 if (!flag56)
30880 {
30881 return;
30882 }
30884 for (int num918 = 0; num918 < 20; num918++)
30885 {
30886 int num919 = Dust.NewDust(base.position, width, height, 135, 0f, 0f, 100, default(Color), 1.5f);
30887 Main.dust[num919].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * width / 2f;
30889 dust2.velocity *= 2f;
30890 Main.dust[num919].noGravity = true;
30891 Main.dust[num919].fadeIn = 2.5f;
30892 Main.dust[num919].shader = GameShaders.Armor.GetSecondaryShader(Main.player[owner].cPet, Main.player[owner]);
30893 }
30894 for (int num920 = 0; num920 < 15; num920++)
30895 {
30896 int num921 = Dust.NewDust(base.position, width, height, 135, 0f, 0f, 0, default(Color), 2.7f);
30897 Main.dust[num921].position = base.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy(velocity.ToRotation()) * width / 2f;
30898 Main.dust[num921].noGravity = true;
30900 dust2.velocity *= 3f;
30901 Main.dust[num921].shader = GameShaders.Armor.GetSecondaryShader(Main.player[owner].cPet, Main.player[owner]);
30902 }
30903 float num922 = (float)Main.rand.NextDouble() * ((float)Math.PI * 2f);
30904 float num923 = (float)Main.rand.NextDouble() * ((float)Math.PI * 2f);
30905 float num924 = (float)Main.rand.NextDouble() * ((float)Math.PI * 2f);
30906 float num925 = 7f + (float)Main.rand.NextDouble() * 7f;
30907 float num926 = 7f + (float)Main.rand.NextDouble() * 7f;
30908 float num927 = 7f + (float)Main.rand.NextDouble() * 7f;
30909 float num928 = num925;
30910 if (num926 > num928)
30911 {
30912 num928 = num926;
30913 }
30914 if (num927 > num928)
30915 {
30916 num928 = num927;
30917 }
30918 for (int num929 = 0; num929 < 200; num929++)
30919 {
30920 int num930 = 135;
30921 float num931 = num928;
30922 if (num929 > 50)
30923 {
30924 num931 = num926;
30925 }
30926 if (num929 > 100)
30927 {
30928 num931 = num925;
30929 }
30930 if (num929 > 150)
30931 {
30932 num931 = num927;
30933 }
30934 int num932 = Dust.NewDust(base.position, 6, 6, num930, 0f, 0f, 100);
30935 Vector2 vector143 = Main.dust[num932].velocity;
30936 Main.dust[num932].position = base.Center;
30937 vector143.Normalize();
30938 vector143 *= num931;
30939 if (num929 > 150)
30940 {
30941 vector143.Y *= 0.5f;
30942 vector143 = vector143.RotatedBy(num924);
30943 }
30944 else if (num929 > 100)
30945 {
30946 vector143.X *= 0.5f;
30947 vector143 = vector143.RotatedBy(num922);
30948 }
30949 else if (num929 > 50)
30950 {
30951 vector143.Y *= 0.5f;
30952 vector143 = vector143.RotatedBy(num923);
30953 }
30955 dust2.velocity *= 0.2f;
30956 dust2 = Main.dust[num932];
30957 dust2.velocity += vector143;
30958 Main.dust[num932].shader = GameShaders.Armor.GetSecondaryShader(Main.player[owner].cPet, Main.player[owner]);
30959 if (num929 <= 200)
30960 {
30961 Main.dust[num932].scale = 2f;
30962 Main.dust[num932].noGravity = true;
30963 Main.dust[num932].fadeIn = Main.rand.NextFloat() * 2f;
30964 if (Main.rand.Next(4) == 0)
30965 {
30966 Main.dust[num932].fadeIn = 2.5f;
30967 }
30968 Main.dust[num932].noLight = true;
30969 if (num929 < 100)
30970 {
30971 dust2 = Main.dust[num932];
30972 dust2.position += Main.dust[num932].velocity * 20f;
30973 dust2 = Main.dust[num932];
30974 dust2.velocity *= -1f;
30975 }
30976 }
30977 }
30978 }
30979 else if (aiStyle == 118)
30980 {
30981 this.ai[0]++;
30982 int num933 = 0;
30983 if (velocity.Length() <= 4f)
30984 {
30985 num933 = 1;
30986 }
30987 alpha -= 15;
30988 if (alpha < 0)
30989 {
30990 alpha = 0;
30991 }
30992 switch (num933)
30993 {
30994 case 0:
30995 rotation -= (float)Math.PI / 30f;
30996 if (Main.rand.Next(3) == 0)
30997 {
30998 if (Main.rand.Next(2) == 0)
30999 {
31000 Vector2 vector149 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
31001 Dust dust52 = Main.dust[Dust.NewDust(base.Center - vector149 * 30f, 0, 0, Utils.SelectRandom<int>(Main.rand, 86, 90))];
31002 dust52.noGravity = true;
31003 dust52.position = base.Center - vector149 * Main.rand.Next(10, 21);
31004 dust52.velocity = vector149.RotatedBy(1.5707963705062866) * 6f;
31005 dust52.scale = 0.5f + Main.rand.NextFloat();
31006 dust52.fadeIn = 0.5f;
31007 dust52.customData = this;
31008 }
31009 else
31010 {
31011 Vector2 vector150 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
31012 Dust dust53 = Main.dust[Dust.NewDust(base.Center - vector150 * 30f, 0, 0, 240)];
31013 dust53.noGravity = true;
31014 dust53.position = base.Center - vector150 * 30f;
31015 dust53.velocity = vector150.RotatedBy(-1.5707963705062866) * 3f;
31016 dust53.scale = 0.5f + Main.rand.NextFloat();
31017 dust53.fadeIn = 0.5f;
31018 dust53.customData = this;
31019 }
31020 }
31021 if (this.ai[0] >= 30f)
31022 {
31023 velocity *= 0.98f;
31024 scale += 0.0074468083f;
31025 if (scale > 1.3f)
31026 {
31027 scale = 1.3f;
31028 }
31029 rotation -= (float)Math.PI / 180f;
31030 }
31031 if (velocity.Length() < 4.1f)
31032 {
31033 velocity.Normalize();
31034 velocity *= 4f;
31035 this.ai[0] = 0f;
31036 }
31037 break;
31038 case 1:
31039 {
31040 rotation -= (float)Math.PI / 30f;
31041 for (int num934 = 0; num934 < 1; num934++)
31042 {
31043 if (Main.rand.Next(2) == 0)
31044 {
31045 Vector2 vector144 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
31046 Dust dust50 = Main.dust[Dust.NewDust(base.Center - vector144 * 30f, 0, 0, 86)];
31047 dust50.noGravity = true;
31048 dust50.position = base.Center - vector144 * Main.rand.Next(10, 21);
31049 dust50.velocity = vector144.RotatedBy(1.5707963705062866) * 6f;
31050 dust50.scale = 0.9f + Main.rand.NextFloat();
31051 dust50.fadeIn = 0.5f;
31052 dust50.customData = this;
31053 vector144 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
31054 dust50 = Main.dust[Dust.NewDust(base.Center - vector144 * 30f, 0, 0, 90)];
31055 dust50.noGravity = true;
31056 dust50.position = base.Center - vector144 * Main.rand.Next(10, 21);
31057 dust50.velocity = vector144.RotatedBy(1.5707963705062866) * 6f;
31058 dust50.scale = 0.9f + Main.rand.NextFloat();
31059 dust50.fadeIn = 0.5f;
31060 dust50.customData = this;
31061 dust50.color = Color.Crimson;
31062 }
31063 else
31064 {
31065 Vector2 vector145 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
31066 Dust dust51 = Main.dust[Dust.NewDust(base.Center - vector145 * 30f, 0, 0, 240)];
31067 dust51.noGravity = true;
31068 dust51.position = base.Center - vector145 * Main.rand.Next(20, 31);
31069 dust51.velocity = vector145.RotatedBy(-1.5707963705062866) * 5f;
31070 dust51.scale = 0.9f + Main.rand.NextFloat();
31071 dust51.fadeIn = 0.5f;
31072 dust51.customData = this;
31073 }
31074 }
31075 if (this.ai[0] % 30f == 0f && this.ai[0] < 241f && Main.myPlayer == owner)
31076 {
31077 Vector2 vector146 = Vector2.UnitY.RotatedByRandom(6.2831854820251465) * 12f;
31078 NewProjectile(GetProjectileSource_FromThis(), base.Center.X, base.Center.Y, vector146.X, vector146.Y, 618, damage / 2, 0f, owner, 0f, whoAmI);
31079 }
31080 Vector2 vector147 = base.Center;
31081 float num935 = 800f;
31082 bool flag57 = false;
31083 int num936 = 0;
31084 if (this.ai[1] == 0f)
31085 {
31086 for (int num937 = 0; num937 < 200; num937++)
31087 {
31088 if (Main.npc[num937].CanBeChasedBy(this))
31089 {
31090 Vector2 center18 = Main.npc[num937].Center;
31091 if (Distance(center18) < num935 && Collision.CanHit(new Vector2(base.position.X + (float)(width / 2), base.position.Y + (float)(height / 2)), 1, 1, Main.npc[num937].position, Main.npc[num937].width, Main.npc[num937].height))
31092 {
31093 num935 = Distance(center18);
31095 flag57 = true;
31096 num936 = num937;
31097 }
31098 }
31099 }
31100 if (flag57)
31101 {
31102 if (this.ai[1] != (float)(num936 + 1))
31103 {
31104 netUpdate = true;
31105 }
31106 this.ai[1] = num936 + 1;
31107 }
31108 flag57 = false;
31109 }
31110 if (this.ai[1] != 0f)
31111 {
31112 int num938 = (int)(this.ai[1] - 1f);
31113 if (Main.npc[num938].active && Main.npc[num938].CanBeChasedBy(this, ignoreDontTakeDamage: true) && Distance(Main.npc[num938].Center) < 1000f)
31114 {
31115 flag57 = true;
31116 vector147 = Main.npc[num938].Center;
31117 }
31118 }
31119 if (!friendly)
31120 {
31121 flag57 = false;
31122 }
31123 if (flag57)
31124 {
31125 float num939 = 4f;
31126 int num940 = 8;
31127 Vector2 vector148 = new Vector2(base.position.X + (float)width * 0.5f, base.position.Y + (float)height * 0.5f);
31128 float num941 = vector147.X - vector148.X;
31129 float num942 = vector147.Y - vector148.Y;
31130 float num943 = (float)Math.Sqrt(num941 * num941 + num942 * num942);
31131 float num944 = num943;
31132 num943 = num939 / num943;
31133 num941 *= num943;
31134 num942 *= num943;
31135 velocity.X = (velocity.X * (float)(num940 - 1) + num941) / (float)num940;
31136 velocity.Y = (velocity.Y * (float)(num940 - 1) + num942) / (float)num940;
31137 }
31138 break;
31139 }
31140 }
31141 if (alpha < 150)
31142 {
31143 Lighting.AddLight(base.Center, 0.7f, 0.2f, 0.6f);
31144 }
31145 if (this.ai[0] >= 600f)
31146 {
31147 Kill();
31148 }
31149 }
31150 else if (aiStyle == 119)
31151 {
31152 int num945 = 0;
31153 float num946 = 0f;
31154 float x7 = 0f;
31155 float y6 = 0f;
31156 bool flag58 = false;
31157 bool flag59 = false;
31158 int num38 = type;
31159 if (num38 == 618)
31160 {
31161 num945 = 617;
31162 num946 = 420f;
31163 x7 = 0.15f;
31164 y6 = 0.15f;
31165 }
31166 if (flag59)
31167 {
31168 int num947 = (int)this.ai[1];
31169 if (!Main.projectile[num947].active || Main.projectile[num947].type != num945)
31170 {
31171 Kill();
31172 return;
31173 }
31174 timeLeft = 2;
31175 }
31176 this.ai[0]++;
31177 if (!(this.ai[0] < num946))
31178 {
31179 return;
31180 }
31181 bool flag60 = true;
31182 int num948 = (int)this.ai[1];
31183 if (Main.projectile[num948].active && Main.projectile[num948].type == num945)
31184 {
31185 if (!flag58 && Main.projectile[num948].oldPos[1] != Vector2.Zero)
31186 {
31187 base.position += Main.projectile[num948].position - Main.projectile[num948].oldPos[1];
31188 }
31189 if (base.Center.HasNaNs())
31190 {
31191 Kill();
31192 return;
31193 }
31194 }
31195 else
31196 {
31197 this.ai[0] = num946;
31198 flag60 = false;
31199 Kill();
31200 }
31201 if (flag60 && !flag58)
31202 {
31203 velocity += new Vector2(Math.Sign(Main.projectile[num948].Center.X - base.Center.X), Math.Sign(Main.projectile[num948].Center.Y - base.Center.Y)) * new Vector2(x7, y6);
31204 if (velocity.Length() > 6f)
31205 {
31206 velocity *= 6f / velocity.Length();
31207 }
31208 }
31209 if (type == 618)
31210 {
31211 if (Main.rand.Next(2) == 0)
31212 {
31213 int num949 = Dust.NewDust(base.Center, 8, 8, 86);
31214 Main.dust[num949].position = base.Center;
31215 Main.dust[num949].velocity = velocity;
31216 Main.dust[num949].noGravity = true;
31217 Main.dust[num949].scale = 1.5f;
31218 if (flag60)
31219 {
31220 Main.dust[num949].customData = Main.projectile[(int)this.ai[1]];
31221 }
31222 }
31223 alpha = 255;
31224 }
31225 else
31226 {
31227 Kill();
31228 }
31229 }
31230 else if (aiStyle == 120)
31231 {
31232 AI_120_StardustGuardian();
31233 }
31234 else if (aiStyle == 121)
31235 {
31236 AI_121_StardustDragon();
31237 }
31238 else if (aiStyle == 122)
31239 {
31240 int num950 = (int)this.ai[0];
31241 bool flag61 = false;
31242 if (num950 == -1 || !Main.npc[num950].active)
31243 {
31244 flag61 = true;
31245 }
31246 if (flag61)
31247 {
31248 if (type == 629)
31249 {
31250 Kill();
31251 return;
31252 }
31253 if (type == 631 && this.ai[0] != -1f)
31254 {
31255 this.ai[0] = -1f;
31256 netUpdate = true;
31257 }
31258 }
31259 if (!flag61 && base.Hitbox.Intersects(Main.npc[num950].Hitbox))
31260 {
31261 Kill();
31262 if (type == 631)
31263 {
31264 localAI[1] = 1f;
31265 Damage();
31266 }
31267 return;
31268 }
31269 if (type == 629)
31270 {
31271 Vector2 value17 = Main.npc[num950].Center - base.Center;
31272 velocity = Vector2.Normalize(value17) * 5f;
31273 Dust.QuickDust(base.Center, Color.Red);
31274 }
31275 if (type != 631)
31276 {
31277 return;
31278 }
31279 if (this.ai[1] > 0f)
31280 {
31281 this.ai[1]--;
31282 velocity = Vector2.Zero;
31283 return;
31284 }
31285 if (flag61)
31286 {
31287 if (velocity == Vector2.Zero)
31288 {
31289 Kill();
31290 }
31291 tileCollide = true;
31292 alpha += 10;
31293 if (alpha > 255)
31294 {
31295 Kill();
31296 }
31297 }
31298 else
31299 {
31300 Vector2 value18 = Main.npc[num950].Center - base.Center;
31301 velocity = Vector2.Normalize(value18) * 12f;
31302 alpha -= 15;
31303 if (alpha < 0)
31304 {
31305 alpha = 0;
31306 }
31307 }
31308 rotation = velocity.ToRotation() - (float)Math.PI / 2f;
31309 }
31310 else if (aiStyle == 123)
31311 {
31312 bool flag62 = type == 641;
31313 bool flag63 = type == 643;
31314 float num951 = 1000f;
31315 velocity = Vector2.Zero;
31316 if (flag62)
31317 {
31318 alpha -= 5;
31319 if (alpha < 0)
31320 {
31321 alpha = 0;
31322 }
31323 if (direction == 0)
31324 {
31325 direction = Main.player[owner].direction;
31326 }
31327 rotation -= (float)direction * ((float)Math.PI * 2f) / 120f;
31328 scale = Opacity;
31329 Lighting.AddLight(base.Center, new Vector3(0.3f, 0.9f, 0.7f) * Opacity);
31330 if (Main.rand.Next(2) == 0)
31331 {
31332 Vector2 vector151 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
31333 Dust dust54 = Main.dust[Dust.NewDust(base.Center - vector151 * 30f, 0, 0, 229)];
31334 dust54.noGravity = true;
31335 dust54.position = base.Center - vector151 * Main.rand.Next(10, 21);
31336 dust54.velocity = vector151.RotatedBy(1.5707963705062866) * 6f;
31337 dust54.scale = 0.5f + Main.rand.NextFloat();
31338 dust54.fadeIn = 0.5f;
31339 dust54.customData = base.Center;
31340 }
31341 if (Main.rand.Next(2) == 0)
31342 {
31343 Vector2 vector152 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
31344 Dust dust55 = Main.dust[Dust.NewDust(base.Center - vector152 * 30f, 0, 0, 240)];
31345 dust55.noGravity = true;
31346 dust55.position = base.Center - vector152 * 30f;
31347 dust55.velocity = vector152.RotatedBy(-1.5707963705062866) * 3f;
31348 dust55.scale = 0.5f + Main.rand.NextFloat();
31349 dust55.fadeIn = 0.5f;
31350 dust55.customData = base.Center;
31351 }
31352 if (this.ai[0] < 0f)
31353 {
31354 Vector2 center19 = base.Center;
31355 int num952 = Dust.NewDust(center19 - Vector2.One * 8f, 16, 16, 229, velocity.X / 2f, velocity.Y / 2f);
31357 dust2.velocity *= 2f;
31358 Main.dust[num952].noGravity = true;
31359 Main.dust[num952].scale = Utils.SelectRandom<float>(Main.rand, 0.8f, 1.65f);
31360 Main.dust[num952].customData = this;
31361 }
31362 }
31363 if (flag63)
31364 {
31365 alpha -= 5;
31366 if (alpha < 0)
31367 {
31368 alpha = 0;
31369 }
31370 if (direction == 0)
31371 {
31372 direction = Main.player[owner].direction;
31373 }
31374 if (++frameCounter >= 3)
31375 {
31376 frameCounter = 0;
31377 if (++frame >= Main.projFrames[type])
31378 {
31379 frame = 0;
31380 }
31381 }
31382 if (alpha == 0 && Main.rand.Next(15) == 0)
31383 {
31384 Dust dust56 = Main.dust[Dust.NewDust(base.Top, 0, 0, 261, 0f, 0f, 100)];
31385 dust56.velocity.X = 0f;
31386 dust56.noGravity = true;
31387 dust56.fadeIn = 1f;
31388 dust56.position = base.Center + Vector2.UnitY.RotatedByRandom(6.2831854820251465) * (4f * Main.rand.NextFloat() + 26f);
31389 dust56.scale = 0.5f;
31390 }
31391 localAI[0]++;
31392 if (localAI[0] >= 60f)
31393 {
31394 localAI[0] = 0f;
31395 }
31396 }
31397 if (this.ai[0] < 0f)
31398 {
31399 this.ai[0]++;
31400 if (flag62)
31401 {
31402 this.ai[1] -= (float)direction * ((float)Math.PI / 8f) / 50f;
31403 }
31404 }
31405 if (this.ai[0] == 0f)
31406 {
31407 int num953 = -1;
31408 float num954 = num951;
31409 NPC ownerMinionAttackTargetNPC4 = OwnerMinionAttackTargetNPC;
31410 if (ownerMinionAttackTargetNPC4 != null && ownerMinionAttackTargetNPC4.CanBeChasedBy(this))
31411 {
31412 float num955 = Distance(ownerMinionAttackTargetNPC4.Center);
31413 if (num955 < num954 && Collision.CanHitLine(base.Center, 0, 0, ownerMinionAttackTargetNPC4.Center, 0, 0))
31414 {
31415 num954 = num955;
31417 }
31418 }
31419 if (num953 < 0)
31420 {
31421 for (int num956 = 0; num956 < 200; num956++)
31422 {
31423 NPC nPC14 = Main.npc[num956];
31424 if (nPC14.CanBeChasedBy(this))
31425 {
31426 float num957 = Distance(nPC14.Center);
31427 if (num957 < num954 && Collision.CanHitLine(base.Center, 0, 0, nPC14.Center, 0, 0))
31428 {
31429 num954 = num957;
31430 num953 = num956;
31431 }
31432 }
31433 }
31434 }
31435 if (num953 != -1)
31436 {
31437 this.ai[0] = 1f;
31438 this.ai[1] = num953;
31439 netUpdate = true;
31440 return;
31441 }
31442 }
31443 if (!(this.ai[0] > 0f))
31444 {
31445 return;
31446 }
31447 int num958 = (int)this.ai[1];
31448 if (!Main.npc[num958].CanBeChasedBy(this))
31449 {
31450 this.ai[0] = 0f;
31451 this.ai[1] = 0f;
31452 netUpdate = true;
31453 return;
31454 }
31455 this.ai[0]++;
31456 float num959 = 30f;
31457 if (flag62)
31458 {
31459 num959 = 10f;
31460 }
31461 if (flag63)
31462 {
31463 num959 = 5f;
31464 }
31465 if (!(this.ai[0] >= num959))
31466 {
31467 return;
31468 }
31469 Vector2 vector153 = DirectionTo(Main.npc[num958].Center);
31470 if (vector153.HasNaNs())
31471 {
31473 }
31474 float num960 = vector153.ToRotation();
31475 int num961 = ((vector153.X > 0f) ? 1 : (-1));
31476 if (flag62)
31477 {
31478 direction = num961;
31479 this.ai[0] = -20f;
31480 this.ai[1] = num960 + (float)num961 * (float)Math.PI / 6f;
31481 netUpdate = true;
31482 if (owner == Main.myPlayer)
31483 {
31484 NewProjectile(GetProjectileSource_FromThis(), base.Center.X, base.Center.Y, vector153.X, vector153.Y, 642, damage, knockBack, owner, this.ai[1], whoAmI);
31485 }
31486 }
31487 if (!flag63)
31488 {
31489 return;
31490 }
31491 direction = num961;
31492 this.ai[0] = -20f;
31493 netUpdate = true;
31494 if (owner != Main.myPlayer)
31495 {
31496 return;
31497 }
31498 NPC nPC15 = Main.npc[num958];
31499 Vector2 vector154 = nPC15.position + nPC15.Size * Utils.RandomVector2(Main.rand, 0f, 1f) - base.Center;
31500 for (int num962 = 0; num962 < 3; num962++)
31501 {
31502 Vector2 other = base.Center + vector154;
31503 Vector2 vector155 = nPC15.velocity * 30f;
31504 other += vector155;
31505 float num963 = MathHelper.Lerp(0.1f, 0.75f, Utils.GetLerpValue(800f, 200f, Distance(other)));
31506 if (num962 > 0)
31507 {
31508 other = base.Center + vector154.RotatedByRandom(0.7853981852531433) * (Main.rand.NextFloat() * num963 + 0.5f);
31509 }
31511 NewProjectile(GetProjectileSource_FromThis(), other.X, other.Y, 0f, 0f, 644, damage, knockBack, owner, x8, whoAmI);
31512 }
31513 }
31514 else if (aiStyle == 124)
31515 {
31516 bool flag64 = type == 650;
31517 Player player11 = Main.player[owner];
31518 if (player11.dead)
31519 {
31520 Kill();
31521 return;
31522 }
31523 if (type == 650 && player11.suspiciouslookingTentacle)
31524 {
31525 timeLeft = 2;
31526 }
31527 if (type == 882 && player11.petFlagEyeOfCthulhuPet)
31528 {
31529 timeLeft = 2;
31530 }
31531 if (type == 888 && player11.petFlagTwinsPet)
31532 {
31533 timeLeft = 2;
31534 }
31535 if (type == 895 && player11.petFlagFairyQueenPet)
31536 {
31537 timeLeft = 2;
31538 }
31539 if (type == 896 && player11.petFlagPumpkingPet)
31540 {
31541 timeLeft = 2;
31542 }
31543 if (type == 898 && player11.petFlagIceQueenPet)
31544 {
31545 timeLeft = 2;
31546 }
31547 if (type == 957 && player11.petFlagGlommerPet)
31548 {
31549 timeLeft = 2;
31550 }
31551 direction = (spriteDirection = player11.direction);
31552 if (type == 650)
31553 {
31554 Vector3 v3_ = new Vector3(0.5f, 0.9f, 1f) * 2f;
31555 DelegateMethods.v3_1 = v3_;
31556 Utils.PlotTileLine(base.Center, base.Center + velocity * 6f, 20f, DelegateMethods.CastLightOpen);
31557 Utils.PlotTileLine(base.Left, base.Right, 20f, DelegateMethods.CastLightOpen);
31558 Utils.PlotTileLine(player11.Center, player11.Center + player11.velocity * 6f, 40f, DelegateMethods.CastLightOpen);
31559 Utils.PlotTileLine(player11.Left, player11.Right, 40f, DelegateMethods.CastLightOpen);
31560 }
31561 if (type == 895)
31562 {
31563 Vector3 vector156 = new Vector3(1f, 0.6f, 1f) * 1.5f;
31564 DelegateMethods.v3_1 = vector156 * 0.75f;
31565 Utils.PlotTileLine(player11.Center, player11.Center + player11.velocity * 6f, 40f, DelegateMethods.CastLightOpen);
31566 Utils.PlotTileLine(player11.Left, player11.Right, 40f, DelegateMethods.CastLightOpen);
31567 DelegateMethods.v3_1 = vector156 * 1.5f;
31568 Utils.PlotTileLine(base.Center, base.Center + velocity * 6f, 30f, DelegateMethods.CastLightOpen);
31569 Utils.PlotTileLine(base.Left, base.Right, 20f, DelegateMethods.CastLightOpen);
31570 }
31571 if (type == 896)
31572 {
31573 Vector3 vector157 = new Vector3(1f, 0.7f, 0.05f) * 1.5f;
31574 DelegateMethods.v3_1 = vector157 * 0.75f;
31575 Utils.PlotTileLine(player11.Center, player11.Center + player11.velocity * 6f, 40f, DelegateMethods.CastLightOpen);
31576 Utils.PlotTileLine(player11.Left, player11.Right, 40f, DelegateMethods.CastLightOpen);
31577 DelegateMethods.v3_1 = vector157 * 1.5f;
31578 Utils.PlotTileLine(base.Center, base.Center + velocity * 6f, 30f, DelegateMethods.CastLightOpen);
31579 Utils.PlotTileLine(base.Left, base.Right, 20f, DelegateMethods.CastLightOpen);
31580 }
31581 float num964 = 30f;
31582 float y7 = -20f;
31583 int num965 = player11.direction;
31584 if (type == 882 && player11.ownedProjectileCounts[650] > 0)
31585 {
31586 num965 *= -1;
31587 }
31588 if (type == 888)
31589 {
31590 num964 = 30f;
31591 y7 = -50f;
31592 if (player11.ownedProjectileCounts[650] > 0)
31593 {
31594 y7 = -70f;
31595 }
31596 }
31597 if (type == 895)
31598 {
31599 num964 = -36f;
31600 y7 = -50f;
31601 }
31602 if (type == 896)
31603 {
31604 num964 = 30f;
31605 y7 = -60f;
31606 if (player11.ownedProjectileCounts[888] > 0)
31607 {
31608 num964 = -30f;
31609 }
31610 }
31611 if (type == 898)
31612 {
31613 num964 = -30f;
31614 y7 = -50f;
31615 if (player11.ownedProjectileCounts[895] > 0)
31616 {
31617 num964 = 30f;
31618 }
31619 }
31620 if (type == 957)
31621 {
31622 num964 = -40f;
31623 y7 = -40f;
31624 if (player11.ownedProjectileCounts[895] > 0)
31625 {
31626 num964 = 40f;
31627 }
31628 }
31629 Vector2 vector158 = new Vector2((float)num965 * num964, y7);
31630 Vector2 vector159 = player11.MountedCenter + vector158;
31631 float num966 = Vector2.Distance(base.Center, vector159);
31632 if (num966 > 1000f)
31633 {
31634 base.Center = player11.Center + vector158;
31635 }
31636 Vector2 vector160 = vector159 - base.Center;
31637 float num967 = 4f;
31638 if (num966 < num967)
31639 {
31640 velocity *= 0.25f;
31641 }
31642 if (vector160 != Vector2.Zero)
31643 {
31644 if (vector160.Length() < num967)
31645 {
31646 velocity = vector160;
31647 }
31648 else
31649 {
31650 velocity = vector160 * 0.1f;
31651 }
31652 }
31653 if (num966 > 50f && (type == 895 || type == 898 || type == 957))
31654 {
31655 direction = (spriteDirection = 1);
31656 if (velocity.X < 0f)
31657 {
31658 direction = (spriteDirection = -1);
31659 }
31660 }
31661 if (velocity.Length() > 6f)
31662 {
31663 if (type == 650)
31664 {
31665 float num968 = velocity.ToRotation() + (float)Math.PI / 2f;
31666 if (Math.Abs(rotation - num968) >= (float)Math.PI)
31667 {
31668 if (num968 < rotation)
31669 {
31670 rotation -= (float)Math.PI * 2f;
31671 }
31672 else
31673 {
31674 rotation += (float)Math.PI * 2f;
31675 }
31676 }
31677 float num969 = 12f;
31678 rotation = (rotation * (num969 - 1f) + num968) / num969;
31679 if (++frameCounter >= 4)
31680 {
31681 frameCounter = 0;
31682 if (++frame >= Main.projFrames[type])
31683 {
31684 frame = 0;
31685 }
31686 }
31687 }
31688 else if (type == 882)
31689 {
31690 rotation = velocity.X * 0.125f;
31691 if (++frameCounter >= 3)
31692 {
31693 frameCounter = 0;
31694 if (frame < 6)
31695 {
31696 frame = 6;
31697 }
31698 else
31699 {
31700 frame++;
31701 if (frame > 15)
31702 {
31703 frame = 10;
31704 }
31705 }
31706 }
31707 }
31708 else if (type == 888)
31709 {
31710 float num970 = velocity.ToRotation() + (float)Math.PI / 2f;
31711 if (Math.Abs(rotation - num970) >= (float)Math.PI)
31712 {
31713 if (num970 < rotation)
31714 {
31715 rotation -= (float)Math.PI * 2f;
31716 }
31717 else
31718 {
31719 rotation += (float)Math.PI * 2f;
31720 }
31721 }
31722 float num971 = 12f;
31723 rotation = (rotation * (num971 - 1f) + num970) / num971;
31724 if (++frameCounter >= 3)
31725 {
31726 frameCounter = 0;
31727 if (frame < 6)
31728 {
31729 frame = 6;
31730 }
31731 else
31732 {
31733 frame++;
31734 if (frame > 17)
31735 {
31736 frame = 6;
31737 }
31738 }
31739 }
31740 }
31741 else if (type == 895)
31742 {
31743 float num972 = velocity.X * 0.1f;
31744 if (Math.Abs(rotation - num972) >= (float)Math.PI)
31745 {
31746 if (num972 < rotation)
31747 {
31748 rotation -= (float)Math.PI * 2f;
31749 }
31750 else
31751 {
31752 rotation += (float)Math.PI * 2f;
31753 }
31754 }
31755 float num973 = 12f;
31756 rotation = (rotation * (num973 - 1f) + num972) / num973;
31757 if (++frameCounter >= 3)
31758 {
31759 frameCounter = 0;
31760 frame++;
31761 if (frame >= Main.projFrames[type])
31762 {
31763 frame = 0;
31764 }
31765 }
31766 if (frameCounter == 0)
31767 {
31768 int num974 = Dust.NewDust(base.position, width, height, 242, 0f, 0f, 50, default(Color), 2f);
31769 Main.dust[num974].noGravity = true;
31770 }
31771 }
31772 else if (type == 896)
31773 {
31774 float num975 = velocity.ToRotation() + (float)Math.PI / 2f;
31775 if (Math.Abs(rotation - num975) >= (float)Math.PI)
31776 {
31777 if (num975 < rotation)
31778 {
31779 rotation -= (float)Math.PI * 2f;
31780 }
31781 else
31782 {
31783 rotation += (float)Math.PI * 2f;
31784 }
31785 }
31786 float num976 = 12f;
31787 rotation = (rotation * (num976 - 1f) + num975) / num976;
31788 if (++frameCounter >= 4)
31789 {
31790 frameCounter = 0;
31791 if (frame < 8)
31792 {
31793 frame = 8;
31794 }
31795 else
31796 {
31797 frame++;
31798 if (frame >= Main.projFrames[type])
31799 {
31800 frame = 8;
31801 }
31802 }
31803 }
31804 }
31805 else if (type == 898)
31806 {
31807 float num977 = velocity.X * 0.1f;
31808 if (Math.Abs(rotation - num977) >= (float)Math.PI)
31809 {
31810 if (num977 < rotation)
31811 {
31812 rotation -= (float)Math.PI * 2f;
31813 }
31814 else
31815 {
31816 rotation += (float)Math.PI * 2f;
31817 }
31818 }
31819 float num978 = 12f;
31820 rotation = (rotation * (num978 - 1f) + num977) / num978;
31821 if (++frameCounter >= 3)
31822 {
31823 frameCounter = 0;
31824 frame++;
31825 if (frame >= Main.projFrames[type])
31826 {
31827 frame = 0;
31828 }
31829 }
31830 if (frameCounter == 0)
31831 {
31832 int num979 = Dust.NewDust(base.position, width, height, 80, 0f, 0f, 50);
31833 Main.dust[num979].noGravity = true;
31834 }
31835 }
31836 else if (type == 957)
31837 {
31838 float num980 = velocity.X * 0.05f;
31839 if (Math.Abs(rotation - num980) >= (float)Math.PI)
31840 {
31841 if (num980 < rotation)
31842 {
31843 rotation -= (float)Math.PI * 2f;
31844 }
31845 else
31846 {
31847 rotation += (float)Math.PI * 2f;
31848 }
31849 }
31850 float num981 = 12f;
31851 rotation = (rotation * (num981 - 1f) + num980) / num981;
31852 if (++frameCounter >= 4)
31853 {
31854 frameCounter = 0;
31855 frame++;
31856 if (frame >= Main.projFrames[type] * 2)
31857 {
31858 frame = 0;
31859 }
31860 }
31861 }
31862 }
31863 else if (type == 650)
31864 {
31865 if (rotation > (float)Math.PI)
31866 {
31867 rotation -= (float)Math.PI * 2f;
31868 }
31869 if (rotation > -0.005f && rotation < 0.005f)
31870 {
31871 rotation = 0f;
31872 }
31873 else
31874 {
31875 rotation *= 0.96f;
31876 }
31877 if (++frameCounter >= 6)
31878 {
31879 frameCounter = 0;
31880 if (++frame >= Main.projFrames[type])
31881 {
31882 frame = 0;
31883 }
31884 }
31885 }
31886 else if (type == 882)
31887 {
31888 rotation = velocity.X * 0.125f;
31889 if (++frameCounter >= 5)
31890 {
31891 frameCounter = 0;
31892 frame++;
31893 if (frame == 6 || frame >= Main.projFrames[type])
31894 {
31895 frame = 0;
31896 }
31897 }
31898 }
31899 else if (type == 888)
31900 {
31901 if (rotation > (float)Math.PI)
31902 {
31903 rotation -= (float)Math.PI * 2f;
31904 }
31905 if (rotation > -0.005f && rotation < 0.005f)
31906 {
31907 rotation = 0f;
31908 }
31909 else
31910 {
31911 rotation *= 0.96f;
31912 }
31913 if (++frameCounter >= 5)
31914 {
31915 frameCounter = 0;
31916 frame++;
31917 if (frame == 6 || frame >= 18)
31918 {
31919 frame = 0;
31920 }
31921 }
31922 }
31923 else if (type == 895)
31924 {
31925 if (rotation > (float)Math.PI)
31926 {
31927 rotation -= (float)Math.PI * 2f;
31928 }
31929 if (rotation > -0.005f && rotation < 0.005f)
31930 {
31931 rotation = 0f;
31932 }
31933 else
31934 {
31935 rotation *= 0.96f;
31936 }
31937 if (++frameCounter >= 5)
31938 {
31939 frameCounter = 0;
31940 frame++;
31941 if (frame >= Main.projFrames[type])
31942 {
31943 frame = 0;
31944 }
31945 }
31946 }
31947 else if (type == 896)
31948 {
31949 if (rotation > (float)Math.PI)
31950 {
31951 rotation -= (float)Math.PI * 2f;
31952 }
31953 if (rotation > -0.005f && rotation < 0.005f)
31954 {
31955 rotation = 0f;
31956 }
31957 else
31958 {
31959 rotation *= 0.96f;
31960 }
31961 if (++frameCounter >= 5)
31962 {
31963 frameCounter = 0;
31964 frame++;
31965 if (frame == 8 || frame >= Main.projFrames[type])
31966 {
31967 frame = 0;
31968 if (Main.rand.Next(15) == 0)
31969 {
31970 frame = 8;
31971 }
31972 }
31973 }
31974 }
31975 else if (type == 898)
31976 {
31977 if (rotation > (float)Math.PI)
31978 {
31979 rotation -= (float)Math.PI * 2f;
31980 }
31981 if (rotation > -0.005f && rotation < 0.005f)
31982 {
31983 rotation = 0f;
31984 }
31985 else
31986 {
31987 rotation *= 0.96f;
31988 }
31989 if (++frameCounter >= 5)
31990 {
31991 frameCounter = 0;
31992 frame++;
31993 if (frame >= Main.projFrames[type])
31994 {
31995 frame = 0;
31996 }
31997 }
31998 }
31999 else if (type == 957)
32000 {
32001 int num982 = Main.projFrames[type];
32002 if (rotation > (float)Math.PI)
32003 {
32004 rotation -= (float)Math.PI * 2f;
32005 }
32006 if (rotation > -0.005f && rotation < 0.005f)
32007 {
32008 rotation = 0f;
32009 }
32010 else
32011 {
32012 rotation *= 0.96f;
32013 }
32014 if (velocity.Length() <= 0.01f)
32015 {
32016 bool flag65 = true;
32017 int num983 = (int)base.Center.X / 16;
32018 int num984 = (int)base.Center.Y / 16;
32019 int num985 = 4;
32020 for (int num986 = 0; num986 < num985 + 1; num986++)
32021 {
32023 {
32024 flag65 = false;
32025 break;
32026 }
32028 if ((num986 == num985 && !flag66) || (num986 < num985 && flag66))
32029 {
32030 flag65 = false;
32031 break;
32032 }
32033 num984++;
32034 }
32035 if (flag65)
32036 {
32037 localAI[0]--;
32038 if (localAI[0] <= 0f)
32039 {
32040 localAI[0] = 0f;
32041 if (frame < num982 * 2)
32042 {
32043 frame = num982 * 2;
32044 }
32045 int num987 = 3;
32046 if (frame <= 30 && frame <= 33)
32047 {
32048 num987 = 2;
32049 }
32050 if (++frameCounter >= num987)
32051 {
32052 frameCounter = 0;
32053 frame++;
32054 if (frame >= num982 * 3)
32055 {
32056 localAI[0] = 200 + Main.rand.Next(150);
32057 frame = 0;
32058 }
32059 if (frame == 32)
32060 {
32062 }
32063 }
32064 }
32065 else if (++frameCounter >= 4)
32066 {
32067 frameCounter = 0;
32068 frame++;
32069 if (frame >= num982 * 2)
32070 {
32071 frame = 0;
32072 }
32073 }
32074 }
32075 else
32076 {
32077 localAI[0] = 300f;
32078 if (++frameCounter >= 4)
32079 {
32080 frameCounter = 0;
32081 frame++;
32082 if (frame >= num982 * 2)
32083 {
32084 frame = 0;
32085 }
32086 }
32087 }
32088 }
32089 else
32090 {
32091 localAI[0] = 300f;
32092 if (++frameCounter >= 4)
32093 {
32094 frameCounter = 0;
32095 frame++;
32096 if (frame >= num982 * 2)
32097 {
32098 frame = 0;
32099 }
32100 }
32101 }
32102 }
32103 if (flag64 && this.ai[0] > 0f && (this.ai[0] += 1f) >= 60f)
32104 {
32105 this.ai[0] = 0f;
32106 this.ai[1] = 0f;
32107 }
32108 if (flag64 && Main.rand.Next(15) == 0)
32109 {
32110 int num988 = -1;
32111 int num989 = -1;
32112 float num990 = -1f;
32113 int num991 = 17;
32114 if ((base.Center - player11.Center).Length() < (float)Main.screenWidth)
32115 {
32116 int num992 = (int)base.Center.X / 16;
32117 int num993 = (int)base.Center.Y / 16;
32120 for (int num994 = num992 - num991; num994 <= num992 + num991; num994++)
32121 {
32122 for (int num995 = num993 - num991; num995 <= num993 + num991; num995++)
32123 {
32124 int num996 = Main.rand.Next(8);
32125 if (num996 < 4 && new Vector2(num992 - num994, num993 - num995).Length() < (float)num991 && Main.tile[num994, num995] != null && Main.tile[num994, num995].active() && Main.IsTileSpelunkable(Main.tile[num994, num995]))
32126 {
32127 float num997 = Distance(new Vector2(num994 * 16 + 8, num995 * 16 + 8));
32128 if (num997 < num990 || num990 == -1f)
32129 {
32130 num990 = num997;
32131 num988 = num994;
32132 num989 = num995;
32133 this.ai[0] = 1f;
32134 this.ai[1] = AngleTo(new Vector2(num994 * 16 + 8, num995 * 16 + 8));
32135 }
32136 if (num996 < 2)
32137 {
32138 int num998 = Dust.NewDust(new Vector2(num994 * 16, num995 * 16), 16, 16, 204, 0f, 0f, 150, default(Color), 0.3f);
32139 Main.dust[num998].fadeIn = 0.75f;
32141 dust2.velocity *= 0.1f;
32142 }
32143 }
32144 }
32145 }
32146 }
32147 }
32148 if (!flag64)
32149 {
32150 return;
32151 }
32152 float f3 = localAI[0] % ((float)Math.PI * 2f) - (float)Math.PI;
32153 float num999 = (float)Math.IEEERemainder(localAI[1], 1.0);
32154 if (num999 < 0f)
32155 {
32156 num999 += 1f;
32157 }
32158 float num1000 = (float)Math.Floor(localAI[1]);
32159 float max = 0.999f;
32160 float num1001 = 0f;
32161 int num1002 = 0;
32162 float amount2 = 0.1f;
32163 bool flag67 = player11.velocity.Length() > 3f;
32164 int num1003 = -1;
32165 int num1004 = -1;
32166 float num1005 = 300f;
32167 float num1006 = 500f;
32168 for (int num1007 = 0; num1007 < 200; num1007++)
32169 {
32171 if (!nPC16.active || !nPC16.chaseable || nPC16.dontTakeDamage || nPC16.immortal)
32172 {
32173 continue;
32174 }
32175 float num1008 = Distance(nPC16.Center);
32176 if (nPC16.friendly || nPC16.lifeMax <= 5)
32177 {
32178 if (num1008 < num1005 && !flag67)
32179 {
32180 num1005 = num1008;
32181 num1004 = num1007;
32182 }
32183 }
32184 else if (num1008 < num1006)
32185 {
32186 num1006 = num1008;
32187 num1003 = num1007;
32188 }
32189 }
32190 if (flag67)
32191 {
32192 num1001 = AngleTo(base.Center + player11.velocity);
32193 num1002 = 1;
32194 num999 = MathHelper.Clamp(num999 + 0.05f, 0f, max);
32195 num1000 += (float)Math.Sign(-10f - num1000);
32196 }
32197 else if (num1003 != -1)
32198 {
32199 num1001 = AngleTo(Main.npc[num1003].Center);
32200 num1002 = 2;
32201 num999 = MathHelper.Clamp(num999 + 0.05f, 0f, max);
32202 num1000 += (float)Math.Sign(-12f - num1000);
32203 }
32204 else if (num1004 != -1)
32205 {
32206 num1001 = AngleTo(Main.npc[num1004].Center);
32207 num1002 = 3;
32208 num999 = MathHelper.Clamp(num999 + 0.05f, 0f, max);
32209 num1000 += (float)Math.Sign(6f - num1000);
32210 }
32211 else if (this.ai[0] > 0f)
32212 {
32213 num1001 = this.ai[1];
32214 num999 = MathHelper.Clamp(num999 + (float)Math.Sign(0.75f - num999) * 0.05f, 0f, max);
32215 num1002 = 4;
32216 num1000 += (float)Math.Sign(10f - num1000);
32217 if (Main.rand.Next(10) == 0)
32218 {
32219 int num1009 = Dust.NewDust(base.Center + f3.ToRotationVector2() * 6f * num999 - Vector2.One * 4f, 8, 8, 204, 0f, 0f, 150, default(Color), 0.3f);
32220 Main.dust[num1009].fadeIn = 0.75f;
32222 dust2.velocity *= 0.1f;
32223 }
32224 }
32225 else
32226 {
32227 num1001 = ((player11.direction == 1) ? 0f : 3.1416028f);
32228 num999 = MathHelper.Clamp(num999 + (float)Math.Sign(0.75f - num999) * 0.05f, 0f, max);
32229 num1000 += (float)Math.Sign(0f - num1000);
32230 amount2 = 0.12f;
32231 }
32232 Vector2 value19 = num1001.ToRotationVector2();
32233 num1001 = Vector2.Lerp(f3.ToRotationVector2(), value19, amount2).ToRotation();
32234 localAI[0] = num1001 + (float)num1002 * ((float)Math.PI * 2f) + (float)Math.PI;
32235 localAI[1] = num1000 + num999;
32236 }
32237 else if (aiStyle == 125)
32238 {
32239 Player player12 = Main.player[owner];
32240 if (Main.myPlayer == owner)
32241 {
32242 if (localAI[1] > 0f)
32243 {
32244 localAI[1]--;
32245 }
32246 if (player12.noItems || player12.CCed || player12.dead)
32247 {
32248 Kill();
32249 }
32251 {
32252 Kill();
32253 player12.mouseInterface = true;
32254 Main.blockMouse = true;
32255 }
32256 else if (!player12.channel)
32257 {
32258 if (localAI[0] == 0f)
32259 {
32260 localAI[0] = 1f;
32261 }
32262 Kill();
32263 }
32264 else if (localAI[1] == 0f)
32265 {
32266 Vector2 vector161 = Main.screenPosition + new Vector2(Main.mouseX, Main.mouseY);
32267 if (player12.gravDir == -1f)
32268 {
32269 vector161.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y;
32270 }
32271 if (vector161 != base.Center)
32272 {
32273 netUpdate = true;
32274 base.Center = vector161;
32275 localAI[1] = 1f;
32276 }
32277 if (this.ai[0] == 0f && this.ai[1] == 0f)
32278 {
32279 this.ai[0] = (int)base.Center.X / 16;
32280 this.ai[1] = (int)base.Center.Y / 16;
32281 netUpdate = true;
32282 velocity = Vector2.Zero;
32283 }
32284 }
32285 velocity = Vector2.Zero;
32286 Point point4 = new Vector2(this.ai[0], this.ai[1]).ToPoint();
32287 Point point5 = base.Center.ToTileCoordinates();
32288 int num1010 = Math.Abs(point4.X - point5.X);
32289 int num1011 = Math.Abs(point4.Y - point5.Y);
32290 int num1012 = Math.Sign(point5.X - point4.X);
32291 int num1013 = Math.Sign(point5.Y - point4.Y);
32292 Point point6 = default(Point);
32293 bool flag68 = false;
32294 bool flag69 = player12.direction == 1;
32295 int num1014;
32296 int num1015;
32297 int num1016;
32298 if (flag69)
32299 {
32300 point6.X = point4.X;
32301 num1014 = point4.Y;
32302 num1015 = point5.Y;
32303 num1016 = num1013;
32304 }
32305 else
32306 {
32307 point6.Y = point4.Y;
32308 num1014 = point4.X;
32309 num1015 = point5.X;
32310 num1016 = num1012;
32311 }
32312 for (int num1017 = num1014; num1017 != num1015; num1017 += num1016)
32313 {
32314 if (flag68)
32315 {
32316 break;
32317 }
32318 if (flag69)
32319 {
32320 point6.Y = num1017;
32321 }
32322 else
32323 {
32324 point6.X = num1017;
32325 }
32326 if (WorldGen.InWorld(point6.X, point6.Y, 1))
32327 {
32328 Tile tile3 = Main.tile[point6.X, point6.Y];
32329 }
32330 }
32331 if (flag69)
32332 {
32333 point6.Y = point5.Y;
32334 num1014 = point4.X;
32335 num1015 = point5.X;
32336 num1016 = num1012;
32337 }
32338 else
32339 {
32340 point6.X = point5.X;
32341 num1014 = point4.Y;
32342 num1015 = point5.Y;
32343 num1016 = num1013;
32344 }
32345 for (int num1018 = num1014; num1018 != num1015; num1018 += num1016)
32346 {
32347 if (flag68)
32348 {
32349 break;
32350 }
32351 if (!flag69)
32352 {
32353 point6.Y = num1018;
32354 }
32355 else
32356 {
32357 point6.X = num1018;
32358 }
32359 if (WorldGen.InWorld(point6.X, point6.Y, 1))
32360 {
32361 Tile tile3 = Main.tile[point6.X, point6.Y];
32362 }
32363 }
32364 }
32365 int num1019 = Math.Sign(player12.velocity.X);
32366 if (num1019 != 0)
32367 {
32368 player12.ChangeDir(num1019);
32369 }
32370 player12.heldProj = whoAmI;
32371 player12.SetDummyItemTime(2);
32372 player12.itemRotation = 0f;
32373 }
32374 else if (aiStyle == 126)
32375 {
32376 int num1020 = Math.Sign(velocity.Y);
32377 int num1021 = ((num1020 != -1) ? 1 : 0);
32378 if (this.ai[0] == 0f)
32379 {
32380 if (!Collision.SolidCollision(base.position + new Vector2(0f, (num1020 == -1) ? (height - 48) : 0), width, 48) && !Collision.WetCollision(base.position + new Vector2(0f, (num1020 == -1) ? (height - 20) : 0), width, 20))
32381 {
32382 velocity = new Vector2(0f, (float)Math.Sign(velocity.Y) * 0.001f);
32383 this.ai[0] = 1f;
32384 this.ai[1] = 0f;
32385 timeLeft = 60;
32386 }
32387 this.ai[1]++;
32388 if (this.ai[1] >= 60f)
32389 {
32390 Kill();
32391 }
32392 for (int num1022 = 0; num1022 < 3; num1022++)
32393 {
32394 int num1023 = Dust.NewDust(base.position, width, height, 31, 0f, 0f, 100);
32395 Main.dust[num1023].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f;
32396 Main.dust[num1023].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f;
32397 Main.dust[num1023].noGravity = true;
32398 Main.dust[num1023].position = base.Center + new Vector2(0f, -height / 2).RotatedBy(rotation) * 1.1f;
32399 }
32400 }
32401 if (this.ai[0] != 1f)
32402 {
32403 return;
32404 }
32405 velocity = new Vector2(0f, (float)Math.Sign(velocity.Y) * 0.001f);
32406 if (num1020 != 0)
32407 {
32408 int num1024 = 16;
32409 int num1025 = 320;
32410 if (type == 670)
32411 {
32412 num1025 -= (int)Math.Abs(localAI[1]) * 64;
32413 }
32414 for (; num1024 < num1025 && !Collision.SolidCollision(base.position + new Vector2(0f, (num1020 == -1) ? (height - num1024 - 16) : 0), width, num1024 + 16); num1024 += 16)
32415 {
32416 }
32417 if (num1020 == -1)
32418 {
32419 base.position.Y += height;
32420 height = num1024;
32421 base.position.Y -= num1024;
32422 }
32423 else
32424 {
32425 height = num1024;
32426 }
32427 }
32428 this.ai[1]++;
32429 if (type == 670 && owner == Main.myPlayer && this.ai[1] == 12f && localAI[1] < 3f && localAI[1] > -3f)
32430 {
32431 if (localAI[1] == 0f)
32432 {
32433 int num1026 = NewProjectile(GetProjectileSource_FromThis(), base.Bottom + new Vector2(-50f, -10f), -Vector2.UnitY, type, damage, knockBack, owner);
32434 Main.projectile[num1026].localAI[1] = localAI[1] - 1f;
32435 num1026 = NewProjectile(GetProjectileSource_FromThis(), base.Bottom + new Vector2(50f, -10f), -Vector2.UnitY, type, damage, knockBack, owner);
32436 Main.projectile[num1026].localAI[1] = localAI[1] + 1f;
32437 }
32438 else
32439 {
32440 int num1027 = Math.Sign(localAI[1]);
32441 int num1028 = NewProjectile(GetProjectileSource_FromThis(), base.Bottom + new Vector2(50 * num1027, -10f), -Vector2.UnitY, type, damage, knockBack, owner);
32442 Main.projectile[num1028].localAI[1] = localAI[1] + (float)num1027;
32443 }
32444 }
32445 if (this.ai[1] >= 60f)
32446 {
32447 Kill();
32448 }
32449 if (localAI[0] == 0f)
32450 {
32451 localAI[0] = 1f;
32452 for (int num1029 = 0; (float)num1029 < 60f; num1029++)
32453 {
32454 int num1030 = Utils.SelectRandom<int>(Main.rand, 6, 259, 158);
32455 int num1031 = Dust.NewDust(base.position, width, height, num1030, 0f, -2.5f * (float)(-num1020));
32456 Main.dust[num1031].alpha = 200;
32458 dust2.velocity *= new Vector2(0.3f, 2f);
32459 Main.dust[num1031].velocity.Y += 2 * num1020;
32461 dust2.scale += Main.rand.NextFloat();
32462 Main.dust[num1031].position = new Vector2(base.Center.X, base.Center.Y + (float)height * 0.5f * (float)(-num1020));
32463 Main.dust[num1031].customData = num1021;
32464 if (num1020 == -1 && Main.rand.Next(4) != 0)
32465 {
32466 Main.dust[num1031].velocity.Y -= 0.2f;
32467 }
32468 }
32470 }
32471 if (num1020 == 1)
32472 {
32473 for (int num1032 = 0; (float)num1032 < 9f; num1032++)
32474 {
32475 int num1033 = Utils.SelectRandom<int>(Main.rand, 6, 259, 158);
32476 int num1034 = Dust.NewDust(base.position, width, height, num1033, 0f, -2.5f * (float)(-num1020));
32477 Main.dust[num1034].alpha = 200;
32479 dust2.velocity *= new Vector2(0.3f, 2f);
32480 Main.dust[num1034].velocity.Y += 2 * num1020;
32482 dust2.scale += Main.rand.NextFloat();
32483 Main.dust[num1034].position = new Vector2(base.Center.X, base.Center.Y + (float)height * 0.5f * (float)(-num1020));
32484 Main.dust[num1034].customData = num1021;
32485 if (num1020 == -1 && Main.rand.Next(4) != 0)
32486 {
32487 Main.dust[num1034].velocity.Y -= 0.2f;
32488 }
32489 }
32490 }
32491 int num1035 = (int)(this.ai[1] / 60f * (float)height) * 3;
32492 if (num1035 > height)
32493 {
32494 num1035 = height;
32495 }
32496 Vector2 vector162 = base.position + ((num1020 == -1) ? new Vector2(0f, height - num1035) : Vector2.Zero);
32497 Vector2 vector163 = base.position + ((num1020 == -1) ? new Vector2(0f, height) : Vector2.Zero);
32498 for (int num1036 = 0; (float)num1036 < 6f; num1036++)
32499 {
32500 if (Main.rand.Next(3) < 2)
32501 {
32502 int num1037 = Dust.NewDust(vector162, width, num1035, 6, 0f, 0f, 90, default(Color), 2.5f);
32503 Main.dust[num1037].noGravity = true;
32504 Main.dust[num1037].fadeIn = 1f;
32505 if (Main.dust[num1037].velocity.Y > 0f)
32506 {
32507 Main.dust[num1037].velocity.Y *= -1f;
32508 }
32509 if (Main.rand.Next(6) < 3)
32510 {
32511 Main.dust[num1037].position.Y = MathHelper.Lerp(Main.dust[num1037].position.Y, vector163.Y, 0.5f);
32513 dust2.velocity *= 5f;
32514 Main.dust[num1037].velocity.Y -= 3f;
32515 Main.dust[num1037].position.X = base.Center.X;
32516 Main.dust[num1037].noGravity = false;
32517 Main.dust[num1037].noLight = true;
32518 Main.dust[num1037].fadeIn = 0.4f;
32520 dust2.scale *= 0.3f;
32521 }
32522 else
32523 {
32524 Main.dust[num1037].velocity = DirectionFrom(Main.dust[num1037].position) * Main.dust[num1037].velocity.Length() * 0.25f;
32525 }
32526 Main.dust[num1037].velocity.Y *= -num1020;
32527 Main.dust[num1037].customData = num1021;
32528 }
32529 }
32530 for (int num1038 = 0; (float)num1038 < 6f; num1038++)
32531 {
32532 if (!(Main.rand.NextFloat() < 0.5f))
32533 {
32534 int num1039 = Utils.SelectRandom<int>(Main.rand, 6, 259, 158);
32535 int num1040 = Dust.NewDust(vector162, width, num1035, num1039, 0f, -2.5f * (float)(-num1020));
32536 Main.dust[num1040].alpha = 200;
32538 dust2.velocity *= new Vector2(0.6f, 1.5f);
32540 dust2.scale += Main.rand.NextFloat();
32541 if (num1020 == -1 && Main.rand.Next(4) != 0)
32542 {
32543 Main.dust[num1040].velocity.Y -= 0.2f;
32544 }
32545 Main.dust[num1040].customData = num1021;
32546 }
32547 }
32548 }
32549 else if (aiStyle == 127)
32550 {
32551 float num1041 = 900f;
32552 if (type == 657)
32553 {
32554 num1041 = 300f;
32555 }
32556 if (soundDelay == 0)
32557 {
32558 soundDelay = -1;
32560 }
32561 this.ai[0]++;
32562 if (this.ai[0] >= num1041)
32563 {
32564 Kill();
32565 }
32566 if (type == 656 && localAI[0] >= 30f)
32567 {
32568 damage = 0;
32569 if (this.ai[0] < num1041 - 120f)
32570 {
32571 float num1042 = this.ai[0] % 60f;
32572 this.ai[0] = num1041 - 120f + num1042;
32573 netUpdate = true;
32574 }
32575 }
32576 float num1043 = 15f;
32577 float num1044 = 15f;
32578 Point point7 = base.Center.ToTileCoordinates();
32580 topY++;
32581 bottomY--;
32582 Vector2 value20 = new Vector2(point7.X, topY) * 16f + new Vector2(8f);
32583 Vector2 value21 = new Vector2(point7.X, bottomY) * 16f + new Vector2(8f);
32585 Vector2 vector165 = new Vector2(0f, value21.Y - value20.Y);
32586 vector165.X = vector165.Y * 0.2f;
32587 width = (int)(vector165.X * 0.65f);
32588 height = (int)vector165.Y;
32589 base.Center = vector164;
32590 if (type == 656 && owner == Main.myPlayer)
32591 {
32592 bool flag70 = false;
32593 Vector2 center20 = Main.player[owner].Center;
32594 Vector2 top = Main.player[owner].Top;
32595 for (float num1045 = 0f; num1045 < 1f; num1045 += 0.05f)
32596 {
32597 Vector2 position = Vector2.Lerp(value20, value21, num1045);
32598 if (Collision.CanHitLine(position, 0, 0, center20, 0, 0) || Collision.CanHitLine(position, 0, 0, top, 0, 0))
32599 {
32600 flag70 = true;
32601 break;
32602 }
32603 }
32604 if (!flag70 && this.ai[0] < num1041 - 120f)
32605 {
32606 float num1046 = this.ai[0] % 60f;
32607 this.ai[0] = num1041 - 120f + num1046;
32608 netUpdate = true;
32609 }
32610 }
32611 if (!(this.ai[0] < num1041 - 120f))
32612 {
32613 return;
32614 }
32615 for (int num1047 = 0; num1047 < 1; num1047++)
32616 {
32617 float value22 = -0.5f;
32618 float value23 = 0.9f;
32619 float amount3 = Main.rand.NextFloat();
32621 vector166.X *= MathHelper.Lerp(2.2f, 0.6f, amount3);
32622 vector166.X *= -1f;
32623 Vector2 vector167 = new Vector2(6f, 10f);
32625 Dust dust57 = Main.dust[Dust.NewDust(vector168, 0, 0, 269)];
32626 dust57.position = vector168;
32627 dust57.customData = vector164 + vector167;
32628 dust57.fadeIn = 1f;
32629 dust57.scale = 0.3f;
32630 if (vector166.X > -1.2f)
32631 {
32632 dust57.velocity.X = 1f + Main.rand.NextFloat();
32633 }
32634 dust57.velocity.Y = Main.rand.NextFloat() * -0.5f - 1f;
32635 }
32636 }
32637 else if (aiStyle == 128)
32638 {
32639 Color newColor4 = new Color(255, 255, 255);
32640 if (soundDelay == 0)
32641 {
32642 soundDelay = -1;
32644 }
32645 if (localAI[1] < 30f)
32646 {
32647 for (int num1048 = 0; num1048 < 1; num1048++)
32648 {
32649 float value24 = -0.5f;
32650 float value25 = 0.9f;
32651 float amount4 = Main.rand.NextFloat();
32653 vector169.X *= MathHelper.Lerp(2.2f, 0.6f, amount4);
32654 vector169.X *= -1f;
32655 Vector2 vector170 = new Vector2(2f, 10f);
32656 Vector2 vector171 = base.Center + new Vector2(60f, 200f) * vector169 * 0.5f + vector170;
32657 Dust dust58 = Main.dust[Dust.NewDust(vector171, 0, 0, 269)];
32658 dust58.position = vector171;
32659 dust58.customData = base.Center + vector170;
32660 dust58.fadeIn = 1f;
32661 dust58.scale = 0.3f;
32662 if (vector169.X > -1.2f)
32663 {
32664 dust58.velocity.X = 1f + Main.rand.NextFloat();
32665 }
32666 dust58.velocity.Y = Main.rand.NextFloat() * -0.5f - 1f;
32667 }
32668 }
32669 if (localAI[0] == 0f)
32670 {
32671 localAI[0] = 0.8f;
32672 direction = 1;
32673 Point point8 = base.Center.ToTileCoordinates();
32674 base.Center = new Vector2(point8.X * 16 + 8, point8.Y * 16 + 8);
32675 }
32676 rotation = localAI[1] / 40f * ((float)Math.PI * 2f) * (float)direction;
32677 if (localAI[1] < 33f)
32678 {
32679 if (alpha > 0)
32680 {
32681 alpha -= 8;
32682 }
32683 if (alpha < 0)
32684 {
32685 alpha = 0;
32686 }
32687 }
32688 if (localAI[1] > 103f)
32689 {
32690 if (alpha < 255)
32691 {
32692 alpha += 16;
32693 }
32694 if (alpha > 255)
32695 {
32696 alpha = 255;
32697 }
32698 }
32699 if (alpha == 0)
32700 {
32701 Lighting.AddLight(base.Center, newColor4.ToVector3() * 0.5f);
32702 }
32703 for (int num1049 = 0; num1049 < 2; num1049++)
32704 {
32705 if (Main.rand.Next(10) == 0)
32706 {
32707 Vector2 vector172 = Vector2.UnitY.RotatedBy((float)num1049 * (float)Math.PI).RotatedBy(rotation);
32708 Dust dust59 = Main.dust[Dust.NewDust(base.Center, 0, 0, 267, 0f, 0f, 225, newColor4, 1.5f)];
32709 dust59.noGravity = true;
32710 dust59.noLight = true;
32711 dust59.scale = Opacity * localAI[0];
32712 dust59.position = base.Center;
32713 dust59.velocity = vector172 * 2.5f;
32714 }
32715 }
32716 for (int num1050 = 0; num1050 < 2; num1050++)
32717 {
32718 if (Main.rand.Next(10) == 0)
32719 {
32720 Vector2 vector173 = Vector2.UnitY.RotatedBy((float)num1050 * (float)Math.PI);
32721 Dust dust60 = Main.dust[Dust.NewDust(base.Center, 0, 0, 267, 0f, 0f, 225, newColor4, 1.5f)];
32722 dust60.noGravity = true;
32723 dust60.noLight = true;
32724 dust60.scale = Opacity * localAI[0];
32725 dust60.position = base.Center;
32726 dust60.velocity = vector173 * 2.5f;
32727 }
32728 }
32729 if (localAI[1] < 33f || localAI[1] > 87f)
32730 {
32731 scale = Opacity / 2f * localAI[0];
32732 }
32733 velocity = Vector2.Zero;
32734 localAI[1]++;
32735 if (localAI[1] == 60f && owner == Main.myPlayer)
32736 {
32737 int num1051 = 30;
32738 if (Main.expertMode)
32739 {
32740 num1051 = 22;
32741 }
32742 NewProjectile(GetProjectileSource_FromThis(), base.Center, Vector2.Zero, 657, num1051, 3f, owner);
32743 }
32744 if (localAI[1] >= 120f)
32745 {
32746 Kill();
32747 }
32748 }
32749 else if (aiStyle == 129)
32750 {
32751 float num1052 = 10f;
32752 float num1053 = 5f;
32753 float num1054 = 40f;
32754 int num1055 = 300;
32755 int num1056 = 180;
32756 if (type == 659)
32757 {
32758 num1055 = 420;
32759 num1056 = 240;
32760 num1052 = 3f;
32761 num1053 = 7.5f;
32762 num1054 = 1f;
32763 if (localAI[0] > 0f)
32764 {
32765 localAI[0]--;
32766 }
32767 if (localAI[0] == 0f && this.ai[0] < 0f && owner == Main.myPlayer)
32768 {
32769 localAI[0] = 5f;
32770 for (int num1057 = 0; num1057 < 200; num1057++)
32771 {
32773 if (nPC17.CanBeChasedBy(this))
32774 {
32775 bool flag71 = this.ai[0] < 0f || Main.npc[(int)this.ai[0]].Distance(base.Center) > nPC17.Distance(base.Center);
32776 if ((flag71 & (nPC17.Distance(base.Center) < 400f)) && (Collision.CanHitLine(base.Center, 0, 0, nPC17.Center, 0, 0) || Collision.CanHitLine(base.Center, 0, 0, nPC17.Top, 0, 0)))
32777 {
32778 this.ai[0] = num1057;
32779 }
32780 }
32781 }
32782 if (this.ai[0] >= 0f)
32783 {
32784 timeLeft = num1055;
32785 netUpdate = true;
32786 }
32787 }
32788 if (timeLeft > 30 && alpha > 0)
32789 {
32790 alpha -= 12;
32791 }
32792 if (timeLeft > 30 && alpha < 128 && Collision.SolidCollision(base.position, width, height))
32793 {
32794 alpha = 128;
32795 }
32796 if (alpha < 0)
32797 {
32798 alpha = 0;
32799 }
32800 if (++frameCounter > 4)
32801 {
32802 frameCounter = 0;
32803 if (++frame >= 4)
32804 {
32805 frame = 0;
32806 }
32807 }
32808 float num1058 = 0.5f;
32809 if (timeLeft < 120)
32810 {
32811 num1058 = 1.1f;
32812 }
32813 if (timeLeft < 60)
32814 {
32815 num1058 = 1.6f;
32816 }
32817 this.ai[1]++;
32818 float num1059 = this.ai[1] / 180f * ((float)Math.PI * 2f);
32819 for (float num1060 = 0f; num1060 < 3f; num1060++)
32820 {
32821 if (Main.rand.Next(3) == 0)
32822 {
32823 Dust dust61 = Main.dust[Dust.NewDust(base.Center, 0, 0, 27, 0f, -2f)];
32824 dust61.position = base.Center + Vector2.UnitY.RotatedBy(num1060 * ((float)Math.PI * 2f) / 3f + this.ai[1]) * 10f;
32825 dust61.noGravity = true;
32826 dust61.velocity = DirectionFrom(dust61.position);
32827 dust61.scale = num1058;
32828 dust61.fadeIn = 0.5f;
32829 dust61.alpha = 200;
32830 }
32831 }
32832 }
32833 if (timeLeft > 2 && Collision.SolidCollision(base.position, width, height))
32834 {
32835 timeLeft = 2;
32836 }
32837 int num1061 = (int)this.ai[0];
32838 if (num1061 >= 0 && Main.npc[num1061].active)
32839 {
32840 if (Distance(Main.npc[num1061].Center) > num1054)
32841 {
32842 Vector2 vector174 = DirectionTo(Main.npc[num1061].Center);
32843 if (vector174.HasNaNs())
32844 {
32846 }
32847 velocity = (velocity * (num1052 - 1f) + vector174 * num1053) / num1052;
32848 }
32849 return;
32850 }
32851 if (this.ai[0] == -1f && timeLeft > 5)
32852 {
32853 timeLeft = 5;
32854 }
32855 if (this.ai[0] == -2f && timeLeft > num1056)
32856 {
32857 timeLeft = num1056;
32858 }
32859 if (this.ai[0] >= 0f)
32860 {
32861 this.ai[0] = -1f;
32862 netUpdate = true;
32863 }
32864 }
32865 else if (aiStyle == 130)
32866 {
32867 AI_130_FlameBurstTower();
32868 }
32869 else if (aiStyle == 131)
32870 {
32871 AI_131_FlameBurstShot();
32872 }
32873 else if (aiStyle == 132)
32874 {
32875 if (localAI[1] == 0f)
32876 {
32877 if (localAI[0] == 0f)
32878 {
32880 }
32881 if (localAI[0] == 105f)
32882 {
32883 for (int num1062 = 0; num1062 < 20; num1062++)
32884 {
32885 float num1063 = (float)num1062 / 20f;
32886 Vector2 vector175 = new Vector2(Main.rand.NextFloat() * 10f, 0f).RotatedBy(num1063 * -(float)Math.PI + Main.rand.NextFloat() * 0.1f - 0.05f);
32887 Gore gore2 = Gore.NewGoreDirect(base.Center + vector175 * 3f, vector175, Utils.SelectRandom<int>(Main.rand, 1027, 1028, 1029, 1030));
32888 if (gore2.velocity.Y > 0f)
32889 {
32890 Gore gore = gore2;
32891 gore.velocity *= -0.5f;
32892 }
32893 if (gore2.velocity.Y < -5f)
32894 {
32895 gore2.velocity.Y *= 0.8f;
32896 }
32897 gore2.velocity.Y *= 1.1f;
32898 gore2.velocity.X *= 0.88f;
32899 }
32900 }
32901 if (!Main.dedServ)
32902 {
32903 if (!Filters.Scene["CrystalDestructionVortex"].IsActive())
32904 {
32905 Filters.Scene.Activate("CrystalDestructionVortex", default(Vector2));
32906 }
32907 if (!Filters.Scene["CrystalDestructionColor"].IsActive())
32908 {
32909 Filters.Scene.Activate("CrystalDestructionColor", default(Vector2));
32910 }
32911 float num1064 = Math.Min(1f, localAI[0] / 120f);
32912 Filters.Scene["CrystalDestructionColor"].GetShader().UseIntensity(num1064);
32913 Filters.Scene["CrystalDestructionVortex"].GetShader().UseIntensity(num1064 * 2f).UseProgress(0f)
32914 .UseTargetPosition(base.Center);
32915 }
32916 if (localAI[0] == 120f)
32917 {
32918 localAI[0] = 0f;
32919 localAI[1]++;
32920 }
32921 }
32922 else if (localAI[1] == 1f)
32923 {
32924 if (!Main.dedServ)
32925 {
32926 float num1065 = localAI[0] / 300f;
32927 float num1066 = Math.Min(1f, localAI[0] / 150f);
32928 velocity.Y = num1066 * -0.25f;
32929 if (!Filters.Scene["CrystalDestructionVortex"].IsActive())
32930 {
32931 Filters.Scene.Activate("CrystalDestructionVortex", default(Vector2));
32932 }
32933 if (!Filters.Scene["CrystalDestructionColor"].IsActive())
32934 {
32935 Filters.Scene.Activate("CrystalDestructionColor", default(Vector2));
32936 }
32937 num1066 = 1f;
32938 Filters.Scene["CrystalDestructionColor"].GetShader().UseIntensity(num1066);
32939 Filters.Scene["CrystalDestructionVortex"].GetShader().UseIntensity(num1066 * 2f).UseProgress(0f)
32940 .UseTargetPosition(base.Center);
32941 }
32942 if (localAI[0] == 300f)
32943 {
32944 localAI[0] = 0f;
32945 localAI[1]++;
32946 }
32947 }
32948 else if (localAI[1] == 2f)
32949 {
32950 float num1067 = localAI[0] / 300f;
32951 if (Main.netMode != 2)
32952 {
32953 Filters.Scene["CrystalDestructionVortex"].GetShader().UseIntensity(2f).UseProgress(num1067 * 30f);
32954 }
32955 velocity.Y -= 1f;
32956 if (localAI[0] == 60f)
32957 {
32958 localAI[0] = 0f;
32959 localAI[1]++;
32960 }
32961 }
32962 else if (localAI[1] == 3f)
32963 {
32964 if (!Main.dedServ)
32965 {
32966 Filters.Scene.Deactivate("CrystalDestructionVortex");
32967 Filters.Scene.Deactivate("CrystalDestructionColor");
32968 }
32969 Kill();
32970 }
32971 if (localAI[1] >= 1f)
32972 {
32973 for (int num1068 = 0; num1068 < 1 + (int)(0f - velocity.Y); num1068++)
32974 {
32975 if (Main.rand.Next(2) == 0)
32976 {
32977 float num1069 = Main.rand.NextFloat() * (0f - velocity.Y);
32978 Vector2 vector176 = new Vector2(Main.rand.NextFloat() * 0.1f - 0.05f, 0f);
32979 vector176.X += (float)Math.Sin((double)((base.position.Y + num1069) * 0.01f) + 6.2831854820251465 * ((double)Main.rand.Next(3) / 3.0)) * 0.5f;
32980 vector176.X = MathHelper.Lerp(Main.rand.NextFloat() - 0.5f, vector176.X, MathHelper.Clamp(0f - velocity.Y, 0f, 1f));
32981 vector176.Y = 0.5f - Math.Abs(vector176.X);
32982 vector176 *= new Vector2(100f, 50f);
32983 vector176.Y += num1069;
32984 Vector2 vector177 = base.Center + vector176;
32985 Dust dust62 = Dust.NewDustPerfect(vector177, 27, Vector2.Zero, 0, Color.White * 0.1f, 1.1f);
32986 dust62.velocity.Y = Main.rand.NextFloat() * 2f;
32987 dust62.fadeIn = 0.1f;
32988 }
32989 }
32990 }
32991 localAI[0]++;
32992 }
32993 else if (aiStyle == 133)
32994 {
32995 if (type == 673)
32996 {
32997 if (this.ai[0] == 70f)
32998 {
33000 }
33001 this.ai[0]++;
33002 float opacity = 0f;
33003 if (this.ai[0] < 20f)
33004 {
33005 opacity = Utils.GetLerpValue(0f, 20f, this.ai[0], clamped: true);
33006 }
33007 else if (this.ai[0] < 60f)
33008 {
33009 opacity = 1f;
33010 }
33011 else if (this.ai[0] < 80f)
33012 {
33013 opacity = Utils.GetLerpValue(80f, 60f, this.ai[0], clamped: true);
33014 }
33015 else
33016 {
33017 Kill();
33018 }
33019 Opacity = opacity;
33020 _ = owner;
33021 _ = Main.myPlayer;
33022 }
33023 if (type != 674)
33024 {
33025 return;
33026 }
33027 if (this.ai[0] == 0f)
33028 {
33030 }
33031 this.ai[0]++;
33032 if (!(this.ai[0] >= 40f))
33033 {
33034 return;
33035 }
33036 for (int num1070 = 0; num1070 < 200; num1070++)
33037 {
33039 if (nPC18.active && nPC18.damage >= 1 && nPC18.lifeMax >= 30 && !(Distance(nPC18.Center) > 1000f) && nPC18.type != 564 && nPC18.type != 565)
33040 {
33041 int num1071 = 500;
33042 int num1072 = nPC18.lifeMax - nPC18.life;
33043 if (num1071 > num1072)
33044 {
33045 num1071 = num1072;
33046 }
33047 if (num1071 > 0)
33048 {
33049 NPC nPC13 = nPC18;
33050 nPC13.life += num1071;
33051 nPC18.HealEffect(num1071);
33052 nPC18.netUpdate = true;
33053 }
33054 }
33055 }
33056 Kill();
33057 }
33058 else if (aiStyle == 134)
33059 {
33060 AI_134_Ballista();
33061 }
33062 else if (aiStyle == 135)
33063 {
33064 AI_135_OgreStomp();
33065 }
33066 else if (aiStyle == 136)
33067 {
33068 AI_136_BetsyBreath();
33069 }
33070 else if (aiStyle == 137)
33071 {
33072 AI_137_LightningAura();
33073 }
33074 else if (aiStyle == 138)
33075 {
33076 AI_138_ExplosiveTrap();
33077 }
33078 else if (aiStyle == 139)
33079 {
33080 AI_139_ExplosiveTrapExplosion();
33081 }
33082 else if (aiStyle == 140)
33083 {
33084 AI_140_MonkStaffT1();
33085 }
33086 else if (aiStyle == 141)
33087 {
33088 AI_141_MonkStaffT1Explosion();
33089 }
33090 else if (aiStyle == 142)
33091 {
33092 AI_142_MonkStaffT2And3();
33093 }
33094 else if (aiStyle == 143)
33095 {
33096 AI_143_MonkStaffT2Ghast();
33097 }
33098 else if (aiStyle == 144)
33099 {
33100 AI_144_DD2Pet();
33101 }
33102 else if (aiStyle == 145)
33103 {
33104 AI_145_BookStaffStorm();
33105 }
33106 else if (aiStyle == 146)
33107 {
33108 AI_146_DD2Victory();
33109 }
33110 else if (aiStyle == 147)
33111 {
33112 AI_147_Celeb2Rocket();
33113 }
33114 else if (aiStyle == 148)
33115 {
33116 AI_148_StarSpawner();
33117 }
33118 else if (aiStyle == 149)
33119 {
33120 AI_149_GolfBall();
33121 }
33122 else if (aiStyle == 150)
33123 {
33124 AI_150_GolfClubHelper();
33125 }
33126 else if (aiStyle == 151)
33127 {
33128 AI_151_SuperStar();
33129 }
33130 else if (aiStyle == 152)
33131 {
33132 AI_152_SuperStarSlash();
33133 }
33134 else if (aiStyle == 153)
33135 {
33136 AI_153_ToiletPop();
33137 }
33138 else if (aiStyle == 154)
33139 {
33140 AI_154_VoidLens();
33141 }
33142 else if (aiStyle == 155)
33143 {
33144 AI_155_MysticSnakeCoil();
33145 }
33146 else if (aiStyle == 156)
33147 {
33148 AI_156_BatOfLight();
33149 }
33150 else if (aiStyle == 157)
33151 {
33152 AI_157_SharpTears();
33153 }
33154 else if (aiStyle == 158)
33155 {
33156 AI_158_BabyBird();
33157 }
33158 else if (aiStyle == 159)
33159 {
33160 AI_159_PaperAirplanes();
33161 }
33162 else if (aiStyle == 160)
33163 {
33164 AI_160_Kites();
33165 }
33166 else if (aiStyle == 161)
33167 {
33168 AI_161_RapierStabs();
33169 }
33170 else if (aiStyle == 162)
33171 {
33172 AI_162_TigerPounce();
33173 }
33174 else if (aiStyle == 163)
33175 {
33176 AI_163_Chum();
33177 }
33178 else if (aiStyle == 164)
33179 {
33180 AI_164_StormTigerGem();
33181 }
33182 else if (aiStyle == 165)
33183 {
33184 AI_165_Whip();
33185 }
33186 else if (aiStyle == 166)
33187 {
33188 AI_166_Dove();
33189 }
33190 else if (aiStyle == 167)
33191 {
33192 AI_167_SparkleGuitar();
33193 }
33194 else if (aiStyle == 168)
33195 {
33196 AI_168_FirstFractal();
33197 }
33198 else if (aiStyle == 169)
33199 {
33200 AI_169_Smolstars();
33201 }
33202 else if (aiStyle == 170)
33203 {
33204 AI_170_FairyGlowstick();
33205 }
33206 else if (aiStyle == 171)
33207 {
33208 AI_171_HallowBossRainbowStreak();
33209 }
33210 else if (aiStyle == 172)
33211 {
33212 AI_172_HallowBossRainbowPelletStorm();
33213 }
33214 else if (aiStyle == 173)
33215 {
33216 AI_173_HallowBossRainbowTrail();
33217 }
33218 else if (aiStyle == 174)
33219 {
33220 AI_174_MultisegmentPet();
33221 }
33222 else if (aiStyle == 175)
33223 {
33224 AI_175_TitaniumStormShards();
33225 }
33226 else if (aiStyle == 176)
33227 {
33228 AI_176_EdgyLightning();
33229 }
33230 else if (aiStyle == 177)
33231 {
33232 AI_177_IceWhipSlicer();
33233 }
33234 else if (aiStyle == 178)
33235 {
33236 AI_178_FireExplosion();
33237 }
33238 else if (aiStyle == 179)
33239 {
33240 AI_179_FairyQueenLance();
33241 }
33242 else if (aiStyle == 180)
33243 {
33244 AI_180_FairyQueenSunDance();
33245 }
33246 else if (aiStyle == 181)
33247 {
33248 AI_181_FairyQueenRangedItemShot();
33249 }
33250 else if (aiStyle == 182)
33251 {
33252 AI_182_FinalFractal();
33253 }
33254 else if (aiStyle == 183)
33255 {
33256 AI_183_ZoologistStrike();
33257 }
33258 else if (aiStyle == 184)
33259 {
33260 AI_184_BadTorchLuck();
33261 }
33262 else if (aiStyle == 185)
33263 {
33264 AI_185_LifeDrain();
33265 }
33266 else if (aiStyle == 186)
33267 {
33268 AI_186_PrincessWeapon();
33269 }
33270 else if (aiStyle == 187)
33271 {
33272 AI_187_ShadowHand();
33273 }
33274 else if (aiStyle == 188)
33275 {
33276 AI_188_LightsBane();
33277 }
33278 else if (aiStyle == 189)
33279 {
33280 AI_189_Volcano();
33281 }
33282 else if (aiStyle == 190)
33283 {
33284 AI_190_NightsEdge();
33285 }
33286 else if (aiStyle == 191)
33287 {
33288 AI_191_TrueNightsEdge();
33289 }
33290 else if (aiStyle == 192)
33291 {
33292 AI_192_JuminoAnimation();
33293 }
33294 else if (aiStyle == 193)
33295 {
33296 AI_193_Flamethrower();
33297 }
33298 else if (aiStyle == 194)
33299 {
33300 AI_194_HorsemanPumpkin();
33301 }
33302 else if (aiStyle == 195)
33303 {
33304 AI_195_JimsDrone();
33305 }
33306 }
33307
33308 private void AI_195_JimsDrone()
33309 {
33310 //IL_0240: Unknown result type (might be due to invalid IL or missing references)
33311 //IL_027c: Unknown result type (might be due to invalid IL or missing references)
33312 //IL_0281: Unknown result type (might be due to invalid IL or missing references)
33313 //IL_0293: Unknown result type (might be due to invalid IL or missing references)
33314 Player player = Main.player[owner];
33315 bool flag = false;
33316 if (player.dead)
33317 {
33318 flag = true;
33319 }
33320 if (owner == Main.myPlayer)
33321 {
33322 if (position.Y - (float)height <= (float)(16 * Main.offScreenRange / 2))
33323 {
33324 Kill();
33325 return;
33326 }
33327 if (player.HeldItem.type != 5451)
33328 {
33329 flag = true;
33330 }
33331 bool flag2 = player.gravDir == -1f;
33332 BitsByte bitsByte = (byte)0;
33334 bitsByte[0] = localInputCache.controlLeft ^ flag2;
33335 bitsByte[1] = localInputCache.controlRight ^ flag2;
33336 bitsByte[2] = localInputCache.controlUp;
33337 bitsByte[3] = localInputCache.controlDown;
33338 float num = (int)(byte)bitsByte;
33339 if (ai[0] != num)
33340 {
33341 ai[0] = num;
33342 netUpdate = true;
33343 }
33344 Main.DroneCameraTracker.Track(this);
33345 }
33346 if (flag)
33347 {
33348 Kill();
33349 return;
33350 }
33351 BitsByte bitsByte2 = (byte)ai[0];
33352 rotation = ai[1];
33353 bool flag3 = bitsByte2[0];
33354 bool flag4 = bitsByte2[1];
33355 bool flag5 = bitsByte2[2];
33356 _ = bitsByte2[3];
33357 localAI[0] += 1f;
33358 if (!flag3 && !flag4)
33359 {
33360 localAI[0] = 0f;
33361 }
33362 bool flag6 = velocity.Y == 0f;
33363 int num2 = 0;
33364 if (!flag6)
33365 {
33366 num2 = 10;
33367 }
33368 if (flag5)
33369 {
33370 num2 = 100;
33371 }
33372 localAI[1] = MathHelper.Lerp(localAI[1], num2, 0.2f);
33373 float num3 = Utils.Remap(localAI[0], 0f, 5f, 0f, 1f) * Utils.Remap(localAI[0], 5f, 15f, 1f, 0f);
33374 float num4 = Utils.Clamp(MathHelper.Max(Utils.Remap(localAI[1], 0f, 100f, 0f, 25f), num3 * 12f), 0f, 100f);
33376 if (activeSound == null && num4 != 0f)
33377 {
33378 float[] array = localAI;
33380 array[2] = ((SlotId)(ref val)).ToFloat();
33382 }
33383 if (activeSound != null)
33384 {
33385 activeSound.Volume = num4;
33386 activeSound.Position = base.Center;
33387 activeSound.Pitch = Utils.Clamp(Utils.Remap(localAI[1], 0f, 100f, -1f, 1f) + num3, -1f, 1f);
33388 }
33389 float num5 = 0.15f;
33390 if (flag6)
33391 {
33392 rotation = MathHelper.WrapAngle(rotation) * 0.7f;
33393 velocity.X *= 0.97f;
33394 if (flag5)
33395 {
33396 Vector2 vector = (rotation - (float)Math.PI / 2f).ToRotationVector2();
33397 velocity += vector * 0.5f;
33398 num5 = 0.05f;
33399 }
33400 }
33401 else
33402 {
33403 float num6 = (float)Math.PI / 15f;
33404 num6 = Utils.Remap(localAI[0], 0f, 10f, num6 * 0.1f, num6);
33405 int num7 = flag4.ToInt() - flag3.ToInt();
33406 rotation += (float)num7 * num6;
33407 if (flag5)
33408 {
33409 Vector2 vector2 = (rotation - (float)Math.PI / 2f).ToRotationVector2();
33410 velocity.X *= 0.97f;
33411 velocity += vector2 * 0.5f;
33412 }
33413 }
33414 velocity.Y += num5;
33415 ai[1] = rotation;
33416 if (!flag5 && velocity.Y > 12f)
33417 {
33418 velocity.Y *= 0.95f;
33419 }
33420 if (velocity.Length() > 16f)
33421 {
33422 velocity *= 16f / velocity.Length();
33423 }
33424 Lighting.AddLight(base.Center, Vector3.One * 0.3f);
33425 timeLeft = 2;
33426 if (!flag6)
33427 {
33428 Vector2 vector3 = position;
33429 float num8 = 0f;
33430 int num9 = 3;
33431 int num10 = 16 * num9;
33432 for (int i = 0; i < num9; i++)
33433 {
33434 Vector2 vector4 = new Vector2(0f, 16f);
33435 Vector2 vector5 = Collision.TileCollision(vector3 + vector4 * i, vector4, width, height);
33436 num8 += vector5.Y;
33437 if (vector5 != vector4)
33438 {
33439 break;
33440 }
33441 }
33442 if (num8 != (float)num10)
33443 {
33444 for (int j = 0; j < 2; j++)
33445 {
33446 if (!(Main.rand.NextFloat() < 0.66f))
33447 {
33448 Vector2 vector6 = vector3 + new Vector2(0f, num8) + new Vector2((float)width / 2f, height);
33449 Vector2 value = Main.rand.NextVector2CircularEdge(2.5f, 1f) * 0.5f;
33450 if (value.Y > 0f)
33451 {
33452 value.Y *= -1f;
33453 }
33454 Dust.NewDustPerfect(vector6, (Main.rand.Next(2) == 0) ? 31 : 16, value, 127);
33455 }
33456 }
33457 }
33458 }
33459 if (Main.netMode == 2 && Main.player.IndexInRange(owner) && Main.player[owner].active)
33460 {
33461 RemoteClient.CheckSection(owner, position);
33462 }
33463 }
33464
33466 {
33467 if (Main.netMode == 1)
33468 {
33469 return;
33470 }
33471 bool flag = false;
33472 int num = -1;
33473 for (int i = 0; i < 40; i++)
33474 {
33475 Item item = theChest.item[i];
33476 if (item == null)
33477 {
33478 continue;
33479 }
33480 if (item.IsAir)
33481 {
33482 if (num == -1)
33483 {
33484 num = i;
33485 }
33486 }
33487 else if (item.type == 5356 && item.stack < item.maxStack)
33488 {
33489 flag = true;
33490 item.stack++;
33491 if (Main.netMode != 0)
33492 {
33493 NetMessage.SendData(32, -1, -1, null, chestIndex, i);
33494 }
33495 break;
33496 }
33497 }
33498 theChest.item[gasTrapIndex].stack--;
33499 if (theChest.item[gasTrapIndex].stack <= 0)
33500 {
33501 if (flag)
33502 {
33503 theChest.item[gasTrapIndex].TurnToAir();
33504 }
33505 else
33506 {
33507 flag = true;
33508 theChest.item[gasTrapIndex].ChangeItemType(5356);
33509 }
33510 }
33511 if (Main.netMode != 0)
33512 {
33513 NetMessage.SendData(32, -1, -1, null, chestIndex, gasTrapIndex);
33514 }
33515 if (!flag && num > -1)
33516 {
33517 flag = true;
33518 theChest.item[num].ChangeItemType(5356);
33519 if (Main.netMode != 0)
33520 {
33521 NetMessage.SendData(32, -1, -1, null, chestIndex, num);
33522 }
33523 }
33524 if (!flag)
33525 {
33527 }
33528 }
33529
33530 private void AI_111_DryadsWard()
33531 {
33532 if (!Main.npc[(int)ai[1]].active || Main.npc[(int)ai[1]].type != 20 || Main.npc[(int)ai[1]].ai[0] != 14f)
33533 {
33534 Kill();
33535 return;
33536 }
33537 ai[0] += 1f;
33538 rotation += (float)Math.PI / 300f;
33539 scale = ai[0] / 100f;
33540 if (scale > 1f)
33541 {
33542 scale = 1f;
33543 }
33544 alpha = (int)(255f * (1f - scale));
33545 float num = 300f;
33546 if (ai[0] >= 100f)
33547 {
33548 num = MathHelper.Lerp(300f, 600f, (ai[0] - 100f) / 200f);
33549 }
33550 if (num > 600f)
33551 {
33552 num = 600f;
33553 }
33554 if (ai[0] >= 500f)
33555 {
33556 alpha = (int)MathHelper.Lerp(0f, 255f, (ai[0] - 500f) / 100f);
33557 num = MathHelper.Lerp(600f, 1200f, (ai[0] - 500f) / 100f);
33558 rotation += (float)Math.PI / 300f;
33559 }
33560 int num2 = 163;
33561 if (ai[2] == 1f)
33562 {
33563 float num3 = (float)Math.Sin(ai[0] % 120f * ((float)Math.PI * 2f) / 120f) * 0.5f + 0.5f;
33564 if (Main.rand.NextFloat() < num3)
33565 {
33566 num2 = 70;
33567 }
33568 }
33569 if (Main.rand.Next(4) == 0)
33570 {
33571 float num4 = num;
33572 Vector2 vector = new Vector2(Main.rand.Next(-10, 11), Main.rand.Next(-10, 11));
33573 float num5 = Main.rand.Next(3, 9);
33574 vector.Normalize();
33575 int num6 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, num2, 0f, 0f, 100);
33576 Main.dust[num6].noGravity = true;
33577 Main.dust[num6].position = base.Center + vector * num4;
33578 if (Main.rand.Next(8) == 0)
33579 {
33580 Main.dust[num6].velocity = vector * (0f - num5) * 3f;
33581 Main.dust[num6].scale += 0.5f;
33582 }
33583 else
33584 {
33585 Main.dust[num6].velocity = vector * (0f - num5);
33586 }
33587 }
33588 if (Main.rand.Next(2) == 0)
33589 {
33590 Vector2 vector2 = new Vector2(Main.rand.Next(-10, 11), Main.rand.Next(-10, 11));
33591 float num7 = Main.rand.Next(3, 9);
33592 vector2.Normalize();
33593 int num8 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, num2, 0f, 0f, 100, default(Color), 1.5f);
33594 Main.dust[num8].noGravity = true;
33595 Main.dust[num8].position = base.Center + vector2 * 30f;
33596 if (Main.rand.Next(8) == 0)
33597 {
33598 Main.dust[num8].velocity = vector2 * (0f - num7) * 3f;
33599 Main.dust[num8].scale += 0.5f;
33600 }
33601 else
33602 {
33603 Main.dust[num8].velocity = vector2 * (0f - num7);
33604 }
33605 }
33606 if (ai[0] >= 30f && Main.netMode != 2)
33607 {
33608 Player player = Main.player[Main.myPlayer];
33609 if (player.active && !player.dead && Distance(player.Center) <= num && player.FindBuffIndex(165) == -1)
33610 {
33611 player.AddBuff(165, 120);
33612 }
33613 }
33614 if (ai[0] >= 30f && ai[0] % 10f == 0f && Main.netMode != 1)
33615 {
33616 for (int i = 0; i < 200; i++)
33617 {
33618 NPC nPC = Main.npc[i];
33619 if (nPC.type != 488 && nPC.active && Distance(nPC.Center) <= num)
33620 {
33621 if (nPC.townNPC && (nPC.FindBuffIndex(165) == -1 || nPC.buffTime[nPC.FindBuffIndex(165)] <= 20))
33622 {
33623 nPC.AddBuff(165, 120);
33624 }
33625 else if (!nPC.friendly && nPC.lifeMax > 5 && !nPC.dontTakeDamage && (nPC.FindBuffIndex(186) == -1 || nPC.buffTime[nPC.FindBuffIndex(186)] <= 20) && (nPC.dryadBane || Collision.CanHit(base.Center, 1, 1, nPC.position, nPC.width, nPC.height)))
33626 {
33627 nPC.AddBuff(186, 120);
33628 }
33629 }
33630 }
33631 }
33632 if (ai[0] >= 570f)
33633 {
33634 Kill();
33635 }
33636 }
33637
33638 public static bool GasTrapCheck(int x, int y, Player user)
33639 {
33640 if (Main.netMode == 1)
33641 {
33642 return false;
33643 }
33644 int num = Chest.FindChest(x, y);
33645 if (num < 0)
33646 {
33647 return false;
33648 }
33649 Chest chest = Main.chest[num];
33650 int num2 = 16;
33651 int num3 = 16;
33652 bool flag = false;
33653 for (int i = 0; i < 40; i++)
33654 {
33655 ushort num4 = Main.tile[chest.x, chest.y].type;
33657 {
33659 if (tileData != null)
33660 {
33661 int num5 = (int)Math.Ceiling((float)tileData.Width / 2f);
33662 int num6 = (int)Math.Ceiling((float)tileData.Width / 2f);
33663 num2 = num5 * 16;
33664 num3 = num6 * 16;
33665 if (num5 % 2 != 0)
33666 {
33667 num2 += 8;
33668 }
33669 if (num6 % 2 != 0)
33670 {
33671 num3 += 8;
33672 }
33673 }
33674 }
33675 if (chest.item[i] != null && chest.item[i].type == 5346)
33676 {
33677 UseGasTrapInChest(num, chest, i, num2, num3);
33678 flag = true;
33679 break;
33680 }
33681 }
33682 if (flag)
33683 {
33684 num3 -= 8;
33685 NewProjectile(position: new Vector2(x * 16 + num2, y * 16 + num3), spawnSource: user.GetProjectileSource_TileInteraction(x, y), velocity: Vector2.Zero, Type: 1007, Damage: 10, KnockBack: 0f, Owner: Main.myPlayer);
33686 }
33687 return flag;
33688 }
33689
33691 {
33692 int num = (int)ai[0];
33693 Vector2 center = base.Center;
33694 if (Main.player.IndexInRange(num))
33695 {
33696 Player player = Main.player[num];
33697 if (player.active && !player.dead)
33698 {
33699 center = player.Center;
33700 }
33701 }
33702 Vector2 vector = center - base.Center;
33703 int num2 = 30;
33704 float num3 = 4f;
33705 float num4 = 5f;
33706 float num5 = 0.4f;
33707 float num6 = 0.4f;
33708 if (!(vector.Y < (float)num2) || !(vector.Y > (float)(-num2)))
33709 {
33710 float num7 = (float)Math.Sign(vector.Y) * num6;
33711 velocity.Y = Utils.Clamp(velocity.Y + num7, 0f - num4, num4);
33712 }
33713 velocity.X = Utils.Clamp(velocity.X + (float)Math.Sign(vector.X) * num5, 0f - num3, num3);
33714 rotation = velocity.ToRotation();
33715 spriteDirection = ((!(velocity.X < 0f)) ? 1 : (-1));
33716 if (timeLeft < 6)
33717 {
33718 Opacity -= 0.1f;
33719 }
33720 else
33721 {
33722 Opacity += 1f / 30f;
33723 }
33724 if (Main.rand.Next(3) != 0)
33725 {
33726 Dust dust = Dust.NewDustDirect(position, width, height, 6, velocity.X, velocity.Y);
33727 dust.scale = 0.6f;
33728 dust.fadeIn = 1.1f;
33729 dust.noGravity = true;
33730 dust.noLight = true;
33731 }
33732 }
33733
33734 private void AI_193_Flamethrower()
33735 {
33736 localAI[0] += 1f;
33737 int num = 60;
33738 int num2 = 12;
33739 int num3 = num + num2;
33740 if (localAI[0] >= (float)num3)
33741 {
33742 Kill();
33743 }
33744 if (localAI[0] >= (float)num)
33745 {
33746 velocity *= 0.95f;
33747 }
33748 bool flag = ai[0] == 1f;
33749 int num4 = 50;
33750 int num5 = num4;
33751 if (flag)
33752 {
33753 num4 = 0;
33754 num5 = num;
33755 }
33756 if (localAI[0] < (float)num5 && Main.rand.NextFloat() < 0.25f)
33757 {
33758 short num6 = (short)(flag ? 135 : 6);
33759 Dust dust = Dust.NewDustDirect(base.Center + Main.rand.NextVector2Circular(60f, 60f) * Utils.Remap(localAI[0], 0f, 72f, 0.5f, 1f), 4, 4, num6, velocity.X * 0.2f, velocity.Y * 0.2f, 100);
33760 if (Main.rand.Next(4) == 0)
33761 {
33762 dust.noGravity = true;
33763 dust.scale *= 3f;
33764 dust.velocity.X *= 2f;
33765 dust.velocity.Y *= 2f;
33766 }
33767 else
33768 {
33769 dust.scale *= 1.5f;
33770 }
33771 dust.scale *= 1.5f;
33772 dust.velocity *= 1.2f;
33773 dust.velocity += velocity * 1f * Utils.Remap(localAI[0], 0f, (float)num * 0.75f, 1f, 0.1f) * Utils.Remap(localAI[0], 0f, (float)num * 0.1f, 0.1f, 1f);
33774 dust.customData = 1;
33775 }
33776 if (num4 > 0 && localAI[0] >= (float)num4 && Main.rand.NextFloat() < 0.5f)
33777 {
33778 Vector2 center = Main.player[owner].Center;
33779 Vector2 vector = (base.Center - center).SafeNormalize(Vector2.Zero).RotatedByRandom(0.19634954631328583) * 7f;
33780 short num7 = 31;
33781 Dust dust2 = Dust.NewDustDirect(base.Center + Main.rand.NextVector2Circular(50f, 50f) - vector * 2f, 4, 4, num7, 0f, 0f, 150, new Color(80, 80, 80));
33782 dust2.noGravity = true;
33783 dust2.velocity = vector;
33784 dust2.scale *= 1.1f + Main.rand.NextFloat() * 0.2f;
33785 dust2.customData = -0.3f - 0.15f * Main.rand.NextFloat();
33786 }
33787 }
33788
33789 private void AI_047_MagnetSphere()
33790 {
33791 if (ai[0] == 0f)
33792 {
33793 ai[0] = velocity.X;
33794 ai[1] = velocity.Y;
33795 }
33796 if (velocity.X > 0f)
33797 {
33798 rotation += (Math.Abs(velocity.Y) + Math.Abs(velocity.X)) * 0.001f;
33799 }
33800 else
33801 {
33802 rotation -= (Math.Abs(velocity.Y) + Math.Abs(velocity.X)) * 0.001f;
33803 }
33804 frameCounter++;
33805 if (frameCounter > 6)
33806 {
33807 frameCounter = 0;
33808 frame++;
33809 if (frame > 4)
33810 {
33811 frame = 0;
33812 }
33813 }
33814 if (velocity.Length() > 2f)
33815 {
33816 velocity *= 0.98f;
33817 }
33818 for (int i = 0; i < 1000; i++)
33819 {
33820 if (i != whoAmI)
33821 {
33822 Projectile projectile = Main.projectile[i];
33823 if (projectile.active && projectile.owner == owner && projectile.type == type && timeLeft > Main.projectile[i].timeLeft && Main.projectile[i].timeLeft > 30)
33824 {
33825 Main.projectile[i].timeLeft = 30;
33826 }
33827 }
33828 }
33829 AI_047_MagnetSphere_TryAttacking();
33830 }
33831
33833 {
33834 int[] array = new int[20];
33835 int num = 0;
33836 float num2 = 300f;
33837 bool flag = false;
33838 float num3 = 0f;
33839 float num4 = 0f;
33840 for (int i = 0; i < 200; i++)
33841 {
33842 if (!Main.npc[i].CanBeChasedBy(this))
33843 {
33844 continue;
33845 }
33846 float num5 = Main.npc[i].position.X + (float)(Main.npc[i].width / 2);
33847 float num6 = Main.npc[i].position.Y + (float)(Main.npc[i].height / 2);
33848 if (Math.Abs(position.X + (float)(width / 2) - num5) + Math.Abs(position.Y + (float)(height / 2) - num6) < num2 && Collision.CanHit(base.Center, 1, 1, Main.npc[i].Center, 1, 1))
33849 {
33850 if (num < 20)
33851 {
33852 array[num] = i;
33853 num++;
33854 num3 = num5;
33855 num4 = num6;
33856 }
33857 flag = true;
33858 }
33859 }
33860 if (timeLeft < 30)
33861 {
33862 flag = false;
33863 }
33864 if (flag)
33865 {
33866 int num7 = Main.rand.Next(num);
33867 num7 = array[num7];
33868 num3 = Main.npc[num7].position.X + (float)(Main.npc[num7].width / 2);
33869 num4 = Main.npc[num7].position.Y + (float)(Main.npc[num7].height / 2);
33870 localAI[0] += 1f;
33871 if (localAI[0] > 8f)
33872 {
33873 localAI[0] = 0f;
33874 Vector2 vector = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
33875 vector += velocity * 4f;
33876 float num8 = num3 - vector.X;
33877 float num9 = num4 - vector.Y;
33878 float num10 = (float)Math.Sqrt(num8 * num8 + num9 * num9);
33879 num10 = 6f / num10;
33880 num8 *= num10;
33881 num9 *= num10;
33882 NewProjectile(GetProjectileSource_FromThis(), vector.X, vector.Y, num8, num9, 255, damage, knockBack, owner);
33883 }
33884 }
33885 }
33886
33888 {
33889 int num = 420;
33890 timeSinceFall = proj.ai[0] - (float)num;
33891 if (timeSinceFall < 0f)
33892 {
33893 timeSinceFall = 0f;
33894 }
33895 int num2 = 24;
33896 int num3 = -4;
33897 float num4 = 0.2f;
33898 fall = (float)num3 * timeSinceFall + num4 * (timeSinceFall * timeSinceFall) / 2f;
33899 if (fall > (float)num2)
33900 {
33901 fall = num2;
33902 }
33903 }
33904
33906 {
33907 float num = 120f;
33908 float num2 = 420f + num;
33909 float num3 = num2 - 150f;
33910 if (Opacity > 0f && Opacity < 1f)
33911 {
33912 for (int i = 0; i < 1; i++)
33913 {
33914 Rectangle r = Utils.CenteredRectangle(base.Center + new Vector2(0f, 20f), new Vector2(32f, 32f));
33915 Dust dust = Dust.NewDustDirect(r.TopLeft(), r.Width, r.Height, 263, 0f, 0f, 100, new Color(80, 200, 255), 0.6f);
33916 dust.noGravity = true;
33917 dust.fadeIn = 0.9f;
33918 dust.velocity = new Vector2(0f, -0.3f);
33919 }
33920 }
33921 int num4 = 20;
33922 int num5 = 4;
33923 if (frame == 1)
33924 {
33925 num5 = 60;
33926 }
33927 AI_192_GetJuminoFall(this, out var timeSinceFall, out var fall);
33928 if (timeSinceFall > 0f)
33929 {
33930 if (fall < 20f)
33931 {
33932 frame = 0;
33933 }
33934 else if (++frameCounter >= num5)
33935 {
33936 frameCounter = 0;
33937 if (++frame >= num4)
33938 {
33939 frame = num4 - 1;
33940 }
33941 }
33942 }
33943 else
33944 {
33945 frame = 1;
33946 }
33947 float num6 = Main.player[owner].Center.X - base.Center.X;
33948 direction = (spriteDirection = ((num6 >= 0f) ? 1 : (-1)));
33949 int num7 = 30;
33950 float num8 = num2 + (float)(num4 * num5) + (float)num7;
33951 Opacity = Utils.Remap(ai[0], num3 + 0f, num3 + 20f, 0f, 1f) * Utils.Remap(ai[0], num8 - 5f, num8, 1f, 0.5f);
33952 ai[0] += 1f;
33953 if (ai[0] <= 130f && ai[0] >= 60f)
33954 {
33955 float num9 = Utils.Remap(ai[0], 60f, 130f, 0f, 1f);
33956 if (Main.rand.NextFloat() < num9 * 0.5f)
33957 {
33958 Rectangle r2 = Utils.CenteredRectangle(base.Center + new Vector2(0f, 0f), new Vector2(70f, 70f) * num9);
33959 Dust dust2 = Dust.NewDustDirect(r2.TopLeft(), r2.Width, r2.Height, 263, 0f, 0f, 100, new Color(80, 200, 255), 0.6f);
33960 dust2.noGravity = true;
33961 dust2.fadeIn = 0.9f;
33962 dust2.velocity = Main.rand.NextVector2Circular(2f, 2f);
33963 }
33964 for (float num10 = 0f; num10 < 1f; num10 += 0.5f)
33965 {
33966 if (Main.rand.NextFloat() < 0.5f)
33967 {
33968 Dust dust3 = Dust.NewDustPerfect(base.Center, 263, (-Vector2.UnitY).RotatedBy(((0f - num9) * (3f - num9 * 0.6f) + num10 + Main.rand.NextFloatDirection() * 0.05f * (1f - num9)) * ((float)Math.PI * 2f)) * (2f + Main.rand.NextFloat() + Main.rand.NextFloat() * 3f * num9), 30, new Color(80, 200, 255));
33969 dust3.noGravity = true;
33970 dust3.fadeIn = 1.1f;
33971 }
33972 }
33973 }
33974 if (ai[0] <= 60f)
33975 {
33976 float num11 = Utils.Remap(ai[0], 0f, 60f, 0f, 1f);
33977 for (float num12 = 0f; num12 < 1f; num12 += 0.5f)
33978 {
33979 if (Main.rand.NextFloat() < 0.5f)
33980 {
33981 Dust dust4 = Dust.NewDustPerfect(base.Center, 263, (-Vector2.UnitY).RotatedBy(((0f - num11) * 3f + num12 + Main.rand.NextFloatDirection() * 0.05f) * ((float)Math.PI * 2f)) * (2f * num11 + Main.rand.NextFloat() * num11), 100, new Color(80, 200, 255), 2f - num11);
33982 dust4.noGravity = true;
33983 dust4.fadeIn = 1.1f;
33984 }
33985 }
33986 if (ai[0] == 58f)
33987 {
33988 for (float num13 = 0f; num13 < 1f; num13 += 1f / 12f)
33989 {
33990 Dust dust5 = Dust.NewDustPerfect(base.Center, 263, (-Vector2.UnitY).RotatedBy(((0f - num11) * 2f + num13 + Main.rand.NextFloatDirection() * 0.05f) * ((float)Math.PI * 2f)) * (1f * num11 + Main.rand.NextFloat() * num11 * 2f), 100, new Color(80, 200, 255), 0.8f);
33991 dust5.noGravity = true;
33992 dust5.fadeIn = 1.2f;
33993 }
33994 }
33995 }
33996 if (ai[0] >= num8 - 20f)
33997 {
33998 float num14 = Utils.Remap(ai[0], num8 - 20f, num8, 0.25f, 1f);
33999 Rectangle r3 = Utils.CenteredRectangle(base.Center + new Vector2(0f, 30f + num14 * -20f), new Vector2(82f, 72f) * num14);
34000 for (int j = 0; j < 5; j++)
34001 {
34002 Dust dust6 = Dust.NewDustDirect(r3.TopLeft(), r3.Width, r3.Height, 263, 0f, num14 * -4f, 100, new Color(80, 200, 255) * 0.75f, 0.1f);
34003 dust6.noGravity = true;
34004 dust6.fadeIn = 0.6f + Main.rand.NextFloat() * 0.3f;
34005 dust6.velocity = new Vector2(0f, -0.3f);
34006 }
34007 for (int k = 0; k < 1; k++)
34008 {
34009 Rectangle r4 = Utils.CenteredRectangle(base.Center + new Vector2(0f, 40f), new Vector2(32f, 32f));
34010 Dust dust7 = Dust.NewDustDirect(r4.TopLeft(), r4.Width, r4.Height, 263, 0f, 0f, 100, new Color(80, 200, 255), 0.6f);
34011 dust7.noGravity = true;
34012 dust7.fadeIn = 0.9f;
34013 dust7.velocity = new Vector2(0f, -0.3f);
34014 }
34015 }
34016 if (Main.rand.Next(6) == 0 && ai[0] >= 90f && ai[0] < num2)
34017 {
34018 Rectangle r5 = Utils.CenteredRectangle(base.Center + new Vector2(0f, 0f), new Vector2(104f, 104f));
34019 Dust dust8 = Dust.NewDustDirect(r5.TopLeft(), r5.Width, r5.Height, 263, 0f, 0f, 100, new Color(80, 200, 255), 0.6f);
34020 dust8.noGravity = true;
34021 dust8.fadeIn = 0.9f;
34022 dust8.velocity = new Vector2(0f, -0.3f);
34023 }
34024 if (ai[0] >= num8)
34025 {
34026 int num15 = Item.NewItem(new EntitySource_Gift(this), base.Center + new Vector2(0f, 12f), Vector2.Zero, 5276);
34027 Main.item[num15].velocity = new Vector2(0f, 0f);
34028 Kill();
34029 }
34030 }
34031
34033 {
34034 float num = 50f;
34035 float num2 = 15f;
34036 float num3 = ai[1] + num;
34037 float num4 = num3 + num2;
34038 float num5 = 77f;
34039 if (type == 985)
34040 {
34041 num = 0f;
34042 num3 = ai[1];
34043 num4 = ai[1] + 25f;
34044 num5 = num4;
34045 }
34046 if (localAI[0] == 0f && type == 973)
34047 {
34049 }
34050 localAI[0] += 1f;
34051 if (type == 985 && localAI[1] == 1f)
34052 {
34053 localAI[0] += 2f;
34054 }
34055 if (type == 973 && damage == 0 && localAI[0] < MathHelper.Lerp(num3, num4, 0.5f))
34056 {
34057 localAI[0] += 6f;
34058 }
34059 Opacity = Utils.Remap(localAI[0], 0f, ai[1], 0f, 1f) * Utils.Remap(localAI[0], num3, num4, 1f, 0f);
34060 if (localAI[0] >= num4)
34061 {
34062 localAI[1] = 1f;
34063 Kill();
34064 return;
34065 }
34066 Player player = Main.player[owner];
34067 float fromValue = localAI[0] / ai[1];
34068 float num6 = Utils.Remap(localAI[0], ai[1] * 0.4f, num4, 0f, 1f);
34069 direction = (spriteDirection = (int)ai[0]);
34070 if (type == 973)
34071 {
34072 int num7 = 3;
34073 if (damage != 0 && localAI[0] >= num5 + (float)num7)
34074 {
34075 damage = 0;
34076 }
34077 if (damage != 0)
34078 {
34079 int num8 = 80;
34080 bool flag = false;
34081 float num9 = velocity.ToRotation();
34082 for (float num10 = -1f; num10 <= 1f; num10 += 0.5f)
34083 {
34084 Vector2 position = base.Center + (num9 + num10 * ((float)Math.PI / 4f) * 0.25f).ToRotationVector2() * num8 * 0.5f * scale;
34085 Vector2 position2 = base.Center + (num9 + num10 * ((float)Math.PI / 4f) * 0.25f).ToRotationVector2() * num8 * scale;
34086 if (!Collision.SolidTiles(base.Center, 0, 0) && Collision.CanHit(position, 0, 0, position2, 0, 0))
34087 {
34088 flag = true;
34089 break;
34090 }
34091 }
34092 if (!flag)
34093 {
34094 damage = 0;
34095 }
34096 }
34097 fromValue = localAI[0] / ai[1];
34098 localAI[1] += 1f;
34099 num6 = Utils.Remap(localAI[1], ai[1] * 0.4f, num4, 0f, 1f);
34100 base.Center = player.RotatedRelativePoint(player.MountedCenter) - velocity + velocity * num6 * num6 * num5;
34101 rotation += ai[0] * ((float)Math.PI * 2f) * (4f + Opacity * 4f) / 90f;
34102 scale = Utils.Remap(localAI[0], ai[1] + 2f, num4, 1.12f, 1f) * ai[2];
34103 float f = rotation + Main.rand.NextFloatDirection() * ((float)Math.PI / 2f) * 0.7f;
34104 Vector2 vector = base.Center + f.ToRotationVector2() * 84f * scale;
34105 if (Main.rand.Next(5) == 0)
34106 {
34107 Dust dust = Dust.NewDustPerfect(vector, 14, null, 150, default(Color), 1.4f);
34108 dust.noLight = (dust.noLightEmittence = true);
34109 }
34110 for (int i = 0; (float)i < 3f * Opacity; i++)
34111 {
34112 Vector2 vector2 = velocity.SafeNormalize(Vector2.UnitX);
34113 int num11 = ((Main.rand.NextFloat() < Opacity) ? 75 : 27);
34114 Dust dust2 = Dust.NewDustPerfect(vector, num11, velocity * 0.2f + vector2 * 3f, 100, default(Color), 1.4f);
34115 dust2.noGravity = true;
34116 dust2.customData = Opacity * 0.2f;
34117 }
34118 }
34119 if (type != 985)
34120 {
34121 return;
34122 }
34123 ownerHitCheck = localAI[0] <= 6f;
34124 if (localAI[0] >= MathHelper.Lerp(num3, num4, 0.65f))
34125 {
34126 damage = 0;
34127 }
34128 float fromValue2 = 1f - (1f - num6) * (1f - num6);
34129 rotation = velocity.ToRotation();
34130 scale = Utils.Remap(fromValue2, 0f, 1f, 1.5f, 1f) * ai[2];
34131 num6 = Utils.Remap(localAI[0], ai[1] / 2f, num4, 0f, 1f);
34132 Opacity = Utils.Remap(localAI[0], 0f, ai[1] * 0.5f, 0f, 1f) * Utils.Remap(localAI[0], num4 - 12f, num4, 1f, 0f);
34133 if (velocity.Length() > 8f)
34134 {
34135 velocity *= 0.94f;
34136 new Vector2(32f, 32f);
34137 float num12 = Utils.Remap(fromValue, 0.7f, 1f, 110f, 110f);
34138 if (localAI[1] == 0f)
34139 {
34140 bool flag2 = false;
34141 for (float num13 = -1f; num13 <= 1f; num13 += 0.5f)
34142 {
34143 Vector2 position3 = base.Center + (rotation + num13 * ((float)Math.PI / 4f) * 0.25f).ToRotationVector2() * num12 * 0.5f * scale;
34144 Vector2 position4 = base.Center + (rotation + num13 * ((float)Math.PI / 4f) * 0.25f).ToRotationVector2() * num12 * scale;
34145 if (Collision.CanHit(position3, 0, 0, position4, 0, 0))
34146 {
34147 flag2 = true;
34148 break;
34149 }
34150 }
34151 if (!flag2)
34152 {
34153 localAI[1] = 1f;
34154 }
34155 }
34156 if (localAI[1] == 1f && velocity.Length() > 8f)
34157 {
34158 velocity *= 0.8f;
34159 }
34160 if (localAI[1] == 1f)
34161 {
34162 velocity *= 0.88f;
34163 }
34164 }
34165 float num14 = rotation + Main.rand.NextFloatDirection() * ((float)Math.PI / 2f) * 0.9f;
34166 Vector2 vector3 = base.Center + num14.ToRotationVector2() * 85f * scale;
34167 (num14 + ai[0] * ((float)Math.PI / 2f)).ToRotationVector2();
34168 Color value = new Color(64, 220, 96);
34169 Color value2 = new Color(15, 84, 125);
34170 Lighting.AddLight(base.Center + rotation.ToRotationVector2() * 85f * scale, value.ToVector3());
34171 for (int j = 0; j < 3; j++)
34172 {
34173 if (Main.rand.NextFloat() < Opacity + 0.1f)
34174 {
34175 Color.Lerp(Color.Lerp(Color.Lerp(value2, value, Utils.Remap(fromValue, 0f, 0.6f, 0f, 1f)), Color.White, Utils.Remap(fromValue, 0.6f, 0.8f, 0f, 0.5f)), Color.White, Main.rand.NextFloat() * 0.3f);
34176 Dust dust3 = Dust.NewDustPerfect(vector3, 107, velocity * 0.7f, 100, default(Color) * Opacity, 0.8f * Opacity);
34177 dust3.scale *= 0.7f;
34178 dust3.velocity += player.velocity * 0.1f;
34179 dust3.position -= dust3.velocity * 6f;
34180 }
34181 }
34182 if (damage == 0)
34183 {
34184 localAI[0] += 3f;
34185 velocity *= 0.76f;
34186 }
34187 if (localAI[0] < 10f && (localAI[1] == 1f || damage == 0))
34188 {
34189 localAI[0] += 1f;
34190 velocity *= 0.85f;
34191 for (int k = 0; k < 4; k++)
34192 {
34193 float num15 = Main.rand.NextFloatDirection();
34194 float num16 = 1f - Math.Abs(num15);
34195 num14 = rotation + num15 * ((float)Math.PI / 2f) * 0.9f;
34196 vector3 = base.Center + num14.ToRotationVector2() * 85f * scale;
34197 Color.Lerp(Color.Lerp(Color.Lerp(value2, value, Utils.Remap(fromValue, 0f, 0.6f, 0f, 1f)), Color.White, Utils.Remap(fromValue, 0.6f, 0.8f, 0f, 0.5f)), Color.White, Main.rand.NextFloat() * 0.3f);
34198 Dust dust4 = Dust.NewDustPerfect(vector3, 107, velocity.RotatedBy(num15 * ((float)Math.PI / 4f)) * 0.2f * Main.rand.NextFloat(), 100, default(Color), 1.4f * num16);
34199 dust4.velocity += player.velocity * 0.1f;
34200 dust4.position -= dust4.velocity * Main.rand.NextFloat() * 3f;
34201 }
34202 }
34203 }
34204
34205 private void AI_190_NightsEdge()
34206 {
34207 if (localAI[0] == 0f && type == 984)
34208 {
34209 SoundEffectInstance soundEffectInstance = SoundEngine.PlaySound(SoundID.Item60, position);
34210 if (soundEffectInstance != null)
34211 {
34212 soundEffectInstance.Volume *= 0.65f;
34213 }
34214 }
34215 localAI[0] += 1f;
34216 Player player = Main.player[owner];
34217 float num = localAI[0] / ai[1];
34218 float num2 = ai[0];
34219 float num3 = velocity.ToRotation();
34220 float num4 = (float)Math.PI * num2 * num + num3 + num2 * (float)Math.PI + player.fullRotation;
34221 rotation = num4;
34222 float num5 = 0.2f;
34223 float num6 = 1f;
34224 switch (type)
34225 {
34226 case 982:
34227 num5 = 0.6f;
34228 break;
34229 case 997:
34230 num5 = 0.6f;
34231 break;
34232 case 983:
34233 num5 = 1f;
34234 num6 = 1.2f;
34235 break;
34236 case 984:
34237 num5 = 0.6f;
34238 break;
34239 }
34240 base.Center = player.RotatedRelativePoint(player.MountedCenter) - velocity;
34241 scale = num6 + num * num5;
34242 if (type == 972)
34243 {
34244 if (Math.Abs(num2) < 0.2f)
34245 {
34246 rotation += (float)Math.PI * 4f * num2 * 10f * num;
34247 float num7 = Utils.Remap(localAI[0], 10f, ai[1] - 5f, 0f, 1f);
34248 position += velocity.SafeNormalize(Vector2.Zero) * (45f * num7);
34249 scale += num7 * 0.4f;
34250 }
34251 if (Main.rand.Next(2) == 0)
34252 {
34253 float f = rotation + Main.rand.NextFloatDirection() * ((float)Math.PI / 2f) * 0.7f;
34254 Vector2 vector = base.Center + f.ToRotationVector2() * 84f * scale;
34255 if (Main.rand.Next(5) == 0)
34256 {
34257 Dust dust = Dust.NewDustPerfect(vector, 14, null, 150, default(Color), 1.4f);
34258 dust.noLight = (dust.noLightEmittence = true);
34259 }
34260 if (Main.rand.Next(2) == 0)
34261 {
34262 Dust.NewDustPerfect(vector, 27, new Vector2(player.velocity.X * 0.2f + (float)(player.direction * 3), player.velocity.Y * 0.2f), 100, default(Color), 1.4f).noGravity = true;
34263 }
34264 }
34265 }
34266 if (type == 982)
34267 {
34268 float num8 = rotation + Main.rand.NextFloatDirection() * ((float)Math.PI / 2f) * 0.7f;
34269 Vector2 vector2 = base.Center + num8.ToRotationVector2() * 84f * scale;
34270 Vector2 vector3 = (num8 + ai[0] * ((float)Math.PI / 2f)).ToRotationVector2();
34271 if (Main.rand.NextFloat() * 2f < Opacity)
34272 {
34273 Dust dust2 = Dust.NewDustPerfect(base.Center + num8.ToRotationVector2() * (Main.rand.NextFloat() * 80f * scale + 20f * scale), 278, vector3 * 1f, 100, Color.Lerp(Color.Gold, Color.White, Main.rand.NextFloat() * 0.3f), 0.4f);
34274 dust2.fadeIn = 0.4f + Main.rand.NextFloat() * 0.15f;
34275 dust2.noGravity = true;
34276 }
34277 if (Main.rand.NextFloat() * 1.5f < Opacity)
34278 {
34279 Dust.NewDustPerfect(vector2, 43, vector3 * 1f, 100, Color.White * Opacity, 1.2f * Opacity);
34280 }
34281 }
34282 if (type == 997)
34283 {
34284 float num9 = rotation + Main.rand.NextFloatDirection() * ((float)Math.PI / 2f) * 0.7f;
34285 _ = base.Center + num9.ToRotationVector2() * 84f * scale;
34286 Vector2 vector4 = (num9 + ai[0] * ((float)Math.PI / 2f)).ToRotationVector2();
34287 if (Main.rand.NextFloat() * 2f < Opacity)
34288 {
34289 Dust dust3 = Dust.NewDustPerfect(base.Center + num9.ToRotationVector2() * (Main.rand.NextFloat() * 80f * scale + 20f * scale), 6, vector4 * 4f, 0, default(Color), 0.4f);
34290 dust3.noGravity = true;
34291 dust3.scale = 1.4f;
34292 }
34293 }
34294 if (type == 983)
34295 {
34296 float num10 = rotation + Main.rand.NextFloatDirection() * ((float)Math.PI / 2f) * 0.7f;
34297 Vector2 vector5 = base.Center + num10.ToRotationVector2() * 84f * scale;
34298 Vector2 vector6 = (num10 + ai[0] * ((float)Math.PI / 2f)).ToRotationVector2();
34299 if (Main.rand.NextFloat() < Opacity)
34300 {
34301 Dust dust4 = Dust.NewDustPerfect(base.Center + num10.ToRotationVector2() * (Main.rand.NextFloat() * 80f * scale + 20f * scale), 278, vector6 * 1f, 100, Color.Lerp(Color.HotPink, Color.White, Main.rand.NextFloat() * 0.3f), 0.4f);
34302 dust4.fadeIn = 0.4f + Main.rand.NextFloat() * 0.15f;
34303 dust4.noGravity = true;
34304 }
34305 if (Main.rand.NextFloat() * 1.5f < Opacity)
34306 {
34307 Dust.NewDustPerfect(vector5, 43, vector6 * 1f, 100, Color.White * Opacity, 1.2f * Opacity);
34308 }
34309 }
34310 if (type == 984)
34311 {
34312 float num11 = rotation + Main.rand.NextFloatDirection() * ((float)Math.PI / 2f) * 0.7f;
34313 Vector2 vector7 = base.Center + num11.ToRotationVector2() * 85f * scale;
34314 Vector2 vector8 = (num11 + ai[0] * ((float)Math.PI / 2f)).ToRotationVector2();
34315 Color value = new Color(64, 220, 96);
34316 Color value2 = new Color(15, 84, 125);
34317 Lighting.AddLight(base.Center, value2.ToVector3());
34318 if (Main.rand.NextFloat() * 2f < Opacity)
34319 {
34320 Color value3 = Color.Lerp(value2, value, Utils.Remap(num, 0f, 0.6f, 0f, 1f));
34321 value3 = Color.Lerp(value3, Color.White, Utils.Remap(num, 0.6f, 0.8f, 0f, 0.5f));
34322 Dust dust5 = Dust.NewDustPerfect(base.Center + num11.ToRotationVector2() * (Main.rand.NextFloat() * 80f * scale + 20f * scale), 278, vector8 * 1f, 100, Color.Lerp(value3, Color.White, Main.rand.NextFloat() * 0.3f), 0.4f);
34323 dust5.fadeIn = 0.4f + Main.rand.NextFloat() * 0.15f;
34324 dust5.noGravity = true;
34325 }
34326 if (Main.rand.NextFloat() < Opacity)
34327 {
34328 Color.Lerp(Color.Lerp(Color.Lerp(value2, value, Utils.Remap(num, 0f, 0.6f, 0f, 1f)), Color.White, Utils.Remap(num, 0.6f, 0.8f, 0f, 0.5f)), Color.White, Main.rand.NextFloat() * 0.3f);
34329 Dust dust6 = Dust.NewDustPerfect(vector7, 107, vector8 * 3f, 100, default(Color) * Opacity, 0.8f * Opacity);
34330 dust6.velocity += player.velocity * 0.1f;
34331 dust6.velocity += new Vector2(player.direction, 0f);
34332 dust6.position -= dust6.velocity * 6f;
34333 }
34334 }
34335 scale *= ai[2];
34336 if (localAI[0] >= ai[1])
34337 {
34338 Kill();
34339 }
34340 }
34341
34342 private void AI_188_LightsBane()
34343 {
34344 if (soundDelay == 0)
34345 {
34346 soundDelay = -1;
34347 SoundEffectInstance soundEffectInstance = SoundEngine.PlaySound(SoundID.Item60, base.Center);
34348 if (soundEffectInstance != null)
34349 {
34350 soundEffectInstance.Volume *= 0.15f * ai[0];
34351 }
34352 }
34353 scale = ai[0];
34354 localAI[0] += 1f;
34355 if (++frameCounter >= 3)
34356 {
34357 frameCounter = 0;
34358 if (++frame >= 12)
34359 {
34360 Kill();
34361 return;
34362 }
34363 }
34364 rotation = velocity.ToRotation();
34365 float f = rotation;
34366 float num = 46f * scale;
34367 Vector2 vector = f.ToRotationVector2();
34368 float num2 = localAI[0] / 36f * 4f;
34369 if (num2 >= 0f && num2 <= 1f)
34370 {
34371 Dust dust = Dust.NewDustPerfect(Vector2.Lerp(base.Center - vector * num, base.Center + vector * num, localAI[0] / 36f), 278, vector.RotatedBy((float)Math.PI * 2f * Main.rand.NextFloatDirection() * 0.02f) * 8f * Main.rand.NextFloat(), 0, new Color(60, 0, 150), 0.7f * num2);
34372 dust.noGravity = true;
34373 dust.noLight = (dust.noLightEmittence = true);
34374 }
34375 }
34376
34377 private void AI_189_Volcano()
34378 {
34379 if (soundDelay == 0)
34380 {
34381 soundDelay = -1;
34383 }
34384 alpha = (int)(255f * (1f - Utils.Remap(ai[0], 0f, 2f, 0f, 1f) * Utils.Remap(ai[0], 6f, 10f, 1f, 0f)));
34385 float num = width / 2;
34386 float num2 = height / 2;
34387 num = (num2 = 8f);
34388 scale = 1f + 1f * (ai[0] / 15f);
34389 if (++frameCounter >= 2)
34390 {
34391 frameCounter = 0;
34392 if (++frame >= 5)
34393 {
34394 Kill();
34395 return;
34396 }
34397 }
34398 ai[0] += 1f;
34399 if (ai[0] == 1f)
34400 {
34401 for (int i = 0; i < 20; i++)
34402 {
34403 int num3 = Utils.SelectRandom<int>(Main.rand, 6, 259, 158);
34404 Dust.NewDustPerfect(base.Center + Main.rand.NextVector2Circular(num, num2), num3, velocity.RotatedBy(Main.rand.NextFloatDirection() * ((float)Math.PI / 4f) * 0.6f) * (2f + 5f * Main.rand.NextFloat()), 200, default(Color), 1f + Main.rand.NextFloat()).customData = 0;
34405 }
34406 int num4 = Main.rand.Next(3, 7);
34407 for (int j = 0; j < num4 * 5; j++)
34408 {
34409 Dust dust = Dust.NewDustPerfect(base.Center + Main.rand.NextVector2Circular(num, num2), 31, velocity.RotatedBy(Main.rand.NextFloatDirection() * ((float)Math.PI / 4f) * 0.6f) * (2f + 5f * Main.rand.NextFloat()), 50, default(Color), 1f + Main.rand.NextFloat());
34410 dust.noGravity = true;
34411 dust.velocity *= 3f;
34412 }
34413 for (int k = 0; k < num4; k++)
34414 {
34415 Gore.NewGorePerfect(base.Center + Main.rand.NextVector2Circular(num, num2) - new Vector2(16f, 16f), velocity.RotatedBy(Main.rand.NextFloatDirection() * ((float)Math.PI / 4f) * 0.6f) * (0f + 4f * Main.rand.NextFloat()), 61 + Main.rand.Next(3));
34416 }
34417 }
34418 for (int l = 0; l < 2; l++)
34419 {
34420 if (Main.rand.Next(3) < 2)
34421 {
34422 Dust dust2 = Dust.NewDustPerfect(base.Center + Main.rand.NextVector2Circular(num, num2), 6, velocity.RotatedBy(Main.rand.NextFloatDirection() * ((float)Math.PI / 4f)) * (1.5f + 2f * Main.rand.NextFloat()), 90, default(Color), 2.5f);
34423 dust2.noGravity = true;
34424 dust2.fadeIn = 1f;
34425 if (Main.rand.Next(6) < 3)
34426 {
34427 dust2.noGravity = false;
34428 dust2.noLight = true;
34429 dust2.fadeIn = 0.4f;
34430 dust2.scale *= 0.3f;
34431 }
34432 else
34433 {
34434 dust2.velocity = DirectionFrom(dust2.position) * dust2.velocity.Length() * 0.25f;
34435 }
34436 dust2.customData = 0;
34437 }
34438 }
34439 for (int m = 0; m < 2; m++)
34440 {
34441 if (!(Main.rand.NextFloat() < 0.5f))
34442 {
34443 int num5 = Utils.SelectRandom<int>(Main.rand, 6, 259, 158);
34444 Dust dust3 = Dust.NewDustPerfect(base.Center + Main.rand.NextVector2Circular(num, num2), num5, velocity.RotatedBy(Main.rand.NextFloatDirection() * ((float)Math.PI / 4f) * 0.5f) * (1f + 2f * Main.rand.NextFloat()), 200, default(Color), 1f + Main.rand.NextFloat());
34445 dust3.velocity *= new Vector2(0.6f, 1.5f);
34446 dust3.customData = 0;
34447 }
34448 }
34449 }
34450
34452 {
34453 float num = 5f;
34454 float num2 = 30f;
34455 float num3 = num2 + num;
34456 int num4 = 1;
34457 int num5 = 4;
34458 int num6 = 2;
34459 bool flag = false;
34460 if (type == 533)
34461 {
34462 num4 = 2;
34463 }
34464 if (type == 388)
34465 {
34466 num4 = 2;
34467 num2 = 40f;
34468 }
34469 targetVelocity /= (float)num4;
34470 for (float num7 = 1f; num7 <= 1.5f; num7 += 0.1f)
34471 {
34473 if (chaseResults.InterceptionHappens && chaseResults.InterceptionTime <= num3)
34474 {
34475 velocity = chaseResults.ChaserVelocity;
34476 if (flag)
34477 {
34478 int num8 = (int)Utils.Clamp((float)Math.Ceiling(chaseResults.InterceptionTime) + (float)num6, num5, num2 - 1f) / num4;
34479 float num9 = num2 / (float)num4 - (float)num8;
34480 ai[1] += num9 * (float)num4;
34481 }
34482 break;
34483 }
34484 }
34485 }
34486
34488 {
34489 int num = Main.rand.Next(2) * 2 - 1;
34490 int num2 = Main.rand.Next(4);
34491 float num3 = (isHostile ? 200f : 100f);
34492 float num4 = (isHostile ? 30 : 20);
34493 float num5 = (isHostile ? 30 : 0);
34494 float num6 = Main.rand.NextFloatDirection() * (float)Math.PI * 0.125f;
34495 if (isHostile && targetEntity.velocity.X * (float)num > 0f)
34496 {
34497 num *= -1;
34498 }
34499 if (num2 == 0 && isHostile)
34500 {
34501 num4 += 10f;
34502 }
34503 spawnposition = targetEntity.Center + targetEntity.velocity * num5 + new Vector2((float)num * (0f - num3), 0f).RotatedBy(num6);
34504 spawnvelocity = new Vector2((float)num * num3 / num4, 0f).RotatedBy(num6);
34505 ai0 = 0f;
34506 ai1 = 0f;
34507 if (num2 == 1)
34508 {
34509 float num7 = (float)Math.PI * 2f * Main.rand.NextFloat();
34510 spawnposition = targetEntity.Center - num7.ToRotationVector2() * (isHostile ? num3 : (num3 * 0.5f));
34511 ai0 = 180f;
34512 ai1 = num7 - (float)Math.PI / 2f;
34513 spawnvelocity = num7.ToRotationVector2() * (isHostile ? 4 : 2);
34514 }
34515 if (num2 == 2)
34516 {
34517 float num8 = (float)Math.PI * 2f * Main.rand.NextFloat();
34518 spawnposition = targetEntity.Center - num8.ToRotationVector2() * num3;
34519 ai0 = 300f;
34520 ai1 = num8;
34521 spawnvelocity = num8.ToRotationVector2() * (isHostile ? 4 : 2);
34522 }
34523 if (num2 == 3)
34524 {
34525 float f = (float)Math.PI * 2f * Main.rand.NextFloat();
34526 float num9 = (isHostile ? 60 : 30);
34527 float num10 = (float)Math.PI / 2f / num9 * Main.rand.NextFloatDirection();
34528 spawnposition = targetEntity.Center + targetEntity.velocity * num9;
34529 Vector2 vector = f.ToRotationVector2() * (isHostile ? 8 : 3);
34530 for (int i = 0; (float)i < num9; i++)
34531 {
34533 vector = vector.RotatedBy(0f - num10);
34534 }
34536 ai0 = 390f;
34537 ai1 = num10;
34538 }
34539 }
34540
34541 private void AI_187_ShadowHand()
34542 {
34543 //IL_0041: Unknown result type (might be due to invalid IL or missing references)
34544 //IL_002a: Unknown result type (might be due to invalid IL or missing references)
34545 //IL_002f: Unknown result type (might be due to invalid IL or missing references)
34546 //IL_0058: Unknown result type (might be due to invalid IL or missing references)
34547 //IL_005d: Unknown result type (might be due to invalid IL or missing references)
34548 AI_187_ShadowHand_GetVariation(out var variation, out var fakeCounter, out var counterMax);
34550 SlotId val;
34551 if (fakeCounter == 0f)
34552 {
34553 float[] array = localAI;
34555 array[1] = ((SlotId)(ref val)).ToFloat();
34556 }
34558 if (activeSound == null)
34559 {
34560 float[] array2 = localAI;
34561 val = SlotId.Invalid;
34562 array2[1] = ((SlotId)(ref val)).ToFloat();
34563 }
34564 else
34565 {
34566 activeSound.Position = base.Center;
34567 }
34568 float num = counterMax - 15f;
34569 if (fakeCounter > num)
34570 {
34571 alpha += 25;
34572 if (alpha > 255)
34573 {
34574 alpha = 255;
34575 }
34576 }
34577 else
34578 {
34579 alpha -= 25;
34580 if (alpha < 50)
34581 {
34582 alpha = 50;
34583 }
34584 }
34585 if (fakeCounter >= counterMax - 1f)
34586 {
34587 Kill();
34588 return;
34589 }
34590 if (variation == 0)
34591 {
34592 velocity *= 0.98f;
34593 direction = (spriteDirection = ((velocity.X > 0f) ? 1 : (-1)));
34594 rotation = velocity.ToRotation();
34595 if (spriteDirection == -1)
34596 {
34597 rotation += (float)Math.PI;
34598 }
34599 }
34600 if (variation == 1)
34601 {
34602 float num2 = 70f;
34603 direction = (spriteDirection = ((velocity.X > 0f) ? 1 : (-1)));
34604 if (velocity.Length() > 0.1f)
34605 {
34606 velocity *= 0.95f;
34607 }
34608 num2 *= (float)direction;
34609 Vector2 vector = base.Center - rotation.ToRotationVector2() * num2;
34610 float num3 = Utils.Remap(fromValue, 0.3f, 0.5f, 0f, 1f) * Utils.Remap(fromValue, 0.45f, 0.5f, 1f, 0f);
34611 float num4 = Utils.Remap(fromValue, 0.5f, 0.55f, 0f, 1f) * Utils.Remap(fromValue, 0.5f, 1f, 1f, 0f);
34612 float num5 = num3 * (float)Math.PI * 1f / 60f;
34613 num5 += num4 * -(float)Math.PI * 8f / 60f;
34614 rotation += num5 * (float)(-direction);
34615 rotation = MathHelper.WrapAngle(rotation);
34616 base.Center = vector + rotation.ToRotationVector2() * num2;
34617 }
34618 if (variation == 2)
34619 {
34620 float f = ai[1];
34621 float num6 = Utils.Remap(fromValue, 0f, 0.4f, 1f, 0f);
34622 float num7 = Utils.Remap(fromValue, 0.3f, 0.4f, 0f, 1f) * Utils.Remap(fromValue, 0.4f, 1f, 1f, 0f);
34623 float num8 = num6 * 2f + num7 * 8f + 0.01f;
34624 velocity = f.ToRotationVector2() * num8;
34625 direction = (spriteDirection = ((velocity.X > 0f) ? 1 : (-1)));
34626 rotation = velocity.ToRotation();
34627 if (spriteDirection == -1)
34628 {
34629 rotation += (float)Math.PI;
34630 }
34631 }
34632 if (variation == 3)
34633 {
34634 float num9 = ai[1];
34635 velocity = velocity.RotatedBy(num9);
34636 direction = (spriteDirection = ((velocity.X > 0f) ? 1 : (-1)));
34637 rotation = velocity.ToRotation();
34638 if (spriteDirection == -1)
34639 {
34640 rotation += (float)Math.PI;
34641 }
34642 }
34643 ai[0] += 1f;
34644 }
34645
34647 {
34648 fakeCounter = ai[0];
34649 variation = 0;
34650 float num = 0f;
34651 float num2 = (counterMax = 180f);
34652 if (fakeCounter >= num && fakeCounter < num2)
34653 {
34654 variation = 0;
34655 counterMax = num2;
34656 return;
34657 }
34658 num = num2;
34659 num2 += 120f;
34660 if (fakeCounter >= num && fakeCounter < num2)
34661 {
34662 variation = 1;
34663 fakeCounter -= num;
34664 counterMax = num2 - num;
34665 return;
34666 }
34667 num = num2;
34668 num2 += 90f;
34669 if (fakeCounter >= num && fakeCounter < num2)
34670 {
34671 variation = 2;
34672 fakeCounter -= num;
34673 counterMax = num2 - num;
34674 }
34675 num = num2;
34676 num2 += 90f;
34677 if (fakeCounter >= num && fakeCounter < num2)
34678 {
34679 variation = 3;
34680 fakeCounter -= num;
34681 counterMax = num2 - num;
34682 }
34683 }
34684
34685 private void AI_185_LifeDrain()
34686 {
34687 if (Main.myPlayer != owner || localAI[0] != 0f)
34688 {
34689 return;
34690 }
34691 Player player = Main.player[owner];
34692 bool flag = false;
34693 for (int i = 0; i < 200; i++)
34694 {
34695 NPC nPC = Main.npc[i];
34696 if (nPC.active && !nPC.townNPC && !nPC.dontTakeDamage && !nPC.friendly && base.Hitbox.Intersects(nPC.Hitbox))
34697 {
34698 flag = true;
34699 break;
34700 }
34701 }
34702 if (!flag)
34703 {
34704 for (int j = 0; j < 255; j++)
34705 {
34707 if (player2.active && player2.whoAmI != player.whoAmI && player2.hostile && !player2.immune && !player2.dead && player2.team != player.team && base.Hitbox.Intersects(player2.Hitbox))
34708 {
34709 flag = true;
34710 break;
34711 }
34712 }
34713 }
34714 if (flag)
34715 {
34716 player.CheckMana(player.inventory[player.selectedItem].mana, pay: true);
34717 localAI[0] = 1f;
34718 }
34719 }
34720
34722 {
34723 float num = 60f;
34724 ai[0] += 1f;
34725 if (ai[0] >= num)
34726 {
34727 Kill();
34728 return;
34729 }
34730 Opacity = Utils.Remap(ai[0], 0f, num, 1f, 0f);
34731 float num2 = ai[0] / num;
34732 float num3 = 1f - (1f - num2) * (1f - num2);
34733 float num4 = 1f - (1f - num3) * (1f - num3);
34734 float num5 = Utils.Remap(ai[0], num - 15f, num, 0f, 1f);
34735 float num6 = num5 * num5;
34736 float num7 = 1f - num6;
34737 scale = (0.4f + 0.6f * num4) * num7;
34738 float num8 = Utils.Remap(ai[0], 20f, num, 0f, 1f);
34739 float num9 = 1f - (1f - num8) * (1f - num8);
34740 float num10 = 1f - (1f - num9) * (1f - num9);
34741 localAI[0] = (0.4f + 0.6f * num10) * num7;
34742 int num11 = width / 2;
34743 Color newColor = Main.hslToRgb(0.92f, 1f, 0.5f) * Opacity;
34744 float num12 = 6f;
34745 float num13 = 2f;
34746 if (num2 < 0.9f)
34747 {
34748 for (int i = 0; i < 3; i++)
34749 {
34750 if (Main.rand.Next(2) == 0)
34751 {
34752 Vector2 vector = Vector2.UnitX.RotatedBy(Main.rand.NextFloat() * ((float)Math.PI * 2f));
34753 Vector2 vector2 = vector * ((float)num11 * scale);
34754 Vector2 vector3 = base.Center + vector2;
34755 Vector2 vector4 = vector.RotatedBy(0.7853981852531433);
34756 vector3 += vector4 * num12;
34757 int num14 = Dust.NewDust(vector3, 0, 0, 267, 0f, 0f, 0, newColor);
34758 Main.dust[num14].position = vector3;
34759 Main.dust[num14].noGravity = true;
34760 Main.dust[num14].scale = 0.3f;
34761 Main.dust[num14].fadeIn = Main.rand.NextFloat() * 1.2f * scale;
34762 Main.dust[num14].velocity = vector4 * scale * (0f - num13);
34763 Main.dust[num14].scale *= scale;
34764 Main.dust[num14].velocity += velocity * 0.5f;
34765 Main.dust[num14].position += Main.dust[num14].velocity * -5f;
34766 if (num14 != 6000)
34767 {
34768 Dust dust = Dust.CloneDust(num14);
34769 dust.scale /= 2f;
34770 dust.fadeIn *= 0.85f;
34771 dust.color = new Color(255, 255, 255, 255);
34772 }
34773 }
34774 }
34775 }
34776 if (num2 < 0.9f)
34777 {
34778 for (int j = 0; j < 3; j++)
34779 {
34780 if (Main.rand.Next(2) == 0)
34781 {
34782 Vector2 vector5 = Vector2.UnitX.RotatedBy(Main.rand.NextFloat() * ((float)Math.PI * 2f));
34783 Vector2 vector6 = vector5 * ((float)num11 * scale);
34784 Vector2 vector7 = base.Center + vector6;
34785 Vector2 vector8 = vector5.RotatedBy(0.7853981852531433);
34786 vector7 += vector8 * (0f - num12);
34787 int num15 = Dust.NewDust(vector7, 0, 0, 267, 0f, 0f, 0, newColor);
34788 Main.dust[num15].position = vector7;
34789 Main.dust[num15].noGravity = true;
34790 Main.dust[num15].scale = 0.3f;
34791 Main.dust[num15].fadeIn = Main.rand.NextFloat() * 1.2f * scale;
34792 Main.dust[num15].velocity = vector8 * scale * num13;
34793 Main.dust[num15].scale *= scale;
34794 Main.dust[num15].velocity = velocity * 0.5f;
34795 if (num15 != 6000)
34796 {
34798 dust2.scale /= 2f;
34799 dust2.fadeIn *= 0.85f;
34800 dust2.color = new Color(255, 255, 255, 255);
34801 }
34802 }
34803 }
34804 }
34805 if (num2 < 0.95f)
34806 {
34807 for (float num16 = 0f; num16 < 0.8f; num16 += 1f)
34808 {
34809 if (Main.rand.Next(4) == 0)
34810 {
34811 Vector2 vector9 = Vector2.UnitX.RotatedBy(Main.rand.NextFloat() * ((float)Math.PI * 2f) + (float)Math.PI / 2f) * ((float)num11 * scale);
34812 Vector2 positionInWorld = base.Center + vector9;
34814 {
34815 PositionInWorld = positionInWorld,
34816 MovementVector = velocity
34817 }, owner);
34818 }
34819 }
34820 }
34821 if (ai[0] == num - 10f)
34822 {
34823 for (float num17 = 0f; num17 < 1f; num17 += 0.25f)
34824 {
34825 Vector2 vector10 = Vector2.UnitX.RotatedBy((float)Math.PI * 2f * num17);
34826 _ = vector10 * ((float)num11 * scale);
34827 Vector2 center = base.Center;
34828 float num18 = 1f;
34830 {
34831 PositionInWorld = center,
34832 MovementVector = vector10 * num18
34833 }, owner);
34835 {
34836 PositionInWorld = center,
34837 MovementVector = vector10 * num18 * 2f
34838 }, owner);
34839 }
34840 }
34841 }
34842
34843 private void AI_184_BadTorchLuck()
34844 {
34845 owner = 255;
34846 if (Main.player[Main.myPlayer].unlockedBiomeTorches)
34847 {
34848 damage = 0;
34849 }
34850 if (localAI[0] == 0f)
34851 {
34852 localAI[0] = 1f;
34854 }
34855 if (ai[1] > 0f)
34856 {
34857 ai[1] -= velocity.Length();
34858 }
34859 else
34860 {
34861 tileCollide = true;
34862 }
34863 int num = (int)ai[0];
34864 float num2 = 4f;
34865 for (float num3 = 0f; num3 < num2; num3 += 1f)
34866 {
34867 int num4 = Dust.NewDust(position + velocity / num2 * num3, 4, 4, num, 0f, 0f, 100);
34868 if (Main.rand.Next(3) != 0)
34869 {
34870 Main.dust[num4].noGravity = true;
34871 }
34872 Main.dust[num4].velocity *= 0.3f;
34873 if (num == 66)
34874 {
34875 Main.dust[num4].color = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB);
34876 Main.dust[num4].noGravity = true;
34877 }
34878 }
34879 }
34880
34882 {
34883 Player player = Main.player[owner];
34884 if ((int)Main.timeForVisualEffects % 120 == 0)
34885 {
34886 netUpdate = true;
34887 }
34888 if (!player.active)
34889 {
34890 active = false;
34891 return;
34892 }
34893 bool num = type == 625;
34894 bool flag = type == 625 || type == 626 || type == 627 || type == 628;
34895 int num2 = 10;
34896 if (flag)
34897 {
34898 if (player.dead)
34899 {
34900 player.stardustDragon = false;
34901 }
34902 if (player.stardustDragon)
34903 {
34904 timeLeft = 2;
34905 }
34906 num2 = 30;
34907 if (Main.rand.Next(30) == 0)
34908 {
34909 int num3 = Dust.NewDust(position, width, height, 135, 0f, 0f, 0, default(Color), 2f);
34910 Main.dust[num3].noGravity = true;
34911 Main.dust[num3].fadeIn = 2f;
34912 Point point = Main.dust[num3].position.ToTileCoordinates();
34913 if (WorldGen.InWorld(point.X, point.Y, 5) && WorldGen.SolidTile(point.X, point.Y))
34914 {
34915 Main.dust[num3].noLight = true;
34916 }
34917 }
34918 }
34919 if (num)
34920 {
34921 Vector2 center = player.Center;
34922 float num4 = 700f;
34923 float num5 = 1000f;
34924 int num6 = -1;
34925 if (Distance(center) > 2000f)
34926 {
34927 base.Center = center;
34928 netUpdate = true;
34929 }
34930 if (true)
34931 {
34932 NPC ownerMinionAttackTargetNPC = OwnerMinionAttackTargetNPC;
34933 if (ownerMinionAttackTargetNPC != null && ownerMinionAttackTargetNPC.CanBeChasedBy(this))
34934 {
34935 float num7 = Distance(ownerMinionAttackTargetNPC.Center);
34936 if (num7 < num4 * 2f)
34937 {
34940 {
34942 }
34943 else
34944 {
34946 }
34947 }
34948 }
34949 if (num6 < 0)
34950 {
34951 for (int i = 0; i < 200; i++)
34952 {
34953 NPC nPC = Main.npc[i];
34954 if (nPC.CanBeChasedBy(this) && player.Distance(nPC.Center) < num5)
34955 {
34956 float num8 = Distance(nPC.Center);
34957 if (num8 < num4)
34958 {
34959 num6 = i;
34960 _ = nPC.boss;
34961 }
34962 }
34963 }
34964 }
34965 }
34966 if (num6 != -1)
34967 {
34968 NPC nPC2 = Main.npc[num6];
34969 Vector2 vector = nPC2.Center - base.Center;
34970 (vector.X > 0f).ToDirectionInt();
34971 (vector.Y > 0f).ToDirectionInt();
34972 float num9 = 0.4f;
34973 if (vector.Length() < 600f)
34974 {
34975 num9 = 0.6f;
34976 }
34977 if (vector.Length() < 300f)
34978 {
34979 num9 = 0.8f;
34980 }
34981 if (vector.Length() > nPC2.Size.Length() * 0.75f)
34982 {
34983 velocity += Vector2.Normalize(vector) * num9 * 1.5f;
34984 if (Vector2.Dot(velocity, vector) < 0.25f)
34985 {
34986 velocity *= 0.8f;
34987 }
34988 }
34989 float num10 = 30f;
34990 if (velocity.Length() > num10)
34991 {
34992 velocity = Vector2.Normalize(velocity) * num10;
34993 }
34994 }
34995 else
34996 {
34997 float num11 = 0.2f;
34998 Vector2 vector2 = center - base.Center;
34999 if (vector2.Length() < 200f)
35000 {
35001 num11 = 0.12f;
35002 }
35003 if (vector2.Length() < 140f)
35004 {
35005 num11 = 0.06f;
35006 }
35007 if (vector2.Length() > 100f)
35008 {
35009 if (Math.Abs(center.X - base.Center.X) > 20f)
35010 {
35011 velocity.X += num11 * (float)Math.Sign(center.X - base.Center.X);
35012 }
35013 if (Math.Abs(center.Y - base.Center.Y) > 10f)
35014 {
35015 velocity.Y += num11 * (float)Math.Sign(center.Y - base.Center.Y);
35016 }
35017 }
35018 else if (velocity.Length() > 2f)
35019 {
35020 velocity *= 0.96f;
35021 }
35022 if (Math.Abs(velocity.Y) < 1f)
35023 {
35024 velocity.Y -= 0.1f;
35025 }
35026 float num12 = 15f;
35027 if (velocity.Length() > num12)
35028 {
35029 velocity = Vector2.Normalize(velocity) * num12;
35030 }
35031 }
35032 rotation = velocity.ToRotation() + (float)Math.PI / 2f;
35033 int num13 = direction;
35034 direction = (spriteDirection = ((velocity.X > 0f) ? 1 : (-1)));
35035 if (num13 != direction)
35036 {
35037 netUpdate = true;
35038 }
35039 float num14 = MathHelper.Clamp(localAI[0], 0f, 50f);
35040 position = base.Center;
35041 scale = 1f + num14 * 0.01f;
35042 width = (height = (int)((float)num2 * scale));
35043 base.Center = position;
35044 if (alpha > 0)
35045 {
35046 for (int j = 0; j < 2; j++)
35047 {
35048 int num15 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 135, 0f, 0f, 100, default(Color), 2f);
35049 Main.dust[num15].noGravity = true;
35050 Main.dust[num15].noLight = true;
35051 }
35052 alpha -= 42;
35053 if (alpha < 0)
35054 {
35055 alpha = 0;
35056 }
35057 }
35058 }
35059 else
35060 {
35061 bool flag2 = false;
35063 _ = Vector2.Zero;
35064 float num16 = 0f;
35065 float num17 = 0f;
35066 float num18 = 1f;
35067 if (ai[1] == 1f)
35068 {
35069 ai[1] = 0f;
35070 netUpdate = true;
35071 }
35072 int byUUID = GetByUUID(owner, (int)ai[0]);
35073 if (Main.projectile.IndexInRange(byUUID))
35074 {
35075 Projectile projectile = Main.projectile[byUUID];
35076 if (flag && projectile.active && (projectile.type == 625 || projectile.type == 626 || projectile.type == 627))
35077 {
35078 flag2 = true;
35079 vector3 = projectile.Center;
35080 _ = projectile.velocity;
35081 num16 = projectile.rotation;
35082 num18 = MathHelper.Clamp(projectile.scale, 0f, 50f);
35083 num17 = 16f;
35084 _ = projectile.alpha;
35085 projectile.localAI[0] = localAI[0] + 1f;
35086 if (projectile.type != 625)
35087 {
35088 projectile.localAI[1] = whoAmI;
35089 }
35090 if (owner == Main.myPlayer && type == 628 && projectile.type == 625)
35091 {
35092 projectile.Kill();
35093 Kill();
35094 return;
35095 }
35096 }
35097 }
35098 if (!flag2)
35099 {
35100 for (int k = 0; k < 1000; k++)
35101 {
35103 if (projectile2.active && projectile2.owner == owner && ProjectileID.Sets.StardustDragon[projectile2.type] && projectile2.localAI[1] == ai[0])
35104 {
35105 ai[0] = projectile2.projUUID;
35106 projectile2.localAI[1] = whoAmI;
35107 netUpdate = true;
35108 }
35109 }
35110 return;
35111 }
35112 if (alpha > 0)
35113 {
35114 for (int l = 0; l < 2; l++)
35115 {
35116 int num19 = Dust.NewDust(position, width, height, 135, 0f, 0f, 100, default(Color), 2f);
35117 Main.dust[num19].noGravity = true;
35118 Main.dust[num19].noLight = true;
35119 }
35120 }
35121 alpha -= 42;
35122 if (alpha < 0)
35123 {
35124 alpha = 0;
35125 }
35126 velocity = Vector2.Zero;
35127 Vector2 vector4 = vector3 - base.Center;
35128 if (num16 != rotation)
35129 {
35130 float num20 = MathHelper.WrapAngle(num16 - rotation);
35131 vector4 = vector4.RotatedBy(num20 * 0.1f);
35132 }
35133 rotation = vector4.ToRotation() + (float)Math.PI / 2f;
35134 position = base.Center;
35135 scale = num18;
35136 width = (height = (int)((float)num2 * scale));
35137 base.Center = position;
35138 if (vector4 != Vector2.Zero)
35139 {
35140 base.Center = vector3 - Vector2.Normalize(vector4) * num17 * num18;
35141 }
35142 spriteDirection = ((vector4.X > 0f) ? 1 : (-1));
35143 }
35144 position.X = MathHelper.Clamp(position.X, 160f, Main.maxTilesX * 16 - 160);
35145 position.Y = MathHelper.Clamp(position.Y, 160f, Main.maxTilesY * 16 - 160);
35146 }
35147
35149 {
35150 for (int i = 0; i < 1000; i++)
35151 {
35152 Projectile projectile = Main.projectile[i];
35153 if (projectile.active && projectile.owner == owner && projectile.type == 625)
35154 {
35155 return projectile;
35156 }
35157 }
35158 return null;
35159 }
35160
35162 {
35163 velocity.X *= 0.2f;
35164 velocity.Y = 0f;
35165 spriteDirection = (direction = 1);
35166 if (velocity.X < 0f)
35167 {
35168 spriteDirection = (direction = -1);
35169 }
35170 frame++;
35171 if (frame >= Main.projFrames[type])
35172 {
35173 frame = Main.projFrames[type] - 1;
35174 }
35175 }
35176
35177 private void AI_182_FinalFractal()
35178 {
35179 if (type == 933 && localAI[1] == 0f)
35180 {
35181 localAI[1] = 1f;
35183 }
35184 Player player = Main.player[owner];
35186 float lerpValue = Utils.GetLerpValue(900f, 0f, velocity.Length() * 2f, clamped: true);
35187 float num = MathHelper.Lerp(0.7f, 2f, lerpValue);
35188 localAI[0] += num;
35189 if (localAI[0] >= 120f)
35190 {
35191 Kill();
35192 return;
35193 }
35194 float lerpValue2 = Utils.GetLerpValue(0f, 1f, localAI[0] / 60f, clamped: true);
35195 float num2 = localAI[0] / 60f;
35196 float num3 = ai[0];
35197 float num4 = velocity.ToRotation();
35198 float num5 = (float)Math.PI;
35199 float num6 = ((velocity.X > 0f) ? 1 : (-1));
35200 float num7 = num5 + num6 * lerpValue2 * ((float)Math.PI * 2f);
35201 float num8 = velocity.Length() + Utils.GetLerpValue(0.5f, 1f, lerpValue2, clamped: true) * 40f;
35202 float num9 = 60f;
35203 if (num8 < num9)
35204 {
35205 num8 = num9;
35206 }
35207 Vector2 vector = mountedCenter + velocity;
35208 Vector2 spinningpoint = new Vector2(1f, 0f).RotatedBy(num7) * new Vector2(num8, num3 * MathHelper.Lerp(2f, 1f, lerpValue));
35209 Vector2 vector2 = vector + spinningpoint.RotatedBy(num4);
35210 Vector2 vector3 = (1f - Utils.GetLerpValue(0f, 0.5f, lerpValue2, clamped: true)) * new Vector2((float)((velocity.X > 0f) ? 1 : (-1)) * (0f - num8) * 0.1f, (0f - ai[0]) * 0.3f);
35211 float num10 = num7 + num4;
35212 rotation = num10 + (float)Math.PI / 2f;
35213 base.Center = vector2 + vector3;
35214 spriteDirection = (direction = ((velocity.X > 0f) ? 1 : (-1)));
35215 if (num3 < 0f)
35216 {
35217 rotation = num5 + num6 * lerpValue2 * ((float)Math.PI * -2f) + num4;
35218 rotation += (float)Math.PI / 2f;
35219 spriteDirection = (direction = ((!(velocity.X > 0f)) ? 1 : (-1)));
35220 }
35221 if (num2 < 1f)
35222 {
35224 Vector2 vector4 = (rotation - (float)Math.PI / 2f).ToRotationVector2();
35225 Vector2 center = base.Center;
35226 int num11 = 1 + (int)(velocity.Length() / 100f);
35227 num11 = (int)((float)num11 * Utils.GetLerpValue(0f, 0.5f, lerpValue2, clamped: true) * Utils.GetLerpValue(1f, 0.5f, lerpValue2, clamped: true));
35228 if (num11 < 1)
35229 {
35230 num11 = 1;
35231 }
35232 for (int i = 0; i < num11; i++)
35233 {
35234 finalFractalProfile.dustMethod(center + vector4 * finalFractalProfile.trailWidth * MathHelper.Lerp(0.5f, 1f, Main.rand.NextFloat()), rotation - (float)Math.PI / 2f + (float)Math.PI / 2f * (float)spriteDirection, player.velocity);
35235 }
35236 Vector3 vector5 = finalFractalProfile.trailColor.ToVector3();
35238 Lighting.AddLight(base.Center, vector5 * 0.5f * Opacity);
35239 Lighting.AddLight(mountedCenter, vector6 * Opacity * 0.15f);
35240 }
35241 Opacity = Utils.GetLerpValue(0f, 5f, localAI[0], clamped: true) * Utils.GetLerpValue(120f, 115f, localAI[0], clamped: true);
35242 }
35243
35245 {
35246 ai[0] += 1f;
35247 alpha = (int)MathHelper.Lerp(255f, 0f, Utils.GetLerpValue(0f, 10f, ai[0], clamped: true));
35248 rotation = velocity.ToRotation();
35249 if (Main.rand.Next(6) == 0)
35250 {
35251 Dust dust = Dust.NewDustPerfect(base.Center, 267);
35252 dust.fadeIn = 1f;
35253 dust.noGravity = true;
35254 dust.alpha = 100;
35255 dust.color = GetFairyQueenWeaponsColor(1f, Main.rand.NextFloat() * 0.4f);
35256 dust.noLightEmittence = true;
35257 dust.scale *= 1.5f;
35258 }
35259 }
35260
35262 {
35263 if (type == 491)
35264 {
35265 AI_009_MagicMissiles_Old();
35266 return;
35267 }
35268 int num = 32;
35269 Player player = Main.player[owner];
35270 int num2 = Main.maxTilesY * 16;
35271 int num3 = 0;
35272 if (ai[0] >= 0f)
35273 {
35274 num3 = (int)(ai[1] / (float)num2);
35275 }
35276 bool flag = ai[0] == -1f || ai[0] == -2f;
35277 if (type == 34)
35278 {
35279 if (frameCounter++ >= 4)
35280 {
35281 frameCounter = 0;
35282 if (++frame >= Main.projFrames[type])
35283 {
35284 frame = 0;
35285 }
35286 }
35287 if (penetrate == 1 && ai[0] >= 0f && num3 == 0)
35288 {
35289 ai[1] += num2;
35290 num3 = 1;
35291 netUpdate = true;
35292 }
35293 if (penetrate == 1 && ai[0] == -1f)
35294 {
35295 ai[0] = -2f;
35296 netUpdate = true;
35297 }
35298 if (num3 > 0 || ai[0] == -2f)
35299 {
35300 localAI[0] += 1f;
35301 }
35302 }
35303 if (owner == Main.myPlayer)
35304 {
35305 if (ai[0] >= 0f)
35306 {
35307 if (player.channel && player.HeldItem.shoot == type)
35308 {
35311 if (ai[0] != pointPoisition.X || ai[1] != pointPoisition.Y)
35312 {
35313 netUpdate = true;
35314 ai[0] = pointPoisition.X;
35315 ai[1] = pointPoisition.Y + (float)(num2 * num3);
35316 }
35317 }
35318 else
35319 {
35320 netUpdate = true;
35321 ai[0] = -1f;
35322 ai[1] = -1f;
35323 int num4 = FindTargetWithLineOfSight();
35324 if (num4 != -1)
35325 {
35326 ai[1] = num4;
35327 }
35328 else if (velocity.Length() < 2f)
35329 {
35330 velocity = DirectionFrom(player.Center) * num;
35331 }
35332 else
35333 {
35334 velocity = velocity.SafeNormalize(Vector2.Zero) * num;
35335 }
35336 }
35337 }
35338 if (flag && ai[1] == -1f)
35339 {
35340 int num5 = FindTargetWithLineOfSight();
35341 if (num5 != -1)
35342 {
35343 ai[1] = num5;
35344 netUpdate = true;
35345 }
35346 }
35347 }
35348 Vector2? vector = null;
35349 float amount = 1f;
35350 if (ai[0] > 0f && ai[1] > 0f)
35351 {
35352 vector = new Vector2(ai[0], ai[1] % (float)num2);
35353 }
35354 if (flag && ai[1] >= 0f)
35355 {
35356 int num6 = (int)ai[1];
35357 if (Main.npc.IndexInRange(num6))
35358 {
35359 NPC nPC = Main.npc[num6];
35360 if (nPC.CanBeChasedBy(this))
35361 {
35362 vector = nPC.Center;
35363 float t = Distance(vector.Value);
35364 float num7 = Utils.GetLerpValue(0f, 100f, t, clamped: true) * Utils.GetLerpValue(600f, 400f, t, clamped: true);
35365 amount = MathHelper.Lerp(0f, 0.2f, Utils.GetLerpValue(200f, 20f, 1f - num7, clamped: true));
35366 }
35367 else
35368 {
35369 ai[1] = -1f;
35370 netUpdate = true;
35371 }
35372 }
35373 }
35374 bool flag2 = false;
35375 if (flag)
35376 {
35377 flag2 = true;
35378 }
35379 if (vector.HasValue)
35380 {
35381 Vector2 value = vector.Value;
35382 if (Distance(value) >= 64f)
35383 {
35384 flag2 = true;
35385 Vector2 v = value - base.Center;
35386 Vector2 vector2 = v.SafeNormalize(Vector2.Zero);
35387 float num8 = Math.Min(num, v.Length());
35389 if (velocity.Length() < 4f)
35390 {
35391 velocity += velocity.SafeNormalize(Vector2.Zero).RotatedBy(0.7853981852531433).SafeNormalize(Vector2.Zero) * 4f;
35392 }
35393 if (velocity.HasNaNs())
35394 {
35395 Kill();
35396 }
35397 velocity = Vector2.Lerp(velocity, value2, amount);
35398 }
35399 else
35400 {
35401 velocity *= 0.3f;
35402 velocity += (value - base.Center) * 0.3f;
35403 flag2 = velocity.Length() >= 2f;
35404 }
35405 if (timeLeft < 60)
35406 {
35407 timeLeft = 60;
35408 }
35409 }
35410 if (flag && ai[1] < 0f)
35411 {
35412 if (velocity.Length() != (float)num)
35413 {
35414 velocity = velocity.MoveTowards(velocity.SafeNormalize(Vector2.UnitY) * num, 4f);
35415 }
35416 if (timeLeft > 300)
35417 {
35418 timeLeft = 300;
35419 }
35420 }
35421 if (flag2 && velocity != Vector2.Zero)
35422 {
35423 rotation = rotation.AngleTowards(velocity.ToRotation(), (float)Math.PI / 4f);
35424 }
35425 else
35426 {
35427 rotation = rotation.AngleLerp(0f, 0.2f);
35428 }
35429 bool flag3 = velocity.Length() > 0.1f && Vector2.Dot(oldVelocity.SafeNormalize(Vector2.Zero), velocity.SafeNormalize(Vector2.Zero)) < 0.2f;
35430 if (type == 16)
35431 {
35432 if (soundDelay == 0 && Math.Abs(velocity.X) + Math.Abs(velocity.Y) > 2f)
35433 {
35434 soundDelay = 10;
35436 }
35437 if (Main.rand.Next(9) == 0)
35438 {
35439 int num9 = Dust.NewDust(position, width, height, 15, 0f, 0f, 100, default(Color), 2f);
35440 Main.dust[num9].velocity *= 0.3f;
35441 Main.dust[num9].position.X = position.X + (float)(width / 2) + 4f + (float)Main.rand.Next(-4, 5);
35442 Main.dust[num9].position.Y = position.Y + (float)(height / 2) + (float)Main.rand.Next(-4, 5);
35443 Main.dust[num9].noGravity = true;
35444 Main.dust[num9].velocity += Main.rand.NextVector2Circular(2f, 2f);
35445 }
35446 if (flag3)
35447 {
35448 int num10 = Main.rand.Next(2, 5);
35449 for (int i = 0; i < num10; i++)
35450 {
35451 Dust dust = Dust.NewDustDirect(position, width, height, 15, 0f, 0f, 100, default(Color), 1.5f);
35452 dust.velocity *= 0.3f;
35453 dust.position = base.Center;
35454 dust.noGravity = true;
35455 dust.velocity += Main.rand.NextVector2Circular(0.5f, 0.5f);
35456 dust.fadeIn = 2.2f;
35457 }
35458 }
35459 }
35460 if (type != 34)
35461 {
35462 return;
35463 }
35464 float lerpValue = Utils.GetLerpValue(0f, 10f, localAI[0], clamped: true);
35466 if (Main.rand.Next(6) == 0)
35467 {
35468 Dust dust2 = Dust.NewDustDirect(base.Center, 0, 0, 6, velocity.X * 0.2f, velocity.Y * 0.2f, 100, newColor, 3.5f);
35469 dust2.noGravity = true;
35470 dust2.velocity *= 1.4f;
35471 dust2.velocity += Main.rand.NextVector2Circular(1f, 1f);
35472 dust2.velocity += velocity * 0.15f;
35473 }
35474 if (Main.rand.Next(12) == 0)
35475 {
35476 Dust dust3 = Dust.NewDustDirect(base.Center, 0, 0, 6, velocity.X * 0.2f, velocity.Y * 0.2f, 100, newColor, 1.5f);
35477 dust3.velocity += Main.rand.NextVector2Circular(1f, 1f);
35478 dust3.velocity += velocity * 0.15f;
35479 }
35480 if (flag3)
35481 {
35482 int num11 = Main.rand.Next(2, 5 + (int)(lerpValue * 4f));
35483 for (int j = 0; j < num11; j++)
35484 {
35485 Dust dust4 = Dust.NewDustDirect(position, width, height, 6, 0f, 0f, 100, newColor, 1.5f);
35486 dust4.velocity *= 0.3f;
35487 dust4.position = base.Center;
35488 dust4.noGravity = true;
35489 dust4.velocity += Main.rand.NextVector2Circular(0.5f, 0.5f);
35490 dust4.fadeIn = 2.2f;
35491 dust4.position += (dust4.position - base.Center) * lerpValue * 10f;
35492 }
35493 }
35494 }
35495
35497 {
35498 if (Main.myPlayer == owner && ai[0] <= 0f)
35499 {
35500 if (Main.player[owner].channel && Main.player[owner].HeldItem.shoot == type)
35501 {
35502 float num = 12f;
35503 if (type == 16)
35504 {
35505 num = 15f;
35506 }
35507 if (type == 491)
35508 {
35509 num = 20f;
35510 }
35511 Vector2 vector = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
35513 Main.player[owner].LimitPointToPlayerReachableArea(ref pointPoisition);
35514 float num2 = pointPoisition.X - vector.X;
35515 float num3 = pointPoisition.Y - vector.Y;
35516 float num4 = (float)Math.Sqrt(num2 * num2 + num3 * num3);
35517 if (ai[0] < 0f)
35518 {
35519 ai[0] += 1f;
35520 }
35521 if (type == 491 && num4 < 100f)
35522 {
35523 if (velocity.Length() < num)
35524 {
35525 velocity *= 1.1f;
35526 if (velocity.Length() > num)
35527 {
35528 velocity.Normalize();
35529 velocity *= num;
35530 }
35531 }
35532 if (ai[0] == 0f)
35533 {
35534 ai[0] = -10f;
35535 }
35536 }
35537 else if (num4 > num)
35538 {
35539 num4 = num / num4;
35540 num2 *= num4;
35541 num3 *= num4;
35542 int num5 = (int)(num2 * 1000f);
35543 int num6 = (int)(velocity.X * 1000f);
35544 int num7 = (int)(num3 * 1000f);
35545 int num8 = (int)(velocity.Y * 1000f);
35546 if (num5 != num6 || num7 != num8)
35547 {
35548 netUpdate = true;
35549 }
35550 if (type == 491)
35551 {
35553 velocity = (velocity * 4f + vector2) / 5f;
35554 }
35555 else
35556 {
35557 velocity.X = num2;
35558 velocity.Y = num3;
35559 }
35560 }
35561 else
35562 {
35563 int num9 = (int)(num2 * 1000f);
35564 int num10 = (int)(velocity.X * 1000f);
35565 int num11 = (int)(num3 * 1000f);
35566 int num12 = (int)(velocity.Y * 1000f);
35567 if (num9 != num10 || num11 != num12)
35568 {
35569 netUpdate = true;
35570 }
35571 velocity.X = num2;
35572 velocity.Y = num3;
35573 }
35574 }
35575 else if (ai[0] <= 0f)
35576 {
35577 netUpdate = true;
35578 if (type != 491)
35579 {
35580 Vector2 vector3 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
35581 float num13 = (float)Main.mouseX + Main.screenPosition.X - vector3.X;
35582 float num14 = (float)Main.mouseY + Main.screenPosition.Y - vector3.Y;
35583 if (Main.player[owner].gravDir == -1f)
35584 {
35585 num14 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector3.Y;
35586 }
35587 float num15 = (float)Math.Sqrt(num13 * num13 + num14 * num14);
35588 if (num15 == 0f || ai[0] < 0f)
35589 {
35590 vector3 = new Vector2(Main.player[owner].position.X + (float)(Main.player[owner].width / 2), Main.player[owner].position.Y + (float)(Main.player[owner].height / 2));
35591 num13 = position.X + (float)width * 0.5f - vector3.X;
35592 num14 = position.Y + (float)height * 0.5f - vector3.Y;
35593 num15 = (float)Math.Sqrt(num13 * num13 + num14 * num14);
35594 }
35595 num15 = 12f / num15;
35596 num13 *= num15;
35597 num14 *= num15;
35598 velocity.X = num13;
35599 velocity.Y = num14;
35600 if (velocity.X == 0f && velocity.Y == 0f)
35601 {
35602 Kill();
35603 }
35604 }
35605 ai[0] = 1f;
35606 }
35607 }
35608 bool flag = false;
35609 if (type == 491)
35610 {
35611 localAI[0] += 1f;
35612 if (ai[0] > 0f && localAI[0] > 15f)
35613 {
35614 tileCollide = false;
35615 Vector2 vector4 = Main.player[owner].Center - base.Center;
35616 if (vector4.Length() < 20f)
35617 {
35618 Kill();
35619 }
35620 vector4.Normalize();
35621 vector4 *= 25f;
35622 velocity = (velocity * 5f + vector4) / 6f;
35623 }
35624 flag = true;
35625 if (ai[0] < 0f || (velocity.X == 0f && velocity.Y == 0f))
35626 {
35627 rotation += 0.3f;
35628 }
35629 else if (ai[0] > 0f)
35630 {
35631 rotation += 0.3f * (float)direction;
35632 }
35633 else
35634 {
35635 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 1.57f;
35636 }
35637 if (Vector2.Distance(base.Center, Main.player[owner].Center) > 2000f)
35638 {
35639 Kill();
35640 }
35641 if (Main.rand.Next(2) == 0)
35642 {
35643 int num16 = Main.rand.Next(3);
35644 int num17 = Dust.NewDust(position, width, height, num16 switch
35645 {
35646 0 => 15,
35647 1 => 57,
35648 _ => 58,
35649 }, velocity.X * 0.25f, velocity.Y * 0.25f, 255, default(Color), 0.7f);
35650 Main.dust[num17].velocity *= 0.25f;
35651 Main.dust[num17].position = (Main.dust[num17].position + position) / 2f;
35652 }
35653 }
35654 if (type == 79)
35655 {
35656 if (soundDelay == 0 && Math.Abs(velocity.X) + Math.Abs(velocity.Y) > 2f)
35657 {
35658 soundDelay = 10;
35660 }
35661 for (int i = 0; i < 1; i++)
35662 {
35663 int num18 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 66, 0f, 0f, 100, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 2.5f);
35664 Main.dust[num18].velocity *= 0.1f;
35665 Main.dust[num18].velocity += velocity * 0.2f;
35666 Main.dust[num18].position.X = position.X + (float)(width / 2) + 4f + (float)Main.rand.Next(-2, 3);
35667 Main.dust[num18].position.Y = position.Y + (float)(height / 2) + (float)Main.rand.Next(-2, 3);
35668 Main.dust[num18].noGravity = true;
35669 }
35670 }
35671 if (type == 16)
35672 {
35673 if (soundDelay == 0 && Math.Abs(velocity.X) + Math.Abs(velocity.Y) > 2f)
35674 {
35675 soundDelay = 10;
35677 }
35678 if (Main.rand.Next(9) == 0)
35679 {
35680 int num19 = Dust.NewDust(position, width, height, 15, 0f, 0f, 100, default(Color), 2f);
35681 Main.dust[num19].velocity *= 0.3f;
35682 Main.dust[num19].position.X = position.X + (float)(width / 2) + 4f + (float)Main.rand.Next(-4, 5);
35683 Main.dust[num19].position.Y = position.Y + (float)(height / 2) + (float)Main.rand.Next(-4, 5);
35684 Main.dust[num19].noGravity = true;
35685 Main.dust[num19].velocity += Main.rand.NextVector2Circular(2f, 2f);
35686 }
35687 flag = true;
35688 if (velocity != Vector2.Zero)
35689 {
35690 rotation = velocity.ToRotation();
35691 }
35692 }
35693 if (type == 34)
35694 {
35695 if (Main.rand.Next(12) == 0)
35696 {
35697 Dust dust = Dust.NewDustDirect(base.Center, 0, 0, 6, velocity.X * 0.2f, velocity.Y * 0.2f, 100, default(Color), 3.5f);
35698 dust.noGravity = true;
35699 dust.velocity *= 1.4f;
35700 dust.velocity += Main.rand.NextVector2Circular(1f, 1f);
35701 dust.velocity += velocity * 0.15f;
35702 }
35703 if (Main.rand.Next(24) == 0)
35704 {
35705 Dust dust2 = Dust.NewDustDirect(base.Center, 0, 0, 6, velocity.X * 0.2f, velocity.Y * 0.2f, 100, default(Color), 1.5f);
35706 dust2.velocity += Main.rand.NextVector2Circular(1f, 1f);
35707 dust2.velocity += velocity * 0.15f;
35708 }
35709 flag = true;
35710 if (velocity != Vector2.Zero)
35711 {
35712 rotation = velocity.ToRotation();
35713 }
35714 }
35715 if (!flag && velocity != Vector2.Zero)
35716 {
35717 rotation = velocity.ToRotation() - (float)Math.PI + (float)Math.PI / 4f;
35718 }
35719 if (velocity.Y > 16f)
35720 {
35721 velocity.Y = 16f;
35722 }
35723 }
35724
35726 {
35727 int num = 10;
35728 int num2 = 0;
35729 Vector2 vector = velocity;
35730 float num3 = 0.2f;
35731 if (ai[0] == 1f || ai[0] == 5f)
35732 {
35733 num3 = 0.4f;
35734 }
35735 if (ai[0] == 6f)
35736 {
35737 num3 = 0f;
35738 }
35739 if (lastVelocity.X != velocity.X)
35740 {
35741 if (Math.Abs(lastVelocity.X) > 4f)
35742 {
35743 num2 = 1;
35744 }
35745 velocity.X = (0f - lastVelocity.X) * num3;
35746 localAI[0] += 1f;
35747 }
35748 if (lastVelocity.Y != velocity.Y)
35749 {
35750 if (Math.Abs(lastVelocity.Y) > 4f)
35751 {
35752 num2 = 1;
35753 }
35754 velocity.Y = (0f - lastVelocity.Y) * num3;
35755 localAI[0] += 1f;
35756 }
35757 if (ai[0] == 1f)
35758 {
35759 ai[0] = 5f;
35760 localNPCHitCooldown = num;
35761 netUpdate = true;
35762 Point scanAreaStart = base.TopLeft.ToTileCoordinates();
35763 Point scanAreaEnd = base.BottomRight.ToTileCoordinates();
35764 num2 = 2;
35765 CreateImpactExplosion(2, base.Center, ref scanAreaStart, ref scanAreaEnd, width, out var causedShockwaves);
35766 CreateImpactExplosion2_FlailTileCollision(base.Center, causedShockwaves, vector);
35767 position -= vector;
35768 }
35769 if (num2 > 0)
35770 {
35771 netUpdate = true;
35772 for (int i = 0; i < num2; i++)
35773 {
35774 Collision.HitTiles(position, vector, width, height);
35775 }
35776 SoundEngine.PlaySound(0, (int)position.X, (int)position.Y);
35777 }
35778 if (ai[0] != 3f && ai[0] != 0f && ai[0] != 5f && ai[0] != 6f && localAI[0] >= 10f)
35779 {
35780 ai[0] = 4f;
35781 netUpdate = true;
35782 }
35783 if (wet)
35784 {
35785 wetVelocity = velocity;
35786 }
35787 }
35788
35790 {
35791 for (int i = 0; i < 200; i++)
35792 {
35793 localNPCImmunity[i] = 0;
35794 }
35795 }
35796
35797 private void AI_015_Flails()
35798 {
35799 Player player = Main.player[owner];
35800 if (!player.active || player.dead || player.noItems || player.CCed || Vector2.Distance(base.Center, player.Center) > 900f)
35801 {
35802 Kill();
35803 return;
35804 }
35805 if (Main.myPlayer == owner && Main.mapFullscreen)
35806 {
35807 Kill();
35808 return;
35809 }
35810 if (type == 948 && wet && !lavaWet)
35811 {
35812 type = 947;
35813 netUpdate = true;
35814 }
35816 bool doFastThrowDust = false;
35817 bool flag = true;
35818 bool flag2 = false;
35819 int num = 10;
35820 float num2 = 24f;
35821 float num3 = 800f;
35822 float num4 = 3f;
35823 float num5 = 16f;
35824 float num6 = 6f;
35825 float num7 = 48f;
35826 float num8 = 1f;
35827 float num9 = 14f;
35828 int num10 = 60;
35829 int num11 = 10;
35830 int num12 = 15;
35831 int num13 = 10;
35832 int num14 = num + 5;
35833 switch (type)
35834 {
35835 case 947:
35836 case 948:
35837 num = 13;
35838 num2 = 12f;
35839 num5 = 8f;
35840 num7 = 13f;
35841 break;
35842 case 25:
35843 num = 15;
35844 num2 = 14f;
35845 num5 = 10f;
35846 num7 = 15f;
35847 break;
35848 case 154:
35849 num = 15;
35850 num2 = 15f;
35851 num5 = 11f;
35852 num7 = 16f;
35853 break;
35854 case 26:
35855 num = 15;
35856 num2 = 16f;
35857 num5 = 12f;
35858 num7 = 16f;
35859 break;
35860 case 35:
35861 num = 15;
35862 num2 = 17f;
35863 num5 = 14f;
35864 num7 = 18f;
35865 break;
35866 case 63:
35867 num = 13;
35868 num2 = 21f;
35869 num5 = 20f;
35870 num7 = 24f;
35871 num12 = 12;
35872 break;
35873 case 757:
35874 num = 13;
35875 num2 = 22f;
35876 num5 = 22f;
35877 num7 = 26f;
35878 num12 = 12;
35879 break;
35880 case 247:
35881 num = 13;
35882 num2 = 23f;
35883 num12 = 12;
35884 break;
35885 }
35886 float meleeSpeed = player.meleeSpeed;
35887 float num15 = 1f / meleeSpeed;
35888 num2 *= num15;
35889 num8 *= num15;
35890 num9 *= num15;
35891 num4 *= num15;
35892 num5 *= num15;
35893 num6 *= num15;
35894 num7 *= num15;
35895 float num16 = num2 * (float)num;
35896 float num17 = num16 + 160f;
35897 localNPCHitCooldown = num11;
35898 switch ((int)ai[0])
35899 {
35900 case 0:
35901 {
35902 flag2 = true;
35903 if (owner == Main.myPlayer)
35904 {
35905 Vector2 origin = mountedCenter;
35907 Vector2 vector3 = origin.DirectionTo(mouseWorld).SafeNormalize(Vector2.UnitX * player.direction);
35908 player.ChangeDir((vector3.X > 0f) ? 1 : (-1));
35909 if (!player.channel)
35910 {
35911 ai[0] = 1f;
35912 ai[1] = 0f;
35913 velocity = vector3 * num2 + player.velocity;
35914 base.Center = mountedCenter;
35915 netUpdate = true;
35916 ResetLocalNPCHitImmunity();
35917 localNPCHitCooldown = num13;
35918 break;
35919 }
35920 }
35921 localAI[1] += 1f;
35922 Vector2 vector4 = new Vector2(player.direction).RotatedBy((float)Math.PI * 10f * (localAI[1] / 60f) * (float)player.direction);
35923 vector4.Y *= 0.8f;
35924 if (vector4.Y * player.gravDir > 0f)
35925 {
35926 vector4.Y *= 0.5f;
35927 }
35928 base.Center = mountedCenter + vector4 * 30f;
35929 velocity = Vector2.Zero;
35930 localNPCHitCooldown = num12;
35931 break;
35932 }
35933 case 1:
35934 {
35935 doFastThrowDust = true;
35936 bool flag3 = ai[1]++ >= (float)num;
35937 flag3 |= Distance(mountedCenter) >= num3;
35938 if (player.controlUseItem)
35939 {
35940 ai[0] = 6f;
35941 ai[1] = 0f;
35942 netUpdate = true;
35943 velocity *= 0.2f;
35944 if (Main.myPlayer == owner && type == 757)
35945 {
35946 NewProjectile(GetProjectileSource_FromThis(), base.Center, velocity, 928, damage, knockBack, Main.myPlayer);
35947 }
35948 break;
35949 }
35950 if (flag3)
35951 {
35952 ai[0] = 2f;
35953 ai[1] = 0f;
35954 netUpdate = true;
35955 velocity *= 0.3f;
35956 if (Main.myPlayer == owner && type == 757)
35957 {
35958 NewProjectile(GetProjectileSource_FromThis(), base.Center, velocity, 928, damage, knockBack, Main.myPlayer);
35959 }
35960 }
35961 player.ChangeDir((player.Center.X < base.Center.X) ? 1 : (-1));
35962 localNPCHitCooldown = num13;
35963 break;
35964 }
35965 case 2:
35966 {
35967 Vector2 vector = DirectionTo(mountedCenter).SafeNormalize(Vector2.Zero);
35968 if (Distance(mountedCenter) <= num5)
35969 {
35970 Kill();
35971 return;
35972 }
35973 if (player.controlUseItem)
35974 {
35975 ai[0] = 6f;
35976 ai[1] = 0f;
35977 netUpdate = true;
35978 velocity *= 0.2f;
35979 }
35980 else
35981 {
35982 velocity *= 0.98f;
35983 velocity = velocity.MoveTowards(vector * num5, num4);
35984 player.ChangeDir((player.Center.X < base.Center.X) ? 1 : (-1));
35985 }
35986 break;
35987 }
35988 case 3:
35989 {
35990 if (!player.controlUseItem)
35991 {
35992 ai[0] = 4f;
35993 ai[1] = 0f;
35994 netUpdate = true;
35995 break;
35996 }
35997 float num18 = Distance(mountedCenter);
35998 tileCollide = ai[1] == 1f;
35999 bool flag4 = num18 <= num16;
36000 if (flag4 != tileCollide)
36001 {
36002 tileCollide = flag4;
36003 ai[1] = (tileCollide ? 1 : 0);
36004 netUpdate = true;
36005 }
36006 if (num18 > (float)num10)
36007 {
36008 if (num18 >= num16)
36009 {
36010 velocity *= 0.5f;
36011 velocity = velocity.MoveTowards(DirectionTo(mountedCenter).SafeNormalize(Vector2.Zero) * num9, num9);
36012 }
36013 velocity *= 0.98f;
36014 velocity = velocity.MoveTowards(DirectionTo(mountedCenter).SafeNormalize(Vector2.Zero) * num9, num8);
36015 }
36016 else
36017 {
36018 if (velocity.Length() < 6f)
36019 {
36020 velocity.X *= 0.96f;
36021 velocity.Y += 0.2f;
36022 }
36023 if (player.velocity.X == 0f)
36024 {
36025 velocity.X *= 0.96f;
36026 }
36027 }
36028 player.ChangeDir((player.Center.X < base.Center.X) ? 1 : (-1));
36029 break;
36030 }
36031 case 4:
36032 {
36033 tileCollide = false;
36034 Vector2 vector2 = DirectionTo(mountedCenter).SafeNormalize(Vector2.Zero);
36035 if (Distance(mountedCenter) <= num7)
36036 {
36037 Kill();
36038 return;
36039 }
36040 velocity *= 0.98f;
36041 velocity = velocity.MoveTowards(vector2 * num7, num6);
36042 Vector2 target = base.Center + velocity;
36043 Vector2 value = mountedCenter.DirectionFrom(target).SafeNormalize(Vector2.Zero);
36044 if (Vector2.Dot(vector2, value) < 0f)
36045 {
36046 Kill();
36047 return;
36048 }
36049 player.ChangeDir((player.Center.X < base.Center.X) ? 1 : (-1));
36050 break;
36051 }
36052 case 5:
36053 if (ai[1]++ >= (float)num14)
36054 {
36055 ai[0] = 6f;
36056 ai[1] = 0f;
36057 netUpdate = true;
36058 }
36059 else
36060 {
36061 localNPCHitCooldown = num13;
36062 velocity.Y += 0.6f;
36063 velocity.X *= 0.95f;
36064 player.ChangeDir((player.Center.X < base.Center.X) ? 1 : (-1));
36065 }
36066 break;
36067 case 6:
36068 if (!player.controlUseItem || Distance(mountedCenter) > num17)
36069 {
36070 ai[0] = 4f;
36071 ai[1] = 0f;
36072 netUpdate = true;
36073 break;
36074 }
36075 if (!shimmerWet)
36076 {
36077 velocity.Y += 0.8f;
36078 }
36079 velocity.X *= 0.95f;
36080 player.ChangeDir((player.Center.X < base.Center.X) ? 1 : (-1));
36081 break;
36082 }
36083 int num19 = type;
36084 if (num19 == 247)
36085 {
36086 flag = false;
36087 float num20 = (Math.Abs(velocity.X) + Math.Abs(velocity.Y)) * 0.01f;
36088 rotation += ((velocity.X > 0f) ? num20 : (0f - num20));
36089 if (ai[0] == 0f)
36090 {
36091 rotation += (float)Math.PI * 2f / 15f * (float)player.direction;
36092 }
36093 float num21 = 600f;
36094 NPC nPC = null;
36095 if (owner == Main.myPlayer)
36096 {
36097 localAI[0] += 1f;
36098 if (localAI[0] >= 20f)
36099 {
36100 localAI[0] = 17f;
36101 for (int i = 0; i < 200; i++)
36102 {
36103 NPC nPC2 = Main.npc[i];
36104 if (nPC2.CanBeChasedBy(this))
36105 {
36106 float num22 = Distance(nPC2.Center);
36107 if (!(num22 >= num21) && Collision.CanHit(position, width, height, nPC2.position, nPC2.width, nPC2.height))
36108 {
36109 nPC = nPC2;
36110 num21 = num22;
36111 }
36112 }
36113 }
36114 }
36115 if (nPC != null)
36116 {
36117 localAI[0] = 0f;
36118 float num23 = 14f;
36119 Vector2 center = base.Center;
36120 Vector2 vector5 = center.DirectionTo(nPC.Center) * num23;
36121 NewProjectile(GetProjectileSource_FromThis(), center, vector5, 248, (int)((double)damage / 1.5), knockBack / 2f, Main.myPlayer);
36122 }
36123 }
36124 }
36125 direction = ((velocity.X > 0f) ? 1 : (-1));
36126 spriteDirection = direction;
36127 ownerHitCheck = flag2;
36128 if (flag)
36129 {
36130 if (velocity.Length() > 1f)
36131 {
36132 rotation = velocity.ToRotation() + velocity.X * 0.1f;
36133 }
36134 else
36135 {
36136 rotation += velocity.X * 0.1f;
36137 }
36138 }
36139 timeLeft = 2;
36140 player.heldProj = whoAmI;
36141 player.SetDummyItemTime(2);
36142 player.itemRotation = DirectionFrom(mountedCenter).ToRotation();
36143 if (base.Center.X < mountedCenter.X)
36144 {
36145 player.itemRotation += (float)Math.PI;
36146 }
36147 player.itemRotation = MathHelper.WrapAngle(player.itemRotation);
36148 AI_015_Flails_Dust(doFastThrowDust);
36149 }
36150
36152 {
36153 bool flag = false;
36154 if (lastVelocity.X != velocity.X)
36155 {
36156 if (Math.Abs(lastVelocity.X) > 4f)
36157 {
36158 flag = true;
36159 }
36160 position.X += velocity.X;
36161 velocity.X = (0f - lastVelocity.X) * 0.2f;
36162 }
36163 if (lastVelocity.Y != velocity.Y)
36164 {
36165 if (Math.Abs(lastVelocity.Y) > 4f)
36166 {
36167 flag = true;
36168 }
36169 position.Y += velocity.Y;
36170 velocity.Y = (0f - lastVelocity.Y) * 0.2f;
36171 }
36172 ai[0] = 1f;
36173 if (flag)
36174 {
36175 netUpdate = true;
36176 Collision.HitTiles(position, velocity, width, height);
36177 SoundEngine.PlaySound(0, (int)position.X, (int)position.Y);
36178 }
36179 if (wet)
36180 {
36181 wetVelocity = velocity;
36182 }
36183 }
36184
36185 private void AI_015_Flails_Old()
36186 {
36187 AI_015_Flails_Dust(doFastThrowDust: false);
36188 bool flag = Main.player[owner].dead;
36189 if (!flag)
36190 {
36191 flag = (Main.player[owner].Center - base.Center).Length() > 2000f;
36192 }
36193 if (flag)
36194 {
36195 Kill();
36196 return;
36197 }
36198 Main.player[owner].SetDummyItemTime(10);
36199 if (position.X + (float)(width / 2) > Main.player[owner].position.X + (float)(Main.player[owner].width / 2))
36200 {
36201 Main.player[owner].ChangeDir(1);
36202 direction = 1;
36203 }
36204 else
36205 {
36206 Main.player[owner].ChangeDir(-1);
36207 direction = -1;
36208 }
36209 Vector2 mountedCenter = Main.player[owner].MountedCenter;
36210 Vector2 vector = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
36211 float num = mountedCenter.X - vector.X;
36212 float num2 = mountedCenter.Y - vector.Y;
36213 float num3 = (float)Math.Sqrt(num * num + num2 * num2);
36214 if (ai[0] == 0f)
36215 {
36216 float num4 = 160f;
36217 if (type == 63)
36218 {
36219 num4 *= 1.5f;
36220 }
36221 if (type == 247)
36222 {
36223 num4 *= 1.5f;
36224 }
36225 if (type == 757)
36226 {
36227 num4 *= 1.5f;
36228 }
36229 tileCollide = true;
36230 if (num3 > num4)
36231 {
36232 ai[0] = 1f;
36233 netUpdate = true;
36234 }
36235 else if (!Main.player[owner].channel)
36236 {
36237 if (velocity.Y < 0f)
36238 {
36239 velocity.Y *= 0.9f;
36240 }
36241 velocity.Y += 1f;
36242 velocity.X *= 0.9f;
36243 }
36244 }
36245 else if (ai[0] == 1f)
36246 {
36247 float meleeSpeed = Main.player[owner].meleeSpeed;
36248 float num5 = 14f / meleeSpeed;
36249 float num6 = 0.9f / meleeSpeed;
36250 float num7 = 300f / meleeSpeed;
36251 int num8 = 60;
36252 if (type == 63)
36253 {
36254 num7 *= 1.5f;
36255 num5 *= 1.5f;
36256 num6 *= 1.5f;
36257 }
36258 if (type == 247)
36259 {
36260 num7 *= 1.5f;
36261 num5 = 15.9f;
36262 num6 *= 2f;
36263 num8 = 100;
36264 }
36265 if (type == 757)
36266 {
36267 num7 *= 1.5f;
36268 num5 = 15.9f;
36269 num6 *= 2f;
36270 num8 = 100;
36271 }
36272 Math.Abs(num);
36273 Math.Abs(num2);
36274 if (ai[1] == 1f)
36275 {
36276 tileCollide = false;
36277 }
36278 if (!Main.player[owner].channel || num3 > num7 || !tileCollide)
36279 {
36280 ai[1] = 1f;
36281 if (tileCollide)
36282 {
36283 netUpdate = true;
36284 }
36285 tileCollide = false;
36286 if (num3 < 20f)
36287 {
36288 Kill();
36289 }
36290 }
36291 if (!tileCollide)
36292 {
36293 num6 *= 2f;
36294 }
36295 if (num3 > (float)num8 || !tileCollide)
36296 {
36297 num3 = num5 / num3;
36298 num *= num3;
36299 num2 *= num3;
36300 new Vector2(velocity.X, velocity.Y);
36301 float num9 = num - velocity.X;
36302 float num10 = num2 - velocity.Y;
36303 float num11 = (float)Math.Sqrt(num9 * num9 + num10 * num10);
36304 num11 = num6 / num11;
36305 num9 *= num11;
36306 num10 *= num11;
36307 velocity.X *= 0.98f;
36308 velocity.Y *= 0.98f;
36309 velocity.X += num9;
36310 velocity.Y += num10;
36311 }
36312 else
36313 {
36314 if (Math.Abs(velocity.X) + Math.Abs(velocity.Y) < 6f)
36315 {
36316 velocity.X *= 0.96f;
36317 velocity.Y += 0.2f;
36318 }
36319 if (Main.player[owner].velocity.X == 0f)
36320 {
36321 velocity.X *= 0.96f;
36322 }
36323 }
36324 }
36325 if (type == 247)
36326 {
36327 if (velocity.X < 0f)
36328 {
36329 rotation -= (Math.Abs(velocity.X) + Math.Abs(velocity.Y)) * 0.01f;
36330 }
36331 else
36332 {
36333 rotation += (Math.Abs(velocity.X) + Math.Abs(velocity.Y)) * 0.01f;
36334 }
36335 float num12 = position.X;
36336 float num13 = position.Y;
36337 float num14 = 600f;
36338 bool flag2 = false;
36339 if (owner == Main.myPlayer)
36340 {
36341 localAI[1] += 1f;
36342 if (localAI[1] > 20f)
36343 {
36344 localAI[1] = 20f;
36345 for (int i = 0; i < 200; i++)
36346 {
36347 if (Main.npc[i].CanBeChasedBy(this))
36348 {
36349 float num15 = Main.npc[i].position.X + (float)(Main.npc[i].width / 2);
36350 float num16 = Main.npc[i].position.Y + (float)(Main.npc[i].height / 2);
36351 float num17 = Math.Abs(position.X + (float)(width / 2) - num15) + Math.Abs(position.Y + (float)(height / 2) - num16);
36352 if (num17 < num14 && Collision.CanHit(position, width, height, Main.npc[i].position, Main.npc[i].width, Main.npc[i].height))
36353 {
36354 num14 = num17;
36355 num12 = num15;
36356 num13 = num16;
36357 flag2 = true;
36358 }
36359 }
36360 }
36361 }
36362 }
36363 if (flag2)
36364 {
36365 localAI[1] = 0f;
36366 vector = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
36367 num = num12 - vector.X;
36368 num2 = num13 - vector.Y;
36369 num3 = (float)Math.Sqrt(num * num + num2 * num2);
36370 num3 = 14f / num3;
36371 num *= num3;
36372 num2 *= num3;
36373 NewProjectile(GetProjectileSource_FromThis(), vector.X, vector.Y, num, num2, 248, (int)((double)damage / 1.5), knockBack / 2f, Main.myPlayer);
36374 }
36375 }
36376 else
36377 {
36378 rotation = (float)Math.Atan2(num2, num) - velocity.X * 0.1f;
36379 }
36380 }
36381
36383 {
36384 if (type == 25)
36385 {
36386 int maxValue = 15;
36387 if (doFastThrowDust)
36388 {
36389 maxValue = 1;
36390 }
36391 if (Main.rand.Next(maxValue) == 0)
36392 {
36393 Dust.NewDust(position, width, height, 14, 0f, 0f, 150, default(Color), 1.3f);
36394 }
36395 }
36396 else if (type == 757)
36397 {
36398 int num = 4;
36399 if (velocity.Length() < 8f)
36400 {
36401 num = 10;
36402 }
36403 if (doFastThrowDust)
36404 {
36405 num /= 2;
36406 }
36407 for (int i = 0; i < 2; i++)
36408 {
36409 if (Main.rand.Next(num) == 0)
36410 {
36411 Dust dust = Dust.NewDustDirect(position, width, height, 5, 0f, 0f, 0, default(Color), 0.8f);
36412 dust.velocity += velocity / 4f;
36413 dust.fadeIn = 1.3f;
36414 }
36415 }
36416 num = 40;
36417 if (doFastThrowDust)
36418 {
36419 num /= 2;
36420 }
36421 for (float num2 = 0f; num2 < 1f; num2 += 0.1f)
36422 {
36423 if (Main.rand.Next(num) == 0)
36424 {
36425 Dust.NewDustDirect(Vector2.Lerp(Main.player[owner].Center, base.Center, Main.rand.NextFloat()) + new Vector2(-8f), 16, 16, 5, 0f, 0f, 0, default(Color), 1.3f).velocity += velocity / 4f;
36426 }
36427 }
36428 }
36429 else if (type == 26)
36430 {
36431 int num3 = Dust.NewDust(position, width, height, 172, velocity.X * 0.4f, velocity.Y * 0.4f, 100, default(Color), 1.5f);
36432 Main.dust[num3].noGravity = true;
36433 Main.dust[num3].velocity.X /= 2f;
36434 Main.dust[num3].velocity.Y /= 2f;
36435 }
36436 else if (type == 948 && !wet)
36437 {
36438 int num4 = Dust.NewDust(position, width, height, 6, velocity.X * 0.4f, velocity.Y * 0.4f, 100, default(Color), 1.2f);
36439 Main.dust[num4].noGravity = true;
36440 Main.dust[num4].velocity.X *= 4f;
36441 Main.dust[num4].velocity.Y *= 4f;
36442 Main.dust[num4].velocity = (Main.dust[num4].velocity + velocity) / 2f;
36443 }
36444 else if (type == 35)
36445 {
36446 int num5 = Dust.NewDust(position, width, height, 6, velocity.X * 0.4f, velocity.Y * 0.4f, 100, default(Color), 3f);
36447 Main.dust[num5].noGravity = true;
36448 Main.dust[num5].velocity.X *= 2f;
36449 Main.dust[num5].velocity.Y *= 2f;
36450 }
36451 else if (type == 154)
36452 {
36453 int num6 = Dust.NewDust(position, width, height, 115, velocity.X * 0.4f, velocity.Y * 0.4f, 140, default(Color), 1.5f);
36454 Main.dust[num6].noGravity = true;
36455 Main.dust[num6].velocity *= 0.25f;
36456 }
36457 }
36458
36459 private void AI_100_Medusa()
36460 {
36461 Player player = Main.player[owner];
36463 if (type == 535)
36464 {
36465 zero.X = (float)player.direction * 6f;
36466 zero.Y = player.gravDir * -14f;
36467 bool flag = true;
36468 bool flag2 = ai[0] > 0f;
36469 if (!player.dead)
36470 {
36471 timeLeft = 3;
36472 }
36473 if (ai[0] > 0f)
36474 {
36475 ai[0] -= 1f;
36476 }
36477 if (flag2)
36478 {
36479 if (frame < 8)
36480 {
36481 frame = 8;
36482 }
36483 if (frame >= 12)
36484 {
36485 frame = 8;
36486 }
36487 frameCounter++;
36488 if (++frameCounter >= 5)
36489 {
36490 frameCounter = 0;
36491 if (++frame >= 12)
36492 {
36493 frame = 8;
36494 }
36495 }
36496 }
36497 else if (++frameCounter >= 5)
36498 {
36499 frameCounter = 0;
36500 if (++frame >= 8)
36501 {
36502 frame = 0;
36503 }
36504 }
36505 Vector2 center = player.Center;
36506 Vector2 vector = Main.screenPosition + new Vector2(Main.mouseX, Main.mouseY) - center;
36507 if (player.gravDir == -1f)
36508 {
36509 vector.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - center.Y;
36510 }
36511 Vector2 vector2 = new Vector2(Math.Sign((vector.X == 0f) ? ((float)player.direction) : vector.X), 0f);
36512 if (vector2.X != velocity.X || vector2.Y != velocity.Y)
36513 {
36514 netUpdate = true;
36515 }
36516 velocity = vector2;
36517 if (flag2 && soundDelay == 0)
36518 {
36519 SoundEngine.PlaySound(4, (int)base.position.X, (int)base.position.Y, 17);
36520 }
36521 soundDelay = (flag2 ? 4 : 0);
36522 if (Main.myPlayer == owner)
36523 {
36524 Vector2 position = player.Center + new Vector2(player.direction * 4, player.gravDir * 2f);
36525 if (!player.channel)
36526 {
36527 Kill();
36528 return;
36529 }
36530 if (!flag2 || ai[0] % 15f == 0f)
36531 {
36532 bool flag3 = false;
36533 for (int i = 0; i < 200; i++)
36534 {
36535 NPC nPC = Main.npc[i];
36536 if (nPC.active && Distance(nPC.Center) < 320f && nPC.CanBeChasedBy(this) && Collision.CanHitLine(nPC.position, nPC.width, nPC.height, position, 0, 0))
36537 {
36538 flag3 = true;
36539 break;
36540 }
36541 }
36542 if (flag3)
36543 {
36544 bool flag4 = false;
36545 if (!flag || player.CheckMana(player.inventory[player.selectedItem].mana, pay: true))
36546 {
36547 int num = damage;
36548 position = base.Center;
36549 int num2 = 0;
36550 float num3 = 0f;
36551 _medusaHeadTargetList.Clear();
36552 for (int j = 0; j < 200; j++)
36553 {
36554 NPC nPC2 = Main.npc[j];
36555 float num4 = Distance(nPC2.Center);
36556 if (nPC2.active && num4 < 320f && nPC2.CanBeChasedBy(this) && Collision.CanHitLine(nPC2.position, nPC2.width, nPC2.height, position, 0, 0))
36557 {
36558 _medusaHeadTargetList.Add(Tuple.Create(j, num4));
36559 }
36560 }
36561 _medusaHeadTargetList.Sort(_medusaTargetComparer);
36562 for (int k = 0; k < _medusaHeadTargetList.Count && k < 3; k++)
36563 {
36564 Tuple<int, float> tuple = _medusaHeadTargetList[k];
36565 NPC nPC3 = Main.npc[tuple.Item1];
36566 Vector2 v = nPC3.Center - position;
36567 num3 += v.ToRotation();
36568 num2++;
36569 int num5 = NewProjectile(GetProjectileSource_FromThis(), position.X, position.Y, v.X, v.Y, 536, 0, 0f, owner, whoAmI);
36570 Main.projectile[num5].Center = nPC3.Center;
36571 Main.projectile[num5].damage = num;
36572 Main.projectile[num5].Damage();
36573 Main.projectile[num5].damage = 0;
36574 Main.projectile[num5].Center = position;
36575 ai[0] = 180f;
36576 }
36577 num3 = ((num2 == 0) ? ((player.direction == 1) ? 0f : ((float)Math.PI)) : (num3 / (float)num2));
36578 for (int l = 0; l < 4; l++)
36579 {
36581 zero2 = ((Main.rand.Next(4) == 0) ? (Vector2.UnitX.RotatedByRandom(6.2831854820251465) * new Vector2(200f, 50f) * (Main.rand.NextFloat() * 0.7f + 0.3f)) : (Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy(num3) * new Vector2(200f, 50f) * (Main.rand.NextFloat() * 0.7f + 0.3f)));
36582 NewProjectile(GetProjectileSource_FromThis(), position.X, position.Y, zero2.X, zero2.Y, 536, 0, 0f, owner, whoAmI);
36583 }
36584 ai[0] = 60f;
36585 netUpdate = true;
36586 }
36587 }
36588 }
36589 }
36590 Lighting.AddLight(base.Center, 0.9f, 0.75f, 0.1f);
36591 }
36592 rotation = ((player.gravDir == 1f) ? 0f : ((float)Math.PI));
36593 spriteDirection = direction;
36594 timeLeft = 2;
36595 Vector2 vector3 = Main.OffsetsPlayerOnhand[player.bodyFrame.Y / 56] * 2f;
36596 if (player.direction != 1)
36597 {
36598 vector3.X = (float)player.bodyFrame.Width - vector3.X;
36599 }
36600 vector3 -= (player.bodyFrame.Size() - new Vector2(player.width, 42f)) / 2f;
36601 base.Center = (player.position + vector3 + zero - velocity).Floor();
36602 player.ChangeDir(direction);
36603 player.heldProj = whoAmI;
36604 player.SetDummyItemTime(2);
36605 }
36606
36608 {
36609 Player player = Main.player[owner];
36610 if (!player.active)
36611 {
36612 active = false;
36613 return;
36614 }
36615 bool flag = type == 623;
36616 Vector2 vector = player.Center;
36617 float num = 100f;
36618 float num2 = 500f;
36619 float num3 = 500f;
36620 float num4 = 100f;
36621 bool flag2 = true;
36622 if (flag)
36623 {
36624 if (player.dead)
36625 {
36626 player.stardustGuardian = false;
36627 }
36628 if (player.stardustGuardian)
36629 {
36630 timeLeft = 2;
36631 }
36632 num = 150f;
36633 vector.X -= (5 + player.width / 2) * player.direction;
36634 vector.Y -= 25f;
36635 Lighting.AddLight(base.Center, 0.9f, 0.9f, 0.7f);
36636 if (ai[0] != 3f && alpha == 255)
36637 {
36638 alpha = 0;
36639 for (int i = 0; i < 30; i++)
36640 {
36641 int num5 = Dust.NewDust(position, width, height, 135, 0f, 0f, 200, default(Color), 1.7f);
36642 Main.dust[num5].noGravity = true;
36643 Main.dust[num5].velocity *= 3f;
36644 Main.dust[num5].shader = GameShaders.Armor.GetSecondaryShader(Main.player[owner].cPet, Main.player[owner]);
36645 num5 = Dust.NewDust(position, width, height, 135, 0f, 0f, 100);
36646 Main.dust[num5].velocity *= 2f;
36647 Main.dust[num5].noGravity = true;
36648 Main.dust[num5].fadeIn = 2.5f;
36649 Main.dust[num5].shader = GameShaders.Armor.GetSecondaryShader(Main.player[owner].cPet, Main.player[owner]);
36650 }
36651 }
36652 }
36653 if (ai[0] != 0f)
36654 {
36655 Main.player[owner].tankPet = whoAmI;
36656 Main.player[owner].tankPetReset = false;
36657 }
36658 if (ai[0] == 0f)
36659 {
36660 base.Center = Vector2.Lerp(base.Center, vector, 0.05f);
36661 velocity *= 0.5f;
36662 direction = (spriteDirection = player.direction);
36663 if (flag && ++frameCounter >= 9)
36664 {
36665 frameCounter = 0;
36666 if (++frame >= 8)
36667 {
36668 frame = 0;
36669 }
36670 }
36671 int targetNPCIndex = -1;
36673 bool flag3 = flag2;
36674 if (flag && Math.Abs(base.Center.X - vector.X) > num + 20f)
36675 {
36676 flag3 = false;
36677 }
36678 if (flag3)
36679 {
36680 AI_120_StardustGuardian_FindTarget(num2, ref targetNPCIndex, ref distanceToClosestTarget);
36681 }
36682 if (targetNPCIndex != -1)
36683 {
36685 direction = (spriteDirection = (nPC.Center.X > base.Center.X).ToDirectionInt());
36686 float num6 = Math.Abs(vector.X - base.Center.X);
36687 float num7 = Math.Abs(nPC.Center.X - base.Center.X);
36688 float num8 = Math.Abs(vector.Y - base.Center.Y);
36689 float num9 = Math.Abs(nPC.Center.Y - base.Bottom.Y);
36690 float num10 = (nPC.Center.Y > base.Bottom.Y).ToDirectionInt();
36691 if ((num6 < num || (vector.X - base.Center.X) * (float)direction < 0f) && num7 > 20f && num7 < num - num6 + 100f)
36692 {
36693 velocity.X += 0.1f * (float)direction;
36694 }
36695 else
36696 {
36697 velocity.X *= 0.7f;
36698 }
36699 if ((num8 < num4 || (vector.Y - base.Bottom.Y) * num10 < 0f) && num9 > 10f && num9 < num4 - num8 + 10f)
36700 {
36701 velocity.Y += 0.1f * num10;
36702 }
36703 else
36704 {
36705 velocity.Y *= 0.7f;
36706 }
36707 if (owner == Main.myPlayer && num7 < num3)
36708 {
36709 ai[0] = 2f;
36710 ai[1] = targetNPCIndex;
36711 netUpdate = true;
36712 }
36713 }
36714 }
36715 else if (ai[0] == 1f)
36716 {
36717 if (player.HasMinionRestTarget)
36718 {
36720 }
36721 else
36722 {
36723 ai[0] = 0f;
36724 netUpdate = true;
36725 }
36726 int targetNPCIndex2 = -1;
36728 bool flag4 = true;
36729 if (flag && Math.Abs(base.Center.X - vector.X) > num + 20f)
36730 {
36731 flag4 = false;
36732 }
36733 if (flag4)
36734 {
36735 AI_120_StardustGuardian_FindTarget(num2, ref targetNPCIndex2, ref distanceToClosestTarget2);
36736 }
36737 if (targetNPCIndex2 != -1)
36738 {
36740 direction = (spriteDirection = (nPC2.Center.X > base.Center.X).ToDirectionInt());
36741 float num11 = Math.Abs(vector.X - base.Center.X);
36742 float num12 = Math.Abs(nPC2.Center.X - base.Center.X);
36743 float num13 = Math.Abs(vector.Y - base.Center.Y);
36744 float num14 = Math.Abs(nPC2.Center.Y - base.Bottom.Y);
36745 float num15 = (nPC2.Center.Y > base.Bottom.Y).ToDirectionInt();
36746 if ((num11 < num || (vector.X - base.Center.X) * (float)direction < 0f) && num12 > 20f && num12 < num - num11 + 100f)
36747 {
36748 velocity.X += 0.1f * (float)direction;
36749 }
36750 else
36751 {
36752 velocity.X *= 0.7f;
36753 }
36754 if ((num13 < num4 || (vector.Y - base.Bottom.Y) * num15 < 0f) && num14 > 10f && num14 < num4 - num13 + 10f)
36755 {
36756 velocity.Y += 0.1f * num15;
36757 }
36758 else
36759 {
36760 velocity.Y *= 0.7f;
36761 }
36762 if (owner == Main.myPlayer && num12 < num3)
36763 {
36764 ai[0] = 2f;
36765 ai[1] = targetNPCIndex2;
36766 netUpdate = true;
36767 }
36768 }
36769 else
36770 {
36771 if (Math.Abs(vector.X - base.Center.X) > num + 40f)
36772 {
36773 ai[0] = 3f;
36774 netUpdate = true;
36775 }
36776 else if (Math.Abs(vector.X - base.Center.X) > 20f)
36777 {
36778 direction = (spriteDirection = (vector.X > base.Center.X).ToDirectionInt());
36779 velocity.X += 0.06f * (float)direction;
36780 }
36781 else
36782 {
36783 velocity.X *= 0.8f;
36784 direction = (spriteDirection = (player.Center.X < base.Center.X).ToDirectionInt());
36785 }
36786 if (Math.Abs(vector.Y - base.Center.Y) > num4)
36787 {
36788 ai[0] = 3f;
36789 netUpdate = true;
36790 }
36791 else if (Math.Abs(vector.Y - base.Center.Y) > 10f)
36792 {
36793 velocity.Y += 0.06f * (float)Math.Sign(vector.Y - base.Center.Y);
36794 }
36795 else
36796 {
36797 velocity.Y *= 0.8f;
36798 }
36799 }
36800 if (flag && ++frameCounter >= 9)
36801 {
36802 frameCounter = 0;
36803 if (++frame >= Main.projFrames[type] - 4)
36804 {
36805 frame = 0;
36806 }
36807 }
36808 }
36809 else if (ai[0] == 2f)
36810 {
36811 if (flag)
36812 {
36813 int num16 = 3;
36814 if (frame < 12)
36815 {
36816 frame = 12;
36817 }
36818 if (frame == 12 || frame == 13)
36819 {
36820 num16 = 8;
36821 }
36822 if (++frameCounter >= num16)
36823 {
36824 frameCounter = 0;
36825 if (++frame >= 19)
36826 {
36827 frame = 14;
36828 }
36829 }
36830 }
36831 bool flag5 = false;
36832 if (flag2)
36833 {
36834 flag5 = Distance(player.Center) < num2;
36835 }
36836 NPC nPC3 = null;
36837 int num17 = (int)ai[1];
36838 if (Main.npc.IndexInRange(num17))
36839 {
36840 nPC3 = Main.npc[num17];
36841 if (!nPC3.CanBeChasedBy(this) || Distance(nPC3.Center) > num3)
36842 {
36843 nPC3 = null;
36844 }
36845 }
36846 if (!flag5 || nPC3 == null)
36847 {
36848 ai[1] = 0f;
36849 ai[0] = 0f;
36850 netUpdate = true;
36851 if (frame < 18)
36852 {
36853 frame = 18;
36854 }
36855 }
36856 else
36857 {
36858 int num18 = (((nPC3.Center - player.Center).X > 1f) ? 1 : (-1));
36859 Vector2 targetPosition = nPC3.Center + new Vector2((float)(-num18) * ((float)nPC3.width * 0.5f + 70f), -10f) - base.Center;
36860 float maxAmountAllowedToMove = 6f * Utils.Remap(targetPosition.Length(), 50f, 400f, 1f, 4f);
36861 int num19 = 32;
36863 velocity = velocity.MoveTowards(targetPosition2, num19);
36864 direction = (spriteDirection = num18);
36865 if (localAI[0]++ >= 3f)
36866 {
36867 localAI[0] = 0f;
36868 int targetNPCIndex3 = -1;
36869 float distanceToClosestTarget3 = -1f;
36870 AI_120_StardustGuardian_FindTarget(num2, ref targetNPCIndex3, ref distanceToClosestTarget3);
36871 if (targetNPCIndex3 != -1)
36872 {
36873 ai[1] = targetNPCIndex3;
36874 netUpdate = true;
36875 }
36876 }
36877 }
36878 }
36879 else
36880 {
36881 _ = ai[0];
36882 _ = 2f;
36883 }
36884 if (ai[0] != 3f)
36885 {
36886 return;
36887 }
36888 if (player.HasMinionRestTarget)
36889 {
36891 }
36892 else
36893 {
36894 ai[0] = 0f;
36895 netUpdate = true;
36896 }
36897 if (alpha == 0)
36898 {
36899 alpha = 255;
36900 for (int j = 0; j < 30; j++)
36901 {
36902 int num20 = Dust.NewDust(position, width, height, 135, 0f, 0f, 200, default(Color), 1.7f);
36903 Main.dust[num20].noGravity = true;
36904 Main.dust[num20].velocity *= 3f;
36905 Main.dust[num20].shader = GameShaders.Armor.GetSecondaryShader(Main.player[owner].cPet, Main.player[owner]);
36906 num20 = Dust.NewDust(position, width, height, 135, 0f, 0f, 100);
36907 Main.dust[num20].velocity *= 2f;
36908 Main.dust[num20].noGravity = true;
36909 Main.dust[num20].fadeIn = 2.5f;
36910 Main.dust[num20].shader = GameShaders.Armor.GetSecondaryShader(Main.player[owner].cPet, Main.player[owner]);
36911 }
36912 }
36913 else
36914 {
36915 for (int k = 0; k < 2; k++)
36916 {
36917 int num21 = Dust.NewDust(position, width, height, 135, 0f, 0f, 200, default(Color), 1.7f);
36918 Main.dust[num21].noGravity = true;
36919 Main.dust[num21].velocity *= 3f;
36920 Main.dust[num21].noLight = true;
36921 Main.dust[num21].shader = GameShaders.Armor.GetSecondaryShader(Main.player[owner].cPet, Main.player[owner]);
36922 num21 = Dust.NewDust(position, width, height, 135, 0f, 0f, 100);
36923 Main.dust[num21].velocity *= 2f;
36924 Main.dust[num21].noGravity = true;
36925 Main.dust[num21].fadeIn = 2.5f;
36926 Main.dust[num21].noLight = true;
36927 Main.dust[num21].shader = GameShaders.Armor.GetSecondaryShader(Main.player[owner].cPet, Main.player[owner]);
36928 }
36929 }
36930 velocity *= 0.7f;
36931 base.Center = Vector2.Lerp(base.Center, vector, 0.2f);
36932 if (Distance(vector) < 10f)
36933 {
36934 ai[0] = 1f;
36935 netUpdate = true;
36936 }
36937 }
36938
36940 {
36941 Vector2 center = Main.player[owner].Center;
36942 for (int i = 0; i < 200; i++)
36943 {
36944 NPC nPC = Main.npc[i];
36945 if (nPC.CanBeChasedBy(this))
36946 {
36947 float num = center.Distance(nPC.Center);
36948 if (num < lookupRange)
36949 {
36950 targetNPCIndex = i;
36952 lookupRange = num;
36953 }
36954 }
36955 }
36956 }
36957
36959 {
36960 if (localAI[0] == 0f)
36961 {
36963 }
36964 localAI[0] += 1f;
36965 float num = 180f;
36966 _ = ai[0] / ((float)Math.PI * 2f);
36967 float num2 = (float)Math.PI / 9f;
36968 if (localAI[0] >= num)
36969 {
36970 Kill();
36971 return;
36972 }
36973 alpha -= 15;
36974 if (alpha < 0)
36975 {
36976 alpha = 0;
36977 }
36978 scale = Utils.GetLerpValue(0f, 20f, localAI[0], clamped: true) * Utils.GetLerpValue(num, num - 60f, localAI[0], clamped: true);
36979 float lerpValue = Utils.GetLerpValue(50f, num, localAI[0], clamped: true);
36980 rotation = ai[0] + lerpValue * num2;
36981 int num3 = (int)ai[1];
36982 if (Main.npc.IndexInRange(num3))
36983 {
36984 NPC nPC = Main.npc[num3];
36985 if (nPC.active && nPC.type == 636)
36986 {
36987 base.Center = nPC.Center;
36988 }
36989 velocity = Vector2.Zero;
36990 Vector2 vector = rotation.ToRotationVector2();
36991 Vector3 v3_ = Main.hslToRgb((ai[0] / ((float)Math.PI * 2f) + localAI[0] / num) % 1f, 1f, 0.85f).ToVector3() * scale;
36992 float num4 = 800f * scale;
36993 DelegateMethods.v3_1 = v3_;
36994 for (float num5 = 0f; num5 <= 1f; num5 += 1f / 12f)
36995 {
36996 Point point = (base.Center + vector * num4 * num5).ToTileCoordinates();
36997 DelegateMethods.CastLightOpen(point.X, point.Y);
36998 }
36999 }
37000 else
37001 {
37002 Kill();
37003 }
37004 }
37005
37007 {
37008 localAI[0] += 1f;
37009 if (localAI[0] >= 60f)
37010 {
37011 velocity = ai[0].ToRotationVector2() * 40f;
37012 if (Main.rand.Next(3) == 0)
37013 {
37014 Dust dust = Dust.NewDustPerfect(base.Center, 267);
37015 dust.fadeIn = 1f;
37016 dust.noGravity = true;
37017 dust.alpha = 100;
37018 dust.color = Color.Lerp(AI_171_GetColor(), Color.White, Main.rand.NextFloat() * 0.4f);
37019 dust.noLightEmittence = true;
37020 dust.scale *= 1.5f;
37021 }
37022 }
37023 if (localAI[0] >= 360f)
37024 {
37025 Kill();
37026 return;
37027 }
37028 alpha = (int)MathHelper.Lerp(255f, 0f, Utils.GetLerpValue(0f, 20f, localAI[0], clamped: true));
37029 rotation = ai[0];
37030 }
37031
37033 {
37034 int num = (int)ai[0] - 1;
37035 if (num != -1 && (!Main.npc[num].CanBeChasedBy(this) || localNPCImmunity[num] != 0))
37036 {
37037 ai[0] = 0f;
37038 num = -1;
37039 }
37040 if (num == -1)
37041 {
37042 NPC nPC = FindTargetWithinRange(400f);
37043 if (nPC != null)
37044 {
37045 num = nPC.whoAmI;
37046 ai[0] = num + 1;
37047 netUpdate = true;
37048 }
37049 }
37050 if (num != -1)
37051 {
37052 NPC nPC2 = Main.npc[num];
37053 Vector2 vector = DirectionTo(nPC2.Center);
37054 float num2 = 10f;
37055 if (!vector.HasNaNs())
37056 {
37057 velocity = vector * num2;
37058 rotation = velocity.ToRotation();
37059 }
37060 if (++frameCounter >= 3)
37061 {
37062 frameCounter = 0;
37063 frame = Main.rand.Next(Main.projFrames[type]);
37064 }
37065 }
37066 else
37067 {
37068 Kill();
37069 }
37070 }
37071
37072 public NPC FindTargetWithinRange(float maxRange, bool checkCanHit = false)
37073 {
37074 NPC result = null;
37075 float num = maxRange;
37076 for (int i = 0; i < 200; i++)
37077 {
37078 NPC nPC = Main.npc[i];
37079 if (nPC.CanBeChasedBy(this) && localNPCImmunity[i] == 0 && (!checkCanHit || Collision.CanHitLine(position, width, height, nPC.position, nPC.width, nPC.height)))
37080 {
37081 float num2 = Distance(nPC.Center);
37082 if (!(num <= num2))
37083 {
37084 num = num2;
37085 result = nPC;
37086 }
37087 }
37088 }
37089 return result;
37090 }
37091
37093 {
37094 //IL_009c: Unknown result type (might be due to invalid IL or missing references)
37095 //IL_0085: Unknown result type (might be due to invalid IL or missing references)
37096 //IL_008a: Unknown result type (might be due to invalid IL or missing references)
37097 //IL_00ed: Unknown result type (might be due to invalid IL or missing references)
37098 //IL_00f2: Unknown result type (might be due to invalid IL or missing references)
37099 Player player = Main.player[owner];
37100 if (type == 917 && (!player.active || player.dead))
37101 {
37102 player.coolWhipBuff = false;
37103 Kill();
37104 return;
37105 }
37106 if (type == 917 && player.coolWhipBuff)
37107 {
37108 timeLeft = 2;
37109 }
37110 if (type == 969)
37111 {
37112 SlotId val;
37113 if (soundDelay == 0)
37114 {
37115 soundDelay = -1;
37116 float[] array = localAI;
37118 array[1] = ((SlotId)(ref val)).ToFloat();
37119 }
37121 if (activeSound != null)
37122 {
37123 activeSound.Position = base.Center;
37124 activeSound.Volume = 1f - Math.Max(ai[1] - 555f, 0f) / 15f;
37125 }
37126 else
37127 {
37128 float[] array2 = localAI;
37129 val = SlotId.Invalid;
37130 array2[1] = ((SlotId)(ref val)).ToFloat();
37131 }
37132 ai[1] += 1f;
37133 if (ai[1] > 560f)
37134 {
37135 alpha = (int)MathHelper.Lerp(0f, 250f, (ai[1] - 560f) / 10f);
37136 }
37137 if (ai[1] >= 570f)
37138 {
37139 Kill();
37140 }
37141 float num = 555f;
37142 for (int i = 0; i < 1000; i++)
37143 {
37144 if (i != whoAmI && Main.projectile[i].active && Main.projectile[i].owner == owner && Main.projectile[i].type == type && timeLeft > Main.projectile[i].timeLeft && Main.projectile[i].ai[1] < num)
37145 {
37146 Main.projectile[i].ai[1] = num;
37147 Main.projectile[i].netUpdate = true;
37148 }
37149 }
37150 }
37151 int num2 = (int)ai[0] - 1;
37152 if (num2 != -1 && (!Main.npc[num2].CanBeChasedBy(this) || localNPCImmunity[num2] > 0))
37153 {
37154 ai[0] = 0f;
37155 num2 = -1;
37156 }
37157 if (num2 == -1)
37158 {
37159 bool checkCanHit = false;
37160 if (type == 969)
37161 {
37162 checkCanHit = true;
37163 }
37164 NPC nPC = FindTargetWithinRange(400f, checkCanHit);
37165 if (nPC != null)
37166 {
37167 num2 = nPC.whoAmI;
37168 ai[0] = num2 + 1;
37169 netUpdate = true;
37170 }
37171 }
37172 float num3 = 18f;
37173 float amount = 0.1f;
37174 float num4 = 0f;
37175 if (type == 969)
37176 {
37177 num3 = 8f;
37178 amount = 0.075f;
37179 num4 = 25f;
37180 }
37181 if (num2 != -1)
37182 {
37183 NPC nPC2 = Main.npc[num2];
37184 float num5 = Distance(nPC2.Center);
37185 if (num3 > num5)
37186 {
37187 num3 = num5;
37188 }
37189 Vector2 vector = DirectionTo(nPC2.Center);
37190 if (!vector.HasNaNs() && num5 >= num4)
37191 {
37192 velocity = Vector2.Lerp(velocity, vector * num3, amount);
37193 }
37194 }
37195 else if (type == 969)
37196 {
37197 Vector2 vector2 = DirectionTo(base.Center + velocity);
37198 if (!vector2.HasNaNs())
37199 {
37200 velocity = Vector2.Lerp(velocity, vector2 * num3, amount);
37201 }
37202 }
37203 else
37204 {
37205 velocity *= 0.92f;
37206 }
37207 if (type == 969)
37208 {
37209 rotation = velocity.X * 0.0125f;
37210 if (++frameCounter > 4)
37211 {
37212 frameCounter = 0;
37213 frame++;
37214 if (frame >= Main.projFrames[type])
37215 {
37216 frame = 0;
37217 }
37218 }
37219 if (timeLeft % 3 == 0)
37220 {
37221 int num6 = Dust.NewDust(position, width, height, 16, velocity.X, velocity.Y, 120, default(Color), 0.5f);
37222 Main.dust[num6].noGravity = true;
37223 Main.dust[num6].fadeIn = 0.9f;
37224 Main.dust[num6].velocity = Main.rand.NextVector2Circular(2f, 2f) + new Vector2(0f, -2f) + velocity * 0.75f;
37225 for (int j = 0; j < 2; j++)
37226 {
37227 Dust dust = Dust.NewDustDirect(position, width, height, 16, velocity.X, velocity.Y, 60, default(Color), 0.5f);
37228 dust.noGravity = true;
37229 dust.fadeIn = 0.7f;
37230 dust.velocity = Main.rand.NextVector2Circular(2f, 2f) * 0.2f + new Vector2(0f, -0.4f) + velocity * 1.5f;
37231 dust.position -= velocity * 3f;
37232 }
37233 }
37234 }
37235 else
37236 {
37237 rotation += 0.020943953f + Math.Abs(velocity.X) * 0.2f;
37238 if (Main.rand.Next(3) == 0)
37239 {
37240 Dust dust2 = Dust.NewDustDirect(base.Center, 0, 0, 43, velocity.X, velocity.Y, 254, Color.White, 0.5f);
37241 Vector2 vector3 = Main.rand.NextVector2Circular(1f, 1f);
37242 dust2.position = base.Center + vector3 * 10f;
37243 dust2.velocity = vector3;
37244 }
37245 }
37246 }
37247
37249 {
37250 if (localAI[0] == 0f)
37251 {
37253 for (int i = 0; i < 4; i++)
37254 {
37255 int num = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 100, default(Color), 1.5f);
37256 Main.dust[num].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * width / 2f;
37257 }
37258 for (int j = 0; j < 30; j++)
37259 {
37260 int num2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 200, default(Color), 3.7f);
37261 Main.dust[num2].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * width / 2f;
37262 Main.dust[num2].noGravity = true;
37263 Main.dust[num2].velocity *= 3f;
37264 num2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100, default(Color), 1.5f);
37265 Main.dust[num2].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * width / 2f;
37266 Main.dust[num2].velocity *= 2f;
37267 Main.dust[num2].noGravity = true;
37268 Main.dust[num2].fadeIn = 2.5f;
37269 }
37270 for (int k = 0; k < 10; k++)
37271 {
37272 int num3 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 0, default(Color), 2.7f);
37273 Main.dust[num3].position = base.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy(velocity.ToRotation()) * width / 2f;
37274 Main.dust[num3].noGravity = true;
37275 Main.dust[num3].velocity *= 3f;
37276 }
37277 for (int l = 0; l < 10; l++)
37278 {
37279 int num4 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 0, default(Color), 1.5f);
37280 Main.dust[num4].position = base.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy(velocity.ToRotation()) * width / 2f;
37281 Main.dust[num4].noGravity = true;
37282 Main.dust[num4].velocity *= 3f;
37283 }
37284 for (int m = 0; m < 2; m++)
37285 {
37286 int num5 = 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));
37287 Main.gore[num5].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * width / 2f;
37288 Main.gore[num5].velocity *= 0.3f;
37289 Main.gore[num5].velocity.X += (float)Main.rand.Next(-10, 11) * 0.05f;
37290 Main.gore[num5].velocity.Y += (float)Main.rand.Next(-10, 11) * 0.05f;
37291 }
37292 }
37293 localAI[0] += 1f;
37294 if (localAI[0] >= 10f)
37295 {
37296 Kill();
37297 }
37298 }
37299
37301 {
37302 Player player = Main.player[owner];
37303 if (!player.active || player.dead || !player.hasTitaniumStormBuff)
37304 {
37305 Kill();
37306 return;
37307 }
37308 if (frameCounter == 0)
37309 {
37310 frameCounter = 1;
37311 frame = Main.rand.Next(12);
37312 rotation = Main.rand.NextFloat() * ((float)Math.PI * 2f);
37313 }
37314 rotation += (float)Math.PI / 200f;
37315 AI_GetMyGroupIndexAndFillBlackList(null, out var index, out var totalIndexesInGroup);
37316 float f = ((float)index / (float)totalIndexesInGroup + player.miscCounterNormalized * 6f) * ((float)Math.PI * 2f);
37317 float num = 24f + (float)totalIndexesInGroup * 6f;
37318 Vector2 vector = player.position - player.oldPosition;
37319 base.Center += vector;
37320 Vector2 vector2 = f.ToRotationVector2();
37321 localAI[0] = vector2.Y;
37322 Vector2 value = player.Center + vector2 * new Vector2(1f, 0.05f) * num;
37323 base.Center = Vector2.Lerp(base.Center, value, 0.3f);
37324 }
37325
37327 {
37328 Player player = Main.player[owner];
37329 if (!player.active)
37330 {
37331 active = false;
37332 return;
37333 }
37334 if (type == 883)
37335 {
37336 if (player.dead)
37337 {
37338 player.petFlagEaterOfWorldsPet = false;
37339 }
37340 if (player.petFlagEaterOfWorldsPet)
37341 {
37342 timeLeft = 2;
37343 }
37344 }
37345 if (type == 887)
37346 {
37347 if (player.dead)
37348 {
37349 player.petFlagDestroyerPet = false;
37350 }
37351 if (player.petFlagDestroyerPet)
37352 {
37353 timeLeft = 2;
37354 }
37355 }
37356 if (type == 893)
37357 {
37358 if (player.dead)
37359 {
37360 player.petFlagLunaticCultistPet = false;
37361 }
37362 if (player.petFlagLunaticCultistPet)
37363 {
37364 timeLeft = 2;
37365 }
37366 }
37367 Vector2 center = player.Center;
37368 if (Distance(center) > 2000f)
37369 {
37370 base.Center = center;
37371 velocity = Vector2.Zero;
37372 netUpdate = true;
37373 }
37374 float num = (center - base.Center).Length();
37375 float num2 = Math.Min(12f, Math.Max(4f, player.velocity.Length()));
37376 velocity.Length();
37377 if (velocity == Vector2.Zero)
37378 {
37379 velocity.X = 2f * (float)player.direction;
37380 Vector2 vector = position;
37381 for (int i = 0; i < oldPos.Length; i++)
37382 {
37383 vector -= velocity;
37384 oldPos[i] = vector;
37385 }
37386 }
37387 if (!(num < 120f))
37388 {
37389 float targetAngle = AngleTo(center);
37390 float f = velocity.ToRotation().AngleTowards(targetAngle, MathHelper.ToRadians(5f));
37391 velocity = f.ToRotationVector2() * num2;
37392 }
37393 if (velocity.Length() > num2)
37394 {
37395 velocity = velocity.SafeNormalize(Vector2.Zero) * num2;
37396 }
37397 if (Math.Abs(velocity.Y) < 1f)
37398 {
37399 velocity.Y -= 0.1f;
37400 }
37401 rotation = velocity.ToRotation() + (float)Math.PI / 2f;
37402 int num3 = direction;
37403 direction = (spriteDirection = ((velocity.X > 0f) ? 1 : (-1)));
37404 if (num3 != direction)
37405 {
37406 netUpdate = true;
37407 }
37408 position.X = MathHelper.Clamp(position.X, 160f, Main.maxTilesX * 16 - 160);
37409 position.Y = MathHelper.Clamp(position.Y, 160f, Main.maxTilesY * 16 - 160);
37410 }
37411
37413 {
37414 Opacity = Utils.GetLerpValue(0f, 60f, timeLeft, clamped: true) * Utils.GetLerpValue(660f, 600f, timeLeft, clamped: true);
37415 float num = (float)Math.PI / 360f;
37416 float num2 = 30f;
37417 velocity = velocity.RotatedBy(ai[0]);
37418 if (ai[0] < num)
37419 {
37420 ai[0] += num / num2;
37421 }
37422 rotation = velocity.ToRotation() + (float)Math.PI / 2f;
37423 }
37424
37426 {
37428 {
37429 float lerpValue = Utils.GetLerpValue(0f, 60f, (int)Main.time, clamped: true);
37430 return Color.Lerp(Color.White, Main.OurFavoriteColor, lerpValue) * Opacity;
37431 }
37432 return Main.hslToRgb((ai[1] + 0f) % 1f, 1f, 0.5f) * Opacity;
37433 }
37434
37436 {
37437 bool flag = false;
37438 bool flag2 = false;
37439 float num = 140f;
37440 float num2 = 30f;
37441 float num3 = 0.98f;
37442 float value = 0.05f;
37443 float value2 = 0.1f;
37444 float num4 = 30f;
37445 if (type == 931)
37446 {
37447 num = 180f;
37448 num2 = 20f;
37449 num4 = 30f;
37450 num3 = 0.97f;
37451 value = 0.075f;
37452 value2 = 0.125f;
37453 if (timeLeft == 238)
37454 {
37455 int num5 = alpha;
37456 alpha = 0;
37457 Color fairyQueenWeaponsColor = GetFairyQueenWeaponsColor();
37458 alpha = num5;
37459 for (int i = 0; i < 3; i++)
37460 {
37461 Dust dust = Dust.NewDustPerfect(base.Center, 267, Main.rand.NextVector2CircularEdge(3f, 3f) * (Main.rand.NextFloat() * 0.5f + 0.5f), 0, fairyQueenWeaponsColor);
37462 dust.scale *= 1.2f;
37463 dust.noGravity = true;
37464 }
37465 }
37466 }
37467 if ((float)timeLeft > num)
37468 {
37469 flag = true;
37470 }
37471 else if ((float)timeLeft > num2)
37472 {
37473 flag2 = true;
37474 }
37475 if (flag)
37476 {
37477 float num6 = (float)Math.Cos((float)whoAmI % 6f / 6f + position.X / 320f + position.Y / 160f);
37478 velocity *= num3;
37479 velocity = velocity.RotatedBy(num6 * ((float)Math.PI * 2f) * 0.125f * 1f / 30f);
37480 }
37481 if (friendly)
37482 {
37483 int num7 = (int)ai[0];
37484 if (Main.npc.IndexInRange(num7) && !Main.npc[num7].CanBeChasedBy(this))
37485 {
37486 num7 = -1;
37487 ai[0] = -1f;
37488 netUpdate = true;
37489 }
37490 if (num7 == -1)
37491 {
37492 int num8 = FindTargetWithLineOfSight();
37493 if (num8 != -1)
37494 {
37495 num7 = num8;
37496 ai[0] = num8;
37497 netUpdate = true;
37498 }
37499 }
37500 }
37501 if (flag2)
37502 {
37503 int num9 = (int)ai[0];
37504 Vector2 value3 = velocity;
37505 if (hostile && Main.player.IndexInRange(num9))
37506 {
37507 Player player = Main.player[num9];
37508 value3 = DirectionTo(player.Center) * num4;
37509 }
37510 if (friendly)
37511 {
37512 if (Main.npc.IndexInRange(num9))
37513 {
37514 if (timeLeft < 10)
37515 {
37516 timeLeft = 10;
37517 }
37518 NPC nPC = Main.npc[num9];
37519 value3 = DirectionTo(nPC.Center) * num4;
37520 }
37521 else
37522 {
37523 timeLeft--;
37524 }
37525 }
37526 float amount = MathHelper.Lerp(value, value2, Utils.GetLerpValue(num, 30f, timeLeft, clamped: true));
37527 velocity = Vector2.SmoothStep(velocity, value3, amount);
37528 if (type == 931)
37529 {
37530 velocity *= MathHelper.Lerp(0.85f, 1f, Utils.GetLerpValue(0f, 90f, timeLeft, clamped: true));
37531 }
37532 }
37533 Opacity = Utils.GetLerpValue(240f, 220f, timeLeft, clamped: true);
37534 rotation = velocity.ToRotation() + (float)Math.PI / 2f;
37535 }
37536
37538 {
37540 {
37541 float lerpValue = Utils.GetLerpValue(0f, 60f, (int)Main.time, clamped: true);
37542 return Color.Lerp(Color.White, Main.OurFavoriteColor, lerpValue) * Opacity;
37543 }
37544 return Main.hslToRgb((ai[1] + 0.5f) % 1f, 1f, 0.5f) * Opacity;
37545 }
37546
37548 {
37549 if (localAI[1] <= 90f)
37550 {
37551 localAI[1] += 1f;
37552 scale = 0.5f;
37553 Opacity = 0.5f;
37554 float lerpValue = Utils.GetLerpValue(0f, 90f, localAI[1]);
37555 scale = MathHelper.Lerp(5f, 1f, lerpValue);
37556 Opacity = 1f - (1f - lerpValue * lerpValue);
37557 return;
37558 }
37559 scale = 1f;
37560 Opacity = 1f;
37561 float num = 150f + 10f * (float)AI_172_GetPelletStormsCount();
37562 localAI[0] += 1f;
37563 if (localAI[0] >= num)
37564 {
37565 Kill();
37566 return;
37567 }
37568 velocity = Vector2.Zero;
37569 rotation = 0f;
37570 int num2 = AI_172_GetPelletStormsCount();
37571 for (int i = 0; i < num2; i++)
37572 {
37573 HallowBossPelletStormInfo hallowBossPelletStormInfo = AI_172_GetPelletStormInfo(i);
37574 for (int j = 0; j < hallowBossPelletStormInfo.BulletsInStorm; j++)
37575 {
37576 if (hallowBossPelletStormInfo.IsValid(j))
37577 {
37578 hallowBossPelletStormInfo.GetBulletPosition(j, base.Center);
37579 }
37580 }
37581 }
37582 }
37583
37585 {
37586 return 6;
37587 }
37588
37590 {
37591 float from = 0f + (float)stormIndex * 10f;
37592 float to = 90f + (float)stormIndex * 10f;
37594 result.StartAngle = (float)stormIndex * ((float)Math.PI / 3f) - (float)Math.PI / 2f + (float)stormIndex * ((float)Math.PI / 5f);
37595 result.AnglePerBullet = (float)Math.PI * 2f / 3f;
37596 result.BulletsInStorm = 3;
37597 result.BulletsProgressInStormStartNormalized = Utils.GetLerpValue(from, to, localAI[0]);
37598 result.BulletsProgressInStormBonusByIndexNormalized = 0f;
37599 result.StormTotalRange = 500f;
37600 result.BulletSize = new Vector2(16f, 16f);
37601 return result;
37602 }
37603
37604 public int FindTargetWithLineOfSight(float maxRange = 800f)
37605 {
37606 float num = maxRange;
37607 int result = -1;
37608 for (int i = 0; i < 200; i++)
37609 {
37610 NPC nPC = Main.npc[i];
37611 bool flag = nPC.CanBeChasedBy(this);
37612 if (localNPCImmunity[i] != 0)
37613 {
37614 flag = false;
37615 }
37616 if (flag)
37617 {
37618 float num2 = Distance(Main.npc[i].Center);
37619 if (num2 < num && Collision.CanHit(position, width, height, nPC.position, nPC.width, nPC.height))
37620 {
37621 num = num2;
37622 result = i;
37623 }
37624 }
37625 }
37626 return result;
37627 }
37628
37630 {
37631 Point p = base.Center.ToTileCoordinates();
37632 Vector2 vector = p.ToVector2();
37633 int num = 10;
37635 int num2 = 0;
37636 float num3 = 3f;
37637 if (ai[1] == 1f)
37638 {
37640 rotation = 0f;
37641 velocity.X = 0f;
37642 ai[1] = 2f;
37643 }
37644 frameCounter++;
37645 if (frameCounter > 4)
37646 {
37647 frameCounter = 0;
37648 frame++;
37649 if (frame >= Main.projFrames[type])
37650 {
37651 frame = 0;
37652 }
37653 }
37654 if (velocity.Length() > 1f && timeLeft % 10 == 0)
37655 {
37656 for (int i = p.X - num; i < p.X + num + 1; i++)
37657 {
37658 for (int j = p.Y - num; j < p.Y + num + 1; j++)
37659 {
37660 if (WorldGen.SolidTile(i, j))
37661 {
37662 Vector2 v = vector - new Vector2(i, j);
37663 Vector2 vector2 = v.SafeNormalize(Vector2.Zero) * Math.Max((float)num - v.Length(), 0f);
37664 vector2 *= num3;
37665 zero += vector2;
37666 num2++;
37667 }
37668 }
37669 }
37670 if (num2 > 0)
37671 {
37672 zero /= (float)num2;
37673 }
37674 if (zero.Length() > 1f)
37675 {
37676 velocity = zero;
37677 }
37678 }
37679 velocity *= 0.95f;
37680 if (velocity.Length() < 1f)
37681 {
37682 velocity = Vector2.Zero;
37683 netUpdate = true;
37684 }
37685 }
37686
37687 private void AI_169_Smolstars()
37688 {
37689 Player player = Main.player[owner];
37690 bool num = type == 864;
37691 Vector2 vector = player.Top + new Vector2(0f, -30f);
37692 if (num)
37693 {
37694 if (player.dead)
37695 {
37696 player.smolstar = false;
37697 }
37698 if (player.smolstar)
37699 {
37700 timeLeft = 2;
37701 }
37702 if (ai[0] == 0f)
37703 {
37704 AI_GetMyGroupIndexAndFillBlackList(null, out var index, out var totalIndexesInGroup);
37705 float num2 = (float)Math.PI * 2f / (float)totalIndexesInGroup;
37706 float num3 = (float)totalIndexesInGroup * 0.66f;
37707 Vector2 vector2 = new Vector2(30f, 6f) / 5f * (totalIndexesInGroup - 1);
37708 Vector2 vector3 = Vector2.UnitY.RotatedBy(num2 * (float)index + Main.GlobalTimeWrappedHourly % num3 / num3 * ((float)Math.PI * 2f));
37709 vector += vector3 * vector2;
37710 vector.Y += player.gfxOffY;
37711 vector = vector.Floor();
37712 }
37713 }
37714 if (ai[0] == 0f)
37715 {
37716 Vector2 vector4 = vector - base.Center;
37717 float num4 = 10f;
37718 float lerpValue = Utils.GetLerpValue(200f, 600f, vector4.Length(), clamped: true);
37719 num4 += lerpValue * 30f;
37720 if (vector4.Length() >= 3000f)
37721 {
37722 base.Center = vector;
37723 }
37724 velocity = vector4;
37725 if (velocity.Length() > num4)
37726 {
37727 velocity *= num4 / velocity.Length();
37728 }
37729 int startAttackRange = 800;
37730 int attackTarget = -1;
37731 Minion_FindTargetInRange(startAttackRange, ref attackTarget, skipIfCannotHitWithOwnBody: false);
37732 if (attackTarget != -1)
37733 {
37734 ai[0] = 60f;
37735 ai[1] = attackTarget;
37736 netUpdate = true;
37737 }
37738 float targetAngle = velocity.SafeNormalize(Vector2.UnitY).ToRotation() + (float)Math.PI / 2f;
37739 if (vector4.Length() < 40f)
37740 {
37741 targetAngle = Vector2.UnitY.ToRotation() + (float)Math.PI / 2f;
37742 }
37743 rotation = rotation.AngleLerp(targetAngle, 0.2f);
37744 return;
37745 }
37746 if (ai[0] == -1f)
37747 {
37748 if (ai[1] == 0f)
37749 {
37750 SoundEngine.PlaySound(0, (int)position.X, (int)position.Y);
37751 for (int i = 0; i < 2; i++)
37752 {
37753 Dust dust = Dust.NewDustDirect(position, width, height, 15, oldVelocity.X * 0.2f, oldVelocity.Y * 0.2f, 0, default(Color), 1.4f);
37754 if (Main.rand.Next(3) != 0)
37755 {
37756 dust.scale *= 1.3f;
37757 dust.velocity *= 1.1f;
37758 }
37759 dust.noGravity = true;
37760 dust.fadeIn = 0f;
37761 }
37762 velocity += Main.rand.NextVector2CircularEdge(4f, 4f);
37763 }
37764 ai[1] += 1f;
37765 rotation += velocity.X * 0.1f + velocity.Y * 0.05f;
37766 velocity *= 0.92f;
37767 if (ai[1] >= 9f)
37768 {
37769 ai[0] = 0f;
37770 ai[1] = 0f;
37771 }
37772 return;
37773 }
37774 NPC nPC = null;
37775 int num5 = (int)ai[1];
37776 if (Main.npc.IndexInRange(num5) && Main.npc[num5].CanBeChasedBy(this))
37777 {
37778 nPC = Main.npc[num5];
37779 }
37780 if (nPC == null)
37781 {
37782 ai[0] = -1f;
37783 ai[1] = 0f;
37784 netUpdate = true;
37785 }
37786 else if (player.Distance(nPC.Center) >= 900f)
37787 {
37788 ai[0] = 0f;
37789 ai[1] = 0f;
37790 netUpdate = true;
37791 }
37792 else
37793 {
37794 Vector2 vector5 = nPC.Center - base.Center;
37795 float num6 = 16f;
37796 velocity = vector5;
37797 if (velocity.Length() > num6)
37798 {
37799 velocity *= num6 / velocity.Length();
37800 }
37801 float targetAngle2 = velocity.SafeNormalize(Vector2.UnitY).ToRotation() + (float)Math.PI / 2f;
37802 rotation = rotation.AngleLerp(targetAngle2, 0.4f);
37803 }
37804 float num7 = 0.1f;
37805 float num8 = width * 5;
37806 for (int j = 0; j < 1000; j++)
37807 {
37808 if (j != whoAmI && Main.projectile[j].active && Main.projectile[j].owner == owner && Main.projectile[j].type == type && Math.Abs(position.X - Main.projectile[j].position.X) + Math.Abs(position.Y - Main.projectile[j].position.Y) < num8)
37809 {
37810 if (position.X < Main.projectile[j].position.X)
37811 {
37812 velocity.X -= num7;
37813 }
37814 else
37815 {
37816 velocity.X += num7;
37817 }
37818 if (position.Y < Main.projectile[j].position.Y)
37819 {
37820 velocity.Y -= num7;
37821 }
37822 else
37823 {
37824 velocity.Y += num7;
37825 }
37826 }
37827 }
37828 }
37829
37830 private void AI_019_Spears()
37831 {
37832 Player player = Main.player[owner];
37834 direction = player.direction;
37835 player.heldProj = whoAmI;
37837 base.Center = center;
37838 bool flag = Main.player[owner].itemAnimation < Main.player[owner].itemAnimationMax / 3;
37839 int itemAnimationMax = player.itemAnimationMax;
37840 int itemAnimation = player.itemAnimation;
37841 int num = Main.player[owner].itemAnimationMax / 3;
37842 float num2 = MathHelper.Min(itemAnimation, num);
37843 float num3 = (float)itemAnimation - num2;
37844 float num4 = 0f;
37845 float num5 = 0f;
37846 float num6 = 0f;
37847 bool flag2 = false;
37848 spriteDirection = -direction;
37849 switch (type)
37850 {
37851 case 46:
37852 num4 = 3f;
37853 num6 = 1.6f;
37854 num5 = 1.4f;
37855 break;
37856 case 105:
37857 num4 = 3f;
37858 num6 = 2.4f;
37859 num5 = 2.1f;
37860 break;
37861 case 367:
37862 num4 = 3f;
37863 num6 = 1.6f;
37864 num5 = 1.5f;
37865 break;
37866 case 368:
37867 num4 = 3f;
37868 num6 = 1.5f;
37869 num5 = 1.4f;
37870 break;
37871 case 222:
37872 num4 = 3f;
37873 num6 = 2.4f;
37874 num5 = 2.1f;
37875 break;
37876 case 342:
37877 num4 = 3f;
37878 num6 = 2.4f;
37879 num5 = 2.1f;
37880 break;
37881 case 47:
37882 num4 = 4f;
37883 num6 = 1.2f;
37884 num5 = 0.9f;
37885 break;
37886 case 153:
37887 num4 = 4f;
37888 num6 = 1.5f;
37889 num5 = 1.3f;
37890 break;
37891 case 49:
37892 num4 = 4f;
37893 num6 = 1.1f;
37894 num5 = 0.85f;
37895 break;
37896 case 730:
37897 num4 = 8f;
37898 num6 = 1.5f;
37899 num5 = 1.2f;
37900 break;
37901 case 877:
37902 case 878:
37903 case 879:
37904 alpha -= 40;
37905 if (alpha < 0)
37906 {
37907 alpha = 0;
37908 }
37909 num4 = 28f;
37910 num6 = 0.4f;
37911 num5 = 0.4f;
37912 flag2 = true;
37913 break;
37914 case 64:
37915 case 215:
37916 spriteDirection = -direction;
37917 num4 = 3f;
37918 num6 = 1.9f;
37919 num5 = 1.7f;
37920 break;
37921 case 66:
37922 case 97:
37923 case 212:
37924 case 218:
37925 num4 = 3f;
37926 num6 = 2.1f;
37927 num5 = 1.9f;
37928 break;
37929 case 130:
37930 num4 = 3f;
37931 num6 = 1.3f;
37932 num5 = 1f;
37933 break;
37934 }
37935 float num7 = (float)(itemAnimationMax - num) - num3;
37936 float num8 = (float)num - num2;
37937 float num9 = num4 + num5 * num7 - num6 * num8;
37938 position += velocity * num9;
37939 switch (type)
37940 {
37941 case 47:
37942 if (Main.player[owner].wet && Main.rand.Next(2) == 0)
37943 {
37944 int num10 = Dust.NewDust(Main.player[owner].position, Main.player[owner].width, Main.player[owner].height, 15, 0f, 0f, 100, default(Color), 0.8f);
37945 Main.dust[num10].velocity *= 0.1f;
37946 }
37947 break;
37948 case 130:
37949 if ((localAI[0] == 0f || localAI[0] == 4f || localAI[0] == 8f || localAI[0] == 12f || localAI[0] == 16f || localAI[0] == 20f || localAI[0] == 24f) && owner == Main.myPlayer)
37950 {
37951 NewProjectile(GetProjectileSource_FromThis(), base.Center.X, base.Center.Y, velocity.X, velocity.Y, 131, damage / 3, 0f, owner);
37952 }
37953 localAI[0] += 1f;
37954 break;
37955 case 730:
37956 if (localAI[0] == 0f && Main.myPlayer == owner)
37957 {
37958 localAI[0] = 1f;
37959 Vector2 vector = velocity * 4f;
37960 NewProjectile(GetProjectileSource_FromThis(), base.Center.X, base.Center.Y, vector.X, vector.Y, 732, (int)((double)damage * 1.5), knockBack * 0.5f, owner);
37961 }
37962 break;
37963 case 342:
37964 if (flag && localAI[0] == 0f && Main.myPlayer == owner)
37965 {
37966 localAI[0] = 1f;
37967 if (Collision.CanHit(player.position, player.width, player.height, position, width, height))
37968 {
37969 NewProjectile(GetProjectileSource_FromThis(), base.Center.X, base.Center.Y, velocity.X * 2.4f, velocity.Y * 2.4f, 343, damage, knockBack * 0.85f, owner);
37970 }
37971 }
37972 break;
37973 case 222:
37974 if (flag && localAI[0] == 0f && Main.myPlayer == owner)
37975 {
37976 localAI[0] = 1f;
37977 NewProjectile(GetProjectileSource_FromThis(), base.Center.X, base.Center.Y, velocity.X, velocity.Y, 228, damage, knockBack, owner);
37978 }
37979 break;
37980 }
37981 if (flag2 && player.channel && player.itemAnimation < num)
37982 {
37983 player.SetDummyItemTime(num);
37984 }
37985 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + (float)Math.PI / 2f + (float)Math.PI / 4f;
37986 if (spriteDirection == -1)
37987 {
37988 rotation -= (float)Math.PI / 2f;
37989 }
37990 AI_019_Spears_GetExtensionHitbox(out var _);
37991 if (type == 878 || type == 879)
37992 {
37993 float num11 = 6f;
37994 float num12 = 0.8f;
37995 float num13 = Vector2.Dot(velocity.SafeNormalize(Vector2.UnitX * player.direction), player.velocity.SafeNormalize(Vector2.UnitX * player.direction));
37996 float num14 = player.velocity.Length();
37997 if (num14 > num11 && num13 > num12)
37998 {
37999 int num15 = 8;
38000 if (num14 > num11 + 1f)
38001 {
38002 num15 = 5;
38003 }
38004 if (num14 > num11 + 2f)
38005 {
38006 num15 = 2;
38007 }
38008 int num16 = 14;
38009 int num17 = 27;
38010 int num18 = 4;
38011 if (type == 879)
38012 {
38013 num16 = 43;
38014 num17 = 57;
38015 }
38016 if (Main.rand.Next(num15 + 3) == 0)
38017 {
38018 Dust.NewDust(base.Center - new Vector2(num18, num18), num18 * 2, num18 * 2, num16, 0f, 0f, 150, default(Color), 1.4f);
38019 }
38020 if (Main.rand.Next(num15) == 0)
38021 {
38022 int num19 = Dust.NewDust(base.Center - new Vector2(num18, num18), num18 * 2, num18 * 2, num17, velocity.X * 0.2f + (float)(direction * 3), velocity.Y * 0.2f, 100, default(Color), 1.2f);
38023 Main.dust[num19].noGravity = true;
38024 Main.dust[num19].velocity *= 0.25f;
38025 num19 = Dust.NewDust(base.Center - new Vector2(num18, num18), num18 * 2, num18 * 2, num17, 0f, 0f, 150, default(Color), 1.4f);
38026 Main.dust[num19].velocity *= 0.25f;
38027 }
38028 }
38029 }
38030 if (type == 46)
38031 {
38032 if (Main.rand.Next(5) == 0)
38033 {
38034 Dust.NewDust(position, width, height, 14, 0f, 0f, 150, default(Color), 1.4f);
38035 }
38036 int num20 = Dust.NewDust(position, width, height, 27, velocity.X * 0.2f + (float)(direction * 3), velocity.Y * 0.2f, 100, default(Color), 1.2f);
38037 Main.dust[num20].noGravity = true;
38038 Main.dust[num20].velocity /= 2f;
38039 num20 = Dust.NewDust(position - velocity * 2f, width, height, 27, 0f, 0f, 150, default(Color), 1.4f);
38040 Main.dust[num20].velocity /= 5f;
38041 }
38042 if (type == 730)
38043 {
38044 if (Main.rand.Next(5) == 0)
38045 {
38046 Dust dust = Dust.NewDustDirect(position, width, height, 226, 0f, 0f, 150, default(Color), 0.7f);
38047 dust.noGravity = true;
38048 dust.velocity *= 1.4f;
38049 }
38050 if (Main.rand.Next(5) == 0)
38051 {
38052 Dust.NewDustDirect(position, width, height, 226, 0f, 0f, 150, default(Color), 0.5f).velocity.Y -= 0.5f;
38053 }
38054 }
38055 else if (type == 105)
38056 {
38057 if (Main.rand.Next(3) == 0)
38058 {
38059 int num21 = Dust.NewDust(position, width, height, 57, velocity.X * 0.2f, velocity.Y * 0.2f, 200, default(Color), 1.2f);
38060 Main.dust[num21].velocity += velocity * 0.3f;
38061 Main.dust[num21].velocity *= 0.2f;
38062 }
38063 if (Main.rand.Next(4) == 0)
38064 {
38065 int num22 = Dust.NewDust(position, width, height, 43, 0f, 0f, 254, default(Color), 0.3f);
38066 Main.dust[num22].velocity += velocity * 0.5f;
38067 Main.dust[num22].velocity *= 0.5f;
38068 }
38069 }
38070 else if (type == 153)
38071 {
38072 int num23 = Dust.NewDust(position - velocity * 3f, width, height, 115, velocity.X * 0.4f, velocity.Y * 0.4f, 140);
38073 Main.dust[num23].noGravity = true;
38074 Main.dust[num23].fadeIn = 1.25f;
38075 Main.dust[num23].velocity *= 0.25f;
38076 }
38077 if (type == 342)
38078 {
38079 Lighting.AddLight(base.Center, 0.65f, 0.9f, 1f);
38080 if (timeLeft % 2 == 0)
38081 {
38082 int num24 = 10;
38083 int num25 = Dust.NewDust(position - velocity * 3f - new Vector2(num24, num24), width + num24 * 2, height + num24 * 2, 135, velocity.X * 0.4f, velocity.Y * 0.4f, 50, default(Color), 1.2f);
38084 Main.dust[num25].velocity *= 0.5f;
38085 Main.dust[num25].velocity += velocity * 0.25f;
38086 }
38087 }
38088 ai[0] += 1f;
38089 bool flag3 = ai[0] >= (float)itemAnimationMax;
38090 if (flag2)
38091 {
38092 flag3 &= !player.channel;
38093 }
38094 if (flag3)
38095 {
38096 Kill();
38097 }
38098 }
38099
38101 {
38102 extensionBox = default(Rectangle);
38103 Player player = Main.player[owner];
38104 if (player.itemAnimation < player.itemAnimationMax / 3)
38105 {
38106 return false;
38107 }
38108 int itemAnimationMax = player.itemAnimationMax;
38109 int itemAnimation = player.itemAnimation;
38110 int num = player.itemAnimationMax / 3;
38111 float num2 = Utils.Remap(itemAnimation, itemAnimationMax, num, 0f, 1f);
38112 float num3 = 10f;
38113 float num4 = 30f;
38114 float num5 = 10f;
38115 float num6 = 10f;
38116 switch (type)
38117 {
38118 default:
38119 return false;
38120 case 105:
38121 num4 = 50f;
38122 num6 = 20f;
38123 break;
38124 case 46:
38125 num4 = 50f;
38126 num6 = 15f;
38127 break;
38128 case 153:
38129 num4 = 40f;
38130 num6 = 10f;
38131 break;
38132 }
38133 num4 *= 1f / player.meleeSpeed;
38134 float num7 = num3 + num4 * num2;
38135 float num8 = num5 + num6 * num2;
38136 float f = velocity.ToRotation();
38137 Vector2 center = base.Center + f.ToRotationVector2() * num7;
38139 return true;
38140 }
38141
38142 private void AI_019_Spears_Old()
38143 {
38144 Vector2 vector = Main.player[owner].RotatedRelativePoint(Main.player[owner].MountedCenter);
38145 direction = Main.player[owner].direction;
38146 Main.player[owner].heldProj = whoAmI;
38147 Main.player[owner].MatchItemTimeToItemAnimation();
38148 position.X = vector.X - (float)(width / 2);
38149 position.Y = vector.Y - (float)(height / 2);
38150 bool flag = Main.player[owner].itemAnimation < Main.player[owner].itemAnimationMax / 3;
38151 if (!Main.player[owner].frozen)
38152 {
38153 if (type == 46)
38154 {
38155 if (ai[0] == 0f)
38156 {
38157 ai[0] = 3f;
38158 netUpdate = true;
38159 }
38160 if (flag)
38161 {
38162 ai[0] -= 1.6f;
38163 }
38164 else
38165 {
38166 ai[0] += 1.4f;
38167 }
38168 }
38169 else if (type == 105)
38170 {
38171 if (ai[0] == 0f)
38172 {
38173 ai[0] = 3f;
38174 netUpdate = true;
38175 }
38176 if (flag)
38177 {
38178 ai[0] -= 2.4f;
38179 }
38180 else
38181 {
38182 ai[0] += 2.1f;
38183 }
38184 }
38185 else if (type == 367)
38186 {
38187 spriteDirection = -direction;
38188 if (ai[0] == 0f)
38189 {
38190 ai[0] = 3f;
38191 netUpdate = true;
38192 }
38193 if (flag)
38194 {
38195 ai[0] -= 1.6f;
38196 }
38197 else
38198 {
38199 ai[0] += 1.5f;
38200 }
38201 }
38202 else if (type == 368)
38203 {
38204 spriteDirection = -direction;
38205 if (ai[0] == 0f)
38206 {
38207 ai[0] = 3f;
38208 netUpdate = true;
38209 }
38210 if (flag)
38211 {
38212 ai[0] -= 1.5f;
38213 }
38214 else
38215 {
38216 ai[0] += 1.4f;
38217 }
38218 }
38219 else if (type == 222)
38220 {
38221 if (ai[0] == 0f)
38222 {
38223 ai[0] = 3f;
38224 netUpdate = true;
38225 }
38226 if (flag)
38227 {
38228 ai[0] -= 2.4f;
38229 if (localAI[0] == 0f && Main.myPlayer == owner)
38230 {
38231 localAI[0] = 1f;
38232 NewProjectile(GetProjectileSource_FromThis(), base.Center.X + velocity.X * ai[0], base.Center.Y + velocity.Y * ai[0], velocity.X, velocity.Y, 228, damage, knockBack, owner);
38233 }
38234 }
38235 else
38236 {
38237 ai[0] += 2.1f;
38238 }
38239 }
38240 else if (type == 342)
38241 {
38242 if (ai[0] == 0f)
38243 {
38244 ai[0] = 3f;
38245 netUpdate = true;
38246 }
38247 if (flag)
38248 {
38249 ai[0] -= 2.4f;
38250 if (localAI[0] == 0f && Main.myPlayer == owner)
38251 {
38252 localAI[0] = 1f;
38253 if (Collision.CanHit(Main.player[owner].position, Main.player[owner].width, Main.player[owner].height, new Vector2(base.Center.X + velocity.X * ai[0], base.Center.Y + velocity.Y * ai[0]), width, height))
38254 {
38255 NewProjectile(GetProjectileSource_FromThis(), base.Center.X + velocity.X * ai[0], base.Center.Y + velocity.Y * ai[0], velocity.X * 2.4f, velocity.Y * 2.4f, 343, (int)((double)damage * 0.8), knockBack * 0.85f, owner);
38256 }
38257 }
38258 }
38259 else
38260 {
38261 ai[0] += 2.1f;
38262 }
38263 }
38264 else if (type == 47)
38265 {
38266 if (ai[0] == 0f)
38267 {
38268 ai[0] = 4f;
38269 netUpdate = true;
38270 }
38271 if (flag)
38272 {
38273 ai[0] -= 1.2f;
38274 }
38275 else
38276 {
38277 ai[0] += 0.9f;
38278 }
38279 }
38280 else if (type == 153)
38281 {
38282 spriteDirection = -direction;
38283 if (ai[0] == 0f)
38284 {
38285 ai[0] = 4f;
38286 netUpdate = true;
38287 }
38288 if (flag)
38289 {
38290 ai[0] -= 1.5f;
38291 }
38292 else
38293 {
38294 ai[0] += 1.3f;
38295 }
38296 }
38297 else if (type == 49)
38298 {
38299 if (ai[0] == 0f)
38300 {
38301 ai[0] = 4f;
38302 netUpdate = true;
38303 }
38304 if (flag)
38305 {
38306 ai[0] -= 1.1f;
38307 }
38308 else
38309 {
38310 ai[0] += 0.85f;
38311 }
38312 }
38313 else if (type == 730)
38314 {
38315 spriteDirection = -direction;
38316 if (ai[0] == 0f)
38317 {
38318 ai[0] = 8f;
38319 netUpdate = true;
38320 if (localAI[0] == 0f && Main.myPlayer == owner)
38321 {
38322 localAI[0] = 1f;
38323 Vector2 vector2 = velocity * 4f;
38324 NewProjectile(GetProjectileSource_FromThis(), base.Center.X + velocity.X * ai[0], base.Center.Y + velocity.Y * ai[0], vector2.X, vector2.Y, 732, (int)((double)damage * 1.25), knockBack * 0.5f, owner);
38325 }
38326 }
38327 if (flag)
38328 {
38329 ai[0] -= 1.5f;
38330 }
38331 else
38332 {
38333 ai[0] += 1.2f;
38334 }
38335 }
38336 else if (type == 64 || type == 215)
38337 {
38338 spriteDirection = -direction;
38339 if (ai[0] == 0f)
38340 {
38341 ai[0] = 3f;
38342 netUpdate = true;
38343 }
38344 if (flag)
38345 {
38346 ai[0] -= 1.9f;
38347 }
38348 else
38349 {
38350 ai[0] += 1.7f;
38351 }
38352 }
38353 else if (type == 66 || type == 97 || type == 212 || type == 218)
38354 {
38355 spriteDirection = -direction;
38356 if (ai[0] == 0f)
38357 {
38358 ai[0] = 3f;
38359 netUpdate = true;
38360 }
38361 if (flag)
38362 {
38363 ai[0] -= 2.1f;
38364 }
38365 else
38366 {
38367 ai[0] += 1.9f;
38368 }
38369 }
38370 else if (type == 130)
38371 {
38372 spriteDirection = -direction;
38373 if (ai[0] == 0f)
38374 {
38375 ai[0] = 3f;
38376 netUpdate = true;
38377 }
38378 if (flag)
38379 {
38380 ai[0] -= 1.3f;
38381 }
38382 else
38383 {
38384 ai[0] += 1f;
38385 }
38386 }
38387 }
38388 position += velocity * ai[0];
38389 if (type == 130)
38390 {
38391 if (ai[1] == 0f || ai[1] == 4f || ai[1] == 8f || ai[1] == 12f || ai[1] == 16f || ai[1] == 20f || ai[1] == 24f)
38392 {
38393 NewProjectile(GetProjectileSource_FromThis(), position.X + (float)(width / 2), position.Y + (float)(height / 2), velocity.X, velocity.Y, 131, damage / 3, 0f, owner);
38394 }
38395 ai[1] += 1f;
38396 }
38397 if (Main.player[owner].itemAnimation == 0)
38398 {
38399 Kill();
38400 }
38401 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 2.355f;
38402 if (spriteDirection == -1)
38403 {
38404 rotation -= 1.57f;
38405 }
38406 if (type == 46)
38407 {
38408 if (Main.rand.Next(5) == 0)
38409 {
38410 Dust.NewDust(position, width, height, 14, 0f, 0f, 150, default(Color), 1.4f);
38411 }
38412 int num = Dust.NewDust(position, width, height, 27, velocity.X * 0.2f + (float)(direction * 3), velocity.Y * 0.2f, 100, default(Color), 1.2f);
38413 Main.dust[num].noGravity = true;
38414 Main.dust[num].velocity.X /= 2f;
38415 Main.dust[num].velocity.Y /= 2f;
38416 num = Dust.NewDust(position - velocity * 2f, width, height, 27, 0f, 0f, 150, default(Color), 1.4f);
38417 Main.dust[num].velocity.X /= 5f;
38418 Main.dust[num].velocity.Y /= 5f;
38419 }
38420 if (type == 730)
38421 {
38422 if (Main.rand.Next(5) == 0)
38423 {
38424 Dust dust = Dust.NewDustDirect(position, width, height, 226, 0f, 0f, 150, default(Color), 0.7f);
38425 dust.noGravity = true;
38426 dust.velocity *= 1.4f;
38427 }
38428 if (Main.rand.Next(5) == 0)
38429 {
38430 Dust.NewDustDirect(position, width, height, 226, 0f, 0f, 150, default(Color), 0.5f).velocity.Y -= 0.5f;
38431 }
38432 }
38433 else if (type == 105)
38434 {
38435 if (Main.rand.Next(3) == 0)
38436 {
38437 int num2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 57, velocity.X * 0.2f, velocity.Y * 0.2f, 200, default(Color), 1.2f);
38438 Main.dust[num2].velocity += velocity * 0.3f;
38439 Main.dust[num2].velocity *= 0.2f;
38440 }
38441 if (Main.rand.Next(4) == 0)
38442 {
38443 int num3 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 43, 0f, 0f, 254, default(Color), 0.3f);
38444 Main.dust[num3].velocity += velocity * 0.5f;
38445 Main.dust[num3].velocity *= 0.5f;
38446 }
38447 }
38448 else if (type == 153)
38449 {
38450 int num4 = Dust.NewDust(position - velocity * 3f, width, height, 115, velocity.X * 0.4f, velocity.Y * 0.4f, 140);
38451 Main.dust[num4].noGravity = true;
38452 Main.dust[num4].fadeIn = 1.25f;
38453 Main.dust[num4].velocity *= 0.25f;
38454 }
38455 }
38456
38457 private void AI_168_FirstFractal()
38458 {
38459 float num = 60f;
38460 if ((localAI[0] += 1f) >= num - 1f)
38461 {
38462 Kill();
38463 return;
38464 }
38465 if (frameCounter == 0)
38466 {
38467 frameCounter = 1;
38468 frame = Main.rand.Next(15);
38469 }
38470 velocity = velocity.RotatedBy(ai[0]);
38471 Opacity = Utils.GetLerpValue(0f, 12f, localAI[0], clamped: true) * Utils.GetLerpValue(num, num - 12f, localAI[0], clamped: true);
38472 direction = ((velocity.X > 0f) ? 1 : (-1));
38473 spriteDirection = direction;
38474 rotation = (float)Math.PI / 4f * (float)spriteDirection + velocity.ToRotation();
38475 if (spriteDirection == -1)
38476 {
38477 rotation += (float)Math.PI;
38478 }
38479 if (localAI[0] > 7f)
38480 {
38481 int num2 = 5;
38482 _ = base.Center - new Vector2(num2);
38483 if (Main.rand.Next(15) == 0)
38484 {
38485 Dust dust = Dust.NewDustPerfect(base.Center, 278, null, 100, Color.Lerp(GetFirstFractalColor(), Color.White, Main.rand.NextFloat() * 0.3f));
38486 dust.scale = 0.7f;
38487 dust.noGravity = true;
38488 dust.velocity *= 0.5f;
38489 dust.velocity += velocity * 2f;
38490 }
38491 }
38492 }
38493
38495 {
38496 float num = 90f;
38497 if ((localAI[0] += 1f) >= num - 1f)
38498 {
38499 Kill();
38500 return;
38501 }
38502 float num2 = localAI[0] / num;
38503 Vector2 center = Main.player[owner].Center;
38504 Vector2 vector = new Vector2(ai[0], ai[1]);
38505 Vector2 vector2 = -velocity;
38506 Vector2 value = center + vector2 * 2f;
38507 Vector2 value2 = vector + vector2 * (1f - num2 * 3f);
38508 base.Center = Vector2.CatmullRom(value, center, vector, value2, num2);
38509 int num3 = type;
38510 if (num3 == 856)
38511 {
38512 Lighting.AddLight(base.Center, Color.HotPink.ToVector3() * 0.3f);
38513 rotation = (float)Math.PI * 2f * num2 * 1f;
38514 }
38515 }
38516
38518 {
38519 Player player = Main.player[owner];
38520 if (type == 831)
38521 {
38522 if (player.dead)
38523 {
38524 player.stormTiger = false;
38525 }
38526 if (player.stormTiger)
38527 {
38528 timeLeft = 2;
38529 }
38530 if (++frameCounter >= 4)
38531 {
38532 frameCounter = 0;
38533 if (++frame >= 6)
38534 {
38535 frame = 0;
38536 }
38537 }
38538 }
38539 if (type == 970)
38540 {
38541 if (player.ownedProjectileCounts[type] > 1 && localAI[0] == 0f)
38542 {
38543 localAI[0] = 1f;
38545 }
38546 if (player.dead)
38547 {
38548 player.abigailMinion = false;
38549 }
38550 if (player.abigailMinion)
38551 {
38552 timeLeft = 2;
38553 }
38554 if (++frameCounter >= 4)
38555 {
38556 frameCounter = 0;
38557 if (++frame >= 6)
38558 {
38559 frame = 0;
38560 }
38561 }
38562 }
38563 List<int> ai164_blacklistedTargets = _ai164_blacklistedTargets;
38565 AI_GetMyGroupIndexAndFillBlackList(ai164_blacklistedTargets, out var index, out var totalIndexesInGroup);
38566 Vector2 center = AI_164_GetHomeLocation(player, index, totalIndexesInGroup);
38567 base.Center = center;
38568 }
38569
38571 {
38572 int num = master.bodyFrame.Height;
38573 if (num == 0)
38574 {
38575 num = 1;
38576 }
38577 Vector2 vector = Main.OffsetsPlayerHeadgear[master.bodyFrame.Y / num];
38578 vector.Y -= 2f;
38579 float num2 = master.miscCounterNormalized * 2f;
38580 int num3 = stackedIndex / 4;
38581 int num4 = totalIndexes / 4;
38582 if (totalIndexes % 4 > 0)
38583 {
38584 num4++;
38585 }
38586 int num5 = (totalIndexes - num3 * 4) % 4;
38587 if (num5 == 0)
38588 {
38589 num5 = 4;
38590 }
38591 if (num4 - 1 != num3)
38592 {
38593 num5 = 4;
38594 }
38595 int num6 = stackedIndex % num5;
38596 float num7 = (float)num6 / (float)num5;
38597 num2 += (float)num3 / 8f;
38598 if (stackedIndex >= (num4 - 1) * 4 && num3 > 0)
38599 {
38600 num2 = 0f;
38601 switch (num5)
38602 {
38603 case 1:
38604 num7 = 0f;
38605 break;
38606 case 2:
38607 num7 = 0.25f + (float)num6 * 0.5f;
38608 break;
38609 case 3:
38610 num7 = (float)(num6 - 1) / 6f;
38611 break;
38612 case 4:
38613 num7 = ((float)num6 - 1.5f) / 6f;
38614 break;
38615 }
38616 }
38617 Vector2 vector2 = new Vector2(0f, -8 - 12 * num3).RotatedBy((num2 + num7) * ((float)Math.PI * 2f));
38618 vector += vector2 + new Vector2(0f, master.gravDir * -40f);
38620 _ = master.direction;
38621 Vector2 vec = mountedCenter + new Vector2(0f, master.gravDir * -21f) + vector;
38622 vec.Y += master.gfxOffY;
38623 return vec.Floor();
38624 }
38625
38626 private void AI_162_TigerPounce()
38627 {
38628 if (ai[0] < 0f)
38629 {
38630 Opacity = 0f;
38631 ai[0] += 1f;
38632 return;
38633 }
38634 bool flag = false;
38635 flag = true;
38636 if (frameCounter == 0)
38637 {
38638 frameCounter = 1;
38639 localAI[0] = base.Center.X;
38640 localAI[1] = base.Center.Y;
38641 flag = true;
38642 }
38643 Vector2 vector = new Vector2(localAI[0], localAI[1]);
38644 Vector2 vector2 = vector + velocity;
38645 float y = Vector2.Distance(vector, vector2) * 1.5f;
38646 float num = 0.1f;
38647 Vector2 value = Vector2.Lerp(vector, vector2, 0f - num) + new Vector2(0f, y);
38648 Vector2 value2 = Vector2.Lerp(vector, vector2, 1f + num) + new Vector2(0f, y);
38649 if (Opacity < 1f)
38650 {
38651 Opacity += 0.1f;
38652 }
38653 int num2 = Math.Sign(vector2.X - vector.X);
38654 rotation += (float)num2 * -0.2f;
38655 spriteDirection = num2;
38656 if (ai[1] < 1f)
38657 {
38658 ai[1] = 60f;
38659 }
38660 ai[0] += 1f / ai[1];
38662 if (flag)
38663 {
38664 for (float num3 = 0f; num3 < 1f; num3 += 0.5f)
38665 {
38666 if (Main.rand.Next(19) == 0)
38667 {
38668 Vector2 vector4 = base.Center + DirectionTo(vector3).SafeNormalize(Vector2.UnitY) * 100f;
38669 Dust dust = Dust.NewDustPerfect(base.Center + base.Size * Main.rand.NextVector2Square(0f, 1f), 278, Main.rand.NextVector2Circular(3f, 3f), 100, Color.White * 0.4f);
38670 dust.velocity.Y += -0.6f;
38671 dust.velocity += velocity * 0.1f;
38672 Main.rand.Next(5);
38673 dust.velocity = (vector4 - base.Center) * 0.05f;
38674 dust.fadeIn = 0f;
38675 dust.scale = 0.7f;
38676 dust.noGravity = true;
38677 }
38678 }
38679 if (Main.rand.Next(2) == 0)
38680 {
38681 Dust obj = Main.dust[Dust.NewDust(position, width, height, 269)];
38682 obj.fadeIn = 0.7f;
38683 obj.scale = 0.4f;
38684 obj.velocity += velocity * 0.001f;
38685 obj.noLight = true;
38686 }
38687 }
38688 base.Center = vector3;
38689 if (ai[0] >= 1f)
38690 {
38691 Kill();
38692 }
38693 }
38694
38695 private void PrepareBombToBlow()
38696 {
38697 tileCollide = false;
38698 ai[1] = 0f;
38699 alpha = 255;
38700 if (type == 28 || type == 37 || type == 516 || type == 519)
38701 {
38702 Resize(128, 128);
38703 damage = 100;
38704 knockBack = 8f;
38705 }
38706 else if (type == 773)
38707 {
38708 Resize(48, 96);
38709 damage = 100;
38710 knockBack = 8f;
38711 }
38712 else if (type == 29 || type == 470 || type == 637)
38713 {
38714 Resize(250, 250);
38715 damage = 250;
38716 knockBack = 10f;
38717 }
38718 else if (type == 30 || type == 397 || type == 517 || type == 588)
38719 {
38720 Resize(128, 128);
38721 knockBack = 8f;
38722 }
38723 else if (type == 681)
38724 {
38725 Resize(80, 80);
38726 knockBack = 8f;
38727 }
38728 else if (type == 779 || type == 783 || type == 862 || type == 863)
38729 {
38730 Resize(48, 48);
38731 knockBack = 8f;
38732 }
38733 else if (type == 133 || type == 134 || type == 135 || type == 136 || type == 137 || type == 138 || type == 338 || type == 339 || type == 930)
38734 {
38735 Resize(128, 128);
38736 knockBack = 8f;
38737 }
38738 else if (type == 794 || type == 797 || type == 795 || type == 798 || type == 793 || type == 796 || type == 808 || type == 808)
38739 {
38740 Resize(250, 250);
38741 knockBack = 12f;
38742 }
38743 else if (type == 776 || type == 780 || type == 777 || type == 781 || type == 778 || type == 782 || type == 803 || type == 804)
38744 {
38745 Resize(128, 128);
38746 knockBack = 12f;
38747 }
38748 else if (type == 784 || type == 785 || type == 786 || type == 805 || type == 903 || type == 787 || type == 788 || type == 789 || type == 806 || type == 904 || type == 790 || type == 791 || type == 792 || type == 807 || type == 905 || type == 799 || type == 800 || type == 801 || type == 810 || type == 906 || type == 910 || type == 911)
38749 {
38750 if (type == 903 || type == 904 || type == 905 || type == 906 || type == 910 || type == 911)
38751 {
38752 damage = 100;
38753 }
38754 Resize(48, 48);
38755 knockBack = 12f;
38756 }
38757 else if (type == 139 || type == 140 || type == 141 || type == 142 || type == 143 || type == 144 || type == 340 || type == 341)
38758 {
38759 Resize(200, 200);
38760 knockBack = 10f;
38761 }
38762 }
38763
38764 private void AI_016()
38765 {
38766 if (wet && (type == 799 || type == 800 || type == 801 || type == 810 || type == 906 || type == 784 || type == 785 || type == 786 || type == 805 || type == 903 || type == 787 || type == 788 || type == 789 || type == 806 || type == 904 || type == 790 || type == 791 || type == 792 || type == 807 || type == 905))
38767 {
38768 timeLeft = 1;
38769 }
38770 if (type == 108 || type == 164 || type == 1002)
38771 {
38772 ai[0] += 1f;
38773 if (ai[0] > 3f)
38774 {
38775 Kill();
38776 }
38777 }
38778 if (type == 102)
38779 {
38780 int num = (int)(base.Center.X / 16f);
38781 int num2 = (int)(base.Center.Y / 16f);
38782 if (WorldGen.InWorld(num, num2))
38783 {
38784 Tile tile = Main.tile[num, num2];
38785 if (tile != null && tile.active() && (TileID.Sets.Platforms[tile.type] || tile.type == 380))
38786 {
38787 Kill();
38788 return;
38789 }
38790 }
38791 }
38792 if (type == 75)
38793 {
38794 if (localAI[0] == 0f)
38795 {
38796 localAI[0] = 1f;
38797 SoundEngine.PlaySound(66, (int)position.X, (int)position.Y);
38798 }
38799 for (int i = 0; i < 255; i++)
38800 {
38801 if (Main.player[i].active && !Main.player[i].dead && !Main.player[i].ghost && (base.Center - Main.player[i].Center).Length() < 40f)
38802 {
38803 Kill();
38804 return;
38805 }
38806 }
38807 }
38808 bool flag = false;
38809 if (type == 37 || type == 397 || type == 470 || type == 519 || type == 773 || type == 911)
38810 {
38811 try
38812 {
38813 int num3 = (int)(position.X / 16f) - 1;
38814 int num4 = (int)((position.X + (float)width) / 16f) + 2;
38815 int num5 = (int)(position.Y / 16f) - 1;
38816 int num6 = (int)((position.Y + (float)height) / 16f) + 2;
38817 if (num3 < 0)
38818 {
38819 num3 = 0;
38820 }
38821 if (num4 > Main.maxTilesX)
38822 {
38824 }
38825 if (num5 < 0)
38826 {
38827 num5 = 0;
38828 }
38829 if (num6 > Main.maxTilesY)
38830 {
38832 }
38833 Vector2 vector = default(Vector2);
38834 for (int j = num3; j < num4; j++)
38835 {
38836 for (int k = num5; k < num6; k++)
38837 {
38838 if (Main.tile[j, k] == null || !Main.tile[j, k].nactive() || !Main.tileSolid[Main.tile[j, k].type] || Main.tileSolidTop[Main.tile[j, k].type])
38839 {
38840 continue;
38841 }
38842 vector.X = j * 16;
38843 vector.Y = k * 16;
38844 if (!(position.X + (float)width - 4f > vector.X) || !(position.X + 4f < vector.X + 16f) || !(position.Y + (float)height - 4f > vector.Y) || !(position.Y + 4f < vector.Y + 16f))
38845 {
38846 continue;
38847 }
38848 if (type == 911 && owner == Main.myPlayer && localAI[0] == 0f)
38849 {
38850 float num7 = 12f;
38851 Vector2 value = vector + new Vector2(8f, 8f);
38852 if (Vector2.Distance(base.Center, value) < num7)
38853 {
38854 base.Center += velocity.SafeNormalize(Vector2.Zero) * -4f;
38855 }
38856 localAI[0] = 1f;
38857 netUpdate = true;
38858 }
38859 velocity.X = 0f;
38860 velocity.Y = -0.2f;
38861 flag = true;
38862 }
38863 }
38864 }
38865 catch
38866 {
38867 }
38868 }
38869 if (flag && type == 911)
38870 {
38871 Point p = base.Center.ToTileCoordinates();
38873 {
38874 Vector2 v = p.ToWorldCoordinates() - base.Center;
38875 base.Center += v.SafeNormalize(Vector2.Zero) * -4f;
38876 }
38877 }
38878 if (flag && type == 773)
38879 {
38880 Player player = Main.player[owner];
38881 Vector2 v2 = DirectionTo(player.Center).SafeNormalize(Vector2.UnitX * player.direction);
38882 float num8 = rotation;
38883 float num9 = v2.ToRotation() + (float)Math.PI / 2f;
38884 rotation = rotation.AngleLerp(num9, 0.2f);
38885 rotation = rotation.AngleTowards(num9, 0.05f);
38886 Vector2 vector2 = (rotation - (float)Math.PI / 2f).ToRotationVector2();
38887 if (Main.rand.Next(3) == 0)
38888 {
38889 Dust dust = Dust.NewDustPerfect(base.Center + vector2 * 10f, 59, vector2 * 2f + Main.rand.NextVector2Circular(0.25f, 0.25f), 0, default(Color), 2f);
38890 dust.noGravity = true;
38891 if (Main.rand.Next(3) == 0)
38892 {
38893 dust.velocity *= 1.5f;
38894 dust.noGravity = false;
38895 dust.scale /= 2f;
38896 }
38897 }
38898 if (Main.rand.Next(3) == 0)
38899 {
38900 Point scarabBombDigDirectionSnap = GetScarabBombDigDirectionSnap8();
38901 Dust.NewDustPerfect(base.Center + vector2 * -10f, 59, scarabBombDigDirectionSnap.ToVector2() * 1.5f, 0, default(Color), 2f).noGravity = true;
38902 }
38903 if (Main.rand.Next(15) == 0)
38904 {
38905 Dust dust2 = Dust.NewDustPerfect(base.Center + vector2 * 10f, 88, vector2 * 3f + Main.rand.NextVector2Circular(0.25f, 0.25f), 0, default(Color), 2f);
38906 dust2.noGravity = true;
38907 if (Main.rand.Next(3) == 0)
38908 {
38909 dust2.velocity *= 1.5f;
38910 }
38911 }
38912 bool flag2 = Main.rand.Next(30) == 0;
38913 if (num8 != rotation && Main.rand.Next(40) == 0)
38914 {
38915 flag2 = true;
38916 }
38917 if (flag2)
38918 {
38919 float num10 = (float)Math.PI * 2f * Main.rand.NextFloat();
38920 for (float num11 = 0f; num11 < 1f; num11 += 1f / 7f)
38921 {
38922 Vector2 spinningpoint = (num11 * ((float)Math.PI * 2f) + num10).ToRotationVector2();
38923 spinningpoint *= new Vector2(1f, 0.3f);
38924 spinningpoint = spinningpoint.RotatedBy(num9);
38926 dust3.noGravity = true;
38927 dust3.fadeIn = 1.6f;
38928 }
38929 }
38930 if (++frameCounter >= 3)
38931 {
38932 frameCounter = 0;
38933 if (++frame >= 4)
38934 {
38935 frame = 0;
38936 }
38937 }
38938 }
38939 if (type == 519)
38940 {
38941 localAI[1] += 1f;
38942 float num12 = 180f - localAI[1];
38943 if (num12 < 0f)
38944 {
38945 num12 = 0f;
38946 }
38947 frameCounter++;
38948 if (num12 < 15f)
38949 {
38950 frameCounter++;
38951 }
38952 if ((float)frameCounter >= (num12 / 10f + 6f) / 2f)
38953 {
38954 frame++;
38955 frameCounter = 0;
38956 if (frame >= Main.projFrames[type])
38957 {
38958 frame = 0;
38959 }
38960 }
38961 }
38962 if (type == 681 && localAI[1] == 0f)
38963 {
38964 localAI[1] = 1f;
38965 }
38966 int num13 = 6;
38967 if (type == 776 || type == 780 || type == 803 || type == 804)
38968 {
38969 num13 = 228;
38970 }
38971 else if (type == 784 || type == 805)
38972 {
38973 num13 = ((Main.rand.Next(3) == 0) ? 6 : Dust.dustWater());
38974 }
38975 else if (type == 787 || type == 806)
38976 {
38977 num13 = ((Main.rand.Next(3) == 0) ? 6 : 35);
38978 }
38979 else if (type == 790 || type == 807)
38980 {
38981 num13 = ((Main.rand.Next(3) == 0) ? 6 : 152);
38982 }
38983 if (type == 102)
38984 {
38985 if (velocity.Y > 10f)
38986 {
38987 velocity.Y = 10f;
38988 }
38989 if (localAI[0] == 0f)
38990 {
38991 localAI[0] = 1f;
38993 }
38994 frameCounter++;
38995 if (frameCounter > 3)
38996 {
38997 frame++;
38998 frameCounter = 0;
38999 }
39000 if (frame > 1)
39001 {
39002 frame = 0;
39003 }
39004 if (velocity.Y == 0f)
39005 {
39006 position.X += width / 2;
39007 position.Y += height / 2;
39008 width = 128;
39009 height = 128;
39010 position.X -= width / 2;
39011 position.Y -= height / 2;
39012 damage = 40;
39013 knockBack = 8f;
39014 timeLeft = 3;
39015 netUpdate = true;
39016 }
39017 }
39018 if (type == 303 && timeLeft <= 3 && hostile)
39019 {
39020 position.X += width / 2;
39021 position.Y += height / 2;
39022 width = 128;
39023 height = 128;
39024 position.X -= width / 2;
39025 position.Y -= height / 2;
39026 }
39027 if (owner == Main.myPlayer && timeLeft <= 3)
39028 {
39029 PrepareBombToBlow();
39030 }
39031 else
39032 {
39033 if (type != 30 && type != 75 && type != 517 && type != 681 && type != 588 && type != 397 && type != 108 && type != 1002 && type != 133 && type != 134 && type != 135 && type != 136 && type != 137 && type != 138 && type != 139 && type != 140 && type != 141 && type != 142 && type != 143 && type != 144 && type != 164 && type != 303 && type != 338 && type != 339 && type != 340 && type != 341 && (type < 776 || type > 801) && (type < 803 || type > 810) && type != 862 && type != 863 && type != 930)
39034 {
39035 damage = 0;
39036 }
39037 if (type == 338 || type == 339 || type == 340 || type == 341 || type == 803 || type == 804 || type == 808 || type == 809 || type == 810 || type == 805 || type == 806 || type == 807 || type == 930)
39038 {
39039 localAI[1] += 1f;
39040 if (localAI[1] > 6f)
39041 {
39042 alpha = 0;
39043 }
39044 else
39045 {
39046 alpha = (int)(255f - 42f * localAI[1]) + 100;
39047 if (alpha > 255)
39048 {
39049 alpha = 255;
39050 }
39051 }
39052 for (int l = 0; l < 2; l++)
39053 {
39054 float num14 = 0f;
39055 float num15 = 0f;
39056 if (l == 1)
39057 {
39058 num14 = velocity.X * 0.5f;
39059 num15 = velocity.Y * 0.5f;
39060 }
39061 if (!(localAI[1] > 9f))
39062 {
39063 continue;
39064 }
39065 if (Main.rand.Next(2) == 0)
39066 {
39067 int num16 = Dust.NewDust(new Vector2(position.X + 3f + num14, position.Y + 3f + num15) - velocity * 0.5f, width - 8, height - 8, num13, 0f, 0f, 100);
39068 Main.dust[num16].scale *= 1.4f + (float)Main.rand.Next(10) * 0.1f;
39069 Main.dust[num16].velocity *= 0.2f;
39070 Main.dust[num16].noGravity = true;
39071 if (Main.dust[num16].type == 152)
39072 {
39073 Main.dust[num16].scale *= 0.5f;
39074 Main.dust[num16].velocity += velocity * 0.1f;
39075 }
39076 else if (Main.dust[num16].type == 35)
39077 {
39078 Main.dust[num16].scale *= 0.5f;
39079 Main.dust[num16].velocity += velocity * 0.1f;
39080 }
39081 else if (Main.dust[num16].type == Dust.dustWater())
39082 {
39083 Main.dust[num16].scale *= 0.65f;
39084 Main.dust[num16].velocity += velocity * 0.1f;
39085 }
39086 if (type == 808 || type == 809)
39087 {
39089 if (dust4.dustIndex != 6000)
39090 {
39091 dust4 = Dust.NewDustPerfect(dust4.position, dust4.type, dust4.velocity, dust4.alpha, dust4.color, dust4.scale + 0.5f);
39092 dust4.velocity = Main.rand.NextVector2Circular(3f, 3f);
39093 dust4.noGravity = true;
39094 }
39095 if (dust4.dustIndex != 6000)
39096 {
39097 dust4 = Dust.NewDustPerfect(dust4.position, dust4.type, dust4.velocity, dust4.alpha, dust4.color, dust4.scale + 0.5f);
39098 dust4.velocity = ((float)Math.PI * 2f * ((float)timeLeft / 20f)).ToRotationVector2() * 3f;
39099 dust4.noGravity = true;
39100 }
39101 }
39102 }
39103 if (Main.rand.Next(2) == 0)
39104 {
39105 int num17 = Dust.NewDust(new Vector2(position.X + 3f + num14, position.Y + 3f + num15) - velocity * 0.5f, width - 8, height - 8, 31, 0f, 0f, 100, default(Color), 0.5f);
39106 Main.dust[num17].fadeIn = 0.5f + (float)Main.rand.Next(5) * 0.1f;
39107 Main.dust[num17].velocity *= 0.05f;
39108 }
39109 }
39110 float x = position.X;
39111 float y = position.Y;
39112 float num18 = 600f;
39113 if (type == 930)
39114 {
39115 num18 = 650f;
39116 }
39117 bool flag3 = false;
39118 ai[0] += 1f;
39119 if (ai[0] > 30f)
39120 {
39121 ai[0] = 30f;
39122 for (int m = 0; m < 200; m++)
39123 {
39124 if (Main.npc[m].CanBeChasedBy(this))
39125 {
39126 float num19 = Main.npc[m].position.X + (float)(Main.npc[m].width / 2);
39127 float num20 = Main.npc[m].position.Y + (float)(Main.npc[m].height / 2);
39128 float num21 = Math.Abs(position.X + (float)(width / 2) - num19) + Math.Abs(position.Y + (float)(height / 2) - num20);
39129 if (num21 < num18 && Collision.CanHit(position, width, height, Main.npc[m].position, Main.npc[m].width, Main.npc[m].height))
39130 {
39131 num18 = num21;
39132 x = num19;
39133 y = num20;
39134 flag3 = true;
39135 }
39136 }
39137 }
39138 }
39139 if (!flag3)
39140 {
39141 x = position.X + (float)(width / 2) + velocity.X * 100f;
39142 y = position.Y + (float)(height / 2) + velocity.Y * 100f;
39143 }
39144 float num22 = 16f;
39145 if (type == 930)
39146 {
39147 num22 = 12f;
39148 }
39149 Vector2 value2 = (new Vector2(x, y) - base.Center).SafeNormalize(-Vector2.UnitY) * num22;
39150 velocity = Vector2.Lerp(velocity, value2, 1f / 12f);
39151 }
39152 else if (type == 134 || type == 137 || type == 140 || type == 143 || type == 303 || type == 776 || type == 780 || type == 793 || type == 796 || type == 799 || type == 784 || type == 787 || type == 790)
39153 {
39154 if (Math.Abs(velocity.X) >= 8f || Math.Abs(velocity.Y) >= 8f)
39155 {
39156 for (int n = 0; n < 2; n++)
39157 {
39158 float num23 = 0f;
39159 float num24 = 0f;
39160 if (n == 1)
39161 {
39162 num23 = velocity.X * 0.5f;
39163 num24 = velocity.Y * 0.5f;
39164 }
39165 int num25 = Dust.NewDust(new Vector2(position.X + 3f + num23, position.Y + 3f + num24) - velocity * 0.5f, width - 8, height - 8, num13, 0f, 0f, 100);
39166 Main.dust[num25].scale *= 2f + (float)Main.rand.Next(10) * 0.1f;
39167 Main.dust[num25].velocity *= 0.2f;
39168 Main.dust[num25].noGravity = true;
39169 if (Main.dust[num25].type == 152)
39170 {
39171 Main.dust[num25].scale *= 0.5f;
39172 Main.dust[num25].velocity += velocity * 0.1f;
39173 }
39174 else if (Main.dust[num25].type == 35)
39175 {
39176 Main.dust[num25].scale *= 0.5f;
39177 Main.dust[num25].velocity += velocity * 0.1f;
39178 }
39179 else if (Main.dust[num25].type == Dust.dustWater())
39180 {
39181 Main.dust[num25].scale *= 0.65f;
39182 Main.dust[num25].velocity += velocity * 0.1f;
39183 }
39184 if (type == 793 || type == 796)
39185 {
39187 if (dust5.dustIndex != 6000)
39188 {
39189 dust5 = Dust.NewDustPerfect(dust5.position, dust5.type, dust5.velocity, dust5.alpha, dust5.color, dust5.scale);
39190 dust5.velocity = Main.rand.NextVector2Circular(3f, 3f);
39191 dust5.noGravity = true;
39192 }
39193 if (dust5.dustIndex != 6000)
39194 {
39195 dust5 = Dust.NewDustPerfect(dust5.position, dust5.type, dust5.velocity, dust5.alpha, dust5.color, dust5.scale);
39196 dust5.velocity = ((float)Math.PI * 2f * ((float)timeLeft / 20f)).ToRotationVector2() * 3f;
39197 dust5.noGravity = true;
39198 }
39199 }
39200 num25 = Dust.NewDust(new Vector2(position.X + 3f + num23, position.Y + 3f + num24) - velocity * 0.5f, width - 8, height - 8, 31, 0f, 0f, 100, default(Color), 0.5f);
39201 Main.dust[num25].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f;
39202 Main.dust[num25].velocity *= 0.05f;
39203 }
39204 }
39205 if (Math.Abs(velocity.X) < 15f && Math.Abs(velocity.Y) < 15f)
39206 {
39207 velocity *= 1.1f;
39208 }
39209 }
39210 else if (type == 133 || type == 136 || type == 139 || type == 142 || type == 777 || type == 781 || type == 794 || type == 797 || type == 800 || type == 785 || type == 788 || type == 791)
39211 {
39212 int num26 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 100);
39213 Main.dust[num26].scale *= 1f + (float)Main.rand.Next(10) * 0.1f;
39214 Main.dust[num26].velocity *= 0.2f;
39215 Main.dust[num26].noGravity = true;
39216 }
39217 else if (type == 135 || type == 138 || type == 141 || type == 144 || type == 778 || type == 782 || type == 795 || type == 798 || type == 801 || type == 786 || type == 789 || type == 792)
39218 {
39219 if ((double)velocity.X > -0.2 && (double)velocity.X < 0.2 && (double)velocity.Y > -0.2 && (double)velocity.Y < 0.2)
39220 {
39221 alpha += 2;
39222 if (alpha > 200)
39223 {
39224 alpha = 200;
39225 }
39226 }
39227 else
39228 {
39229 alpha = 0;
39230 int num27 = Dust.NewDust(new Vector2(position.X + 3f, position.Y + 3f) - velocity * 0.5f, width - 8, height - 8, 31, 0f, 0f, 100);
39231 Main.dust[num27].scale *= 1.6f + (float)Main.rand.Next(5) * 0.1f;
39232 Main.dust[num27].velocity *= 0.05f;
39233 Main.dust[num27].noGravity = true;
39234 }
39235 }
39236 else if (type == 779 || type == 783 || type == 862 || type == 863)
39237 {
39238 if (Main.rand.Next(25) == 0)
39239 {
39240 Dust dust6 = Dust.NewDustDirect(position, width, height, 228, (0f - velocity.X) / 10f, (0f - velocity.Y) / 10f, 100);
39241 dust6.noGravity = true;
39242 dust6.velocity *= 0f;
39243 dust6.scale = 1.3f;
39244 }
39245 if (Main.rand.Next(5) == 0)
39246 {
39247 Dust dust7 = Dust.NewDustDirect(position, width, height, 31, (0f - velocity.X) / 10f, (0f - velocity.Y) / 10f, 100);
39248 dust7.noGravity = true;
39249 dust7.velocity *= 0f;
39250 dust7.scale = 1.3f;
39251 }
39252 if (frameCounter == 0)
39253 {
39254 frameCounter = 1;
39255 frame = Main.rand.Next(4);
39256 }
39257 }
39258 else if (type != 30 && type != 517 && type != 681 && type != 397 && type != 519 && type != 588 && type != 779 && type != 783 && type != 862 && type != 863 && Main.rand.Next(2) == 0)
39259 {
39260 int num28 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 100);
39261 Main.dust[num28].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f;
39262 Main.dust[num28].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f;
39263 Main.dust[num28].noGravity = true;
39264 Main.dust[num28].position = base.Center + new Vector2(0f, -height / 2).RotatedBy(rotation) * 1.1f;
39265 int num29 = 6;
39266 if (type == 773)
39267 {
39268 num29 = 59;
39269 }
39270 if (type == 903)
39271 {
39272 num29 = Dust.dustWater();
39273 }
39274 if (type == 904)
39275 {
39276 num29 = 35;
39277 }
39278 if (type == 905)
39279 {
39280 num29 = 152;
39281 }
39282 if (type == 910 || type == 911)
39283 {
39284 num29 = 0;
39285 }
39286 Dust dust8 = Dust.NewDustDirect(position, width, height, num29, 0f, 0f, 100);
39287 dust8.scale = 1f + (float)Main.rand.Next(5) * 0.1f;
39288 dust8.noGravity = true;
39289 dust8.position = base.Center + new Vector2(0f, -height / 2 - 6).RotatedBy(rotation) * 1.1f;
39290 }
39291 else if (type == 681)
39292 {
39293 Dust dust9 = Dust.NewDustDirect(position, width, height, 6, 0f, 0f, 100);
39294 dust9.scale = 1f + (float)Main.rand.Next(5) * 0.1f;
39295 dust9.noGravity = true;
39296 dust9.position = base.Center + new Vector2(6 * Math.Sign(velocity.X), -height / 2 - 6).RotatedBy(rotation) * 1.1f;
39297 }
39298 }
39299 ai[0] += 1f;
39300 if (type == 338 || type == 339 || type == 340 || type == 341 || type == 803 || type == 804 || type == 808 || type == 809 || type == 810 || type == 805 || type == 806 || type == 807 || type == 930)
39301 {
39302 if (velocity.X < 0f)
39303 {
39304 spriteDirection = -1;
39305 rotation = (float)Math.Atan2(0f - velocity.Y, 0f - velocity.X) - 1.57f;
39306 }
39307 else
39308 {
39309 spriteDirection = 1;
39310 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 1.57f;
39311 }
39312 }
39313 else if (type == 134 || type == 137 || type == 140 || type == 143 || type == 303 || type == 776 || type == 780 || type == 793 || type == 796 || type == 799 || type == 784 || type == 787 || type == 790)
39314 {
39315 if (velocity != Vector2.Zero)
39316 {
39317 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 1.57f;
39318 }
39319 }
39320 else if (type == 135 || type == 138 || type == 141 || type == 144 || type == 778 || type == 782 || type == 795 || type == 798 || type == 801 || type == 786 || type == 789 || type == 792)
39321 {
39322 velocity.Y += 0.2f;
39323 velocity *= 0.97f;
39324 if ((double)velocity.X > -0.1 && (double)velocity.X < 0.1)
39325 {
39326 velocity.X = 0f;
39327 }
39328 if ((double)velocity.Y > -0.1 && (double)velocity.Y < 0.1)
39329 {
39330 velocity.Y = 0f;
39331 }
39332 }
39333 else if (type == 133 || type == 136 || type == 139 || type == 142 || type == 777 || type == 781 || type == 794 || type == 797 || type == 800 || type == 785 || type == 788 || type == 791)
39334 {
39335 if (ai[0] > 15f)
39336 {
39337 if (velocity.Y == 0f)
39338 {
39339 velocity.X *= 0.95f;
39340 }
39341 velocity.Y += 0.2f;
39342 }
39343 }
39344 else if (((type == 30 || type == 397 || type == 517 || type == 681 || type == 588 || type == 779 || type == 783 || type == 862 || type == 863) && ai[0] > 10f) || (type != 30 && type != 397 && type != 517 && type != 588 && type != 779 && type != 783 && type != 862 && type != 863 && ai[0] > 5f))
39345 {
39346 ai[0] = 10f;
39347 if (velocity.Y == 0f && velocity.X != 0f)
39348 {
39349 velocity.X *= 0.97f;
39350 if (type == 29 || type == 470 || type == 637)
39351 {
39352 velocity.X *= 0.99f;
39353 }
39354 if ((double)velocity.X > -0.01 && (double)velocity.X < 0.01)
39355 {
39356 velocity.X = 0f;
39357 netUpdate = true;
39358 }
39359 }
39360 velocity.Y += 0.2f;
39361 if (type == 911)
39362 {
39363 velocity.X = MathHelper.Clamp(velocity.X, -8f, 8f);
39364 velocity.Y = MathHelper.Clamp(velocity.Y, -8f, 8f);
39365 }
39366 }
39367 if (type == 519)
39368 {
39369 rotation += velocity.X * 0.06f;
39370 }
39371 else if (type != 134 && type != 137 && type != 140 && type != 143 && type != 303 && (type < 338 || type > 341) && type != 776 && type != 780 && type != 793 && type != 796 && type != 799 && type != 784 && type != 787 && type != 790 && type != 803 && type != 804 && type != 808 && type != 809 && type != 810 && type != 805 && type != 806 && type != 807 && type != 930)
39372 {
39373 rotation += velocity.X * 0.1f;
39374 }
39375 }
39376
39377 private void AI_166_Dove()
39378 {
39379 bool num = type == 855;
39380 if (localAI[0] == 0f)
39381 {
39382 localAI[0] = 1f;
39383 frame = Main.rand.Next(4);
39384 }
39385 int num2 = 4;
39386 if (num)
39387 {
39388 num2 = 6;
39389 }
39390 if (++frameCounter > num2)
39391 {
39392 frameCounter = 0;
39393 if (++frame > 3)
39394 {
39395 frame = 0;
39396 }
39397 }
39398 spriteDirection = -1;
39399 if (velocity.X > 0f)
39400 {
39401 spriteDirection = 1;
39402 }
39403 if (num)
39404 {
39405 float num3 = 1f - (float)alpha / 255f;
39406 Vector3 rgb = new Vector3(1f, 0.6f, 0.1f) * num3;
39407 Lighting.AddLight(base.Center, rgb);
39408 rotation = velocity.X * 0.2f;
39409 if (velocity.Y < -1f)
39410 {
39411 velocity.Y *= 0.99f;
39412 }
39413 else
39414 {
39415 velocity.Y += (float)Math.Sin((float)(timeLeft % 200) / 200f * ((float)Math.PI * 2f)) * 0.25f;
39416 if (velocity.Y > 0.5f)
39417 {
39418 velocity.Y *= 0.8f;
39419 }
39420 velocity.Y = MathHelper.Clamp(velocity.Y, -1.5f, 1.5f);
39421 }
39422 float num4 = Main.WindForVisuals;
39423 if (num4 == 0f)
39424 {
39425 num4 = 0.1f;
39426 }
39427 velocity.X += 0.0525f * num4;
39428 velocity.X = MathHelper.Clamp(velocity.X, -2f, 2f);
39429 }
39430 else
39431 {
39432 rotation = velocity.X * 0.15f;
39433 velocity.Y -= 0.025f;
39434 if (velocity.Y < -3f)
39435 {
39436 velocity.Y = -3f;
39437 }
39438 velocity.X = MathHelper.Clamp(velocity.X, -5f, 5f);
39439 }
39440 if (timeLeft < 90)
39441 {
39442 alpha += 3;
39443 }
39444 if (alpha >= 255)
39445 {
39446 Kill();
39447 }
39448 }
39449
39450 private void AI_161_RapierStabs()
39451 {
39452 Player player = Main.player[owner];
39453 rotation = velocity.ToRotation() + (float)Math.PI / 2f;
39454 ai[0] += 1f;
39455 float opacity = Utils.GetLerpValue(0f, 7f, ai[0], clamped: true) * Utils.GetLerpValue(16f, 12f, ai[0], clamped: true);
39456 Opacity = opacity;
39457 base.Center = player.RotatedRelativePoint(player.MountedCenter, reverseRotation: false, addGfxOffY: false) + velocity * (ai[0] - 1f);
39458 spriteDirection = ((!(Vector2.Dot(velocity, Vector2.UnitX) < 0f)) ? 1 : (-1));
39459 if (ai[0] >= 16f)
39460 {
39461 Kill();
39462 }
39463 else
39464 {
39465 player.heldProj = whoAmI;
39466 }
39467 }
39468
39469 private void AI_165_Whip()
39470 {
39471 Player player = Main.player[owner];
39472 rotation = velocity.ToRotation() + (float)Math.PI / 2f;
39473 ai[0] += 1f;
39474 GetWhipSettings(this, out var timeToFlyOut, out var _, out var _);
39475 base.Center = Main.GetPlayerArmPosition(this) + velocity * (ai[0] - 1f);
39476 spriteDirection = ((!(Vector2.Dot(velocity, Vector2.UnitX) < 0f)) ? 1 : (-1));
39477 if (ai[0] >= timeToFlyOut)
39478 {
39479 Kill();
39480 return;
39481 }
39482 player.heldProj = whoAmI;
39484 if (ai[0] == (float)(int)(timeToFlyOut / 2f))
39485 {
39486 WhipPointsForCollision.Clear();
39487 FillWhipControlPoints(this, WhipPointsForCollision);
39488 Vector2 vector = WhipPointsForCollision[WhipPointsForCollision.Count - 1];
39490 }
39491 switch (type)
39492 {
39493 case 848:
39494 {
39495 float t3 = ai[0] / timeToFlyOut;
39496 float num5 = Utils.GetLerpValue(0.1f, 0.7f, t3, clamped: true) * Utils.GetLerpValue(0.9f, 0.7f, t3, clamped: true);
39497 if (num5 > 0.1f && Main.rand.NextFloat() < num5 / 2f)
39498 {
39499 WhipPointsForCollision.Clear();
39500 FillWhipControlPoints(this, WhipPointsForCollision);
39501 Rectangle r4 = Utils.CenteredRectangle(WhipPointsForCollision[WhipPointsForCollision.Count - 1], new Vector2(30f, 30f));
39502 int num6 = Dust.NewDust(r4.TopLeft(), r4.Width, r4.Height, 172, 0f, 0f, 100, default(Color), 1.5f);
39503 Main.dust[num6].noGravity = true;
39504 Main.dust[num6].velocity.X /= 2f;
39505 Main.dust[num6].velocity.Y /= 2f;
39506 }
39507 break;
39508 }
39509 case 847:
39510 {
39511 float t2 = ai[0] / timeToFlyOut;
39512 if (Utils.GetLerpValue(0.1f, 0.7f, t2, clamped: true) * Utils.GetLerpValue(0.9f, 0.7f, t2, clamped: true) > 0.5f && Main.rand.Next(3) != 0)
39513 {
39514 WhipPointsForCollision.Clear();
39515 FillWhipControlPoints(this, WhipPointsForCollision);
39516 int num2 = Main.rand.Next(WhipPointsForCollision.Count - 10, WhipPointsForCollision.Count);
39517 Rectangle r2 = Utils.CenteredRectangle(WhipPointsForCollision[num2], new Vector2(30f, 30f));
39518 int num3 = 57;
39519 if (Main.rand.Next(3) == 0)
39520 {
39521 num3 = 43;
39522 }
39523 Dust dust3 = Dust.NewDustDirect(r2.TopLeft(), r2.Width, r2.Height, num3, 0f, 0f, 100, Color.White);
39524 dust3.position = WhipPointsForCollision[num2];
39525 dust3.fadeIn = 0.3f;
39526 Vector2 spinningpoint = WhipPointsForCollision[num2] - WhipPointsForCollision[num2 - 1];
39527 dust3.noGravity = true;
39528 dust3.velocity *= 0.5f;
39529 dust3.velocity += spinningpoint.RotatedBy((float)player.direction * ((float)Math.PI / 2f));
39530 dust3.velocity *= 0.5f;
39531 }
39532 break;
39533 }
39534 case 849:
39535 {
39536 float num4 = ai[0] / timeToFlyOut;
39537 Utils.GetLerpValue(0.1f, 0.7f, num4, clamped: true);
39538 Utils.GetLerpValue(0.9f, 0.7f, num4, clamped: true);
39539 if (num4 > 0.4f && Main.rand.Next(9) != 0)
39540 {
39541 WhipPointsForCollision.Clear();
39542 FillWhipControlPoints(this, WhipPointsForCollision);
39543 Rectangle r3 = Utils.CenteredRectangle(WhipPointsForCollision[WhipPointsForCollision.Count - 1], new Vector2(30f, 30f));
39544 Vector2 vector3 = WhipPointsForCollision[WhipPointsForCollision.Count - 2].DirectionTo(WhipPointsForCollision[WhipPointsForCollision.Count - 1]).SafeNormalize(Vector2.Zero);
39545 Dust dust4 = Dust.NewDustDirect(r3.TopLeft(), r3.Width, r3.Height, 191, 0f, 0f, 0, default(Color), 1.3f);
39546 dust4.noGravity = true;
39547 dust4.velocity += vector3 * 2f;
39548 if (Main.rand.Next(2) == 0)
39549 {
39551 {
39552 MovementVector = vector3,
39553 PositionInWorld = r3.Center.ToVector2()
39554 }, owner);
39555 }
39556 Lighting.AddLight(r3.Center.ToVector2(), new Vector3(0.2f, 0f, 0.4f));
39557 }
39558 break;
39559 }
39560 case 915:
39561 {
39562 float t5 = ai[0] / timeToFlyOut;
39563 if (Utils.GetLerpValue(0.1f, 0.7f, t5, clamped: true) * Utils.GetLerpValue(0.9f, 0.7f, t5, clamped: true) > 0.1f)
39564 {
39565 WhipPointsForCollision.Clear();
39566 FillWhipControlPoints(this, WhipPointsForCollision);
39567 Rectangle r6 = Utils.CenteredRectangle(WhipPointsForCollision[WhipPointsForCollision.Count - 1], new Vector2(30f, 30f));
39568 Vector2 vector5 = WhipPointsForCollision[WhipPointsForCollision.Count - 2].DirectionTo(WhipPointsForCollision[WhipPointsForCollision.Count - 1]).SafeNormalize(Vector2.Zero);
39569 Dust dust7 = Dust.NewDustDirect(r6.TopLeft(), r6.Width, r6.Height, 267, 0f, 0f, 0, Main.hslToRgb(player.miscCounterNormalized * 9f % 1f, 1f, 0.5f), 1.3f);
39570 dust7.velocity *= Main.rand.NextFloat() * 0.8f;
39571 dust7.noGravity = true;
39572 dust7.scale = 0.9f + Main.rand.NextFloat() * 0.9f;
39573 dust7.fadeIn = Main.rand.NextFloat() * 0.9f;
39574 dust7.velocity += vector5 * 2f;
39575 if (dust7.dustIndex != 6000)
39576 {
39578 dust8.scale /= 2f;
39579 dust8.fadeIn *= 0.85f;
39580 dust8.color = new Color(255, 255, 255, 255);
39581 }
39582 }
39583 break;
39584 }
39585 case 914:
39586 {
39587 float t6 = ai[0] / timeToFlyOut;
39588 float num8 = Utils.GetLerpValue(0.1f, 0.7f, t6, clamped: true) * Utils.GetLerpValue(0.9f, 0.7f, t6, clamped: true);
39589 if (num8 > 0.1f && Main.rand.NextFloat() < num8 / 2f)
39590 {
39591 WhipPointsForCollision.Clear();
39592 FillWhipControlPoints(this, WhipPointsForCollision);
39593 Rectangle r7 = Utils.CenteredRectangle(WhipPointsForCollision[WhipPointsForCollision.Count - 1], new Vector2(30f, 30f));
39594 Vector2 vector6 = WhipPointsForCollision[WhipPointsForCollision.Count - 2].DirectionTo(WhipPointsForCollision[WhipPointsForCollision.Count - 1]).SafeNormalize(Vector2.Zero);
39595 Dust dust9 = Dust.NewDustDirect(r7.TopLeft(), r7.Width, r7.Height, 39, 0f, 0f, 0, default(Color), 1.2f);
39596 dust9.noGravity = Main.rand.Next(3) == 0;
39597 dust9.velocity += vector6 * 2f;
39598 }
39599 break;
39600 }
39601 case 952:
39602 {
39603 float t7 = ai[0] / timeToFlyOut;
39604 float num9 = Utils.GetLerpValue(0.1f, 0.7f, t7, clamped: true) * Utils.GetLerpValue(0.9f, 0.7f, t7, clamped: true);
39605 if (num9 > 0.15f && Main.rand.NextFloat() < num9)
39606 {
39607 WhipPointsForCollision.Clear();
39608 FillWhipControlPoints(this, WhipPointsForCollision);
39609 Rectangle r8 = Utils.CenteredRectangle(WhipPointsForCollision[WhipPointsForCollision.Count - 1], new Vector2(30f, 30f));
39610 Vector2 vector7 = WhipPointsForCollision[WhipPointsForCollision.Count - 2].DirectionTo(WhipPointsForCollision[WhipPointsForCollision.Count - 1]).SafeNormalize(Vector2.Zero);
39611 Dust dust10 = Dust.NewDustDirect(r8.TopLeft(), r8.Width, r8.Height, 26, 0f, 0f, 0, default(Color), 0.7f);
39612 dust10.noGravity = Main.rand.Next(3) == 0;
39613 if (dust10.noGravity)
39614 {
39615 dust10.scale += 0.4f;
39616 }
39617 dust10.velocity += vector7 * 2f;
39618 }
39619 break;
39620 }
39621 case 912:
39622 {
39623 float t4 = ai[0] / timeToFlyOut;
39624 float num7 = Utils.GetLerpValue(0.1f, 0.7f, t4, clamped: true) * Utils.GetLerpValue(0.9f, 0.7f, t4, clamped: true);
39625 if (!(num7 > 0.1f) || !(Main.rand.NextFloat() < num7 / 2f))
39626 {
39627 break;
39628 }
39629 WhipPointsForCollision.Clear();
39630 FillWhipControlPoints(this, WhipPointsForCollision);
39631 Rectangle r5 = Utils.CenteredRectangle(WhipPointsForCollision[WhipPointsForCollision.Count - 1], new Vector2(30f, 30f));
39632 Vector2 vector4 = WhipPointsForCollision[WhipPointsForCollision.Count - 2].DirectionTo(WhipPointsForCollision[WhipPointsForCollision.Count - 1]).SafeNormalize(Vector2.Zero);
39633 for (int j = 0; j < 3; j++)
39634 {
39635 Dust dust5 = Dust.NewDustDirect(r5.TopLeft(), r5.Width, r5.Height, 16, 0f, 0f, 0, default(Color), 1.2f);
39636 dust5.noGravity = true;
39637 dust5.velocity += vector4 * 2f;
39638 }
39639 for (int k = 0; k < 1; k++)
39640 {
39641 Dust.NewDustDirect(r5.TopLeft(), r5.Width, r5.Height, 13, 0f, 0f, 0, default(Color), 0.8f).velocity += vector4 * 2f;
39642 }
39643 for (int l = 0; l < 3; l++)
39644 {
39645 if (Main.rand.Next(2) != 0)
39646 {
39647 Dust dust6 = Dust.NewDustDirect(r5.TopLeft(), r5.Width, r5.Height, 261, 0f, 0f, 0, Color.Transparent, 0.8f);
39648 dust6.velocity += vector4 * 2f;
39649 dust6.velocity *= 0.3f;
39650 dust6.noGravity = true;
39651 }
39652 }
39653 Lighting.AddLight(r5.Center.ToVector2(), new Vector3(0.1f, 0.1f, 0.2f));
39654 break;
39655 }
39656 case 913:
39657 {
39658 float t = ai[0] / timeToFlyOut;
39659 float num = Utils.GetLerpValue(0.1f, 0.7f, t, clamped: true) * Utils.GetLerpValue(0.9f, 0.7f, t, clamped: true);
39660 if (!(num > 0.1f) || !(Main.rand.NextFloat() < num))
39661 {
39662 break;
39663 }
39664 WhipPointsForCollision.Clear();
39665 FillWhipControlPoints(this, WhipPointsForCollision);
39666 Rectangle r = Utils.CenteredRectangle(WhipPointsForCollision[WhipPointsForCollision.Count - 1], new Vector2(20f, 20f));
39667 Vector2 vector2 = WhipPointsForCollision[WhipPointsForCollision.Count - 2].DirectionTo(WhipPointsForCollision[WhipPointsForCollision.Count - 1]).SafeNormalize(Vector2.Zero);
39668 for (int i = 0; i < 3; i++)
39669 {
39670 if (Main.rand.Next(3) != 0)
39671 {
39672 continue;
39673 }
39674 if (Main.rand.Next(7) == 0)
39675 {
39676 Dust dust = Dust.NewDustDirect(r.TopLeft(), r.Width, r.Height, 31);
39677 dust.velocity.X /= 2f;
39678 dust.velocity.Y /= 2f;
39679 dust.velocity += vector2 * 2f;
39680 dust.fadeIn = 1f + Main.rand.NextFloat() * 0.6f;
39681 dust.noGravity = true;
39682 continue;
39683 }
39684 Dust dust2 = Dust.NewDustDirect(r.TopLeft(), r.Width, r.Height, 6, 0f, 0f, 0, default(Color), 1.2f);
39685 dust2.velocity += vector2 * 2f;
39686 if (Main.rand.Next(3) != 0)
39687 {
39688 dust2.fadeIn = 0.7f + Main.rand.NextFloat() * 0.9f;
39689 dust2.scale = 0.6f;
39690 dust2.noGravity = true;
39691 }
39692 }
39693 break;
39694 }
39695 }
39696 }
39697
39699 {
39701 float num = proj.ai[0] / timeToFlyOut;
39702 float num2 = 0.5f;
39703 float num3 = 1f + num2;
39704 float num4 = (float)Math.PI * 10f * (1f - num * num3) * (float)(-proj.spriteDirection) / (float)segments;
39705 float num5 = num * num3;
39706 float num6 = 0f;
39707 if (num5 > 1f)
39708 {
39709 num6 = (num5 - 1f) / num2;
39710 num5 = MathHelper.Lerp(1f, 0f, num6);
39711 }
39712 float num7 = proj.ai[0] - 1f;
39713 Player player = Main.player[proj.owner];
39714 Item heldItem = Main.player[proj.owner].HeldItem;
39715 num7 = (float)(ContentSamples.ItemsByType[heldItem.type].useAnimation * 2) * num * player.whipRangeMultiplier;
39716 float num8 = proj.velocity.Length() * num7 * num5 * rangeMultiplier / (float)segments;
39717 float num9 = 1f;
39720 float num10 = 0f - (float)Math.PI / 2f;
39722 float num11 = 0f + (float)Math.PI / 2f + (float)Math.PI / 2f * (float)proj.spriteDirection;
39724 float num12 = 0f + (float)Math.PI / 2f;
39726 for (int i = 0; i < segments; i++)
39727 {
39728 float num13 = (float)i / (float)segments;
39729 float num14 = num4 * num13 * num9;
39730 Vector2 vector4 = vector + num10.ToRotationVector2() * num8;
39731 Vector2 vector5 = vector3 + num12.ToRotationVector2() * (num8 * 2f);
39732 Vector2 vector6 = vector2 + num11.ToRotationVector2() * (num8 * 2f);
39733 float num15 = 1f - num5;
39734 float num16 = 1f - num15 * num15;
39735 Vector2 value = Vector2.Lerp(vector5, vector4, num16 * 0.9f + 0.1f);
39736 Vector2 vector7 = Vector2.Lerp(vector6, value, num16 * 0.7f + 0.3f);
39738 float num17 = num6;
39739 num17 *= num17;
39740 Vector2 item = spinningpoint.RotatedBy(proj.rotation + 4.712389f * num17 * (float)proj.spriteDirection, playerArmPosition);
39742 num10 += num14;
39743 num12 += num14;
39744 num11 += num14;
39745 vector = vector4;
39746 vector3 = vector5;
39747 vector2 = vector6;
39748 }
39749 }
39750
39752 {
39753 timeToFlyOut = Main.player[proj.owner].itemAnimationMax * proj.MaxUpdates;
39754 segments = 20;
39755 rangeMultiplier = 1f;
39756 switch (proj.type)
39757 {
39758 case 913:
39759 rangeMultiplier *= 1.4f;
39760 break;
39761 case 912:
39762 rangeMultiplier *= 1.5f;
39763 break;
39764 case 841:
39765 rangeMultiplier *= 0.75f;
39766 break;
39767 case 914:
39768 rangeMultiplier *= 1f;
39769 break;
39770 case 847:
39771 segments = 20;
39772 rangeMultiplier *= 1.75f;
39773 break;
39774 case 849:
39775 segments = 30;
39776 rangeMultiplier = 2.15f;
39777 break;
39778 case 915:
39779 segments = 40;
39780 rangeMultiplier = 2.2f;
39781 break;
39782 case 848:
39783 segments = 40;
39784 rangeMultiplier = 1.6f;
39785 break;
39786 case 952:
39787 rangeMultiplier *= 0.95f;
39788 break;
39789 }
39790 }
39791
39792 private void AI_160_Kites()
39793 {
39794 Player player = Main.player[owner];
39796 timeLeft = 60;
39797 bool flag = false;
39798 if (player.CCed || player.noItems)
39799 {
39800 flag = true;
39801 }
39802 else if (player.inventory[player.selectedItem].shoot != type)
39803 {
39804 flag = true;
39805 }
39806 else if (player.pulley)
39807 {
39808 flag = true;
39809 }
39810 else if (player.dead)
39811 {
39812 flag = true;
39813 }
39814 if (!flag)
39815 {
39816 flag = (player.Center - base.Center).Length() > 2000f;
39817 }
39818 if (flag)
39819 {
39820 Kill();
39821 return;
39822 }
39823 float num = 4f;
39824 float num2 = 500f;
39825 float num3 = num2 / 2f;
39826 if (owner == Main.myPlayer && extraUpdates == 0)
39827 {
39828 float num4 = ai[0];
39829 if (ai[0] == 0f)
39830 {
39831 ai[0] = num3;
39832 }
39833 float num5 = ai[0];
39834 if (Main.mouseRight)
39835 {
39836 num5 -= 5f;
39837 }
39838 if (Main.mouseLeft)
39839 {
39840 num5 += 5f;
39841 }
39842 ai[0] = MathHelper.Clamp(num5, num, num2);
39843 if (num4 != num5)
39844 {
39845 netUpdate = true;
39846 }
39847 }
39848 if (numUpdates == 1)
39849 {
39850 extraUpdates = 0;
39851 }
39852 int num6 = 0;
39853 float cloudAlpha = Main.cloudAlpha;
39854 float num7 = 0f;
39855 if (WorldGen.InAPlaceWithWind(position, width, height))
39856 {
39858 }
39859 float num8 = Utils.GetLerpValue(0.2f, 0.5f, Math.Abs(num7), clamped: true) * 0.5f;
39860 switch (num6)
39861 {
39862 case 0:
39863 {
39865 mouseWorld = base.Center;
39866 mouseWorld += new Vector2(num7, (float)Math.Sin(Main.GlobalTimeWrappedHourly) + cloudAlpha * 5f) * 25f;
39867 Vector2 v = mouseWorld - base.Center;
39868 v = v.SafeNormalize(Vector2.Zero) * (3f + cloudAlpha * 7f);
39869 if (num8 == 0f)
39870 {
39871 v = velocity;
39872 }
39873 float num9 = Distance(mouseWorld);
39874 float lerpValue = Utils.GetLerpValue(5f, 10f, num9, clamped: true);
39875 float y = velocity.Y;
39876 if (num9 > 10f)
39877 {
39878 velocity = Vector2.Lerp(velocity, v, 0.075f * lerpValue);
39879 }
39880 velocity.Y = y;
39881 velocity.Y -= num8;
39882 velocity.Y += 0.02f + num8 * 0.25f;
39883 velocity.Y = MathHelper.Clamp(velocity.Y, -2f, 2f);
39884 if (base.Center.Y + velocity.Y < mouseWorld.Y)
39885 {
39886 velocity.Y = MathHelper.Lerp(velocity.Y, velocity.Y + num8 + 0.01f, 0.75f);
39887 }
39888 velocity.X *= 0.98f;
39889 float num10 = Distance(vector);
39890 float num11 = ai[0];
39891 if (num10 > num11)
39892 {
39893 Vector2 vector3 = DirectionTo(vector);
39894 float num12 = num10 - num11;
39895 base.Center += vector3 * num12;
39896 bool num13 = Vector2.Dot(vector3, Vector2.UnitY) < 0.8f || num8 > 0f;
39897 velocity.Y += vector3.Y * 0.05f;
39898 if (num13)
39899 {
39900 velocity.Y -= 0.15f;
39901 }
39902 velocity.X += vector3.X * 0.2f;
39903 if (num11 == num && owner == Main.myPlayer)
39904 {
39905 Kill();
39906 return;
39907 }
39908 }
39909 break;
39910 }
39911 case 1:
39912 {
39913 Vector2 vector2 = DirectionTo(vector);
39914 velocity = Vector2.Lerp(velocity, vector2 * 16f, 1f);
39915 if (Distance(vector) < 10f && owner == Main.myPlayer)
39916 {
39917 Kill();
39918 return;
39919 }
39920 break;
39921 }
39922 }
39923 timeLeft = 2;
39924 Vector2 vector4 = base.Center - vector;
39925 int dir = ((vector4.X > 0f) ? 1 : (-1));
39926 if (Math.Abs(vector4.X) > Math.Abs(vector4.Y) / 2f)
39927 {
39928 player.ChangeDir(dir);
39929 }
39930 Vector2 vector5 = DirectionTo(vector).SafeNormalize(Vector2.Zero);
39931 if (num8 == 0f && velocity.Y > -0.02f)
39932 {
39933 rotation *= 0.95f;
39934 }
39935 else
39936 {
39937 float num14 = (-vector5).ToRotation() + (float)Math.PI / 4f;
39938 if (spriteDirection == -1)
39939 {
39940 num14 -= (float)Math.PI / 2f * (float)player.direction;
39941 }
39942 rotation = num14 + velocity.X * 0.05f;
39943 }
39944 float num15 = velocity.Length();
39945 switch (type)
39946 {
39947 case 771:
39948 case 822:
39949 case 823:
39950 case 827:
39951 case 830:
39952 case 838:
39953 case 843:
39954 case 844:
39955 case 845:
39956 case 846:
39957 case 850:
39958 case 852:
39959 frame = 0;
39960 break;
39961 case 828:
39962 case 829:
39963 if (num15 < 6f)
39964 {
39965 frame = 1;
39966 }
39967 else
39968 {
39969 frame = 0;
39970 }
39971 break;
39972 case 826:
39973 frame = (int)ai[1];
39974 break;
39975 case 824:
39976 case 839:
39977 case 840:
39978 case 853:
39979 if (num8 < 0.15f)
39980 {
39981 frame = 0;
39982 break;
39983 }
39984 frameCounter++;
39985 if ((float)frameCounter > (1f - num8) * 10f)
39986 {
39987 frameCounter = 0;
39988 frame = Main.rand.Next(4);
39989 }
39990 break;
39991 default:
39992 if (num15 < 3f)
39993 {
39994 frame = 0;
39995 }
39996 else if (num15 < 5f)
39997 {
39998 frame = 1;
39999 }
40000 else if (num15 < 7f)
40001 {
40002 frame = 2;
40003 }
40004 else
40005 {
40006 frame = 3;
40007 }
40008 break;
40009 }
40010 spriteDirection = player.direction;
40011 }
40012
40014 {
40015 if (ai[1] == 0f)
40016 {
40017 direction = ((velocity.X > 0f) ? 1 : (-1));
40018 rotation = velocity.ToRotation();
40019 ai[1] = 1f;
40020 ai[0] = -Main.rand.Next(30, 80);
40021 netUpdate = true;
40022 }
40023 if (wet && owner == Main.myPlayer)
40024 {
40025 Kill();
40026 }
40027 ai[0] += 1f;
40028 Vector2 vector = rotation.ToRotationVector2() * 8f;
40029 float y = (float)Math.Sin((float)Math.PI * 2f * (float)(Main.timeForVisualEffects % 90.0 / 90.0)) * (float)direction * Main.WindForVisuals;
40031 _ = Vector2.UnitX * direction;
40032 bool flag = direction == Math.Sign(Main.WindForVisuals) && velocity.Length() > 3f;
40033 bool num = ai[0] >= 20f && ai[0] <= 69f;
40034 if (ai[0] == 70f)
40035 {
40036 ai[0] = -Main.rand.Next(120, 600);
40037 }
40038 bool num2 = num && flag;
40039 if (num2)
40040 {
40041 float lerpValue = Utils.GetLerpValue(0f, 30f, ai[0], clamped: true);
40042 v = vector.RotatedBy((float)(-direction) * ((float)Math.PI * 2f) * 0.02f * lerpValue);
40043 }
40044 velocity = v.SafeNormalize(Vector2.UnitY) * velocity.Length();
40045 if (!num2)
40046 {
40047 float num3 = MathHelper.Lerp(0.15f, 0.05f, Math.Abs(Main.WindForVisuals));
40048 if (timeLeft % 40 < 20)
40049 {
40050 velocity.Y -= num3;
40051 }
40052 else
40053 {
40054 velocity.Y += num3;
40055 }
40056 if (velocity.Y < -2f)
40057 {
40058 velocity.Y = -2f;
40059 }
40060 if (velocity.Y > 2f)
40061 {
40062 velocity.Y = 2f;
40063 }
40064 velocity.X = MathHelper.Clamp(velocity.X + Main.WindForVisuals * 0.006f, -6f, 6f);
40065 if (velocity.X * oldVelocity.X < 0f)
40066 {
40067 direction *= -1;
40068 ai[0] = -Main.rand.Next(120, 300);
40069 netUpdate = true;
40070 }
40071 }
40072 rotation = velocity.ToRotation();
40073 spriteDirection = direction;
40074 }
40075
40076 private void AI_158_BabyBird()
40077 {
40078 Player player = Main.player[owner];
40079 if (type == 759)
40080 {
40081 if (player.dead)
40082 {
40083 player.babyBird = false;
40084 }
40085 if (player.babyBird)
40086 {
40087 timeLeft = 2;
40088 }
40089 if (++frameCounter >= 6)
40090 {
40091 frameCounter = 0;
40092 if (++frame >= Main.projFrames[type] - 1)
40093 {
40094 frame = 0;
40095 }
40096 }
40097 }
40098 float num = 6f;
40099 float num2 = 8f;
40100 int num3 = 800;
40101 float num4 = 150f;
40102 int attackTarget = -1;
40103 Minion_FindTargetInRange(num3, ref attackTarget, skipIfCannotHitWithOwnBody: false);
40104 if (attackTarget != -1)
40105 {
40107 if (player.Distance(nPC.Center) > (float)num3)
40108 {
40109 attackTarget = -1;
40110 }
40111 }
40112 if (attackTarget != -1)
40113 {
40114 if (!Collision.SolidCollision(position, width, height))
40115 {
40116 tileCollide = true;
40117 }
40119 float num5 = Distance(nPC2.Center);
40120 Rectangle rectangle = new Rectangle((int)position.X, (int)position.Y, width, height);
40121 Rectangle value = new Rectangle((int)nPC2.position.X, (int)nPC2.position.Y, nPC2.width, nPC2.height);
40122 if (rectangle.Intersects(value))
40123 {
40124 tileCollide = false;
40125 if (Math.Abs(velocity.X) + Math.Abs(velocity.Y) < num2)
40126 {
40127 velocity *= 1.1f;
40128 }
40129 if (velocity.Length() > num2)
40130 {
40131 velocity *= num2 / velocity.Length();
40132 }
40133 }
40134 else if (num5 > num4)
40135 {
40136 Vector2 vector = DirectionTo(nPC2.Center);
40137 velocity = Vector2.Lerp(velocity, vector * num, 0.15f);
40138 }
40139 else
40140 {
40141 tileCollide = false;
40142 Vector2 vector2 = DirectionTo(nPC2.Center);
40143 velocity += new Vector2(Math.Sign(vector2.X), Math.Sign(vector2.Y)) * 0.35f;
40144 if (velocity.Length() > num2)
40145 {
40146 velocity *= num2 / velocity.Length();
40147 }
40148 }
40149 float num6 = 0.025f;
40150 float num7 = width * 3;
40151 for (int i = 0; i < 1000; i++)
40152 {
40153 if (i != whoAmI && Main.projectile[i].active && Main.projectile[i].owner == owner && Main.projectile[i].type == type && Math.Abs(position.X - Main.projectile[i].position.X) + Math.Abs(position.Y - Main.projectile[i].position.Y) < num7)
40154 {
40155 if (position.X < Main.projectile[i].position.X)
40156 {
40157 velocity.X -= num6;
40158 }
40159 else
40160 {
40161 velocity.X += num6;
40162 }
40163 if (position.Y < Main.projectile[i].position.Y)
40164 {
40165 velocity.Y -= num6;
40166 }
40167 else
40168 {
40169 velocity.Y += num6;
40170 }
40171 }
40172 }
40173 rotation = velocity.X * 0.1f;
40174 direction = ((velocity.X > 0f) ? 1 : (-1));
40175 spriteDirection = ((velocity.X > 0f) ? 1 : (-1));
40176 return;
40177 }
40178 tileCollide = false;
40179 List<int> ai158_blacklistedTargets = _ai158_blacklistedTargets;
40181 AI_GetMyGroupIndexAndFillBlackList(ai158_blacklistedTargets, out var index, out var _);
40182 localAI[0] = index;
40183 Vector2 vector3 = AI_158_GetHomeLocation(player, index);
40184 float num8 = Distance(vector3);
40185 bool flag = player.gravDir > 0f && player.fullRotation == 0f && player.headRotation == 0f;
40186 if (num8 > 2000f)
40187 {
40188 base.Center = vector3;
40189 frame = Main.projFrames[type] - 1;
40190 frameCounter = 0;
40191 velocity = Vector2.Zero;
40192 direction = (spriteDirection = player.direction);
40193 rotation = 0f;
40194 }
40195 else if (num8 > 40f)
40196 {
40197 float num9 = num + num8 * 0.006f;
40198 Vector2 vector4 = DirectionTo(vector3);
40199 vector4 *= MathHelper.Lerp(1f, 5f, Utils.GetLerpValue(40f, 800f, num8, clamped: true));
40200 velocity = Vector2.Lerp(velocity, vector4 * num9, 0.025f);
40201 if (velocity.Length() > num9)
40202 {
40203 velocity *= num9 / velocity.Length();
40204 }
40205 float num10 = 0.05f;
40206 float num11 = width;
40207 for (int j = 0; j < 1000; j++)
40208 {
40209 if (j != whoAmI && Main.projectile[j].active && Main.projectile[j].owner == owner && Main.projectile[j].type == type && Math.Abs(position.X - Main.projectile[j].position.X) + Math.Abs(position.Y - Main.projectile[j].position.Y) < num11)
40210 {
40211 if (position.X < Main.projectile[j].position.X)
40212 {
40213 velocity.X -= num10;
40214 }
40215 else
40216 {
40217 velocity.X += num10;
40218 }
40219 if (position.Y < Main.projectile[j].position.Y)
40220 {
40221 velocity.Y -= num10;
40222 }
40223 else
40224 {
40225 velocity.Y += num10;
40226 }
40227 }
40228 }
40229 rotation = velocity.X * 0.04f;
40230 direction = ((velocity.X > 0f) ? 1 : (-1));
40231 spriteDirection = ((velocity.X > 0f) ? 1 : (-1));
40232 }
40233 else if (num8 > 8f + player.velocity.Length())
40234 {
40235 Vector2 vector5 = DirectionTo(vector3);
40236 velocity += new Vector2(Math.Sign(vector5.X), Math.Sign(vector5.Y)) * 0.05f;
40237 if (velocity.Length() > num)
40238 {
40239 velocity *= num / velocity.Length();
40240 }
40241 rotation = velocity.X * 0.1f;
40242 direction = ((velocity.X > 0f) ? 1 : (-1));
40243 spriteDirection = ((velocity.X > 0f) ? 1 : (-1));
40244 }
40245 else if (flag)
40246 {
40247 base.Center = vector3;
40248 frame = Main.projFrames[type] - 1;
40249 frameCounter = 0;
40250 velocity = Vector2.Zero;
40251 direction = (spriteDirection = player.direction);
40252 rotation = 0f;
40253 }
40254 }
40255
40257 {
40258 int num = master.bodyFrame.Height;
40259 if (num == 0)
40260 {
40261 num = 1;
40262 }
40263 Vector2 vector = Main.OffsetsPlayerHeadgear[master.bodyFrame.Y / num];
40264 vector.Y -= 2f;
40265 if (master.mount.Active && master.mount.Type == 52)
40266 {
40267 vector.Y += 6f;
40268 vector.X -= master.direction * 10;
40269 }
40270 switch (stackedIndex % 6)
40271 {
40272 case 1:
40273 vector += new Vector2(master.direction * 8, master.gravDir * -2f);
40274 break;
40275 case 2:
40276 vector += new Vector2(master.direction * -10, master.gravDir * -2f);
40277 break;
40278 case 4:
40279 vector += new Vector2(master.direction * 10, master.gravDir * -10f);
40280 break;
40281 case 5:
40282 vector += new Vector2(master.direction * -12, master.gravDir * -10f);
40283 break;
40284 case 3:
40285 {
40287 _ = master.direction;
40288 vector = vector2 + new Vector2(0f, master.gravDir * -10f);
40289 break;
40290 }
40291 }
40292 vector += new Vector2(0f, master.gravDir * -16f) * (stackedIndex / 6);
40294 _ = master.direction;
40295 return (vector3 + new Vector2(0f, master.gravDir * -21f) + vector).Floor();
40296 }
40297
40299 {
40300 float num = startAttackRange;
40301 float num2 = num;
40302 float num3 = num;
40303 NPC ownerMinionAttackTargetNPC = OwnerMinionAttackTargetNPC;
40304 if (ownerMinionAttackTargetNPC != null && ownerMinionAttackTargetNPC.CanBeChasedBy(this) && IsInRangeOfMeOrMyOwner(ownerMinionAttackTargetNPC, num, out var _, out var _, out var _))
40305 {
40307 }
40308 else
40309 {
40310 if (attackTarget >= 0)
40311 {
40312 return;
40313 }
40314 for (int i = 0; i < 200; i++)
40315 {
40316 NPC nPC = Main.npc[i];
40317 if (nPC.CanBeChasedBy(this) && IsInRangeOfMeOrMyOwner(nPC, num, out var myDistance2, out var playerDistance2, out var closerIsMe2) && (!skipIfCannotHitWithOwnBody || CanHitWithOwnBody(nPC)) && (customEliminationCheck == null || customEliminationCheck(nPC, attackTarget)))
40318 {
40319 attackTarget = i;
40321 if (num2 > myDistance2)
40322 {
40323 num2 = myDistance2;
40324 }
40325 if (num3 > playerDistance2)
40326 {
40328 }
40329 num = Math.Max(num2, num3);
40330 }
40331 }
40332 }
40333 }
40334
40336 {
40337 return true;
40338 }
40339
40341 {
40342 List<NPC> list = new List<NPC>();
40343 Vector2 center = Main.player[owner].Center;
40344 Rectangle value = Utils.CenteredRectangle(center, new Vector2(1600f, 800f));
40345 int num = Main.player[owner].ownedProjectileCounts[831] + 1;
40346 for (int i = 0; i < 200; i++)
40347 {
40348 NPC nPC = Main.npc[i];
40349 if (nPC.CanBeChasedBy(this) && nPC.Hitbox.Intersects(value))
40350 {
40351 list.Add(nPC);
40352 }
40353 }
40354 if (list.Count == 0)
40355 {
40356 return false;
40357 }
40358 NPC nPC2 = list[0];
40359 for (int j = 1; j < list.Count; j++)
40360 {
40361 if (Vector2.Distance(nPC2.Center, center) > Vector2.Distance(list[j].Center, center))
40362 {
40363 nPC2 = list[j];
40364 }
40365 }
40366 list.Remove(nPC2);
40367 NPC nPC3 = null;
40368 if (list.Count > 0)
40369 {
40370 nPC3 = list[0];
40371 for (int k = 1; k < list.Count; k++)
40372 {
40373 if (Distance(nPC3.Center) > Distance(list[k].Center))
40374 {
40375 nPC3 = list[k];
40376 }
40377 }
40378 list.Remove(nPC3);
40379 }
40381 if (nPC3 != null)
40382 {
40383 list2.Add(nPC3.Center);
40384 }
40385 int num2 = 0;
40386 while (list.Count > 0 && list2.Count < num - 1)
40387 {
40388 int index = Main.rand.Next(list.Count);
40389 Vector2 vector = list[index].velocity * 4f * (num2 + 1);
40390 list2.Add(list[index].Center + vector);
40391 list.RemoveAt(index);
40392 num2++;
40393 }
40394 if (nPC2 != null)
40395 {
40396 list2.Add(nPC2.Center);
40397 }
40398 if (list2.Count > 0 && Collision.SolidCollision(list2[list2.Count - 1] - base.Size / 2f, width, height))
40399 {
40400 list2.Add(center);
40401 }
40402 Vector2 vector2 = base.Center;
40403 float num3 = Math.Min(20, 30 / list2.Count);
40404 float num4 = 0f;
40405 for (int l = 0; l < list2.Count; l++)
40406 {
40407 float num5 = 20f;
40409 vector3.X += ((vector2.X < vector3.X) ? num5 : (0f - num5));
40411 int num6 = (int)Math.Min(num3, 4.0 + Math.Ceiling(vector4.Length() / 50f));
40412 if (num6 < 5)
40413 {
40414 num6 = 5;
40415 }
40416 NewProjectile(GetProjectileSource_FromThis(), vector2, vector4, 818, damage, 0f, owner, (0f - num4) * 4f, num6 * 4);
40417 vector2 = vector3;
40418 num4 += (float)num6;
40419 }
40420 base.Center = vector2;
40421 ai[0] = 4f;
40422 ai[1] = num4;
40423 netUpdate = true;
40424 return true;
40425 }
40426
40428 {
40429 Player player = Main.player[owner];
40430 if (!player.active)
40431 {
40432 active = false;
40433 return;
40434 }
40435 bool flag = type == 393 || type == 394 || type == 395;
40436 bool flag2 = type == 758;
40437 bool flag3 = type == 833 || type == 834 || type == 835;
40438 bool flag4 = type == 834 || type == 835;
40439 bool flag5 = type == 951;
40440 int num = 450;
40441 float num2 = 500f;
40442 float num3 = 300f;
40443 int num4 = 15;
40444 if (flag5)
40445 {
40446 if (player.dead)
40447 {
40448 player.flinxMinion = false;
40449 }
40450 if (player.flinxMinion)
40451 {
40452 timeLeft = 2;
40453 }
40454 num = 800;
40455 }
40456 if (flag)
40457 {
40458 if (player.dead)
40459 {
40460 player.pirateMinion = false;
40461 }
40462 if (player.pirateMinion)
40463 {
40464 timeLeft = 2;
40465 }
40466 num = 800;
40467 }
40468 if (flag3)
40469 {
40470 if (player.dead)
40471 {
40472 player.stormTiger = false;
40473 }
40474 if (player.stormTiger)
40475 {
40476 timeLeft = 2;
40477 }
40478 num = 800;
40479 if (ai[0] != 4f)
40480 {
40481 if (velocity != Vector2.Zero && Main.rand.Next(18) == 0)
40482 {
40483 Dust obj = Main.dust[Dust.NewDust(position, width, height, 269)];
40484 obj.fadeIn = 0.5f;
40485 obj.scale = 0.3f;
40486 obj.noLight = true;
40487 obj.velocity += velocity * 0.005f;
40488 }
40489 if (type == 833)
40490 {
40491 Lighting.AddLight(base.Center, Vector3.One * 0.5f);
40492 }
40493 if (type == 834)
40494 {
40495 Lighting.AddLight(base.Center, Vector3.One * 0.8f);
40496 }
40497 if (type == 835)
40498 {
40499 Lighting.AddLight(base.Center, Color.Lerp(Main.OurFavoriteColor, Color.White, 0.8f).ToVector3() * 1f);
40500 }
40501 }
40502 if (owner == Main.myPlayer)
40503 {
40504 if (localAI[0] <= 0f)
40505 {
40506 int num5 = type switch
40507 {
40508 834 => 300,
40509 835 => 240,
40510 _ => 360,
40511 };
40512 if (damage != 0)
40513 {
40514 bool flag6 = AI_067_TigerSpecialAttack();
40515 localAI[0] = (flag6 ? num5 : 10);
40516 }
40517 }
40518 else
40519 {
40520 localAI[0] -= 1f;
40521 }
40522 }
40523 }
40524 if (flag2)
40525 {
40526 if (player.dead)
40527 {
40528 player.vampireFrog = false;
40529 }
40530 if (player.vampireFrog)
40531 {
40532 timeLeft = 2;
40533 }
40534 num = 800;
40535 }
40536 if (type == 500)
40537 {
40538 num2 = 200f;
40539 if (player.dead)
40540 {
40541 player.crimsonHeart = false;
40542 }
40543 if (player.crimsonHeart)
40544 {
40545 timeLeft = 2;
40546 }
40547 }
40548 if (type == 653)
40549 {
40550 num2 = 300f;
40551 if (player.dead)
40552 {
40553 player.companionCube = false;
40554 }
40555 if (player.companionCube)
40556 {
40557 timeLeft = 2;
40558 }
40559 }
40560 if (type == 1018)
40561 {
40562 num2 = 200f;
40563 if (player.dead)
40564 {
40565 player.petFlagDirtiestBlock = false;
40566 }
40567 if (player.petFlagDirtiestBlock)
40568 {
40569 timeLeft = 2;
40570 }
40571 }
40572 if (flag3 && ai[0] == 4f)
40573 {
40574 velocity = Vector2.Zero;
40575 frame = 9;
40576 if (flag4)
40577 {
40578 frame = 11;
40579 }
40580 ai[1] -= 1f;
40581 if (!(ai[1] <= 0f))
40582 {
40583 return;
40584 }
40585 ai[0] = 0f;
40586 ai[1] = 0f;
40587 netUpdate = true;
40588 }
40589 Vector2 vector = player.Center;
40590 if (flag5)
40591 {
40592 vector.X -= (45 + player.width / 2) * player.direction;
40593 vector.X -= minionPos * 30 * player.direction;
40594 }
40595 else if (flag)
40596 {
40597 vector.X -= (15 + player.width / 2) * player.direction;
40598 vector.X -= minionPos * 20 * player.direction;
40599 }
40600 else if (flag3)
40601 {
40602 vector.X -= (15 + player.width / 2) * player.direction;
40603 vector.X -= minionPos * 40 * player.direction;
40604 }
40605 else if (flag2)
40606 {
40607 vector.X -= (35 + player.width / 2) * player.direction;
40608 vector.X -= minionPos * 40 * player.direction;
40609 }
40610 else if (type == 500)
40611 {
40612 vector.X -= (15 + player.width / 2) * player.direction;
40613 vector.X -= 40 * player.direction;
40614 }
40615 else if (type == 1018)
40616 {
40617 vector.X = player.Center.X;
40618 }
40619 else if (type == 653)
40620 {
40621 vector.X = player.Center.X;
40622 }
40623 if (type == 500)
40624 {
40625 Lighting.AddLight(base.Center, 0.9f, 0.1f, 0.3f);
40626 int num6 = 6;
40627 if (frame == 0 || frame == 2)
40628 {
40629 num6 = 12;
40630 }
40631 if (++frameCounter >= num6)
40632 {
40633 frameCounter = 0;
40634 if (++frame >= Main.projFrames[type])
40635 {
40636 frame = 0;
40637 }
40638 }
40639 rotation += velocity.X / 20f;
40640 Vector2 vector2 = (-Vector2.UnitY).RotatedBy(rotation).RotatedBy((float)direction * 0.2f);
40641 int num7 = Dust.NewDust(base.Center + vector2 * 10f - new Vector2(4f), 0, 0, 5, vector2.X, vector2.Y, 0, Color.Transparent);
40642 Main.dust[num7].scale = 1f;
40643 Main.dust[num7].velocity = vector2.RotatedByRandom(0.7853981852531433) * 3.5f;
40644 Main.dust[num7].noGravity = true;
40645 Main.dust[num7].shader = GameShaders.Armor.GetSecondaryShader(Main.player[owner].cLight, Main.player[owner]);
40646 }
40647 if (type == 1018)
40648 {
40649 rotation += velocity.X / 20f;
40650 }
40651 if (type == 653)
40652 {
40653 rotation += velocity.X / 20f;
40654 bool flag7 = owner >= 0 && owner < 255;
40655 if (flag7)
40656 {
40657 _CompanionCubeScreamCooldown[owner] -= 1f;
40658 if (_CompanionCubeScreamCooldown[owner] < 0f)
40659 {
40660 _CompanionCubeScreamCooldown[owner] = 0f;
40661 }
40662 }
40664 if (tileSafely.liquid > 0 && tileSafely.lava())
40665 {
40666 localAI[0] += 1f;
40667 }
40668 else
40669 {
40670 localAI[0] -= 1f;
40671 }
40672 localAI[0] = MathHelper.Clamp(localAI[0], 0f, 20f);
40673 if (localAI[0] >= 20f)
40674 {
40675 if (flag7 && _CompanionCubeScreamCooldown[owner] == 0f)
40676 {
40677 _CompanionCubeScreamCooldown[owner] = 3600f;
40678 SoundEngine.PlaySound((Main.rand.Next(10) == 0) ? SoundID.NPCDeath61 : SoundID.NPCDeath59, position);
40679 }
40680 Kill();
40681 }
40682 if (flag7 && owner == Main.myPlayer && Main.netMode != 2)
40683 {
40684 Vector3 vector3 = Lighting.GetColor((int)base.Center.X / 16, (int)base.Center.Y / 16).ToVector3();
40685 Vector3 vector4 = Lighting.GetColor((int)player.Center.X / 16, (int)player.Center.Y / 16).ToVector3();
40686 if (vector3.Length() < 0.15f && vector4.Length() < 0.15f)
40687 {
40688 localAI[1] += 1f;
40689 }
40690 else if (localAI[1] > 0f)
40691 {
40692 localAI[1] -= 1f;
40693 }
40694 localAI[1] = MathHelper.Clamp(localAI[1], -3600f, 120f);
40695 if (localAI[1] > (float)Main.rand.Next(30, 120) && !player.immune && player.velocity == Vector2.Zero)
40696 {
40697 if (Main.rand.Next(5) == 0)
40698 {
40700 localAI[1] = -600f;
40701 }
40702 else
40703 {
40705 player.Hurt(PlayerDeathReason.ByOther(6), 3, 0);
40706 player.immune = false;
40707 player.immuneTime = 0;
40708 localAI[1] = -300 + Main.rand.Next(30) * -10;
40709 }
40710 }
40711 }
40712 }
40713 bool flag8 = true;
40714 if (type == 500 || type == 653 || type == 1018)
40715 {
40716 flag8 = false;
40717 }
40718 shouldFallThrough = player.position.Y + (float)player.height - 12f > position.Y + (float)height;
40719 friendly = false;
40720 int num8 = 0;
40721 int num9 = 15;
40722 int attackTarget = -1;
40723 bool flag9 = true;
40724 bool flag10 = ai[0] == 5f;
40725 if (flag5)
40726 {
40727 flag9 = false;
40728 friendly = true;
40729 }
40730 if (flag2)
40731 {
40732 friendly = true;
40733 num9 = 20;
40734 num8 = 60;
40735 }
40736 if (flag3)
40737 {
40738 flag9 = false;
40739 friendly = true;
40740 originalDamage = player.highestStormTigerGemOriginalDamage;
40741 }
40742 bool flag11 = ai[0] == 0f;
40743 if (flag3 && flag10)
40744 {
40745 flag11 = true;
40746 }
40747 if (flag11 && flag8)
40748 {
40749 Minion_FindTargetInRange(num, ref attackTarget, skipIfCannotHitWithOwnBody: true, AI_067_CustomEliminationCheck_Pirates);
40750 }
40751 if (flag3 && flag10)
40752 {
40753 if (attackTarget >= 0)
40754 {
40755 float maxDistance = num;
40757 vector = nPC.Center;
40758 if (!IsInRangeOfMeOrMyOwner(nPC, maxDistance, out var _, out var _, out var _))
40759 {
40760 ai[0] = 0f;
40761 ai[1] = 0f;
40762 return;
40763 }
40764 Point point = nPC.Top.ToTileCoordinates();
40765 int num10 = 0;
40766 int num11 = point.Y;
40767 while (num10 < num4)
40768 {
40769 Tile tile = Main.tile[point.X, num11];
40770 if (tile == null || tile.active())
40771 {
40772 break;
40773 }
40774 num10++;
40775 num11++;
40776 }
40777 int num12 = num4 / 2;
40778 if (num10 < num12)
40779 {
40780 ai[0] = 0f;
40781 ai[1] = 0f;
40782 return;
40783 }
40784 if (base.Hitbox.Intersects(nPC.Hitbox) && velocity.Y >= 0f)
40785 {
40786 velocity.Y = -8f;
40787 velocity.X = direction * 10;
40788 }
40789 float num13 = 20f;
40790 float maxAmountAllowedToMove = 4f;
40791 float num14 = 40f;
40792 float num15 = 40f;
40793 Vector2 top = nPC.Top;
40794 float num16 = (float)Math.Cos(Main.timeForVisualEffects / (double)num14 * 6.2831854820251465);
40795 if (num16 > 0f)
40796 {
40797 num16 *= -1f;
40798 }
40799 num16 *= num15;
40800 top.Y += num16;
40801 Vector2 vector5 = top - base.Center;
40802 if (vector5.Length() > num13)
40803 {
40804 vector5 = vector5.SafeNormalize(Vector2.Zero) * num13;
40805 }
40806 velocity = velocity.MoveTowards(vector5, maxAmountAllowedToMove);
40807 frame = 8;
40808 if (flag4)
40809 {
40810 frame = 10;
40811 }
40812 rotation += 0.6f * (float)spriteDirection;
40813 }
40814 else
40815 {
40816 ai[0] = 0f;
40817 ai[1] = 0f;
40818 }
40819 return;
40820 }
40821 if (ai[0] == 1f)
40822 {
40823 tileCollide = false;
40824 float num17 = 0.2f;
40825 float num18 = 10f;
40826 int num19 = 200;
40827 if (num18 < Math.Abs(player.velocity.X) + Math.Abs(player.velocity.Y))
40828 {
40829 num18 = Math.Abs(player.velocity.X) + Math.Abs(player.velocity.Y);
40830 }
40831 Vector2 vector6 = player.Center - base.Center;
40832 float num20 = vector6.Length();
40833 if (num20 > 2000f)
40834 {
40835 position = player.Center - new Vector2(width, height) / 2f;
40836 }
40837 if (num20 < (float)num19 && player.velocity.Y == 0f && position.Y + (float)height <= player.position.Y + (float)player.height && !Collision.SolidCollision(position, width, height))
40838 {
40839 ai[0] = 0f;
40840 netUpdate = true;
40841 if (velocity.Y < -6f)
40842 {
40843 velocity.Y = -6f;
40844 }
40845 }
40846 if (!(num20 < 60f))
40847 {
40848 vector6.Normalize();
40849 vector6 *= num18;
40850 if (velocity.X < vector6.X)
40851 {
40852 velocity.X += num17;
40853 if (velocity.X < 0f)
40854 {
40855 velocity.X += num17 * 1.5f;
40856 }
40857 }
40858 if (velocity.X > vector6.X)
40859 {
40860 velocity.X -= num17;
40861 if (velocity.X > 0f)
40862 {
40863 velocity.X -= num17 * 1.5f;
40864 }
40865 }
40866 if (velocity.Y < vector6.Y)
40867 {
40868 velocity.Y += num17;
40869 if (velocity.Y < 0f)
40870 {
40871 velocity.Y += num17 * 1.5f;
40872 }
40873 }
40874 if (velocity.Y > vector6.Y)
40875 {
40876 velocity.Y -= num17;
40877 if (velocity.Y > 0f)
40878 {
40879 velocity.Y -= num17 * 1.5f;
40880 }
40881 }
40882 }
40883 if (velocity.X != 0f)
40884 {
40885 spriteDirection = Math.Sign(velocity.X);
40886 }
40887 if (flag5)
40888 {
40889 frameCounter++;
40890 if (frameCounter > 3)
40891 {
40892 frame++;
40893 frameCounter = 0;
40894 }
40896 {
40897 frame = 2;
40898 }
40899 rotation = rotation.AngleTowards(rotation + 0.25f * (float)spriteDirection, 0.25f);
40900 }
40901 if (flag)
40902 {
40903 frameCounter++;
40904 if (frameCounter > 3)
40905 {
40906 frame++;
40907 frameCounter = 0;
40908 }
40909 if ((frame < 10) | (frame > 13))
40910 {
40911 frame = 10;
40912 }
40913 rotation = velocity.X * 0.1f;
40914 }
40915 if (flag2)
40916 {
40917 int num21 = 3;
40918 if (++frameCounter >= num21 * 4)
40919 {
40920 frameCounter = 0;
40921 }
40922 frame = 14 + frameCounter / num21;
40923 rotation = velocity.X * 0.15f;
40924 }
40925 if (flag3)
40926 {
40927 frame = 8;
40928 if (flag4)
40929 {
40930 frame = 10;
40931 }
40932 rotation += 0.6f * (float)spriteDirection;
40933 }
40934 if (type == 1018 && Main.LocalPlayer.miscCounter % 3 == 0)
40935 {
40936 int num22 = 2;
40937 Dust obj2 = Main.dust[Dust.NewDust(position + new Vector2(-num22, -num22), 16 + num22 * 2, 16 + num22 * 2, 0, 0f, 0f, 0, default(Color), 0.8f)];
40938 obj2.velocity = -velocity * 0.25f;
40939 obj2.velocity = obj2.velocity.RotatedByRandom(0.2617993950843811);
40940 }
40941 }
40942 if (ai[0] == 2f && ai[1] < 0f)
40943 {
40944 friendly = false;
40945 ai[1] += 1f;
40946 if (num9 >= 0)
40947 {
40948 ai[1] = 0f;
40949 ai[0] = 0f;
40950 netUpdate = true;
40951 return;
40952 }
40953 }
40954 else if (ai[0] == 2f)
40955 {
40956 spriteDirection = direction;
40957 rotation = 0f;
40958 if (flag)
40959 {
40960 friendly = true;
40961 frame = 4 + (int)((float)num9 - ai[1]) / (num9 / 3);
40962 if (velocity.Y != 0f)
40963 {
40964 frame += 3;
40965 }
40966 }
40967 if (flag2)
40968 {
40969 float num23 = ((float)num9 - ai[1]) / (float)num9;
40970 if ((double)num23 > 0.25 && (double)num23 < 0.75)
40971 {
40972 friendly = true;
40973 }
40974 int num24 = (int)(num23 * 5f);
40975 if (num24 > 2)
40976 {
40977 num24 = 4 - num24;
40978 }
40979 if (velocity.Y != 0f)
40980 {
40981 frame = 21 + num24;
40982 }
40983 else
40984 {
40985 frame = 18 + num24;
40986 }
40987 if (velocity.Y == 0f)
40988 {
40989 velocity.X *= 0.8f;
40990 }
40991 }
40992 velocity.Y += 0.4f;
40993 if (velocity.Y > 10f)
40994 {
40995 velocity.Y = 10f;
40996 }
40997 ai[1] -= 1f;
40998 if (ai[1] <= 0f)
40999 {
41000 if (num8 <= 0)
41001 {
41002 ai[1] = 0f;
41003 ai[0] = 0f;
41004 netUpdate = true;
41005 return;
41006 }
41007 ai[1] = -num8;
41008 }
41009 }
41010 if (attackTarget >= 0)
41011 {
41012 float maxDistance2 = num;
41013 float num25 = 20f;
41014 if (flag2)
41015 {
41016 num25 = 50f;
41017 }
41019 Vector2 center = nPC2.Center;
41020 vector = center;
41021 if (IsInRangeOfMeOrMyOwner(nPC2, maxDistance2, out var _, out var _, out var _))
41022 {
41023 shouldFallThrough = nPC2.Center.Y > base.Bottom.Y;
41024 bool flag12 = velocity.Y == 0f;
41025 if (wet && velocity.Y > 0f && !shouldFallThrough)
41026 {
41027 flag12 = true;
41028 }
41029 if (center.Y < base.Center.Y - 30f && flag12)
41030 {
41031 float num26 = (center.Y - base.Center.Y) * -1f;
41032 float num27 = 0.4f;
41033 float num28 = (float)Math.Sqrt(num26 * 2f * num27);
41034 if (num28 > 26f)
41035 {
41036 num28 = 26f;
41037 }
41038 velocity.Y = 0f - num28;
41039 }
41040 if (flag9 && Vector2.Distance(base.Center, vector) < num25)
41041 {
41042 if (velocity.Length() > 10f)
41043 {
41044 velocity /= velocity.Length() / 10f;
41045 }
41046 ai[0] = 2f;
41047 ai[1] = num9;
41048 netUpdate = true;
41049 direction = ((center.X - base.Center.X > 0f) ? 1 : (-1));
41050 }
41051 if (flag3)
41052 {
41053 Point point2 = nPC2.Top.ToTileCoordinates();
41054 int num29 = 0;
41055 int num30 = point2.Y;
41056 while (num29 < num4)
41057 {
41059 if (tile2 == null || tile2.active())
41060 {
41061 break;
41062 }
41063 num29++;
41064 num30++;
41065 }
41066 if (num29 >= num4)
41067 {
41068 ai[0] = 5f;
41069 ai[1] = 0f;
41070 netUpdate = true;
41071 return;
41072 }
41073 if (base.Hitbox.Intersects(nPC2.Hitbox) && velocity.Y >= 0f)
41074 {
41075 velocity.Y = -4f;
41076 velocity.X = direction * 10;
41077 }
41078 }
41079 }
41080 if (flag2)
41081 {
41082 int num31 = 1;
41083 if (center.X - base.Center.X < 0f)
41084 {
41085 num31 = -1;
41086 }
41087 vector.X += 20 * -num31;
41088 }
41089 }
41090 if (ai[0] == 0f && attackTarget < 0)
41091 {
41092 if (Main.player[owner].rocketDelay2 > 0)
41093 {
41094 ai[0] = 1f;
41095 netUpdate = true;
41096 }
41097 Vector2 vector7 = player.Center - base.Center;
41098 if (vector7.Length() > 2000f)
41099 {
41100 position = player.Center - new Vector2(width, height) / 2f;
41101 }
41102 else if (vector7.Length() > num2 || Math.Abs(vector7.Y) > num3)
41103 {
41104 ai[0] = 1f;
41105 netUpdate = true;
41106 if (velocity.Y > 0f && vector7.Y < 0f)
41107 {
41108 velocity.Y = 0f;
41109 }
41110 if (velocity.Y < 0f && vector7.Y > 0f)
41111 {
41112 velocity.Y = 0f;
41113 }
41114 }
41115 }
41116 if (ai[0] == 0f)
41117 {
41118 if (attackTarget < 0)
41119 {
41120 if (Distance(player.Center) > 60f && Distance(vector) > 60f && Math.Sign(vector.X - player.Center.X) != Math.Sign(base.Center.X - player.Center.X))
41121 {
41122 vector = player.Center;
41123 }
41125 for (int i = 0; i < 20; i++)
41126 {
41127 if (Collision.SolidCollision(r.TopLeft(), r.Width, r.Height))
41128 {
41129 break;
41130 }
41131 r.Y += 16;
41132 vector.Y += 16f;
41133 }
41134 Vector2 vector8 = Collision.TileCollision(player.Center - base.Size / 2f, vector - player.Center, width, height);
41135 vector = player.Center - base.Size / 2f + vector8;
41136 if (Distance(vector) < 32f)
41137 {
41138 float num32 = player.Center.Distance(vector);
41139 if (player.Center.Distance(base.Center) < num32)
41140 {
41141 vector = base.Center;
41142 }
41143 }
41144 Vector2 vector9 = player.Center - vector;
41145 if (vector9.Length() > num2 || Math.Abs(vector9.Y) > num3)
41146 {
41148 Vector2 vector10 = vector - player.Center;
41149 Vector2 vector11 = r2.TopLeft();
41150 for (float num33 = 0f; num33 < 1f; num33 += 0.05f)
41151 {
41152 Vector2 vector12 = r2.TopLeft() + vector10 * num33;
41153 if (Collision.SolidCollision(r2.TopLeft() + vector10 * num33, r.Width, r.Height))
41154 {
41155 break;
41156 }
41158 }
41159 vector = vector11 + base.Size / 2f;
41160 }
41161 }
41162 tileCollide = true;
41163 float num34 = 0.5f;
41164 float num35 = 4f;
41165 float num36 = 4f;
41166 float num37 = 0.1f;
41167 if (flag5 && attackTarget != -1)
41168 {
41169 num34 = 0.65f;
41170 num35 = 5.5f;
41171 num36 = 5.5f;
41172 }
41173 if (flag && attackTarget != -1)
41174 {
41175 num34 = 1f;
41176 num35 = 8f;
41177 num36 = 8f;
41178 }
41179 if (flag2 && attackTarget != -1)
41180 {
41181 num34 = 0.7f;
41182 num35 = 6f;
41183 num36 = 6f;
41184 }
41185 if (flag3 && attackTarget != -1)
41186 {
41187 num34 = 1f;
41188 num35 = 8f;
41189 num36 = 8f;
41190 }
41191 if (num36 < Math.Abs(player.velocity.X) + Math.Abs(player.velocity.Y))
41192 {
41193 num36 = Math.Abs(player.velocity.X) + Math.Abs(player.velocity.Y);
41194 num34 = 0.7f;
41195 }
41196 if (type == 653 || type == 1018)
41197 {
41198 float num38 = player.velocity.Length();
41199 if (num38 < 0.1f)
41200 {
41201 num38 = 0f;
41202 }
41203 if (num38 != 0f && num38 < num36)
41204 {
41205 num36 = num38;
41206 }
41207 }
41208 int num39 = 0;
41209 bool flag13 = false;
41210 float num40 = vector.X - base.Center.X;
41211 Vector2 vector13 = vector - base.Center;
41212 if (type == 1018 && Math.Abs(num40) < 50f)
41213 {
41214 rotation = rotation.AngleTowards(0f, 0.2f);
41215 velocity.X *= 0.9f;
41216 if ((double)Math.Abs(velocity.X) < 0.1)
41217 {
41218 velocity.X = 0f;
41219 }
41220 }
41221 else if (type == 653 && Math.Abs(num40) < 150f)
41222 {
41223 rotation = rotation.AngleTowards(0f, 0.2f);
41224 velocity.X *= 0.9f;
41225 if ((double)Math.Abs(velocity.X) < 0.1)
41226 {
41227 velocity.X = 0f;
41228 }
41229 }
41230 else if (Math.Abs(num40) > 5f)
41231 {
41232 if (num40 < 0f)
41233 {
41234 num39 = -1;
41235 if (velocity.X > 0f - num35)
41236 {
41237 velocity.X -= num34;
41238 }
41239 else
41240 {
41241 velocity.X -= num37;
41242 }
41243 }
41244 else
41245 {
41246 num39 = 1;
41247 if (velocity.X < num35)
41248 {
41249 velocity.X += num34;
41250 }
41251 else
41252 {
41253 velocity.X += num37;
41254 }
41255 }
41256 bool flag14 = true;
41257 if (flag)
41258 {
41259 flag14 = false;
41260 }
41261 if (type == 653)
41262 {
41263 flag14 = false;
41264 }
41265 if (type == 1018)
41266 {
41267 flag14 = false;
41268 }
41269 if (flag2 && attackTarget == -1)
41270 {
41271 flag14 = false;
41272 }
41273 if (flag3)
41274 {
41275 flag14 = vector13.Y < -80f;
41276 }
41277 if (flag5)
41278 {
41279 flag14 = attackTarget > -1 && Main.npc[attackTarget].Hitbox.Intersects(base.Hitbox);
41280 }
41281 if (flag14)
41282 {
41283 flag13 = true;
41284 }
41285 }
41286 else
41287 {
41288 velocity.X *= 0.9f;
41289 if (Math.Abs(velocity.X) < num34 * 2f)
41290 {
41291 velocity.X = 0f;
41292 }
41293 }
41294 bool flag15 = Math.Abs(vector13.X) >= 64f || (vector13.Y <= -48f && Math.Abs(vector13.X) >= 8f);
41295 if (num39 != 0 && flag15)
41296 {
41297 int num41 = (int)(position.X + (float)(width / 2)) / 16;
41298 int num42 = (int)position.Y / 16;
41299 num41 += num39;
41300 num41 += (int)velocity.X;
41301 for (int j = num42; j < num42 + height / 16 + 1; j++)
41302 {
41303 if (WorldGen.SolidTile(num41, j))
41304 {
41305 flag13 = true;
41306 }
41307 }
41308 }
41309 if (type == 500 && velocity.X != 0f)
41310 {
41311 flag13 = true;
41312 }
41313 if (type == 653 && Math.Abs(velocity.X) > 3f)
41314 {
41315 flag13 = true;
41316 }
41317 if (type == 1018 && Math.Abs(velocity.X) > 3f)
41318 {
41319 flag13 = true;
41320 }
41321 Collision.StepUp(ref position, ref velocity, width, height, ref stepSpeed, ref gfxOffY);
41322 float num43 = Utils.GetLerpValue(0f, 100f, vector13.Y, clamped: true) * Utils.GetLerpValue(-2f, -6f, velocity.Y, clamped: true);
41323 if (velocity.Y == 0f)
41324 {
41325 if (flag13)
41326 {
41327 for (int k = 0; k < 3; k++)
41328 {
41329 int num44 = (int)(position.X + (float)(width / 2)) / 16;
41330 if (k == 0)
41331 {
41332 num44 = (int)position.X / 16;
41333 }
41334 if (k == 2)
41335 {
41336 num44 = (int)(position.X + (float)width) / 16;
41337 }
41338 int num45 = (int)(position.Y + (float)height) / 16;
41339 if (!WorldGen.SolidTile(num44, num45) && !Main.tile[num44, num45].halfBrick() && Main.tile[num44, num45].slope() <= 0 && (!TileID.Sets.Platforms[Main.tile[num44, num45].type] || !Main.tile[num44, num45].active() || Main.tile[num44, num45].inActive()))
41340 {
41341 continue;
41342 }
41343 try
41344 {
41345 num44 = (int)(position.X + (float)(width / 2)) / 16;
41346 num45 = (int)(position.Y + (float)(height / 2)) / 16;
41347 num44 += num39;
41348 num44 += (int)velocity.X;
41350 {
41351 velocity.Y = -5.1f;
41352 }
41353 else if (!WorldGen.SolidTile(num44, num45 - 2))
41354 {
41355 velocity.Y = -7.1f;
41356 }
41357 else if (WorldGen.SolidTile(num44, num45 - 5))
41358 {
41359 velocity.Y = -11.1f;
41360 }
41361 else if (WorldGen.SolidTile(num44, num45 - 4))
41362 {
41363 velocity.Y = -10.1f;
41364 }
41365 else
41366 {
41367 velocity.Y = -9.1f;
41368 }
41369 }
41370 catch
41371 {
41372 velocity.Y = -9.1f;
41373 }
41374 }
41375 if (vector.Y - base.Center.Y < -48f)
41376 {
41377 float num46 = vector.Y - base.Center.Y;
41378 num46 *= -1f;
41379 if (num46 < 60f)
41380 {
41381 velocity.Y = -6f;
41382 }
41383 else if (num46 < 80f)
41384 {
41385 velocity.Y = -7f;
41386 }
41387 else if (num46 < 100f)
41388 {
41389 velocity.Y = -8f;
41390 }
41391 else if (num46 < 120f)
41392 {
41393 velocity.Y = -9f;
41394 }
41395 else if (num46 < 140f)
41396 {
41397 velocity.Y = -10f;
41398 }
41399 else if (num46 < 160f)
41400 {
41401 velocity.Y = -11f;
41402 }
41403 else if (num46 < 190f)
41404 {
41405 velocity.Y = -12f;
41406 }
41407 else if (num46 < 210f)
41408 {
41409 velocity.Y = -13f;
41410 }
41411 else if (num46 < 270f)
41412 {
41413 velocity.Y = -14f;
41414 }
41415 else if (num46 < 310f)
41416 {
41417 velocity.Y = -15f;
41418 }
41419 else
41420 {
41421 velocity.Y = -16f;
41422 }
41423 }
41424 if (wet && num43 == 0f)
41425 {
41426 velocity.Y *= 2f;
41427 }
41428 }
41429 if (type == 1018 && localAI[2] == 0f)
41430 {
41431 localAI[2] = 1f;
41432 for (int l = 0; l < 6; l++)
41433 {
41434 Dust obj4 = Main.dust[Dust.NewDust(position + velocity, 16, 16, 0, 0f, 0f, 0, default(Color), 0.8f)];
41435 obj4.velocity.X = velocity.X * 0.25f;
41436 obj4.velocity.Y = -2f + Math.Abs(velocity.Y) * 0.25f;
41437 obj4.velocity = obj4.velocity.RotatedByRandom(0.2617993950843811);
41438 }
41439 }
41440 }
41441 else if (type == 1018)
41442 {
41443 localAI[2] = 0f;
41444 }
41445 if (velocity.X > num36)
41446 {
41447 velocity.X = num36;
41448 }
41449 if (velocity.X < 0f - num36)
41450 {
41451 velocity.X = 0f - num36;
41452 }
41453 if (velocity.X < 0f)
41454 {
41455 direction = -1;
41456 }
41457 if (velocity.X > 0f)
41458 {
41459 direction = 1;
41460 }
41461 if (velocity.X == 0f)
41462 {
41463 direction = ((player.Center.X > base.Center.X) ? 1 : (-1));
41464 }
41465 if (velocity.X > num34 && num39 == 1)
41466 {
41467 direction = 1;
41468 }
41469 if (velocity.X < 0f - num34 && num39 == -1)
41470 {
41471 direction = -1;
41472 }
41473 spriteDirection = direction;
41474 if (flag5)
41475 {
41476 if (velocity.Y == 0f)
41477 {
41478 rotation = rotation.AngleTowards(0f, 0.3f);
41479 if (velocity.X == 0f)
41480 {
41481 frame = 0;
41482 frameCounter = 0;
41483 }
41484 else if (Math.Abs(velocity.X) >= 0.5f)
41485 {
41486 frameCounter += (int)Math.Abs(velocity.X);
41487 frameCounter++;
41488 if (frameCounter > 10)
41489 {
41490 frame++;
41491 frameCounter = 0;
41492 }
41494 {
41495 frame = 2;
41496 }
41497 }
41498 else
41499 {
41500 frame = 0;
41501 frameCounter = 0;
41502 }
41503 }
41504 else if (velocity.Y != 0f)
41505 {
41506 rotation = Math.Min(4f, velocity.Y) * -0.1f;
41507 if (spriteDirection == -1)
41508 {
41509 rotation -= (float)Math.PI * 2f;
41510 }
41511 frameCounter = 0;
41512 frame = 1;
41513 }
41514 }
41515 if (flag)
41516 {
41517 rotation = 0f;
41518 if (velocity.Y == 0f)
41519 {
41520 if (velocity.X == 0f)
41521 {
41522 frame = 0;
41523 frameCounter = 0;
41524 }
41525 else if (Math.Abs(velocity.X) >= 0.5f)
41526 {
41527 frameCounter += (int)Math.Abs(velocity.X);
41528 frameCounter++;
41529 if (frameCounter > 10)
41530 {
41531 frame++;
41532 frameCounter = 0;
41533 }
41534 if (frame >= 4)
41535 {
41536 frame = 0;
41537 }
41538 }
41539 else
41540 {
41541 frame = 0;
41542 frameCounter = 0;
41543 }
41544 }
41545 else if (velocity.Y != 0f)
41546 {
41547 frameCounter = 0;
41548 frame = 14;
41549 }
41550 }
41551 if (flag2)
41552 {
41553 rotation = 0f;
41554 if (velocity.Y == 0f)
41555 {
41556 if (velocity.X == 0f)
41557 {
41558 int num47 = 4;
41559 if (++frameCounter >= 7 * num47 && Main.rand.Next(50) == 0)
41560 {
41561 frameCounter = 0;
41562 }
41563 int num48 = frameCounter / num47;
41564 if (num48 >= 4)
41565 {
41566 num48 = 6 - num48;
41567 }
41568 if (num48 < 0)
41569 {
41570 num48 = 0;
41571 }
41572 frame = 1 + num48;
41573 }
41574 else if (Math.Abs(velocity.X) >= 0.5f)
41575 {
41576 frameCounter += (int)Math.Abs(velocity.X);
41577 frameCounter++;
41578 int num49 = 15;
41579 int num50 = 8;
41580 if (frameCounter >= num50 * num49)
41581 {
41582 frameCounter = 0;
41583 }
41584 int num51 = frameCounter / num49;
41585 frame = num51 + 5;
41586 }
41587 else
41588 {
41589 frame = 0;
41590 frameCounter = 0;
41591 }
41592 }
41593 else if (velocity.Y != 0f)
41594 {
41595 if (velocity.Y < 0f)
41596 {
41597 if (frame > 9 || frame < 5)
41598 {
41599 frame = 5;
41600 frameCounter = 0;
41601 }
41602 if (++frameCounter >= 1 && frame < 9)
41603 {
41604 frame++;
41605 frameCounter = 0;
41606 }
41607 }
41608 else
41609 {
41610 if (frame > 13 || frame < 9)
41611 {
41612 frame = 9;
41613 frameCounter = 0;
41614 }
41615 if (++frameCounter >= 2 && frame < 11)
41616 {
41617 frame++;
41618 frameCounter = 0;
41619 }
41620 }
41621 }
41622 }
41623 if (flag3)
41624 {
41625 int num52 = 8;
41626 if (flag4)
41627 {
41628 num52 = 10;
41629 }
41630 rotation = 0f;
41631 if (velocity.Y == 0f)
41632 {
41633 if (velocity.X == 0f)
41634 {
41635 frame = 0;
41636 frameCounter = 0;
41637 }
41638 else if (Math.Abs(velocity.X) >= 0.5f)
41639 {
41640 frameCounter += (int)Math.Abs(velocity.X);
41641 frameCounter++;
41642 if (frameCounter > 10)
41643 {
41644 frame++;
41645 frameCounter = 0;
41646 }
41647 if (frame >= num52 || frame < 2)
41648 {
41649 frame = 2;
41650 }
41651 }
41652 else
41653 {
41654 frame = 0;
41655 frameCounter = 0;
41656 }
41657 }
41658 else if (velocity.Y != 0f)
41659 {
41660 frameCounter = 0;
41661 frame = 1;
41662 if (flag4)
41663 {
41664 frame = 9;
41665 }
41666 }
41667 }
41668 velocity.Y += 0.4f + num43 * 1f;
41669 if (velocity.Y > 10f)
41670 {
41671 velocity.Y = 10f;
41672 }
41673 }
41674 if (!flag)
41675 {
41676 return;
41677 }
41678 localAI[0] += 1f;
41679 if (velocity.X == 0f)
41680 {
41681 localAI[0] += 1f;
41682 }
41683 if (localAI[0] >= (float)Main.rand.Next(900, 1200))
41684 {
41685 localAI[0] = 0f;
41686 for (int m = 0; m < 6; m++)
41687 {
41688 int num53 = Dust.NewDust(base.Center + Vector2.UnitX * -direction * 8f - Vector2.One * 5f + Vector2.UnitY * 8f, 3, 6, 216, -direction, 1f);
41689 Main.dust[num53].velocity /= 2f;
41690 Main.dust[num53].scale = 0.8f;
41691 }
41692 int num54 = Gore.NewGore(base.Center + Vector2.UnitX * -direction * 8f, Vector2.Zero, Main.rand.Next(580, 583));
41693 Main.gore[num54].velocity /= 2f;
41694 Main.gore[num54].velocity.Y = Math.Abs(Main.gore[num54].velocity.Y);
41695 Main.gore[num54].velocity.X = (0f - Math.Abs(Main.gore[num54].velocity.X)) * (float)direction;
41696 }
41697 }
41698
41699 private void AI_157_SharpTears()
41700 {
41701 int num = 5;
41702 float num2 = 1f;
41703 int num3 = 30;
41704 int num4 = 30;
41705 int num5 = 2;
41706 int num6 = 2;
41707 int num7 = 20;
41708 int num8 = 30;
41709 int num9 = 35;
41710 int maxValue = 6;
41711 if (type == 961)
41712 {
41713 num = 16;
41714 num2 = 0.75f;
41715 num3 = 5;
41716 num4 = 5;
41717 num5 = 0;
41718 num6 = 0;
41719 num7 = 10;
41720 num8 = 10;
41721 num9 = 20;
41722 maxValue = 5;
41723 }
41724 bool flag = ai[0] < (float)num7;
41725 bool flag2 = ai[0] >= (float)num8;
41726 bool flag3 = ai[0] >= (float)num9;
41727 ai[0] += 1f;
41728 if (localAI[0] == 0f)
41729 {
41730 localAI[0] = 1f;
41731 rotation = velocity.ToRotation();
41732 frame = Main.rand.Next(maxValue);
41733 for (int i = 0; i < num3; i++)
41734 {
41735 Dust dust = Dust.NewDustPerfect(base.Center + Main.rand.NextVector2Circular(24f, 24f), num, velocity * num2 * MathHelper.Lerp(0.2f, 0.7f, Main.rand.NextFloat()));
41736 dust.velocity += Main.rand.NextVector2Circular(0.5f, 0.5f);
41737 dust.scale = 0.8f + Main.rand.NextFloat() * 0.5f;
41738 }
41739 for (int j = 0; j < num4; j++)
41740 {
41741 Dust dust2 = Dust.NewDustPerfect(base.Center + Main.rand.NextVector2Circular(24f, 24f), num, Main.rand.NextVector2Circular(2f, 2f) + velocity * num2 * MathHelper.Lerp(0.2f, 0.5f, Main.rand.NextFloat()));
41742 dust2.velocity += Main.rand.NextVector2Circular(0.5f, 0.5f);
41743 dust2.scale = 0.8f + Main.rand.NextFloat() * 0.5f;
41744 dust2.fadeIn = 1f;
41745 }
41746 if (type == 961)
41747 {
41749 }
41750 else
41751 {
41753 }
41754 }
41755 if (flag)
41756 {
41757 Opacity += 0.1f;
41758 scale = Opacity * ai[1];
41759 for (int k = 0; k < num5; k++)
41760 {
41761 Dust dust3 = Dust.NewDustPerfect(base.Center + Main.rand.NextVector2Circular(16f, 16f), num, velocity * num2 * MathHelper.Lerp(0.2f, 0.5f, Main.rand.NextFloat()));
41762 dust3.velocity += Main.rand.NextVector2Circular(0.5f, 0.5f);
41763 dust3.velocity *= 0.5f;
41764 dust3.scale = 0.8f + Main.rand.NextFloat() * 0.5f;
41765 }
41766 }
41767 if (flag2)
41768 {
41769 Opacity -= 0.2f;
41770 for (int l = 0; l < num6; l++)
41771 {
41772 Dust dust4 = Dust.NewDustPerfect(base.Center + Main.rand.NextVector2Circular(16f, 16f), num, velocity * num2 * MathHelper.Lerp(0.2f, 0.5f, Main.rand.NextFloat()));
41773 dust4.velocity += Main.rand.NextVector2Circular(0.5f, 0.5f);
41774 dust4.velocity *= 0.5f;
41775 dust4.scale = 0.8f + Main.rand.NextFloat() * 0.5f;
41776 }
41777 }
41778 if (flag3)
41779 {
41780 Kill();
41781 }
41782 if (type == 756)
41783 {
41784 Lighting.AddLight(base.Center, new Vector3(0.5f, 0.1f, 0.1f) * scale);
41785 }
41786 }
41787
41789 {
41790 myDistance = Vector2.Distance(entity.Center, base.Center);
41791 if (myDistance < maxDistance && !CanHitWithOwnBody(entity))
41792 {
41793 myDistance = float.PositiveInfinity;
41794 }
41795 playerDistance = Vector2.Distance(entity.Center, Main.player[owner].Center);
41796 if (playerDistance < maxDistance && !CanHitWithMeleeWeapon(entity))
41797 {
41798 playerDistance = float.PositiveInfinity;
41799 }
41801 if (closerIsMe)
41802 {
41803 return myDistance <= maxDistance;
41804 }
41805 return playerDistance <= maxDistance;
41806 }
41807
41808 private void AI_156_BatOfLight()
41809 {
41810 List<int> ai156_blacklistedTargets = _ai156_blacklistedTargets;
41811 Player player = Main.player[owner];
41812 bool num = type == 755;
41813 bool flag = type == 946;
41814 if (num)
41815 {
41816 if (player.dead)
41817 {
41818 player.batsOfLight = false;
41819 }
41820 if (player.batsOfLight)
41821 {
41822 timeLeft = 2;
41823 }
41824 DelegateMethods.v3_1 = AI_156_GetColor().ToVector3();
41825 Point point = base.Center.ToTileCoordinates();
41826 DelegateMethods.CastLightOpen(point.X, point.Y);
41827 if (++frameCounter >= 6)
41828 {
41829 frameCounter = 0;
41830 if (++frame >= Main.projFrames[type] - 1)
41831 {
41832 frame = 0;
41833 }
41834 }
41835 int num2 = player.direction;
41836 if (velocity.X != 0f)
41837 {
41838 num2 = Math.Sign(velocity.X);
41839 }
41840 spriteDirection = num2;
41841 }
41842 if (flag)
41843 {
41844 if (player.dead)
41845 {
41846 player.empressBlade = false;
41847 }
41848 if (player.empressBlade)
41849 {
41850 timeLeft = 2;
41851 }
41852 DelegateMethods.v3_1 = AI_156_GetColor().ToVector3();
41853 Point point2 = base.Center.ToTileCoordinates();
41855 }
41857 AI_156_Think(ai156_blacklistedTargets);
41858 }
41859
41861 {
41862 if (aiStyle != 156)
41863 {
41864 return Color.Transparent;
41865 }
41866 bool num = type == 755;
41867 _ = type;
41868 if (num)
41869 {
41870 return Color.Crimson;
41871 }
41872 return Color.Transparent;
41873 }
41874
41876 {
41877 bool flag = type == 755;
41878 bool flag2 = type == 946;
41879 int num = 60;
41880 int num2 = num - 1;
41881 int num3 = num + 60;
41882 int num4 = num3 - 1;
41883 int num5 = num + 1;
41884 if (flag)
41885 {
41886 num = 66;
41887 }
41888 if (flag2)
41889 {
41890 num = 40;
41891 num2 = num - 1;
41892 num3 = num + 40;
41893 num4 = num3 - 1;
41894 num5 = num + 1;
41895 }
41896 Player player = Main.player[owner];
41897 if (player.active && Vector2.Distance(player.Center, base.Center) > 2000f)
41898 {
41899 ai[0] = 0f;
41900 ai[1] = 0f;
41901 netUpdate = true;
41902 }
41903 if (ai[0] == -1f)
41904 {
41905 AI_GetMyGroupIndexAndFillBlackList(blacklist, out var index, out var totalIndexesInGroup);
41906 AI_156_GetIdlePosition(index, totalIndexesInGroup, out var idleSpot, out var idleRotation);
41907 velocity = Vector2.Zero;
41908 base.Center = base.Center.MoveTowards(idleSpot, 32f);
41909 rotation = rotation.AngleLerp(idleRotation, 0.2f);
41910 if (Distance(idleSpot) < 2f)
41911 {
41912 ai[0] = 0f;
41913 netUpdate = true;
41914 }
41915 return;
41916 }
41917 if (ai[0] == 0f)
41918 {
41919 if (flag)
41920 {
41921 AI_GetMyGroupIndexAndFillBlackList(blacklist, out var index2, out var totalIndexesInGroup2);
41922 AI_156_GetIdlePosition(index2, totalIndexesInGroup2, out var idleSpot2, out var _);
41923 velocity = Vector2.Zero;
41924 base.Center = Vector2.SmoothStep(base.Center, idleSpot2, 0.45f);
41925 if (Main.rand.Next(20) == 0)
41926 {
41927 int num6 = AI_156_TryAttackingNPCs(blacklist);
41928 if (num6 != -1)
41929 {
41930 AI_156_StartAttack();
41931 ai[0] = num;
41932 ai[1] = num6;
41933 netUpdate = true;
41934 return;
41935 }
41936 }
41937 }
41938 if (!flag2)
41939 {
41940 return;
41941 }
41942 AI_GetMyGroupIndexAndFillBlackList(blacklist, out var index3, out var totalIndexesInGroup3);
41943 AI_156_GetIdlePosition(index3, totalIndexesInGroup3, out var idleSpot3, out var idleRotation3);
41944 velocity = Vector2.Zero;
41945 base.Center = Vector2.SmoothStep(base.Center, idleSpot3, 0.45f);
41946 rotation = rotation.AngleLerp(idleRotation3, 0.45f);
41947 if (Main.rand.Next(20) == 0)
41948 {
41949 int num7 = AI_156_TryAttackingNPCs(blacklist);
41950 if (num7 != -1)
41951 {
41952 AI_156_StartAttack();
41953 ai[0] = Main.rand.NextFromList<int>(num, num3);
41954 ai[0] = num3;
41955 ai[1] = num7;
41956 netUpdate = true;
41957 }
41958 }
41959 return;
41960 }
41961 if (flag)
41962 {
41963 int num8 = (int)ai[1];
41964 if (!Main.npc.IndexInRange(num8))
41965 {
41966 ai[0] = 0f;
41967 netUpdate = true;
41968 return;
41969 }
41970 NPC nPC = Main.npc[num8];
41971 if (!nPC.CanBeChasedBy(this))
41972 {
41973 ai[0] = 0f;
41974 netUpdate = true;
41975 return;
41976 }
41977 ai[0] -= 1f;
41978 if (ai[0] >= (float)num2)
41979 {
41980 velocity *= 0.8f;
41981 if (ai[0] == (float)num2)
41982 {
41983 localAI[0] = base.Center.X;
41984 localAI[1] = base.Center.Y;
41985 }
41986 return;
41987 }
41988 float lerpValue = Utils.GetLerpValue(num2, 0f, ai[0], clamped: true);
41989 Vector2 vector = new Vector2(localAI[0], localAI[1]);
41990 if (lerpValue >= 0.5f)
41991 {
41992 vector = Main.player[owner].Center;
41993 }
41994 Vector2 center = nPC.Center;
41995 float num9 = (center - vector).ToRotation();
41996 float num10 = ((center.X > vector.X) ? (-(float)Math.PI) : ((float)Math.PI));
41997 float num11 = num10 + (0f - num10) * lerpValue * 2f;
41998 Vector2 spinningpoint = num11.ToRotationVector2();
41999 spinningpoint.Y *= (float)Math.Sin((float)identity * 2.3f) * 0.5f;
42000 spinningpoint = spinningpoint.RotatedBy(num9);
42001 float num12 = (center - vector).Length() / 2f;
42003 base.Center = center2;
42004 Vector2 vector2 = MathHelper.WrapAngle(num9 + num11 + 0f).ToRotationVector2() * 10f;
42005 velocity = vector2;
42006 position -= velocity;
42007 if (ai[0] == 0f)
42008 {
42009 int num13 = AI_156_TryAttackingNPCs(blacklist);
42010 if (num13 != -1)
42011 {
42012 ai[0] = num;
42013 ai[1] = num13;
42014 AI_156_StartAttack();
42015 netUpdate = true;
42016 return;
42017 }
42018 ai[1] = 0f;
42019 netUpdate = true;
42020 }
42021 }
42022 if (!flag2)
42023 {
42024 return;
42025 }
42026 bool skipBodyCheck = true;
42027 int num14 = 0;
42028 int num15 = num2;
42029 int num16 = 0;
42030 if (ai[0] >= (float)num5)
42031 {
42032 num14 = 1;
42033 num15 = num4;
42034 num16 = num5;
42035 }
42036 int num17 = (int)ai[1];
42037 if (!Main.npc.IndexInRange(num17))
42038 {
42039 int num18 = AI_156_TryAttackingNPCs(blacklist, skipBodyCheck);
42040 if (num18 != -1)
42041 {
42042 ai[0] = Main.rand.NextFromList<int>(num, num3);
42043 ai[1] = num18;
42044 AI_156_StartAttack();
42045 netUpdate = true;
42046 }
42047 else
42048 {
42049 ai[0] = -1f;
42050 ai[1] = 0f;
42051 netUpdate = true;
42052 }
42053 return;
42054 }
42055 NPC nPC2 = Main.npc[num17];
42056 if (!nPC2.CanBeChasedBy(this))
42057 {
42058 int num19 = AI_156_TryAttackingNPCs(blacklist, skipBodyCheck);
42059 if (num19 != -1)
42060 {
42061 ai[0] = Main.rand.NextFromList<int>(num, num3);
42062 AI_156_StartAttack();
42063 ai[1] = num19;
42064 netUpdate = true;
42065 }
42066 else
42067 {
42068 ai[0] = -1f;
42069 ai[1] = 0f;
42070 netUpdate = true;
42071 }
42072 return;
42073 }
42074 ai[0] -= 1f;
42075 if (ai[0] >= (float)num15)
42076 {
42077 direction = ((base.Center.X < nPC2.Center.X) ? 1 : (-1));
42078 if (ai[0] == (float)num15)
42079 {
42080 localAI[0] = base.Center.X;
42081 localAI[1] = base.Center.Y;
42082 }
42083 }
42084 float lerpValue2 = Utils.GetLerpValue(num15, num16, ai[0], clamped: true);
42085 if (num14 == 0)
42086 {
42087 Vector2 vector3 = new Vector2(localAI[0], localAI[1]);
42088 if (lerpValue2 >= 0.5f)
42089 {
42090 vector3 = Vector2.Lerp(nPC2.Center, Main.player[owner].Center, 0.5f);
42091 }
42092 Vector2 center3 = nPC2.Center;
42093 float num20 = (center3 - vector3).ToRotation();
42094 float num21 = ((direction == 1) ? (-(float)Math.PI) : ((float)Math.PI));
42095 float num22 = num21 + (0f - num21) * lerpValue2 * 2f;
42096 Vector2 spinningpoint2 = num22.ToRotationVector2();
42097 spinningpoint2.Y *= 0.5f;
42098 spinningpoint2.Y *= 0.8f + (float)Math.Sin((float)identity * 2.3f) * 0.2f;
42099 spinningpoint2 = spinningpoint2.RotatedBy(num20);
42100 float num23 = (center3 - vector3).Length() / 2f;
42102 base.Center = center4;
42103 float num24 = MathHelper.WrapAngle(num20 + num22 + 0f);
42104 rotation = num24 + (float)Math.PI / 2f;
42105 Vector2 vector4 = num24.ToRotationVector2() * 10f;
42106 velocity = vector4;
42107 position -= velocity;
42108 }
42109 if (num14 == 1)
42110 {
42111 Vector2 vector5 = new Vector2(localAI[0], localAI[1]);
42112 vector5 += new Vector2(0f, Utils.GetLerpValue(0f, 0.4f, lerpValue2, clamped: true) * -100f);
42113 Vector2 v = nPC2.Center - vector5;
42114 Vector2 vector6 = v.SafeNormalize(Vector2.Zero) * MathHelper.Clamp(v.Length(), 60f, 150f);
42115 Vector2 value = nPC2.Center + vector6;
42116 float lerpValue3 = Utils.GetLerpValue(0.4f, 0.6f, lerpValue2, clamped: true);
42117 float lerpValue4 = Utils.GetLerpValue(0.6f, 1f, lerpValue2, clamped: true);
42118 float targetAngle = v.SafeNormalize(Vector2.Zero).ToRotation() + (float)Math.PI / 2f;
42119 rotation = rotation.AngleTowards(targetAngle, (float)Math.PI / 5f);
42120 base.Center = Vector2.Lerp(vector5, nPC2.Center, lerpValue3);
42121 if (lerpValue4 > 0f)
42122 {
42123 base.Center = Vector2.Lerp(nPC2.Center, value, lerpValue4);
42124 }
42125 }
42126 if (ai[0] == (float)num16)
42127 {
42128 int num25 = AI_156_TryAttackingNPCs(blacklist, skipBodyCheck);
42129 if (num25 != -1)
42130 {
42131 ai[0] = Main.rand.NextFromList<int>(num, num3);
42132 ai[1] = num25;
42133 AI_156_StartAttack();
42134 netUpdate = true;
42135 }
42136 else
42137 {
42138 ai[0] = -1f;
42139 ai[1] = 0f;
42140 netUpdate = true;
42141 }
42142 }
42143 }
42144
42145 private void AI_156_StartAttack()
42146 {
42147 for (int i = 0; i < localNPCImmunity.Length; i++)
42148 {
42149 localNPCImmunity[i] = 0;
42150 }
42151 }
42152
42154 {
42155 Vector2 center = Main.player[owner].Center;
42156 int result = -1;
42157 float num = -1f;
42158 NPC ownerMinionAttackTargetNPC = OwnerMinionAttackTargetNPC;
42159 if (ownerMinionAttackTargetNPC != null && ownerMinionAttackTargetNPC.CanBeChasedBy(this))
42160 {
42161 bool flag = true;
42163 {
42164 flag = false;
42165 }
42166 if (ownerMinionAttackTargetNPC.Distance(center) > 1000f)
42167 {
42168 flag = false;
42169 }
42170 if (!skipBodyCheck && !CanHitWithOwnBody(ownerMinionAttackTargetNPC))
42171 {
42172 flag = false;
42173 }
42174 if (flag)
42175 {
42176 return ownerMinionAttackTargetNPC.whoAmI;
42177 }
42178 }
42179 for (int i = 0; i < 200; i++)
42180 {
42181 NPC nPC = Main.npc[i];
42182 if (nPC.CanBeChasedBy(this) && (nPC.boss || !blackListedTargets.Contains(i)))
42183 {
42184 float num2 = nPC.Distance(center);
42185 if (!(num2 > 1000f) && (!(num2 > num) || num == -1f) && (skipBodyCheck || CanHitWithOwnBody(nPC)))
42186 {
42187 num = num2;
42188 result = i;
42189 }
42190 }
42191 }
42192 return result;
42193 }
42194
42196 {
42197 index = 0;
42199 for (int i = 0; i < 1000; i++)
42200 {
42201 Projectile projectile = Main.projectile[i];
42202 if (projectile.active && projectile.owner == owner && projectile.type == type && (projectile.type != 759 || projectile.frame == Main.projFrames[projectile.type] - 1))
42203 {
42204 if (whoAmI > i)
42205 {
42206 index++;
42207 }
42209 }
42210 }
42211 }
42212
42214 {
42215 Player player = Main.player[owner];
42216 bool num = type == 755;
42217 bool flag = type == 946;
42218 idleRotation = 0f;
42220 if (num)
42221 {
42222 float num2 = ((float)totalIndexes - 1f) / 2f;
42223 idleSpot = player.Center + -Vector2.UnitY.RotatedBy(4.3982296f / (float)totalIndexes * ((float)stackedIndex - num2)) * 40f;
42224 idleRotation = 0f;
42225 }
42226 if (flag)
42227 {
42228 int num3 = stackedIndex + 1;
42229 idleRotation = (float)num3 * ((float)Math.PI * 2f) * (1f / 60f) * (float)player.direction + (float)Math.PI / 2f;
42231 int num4 = num3 % totalIndexes;
42232 Vector2 vector = new Vector2(0f, 0.5f).RotatedBy((player.miscCounterNormalized * (2f + (float)num4) + (float)num4 * 0.5f + (float)player.direction * 1.3f) * ((float)Math.PI * 2f)) * 4f;
42233 idleSpot = idleRotation.ToRotationVector2() * 10f + player.MountedCenter + new Vector2(player.direction * (num3 * -6 - 16), player.gravDir * -15f);
42234 idleSpot += vector;
42235 idleRotation += (float)Math.PI / 2f;
42236 }
42237 }
42238
42240 {
42241 if (Main.netMode != 1 && !Main.player[owner].active)
42242 {
42243 float num = ai[0];
42244 float y = position.Y;
42245 Point point = base.Center.ToTileCoordinates();
42246 Point end = new Point(point.X, (int)y / 16);
42247 Point start = new Point(point.X, (int)num / 16);
42248 AI_155_RemoveRope(start, end);
42249 Kill();
42250 return;
42251 }
42252 int num2 = 100;
42253 int num3 = 1800;
42254 if (ai[1] == 0f)
42255 {
42256 spriteDirection = ((!(Main.player[owner].Center.X > base.Center.X)) ? 1 : (-1));
42257 ai[1] = 1f;
42258 velocity.Y = -5f;
42259 }
42260 if (ai[1] == 1f)
42261 {
42262 localAI[1] += 1f;
42263 float num4 = Utils.Remap(localAI[1], 15f, 30f, 0f, 1f);
42264 int num5 = ((localAI[1] >= 60f) ? 1 : 0);
42265 velocity.Y = -3f * (1f - num4) + (float)(-32 * num5);
42266 velocity.Y = (int)velocity.Y;
42267 if (localAI[1] == 60f)
42268 {
42269 for (int i = 0; i < 30; i++)
42270 {
42271 Dust dust = Dust.NewDustDirect(base.TopLeft + new Vector2(-6f, 0f), 24, 16, 27, 0f, 0f, 150, Color.Transparent, 0.6f);
42272 dust.velocity *= 1f;
42273 dust.velocity.X *= 0.5f;
42274 dust.velocity.Y = -3f;
42275 dust.fadeIn = 1.2f;
42276 dust.noGravity = true;
42277 dust.position.X += Main.rand.NextFloatDirection() * 8f;
42278 dust.velocity = new Vector2(0f, -1f).RotatedBy((float)Math.PI / 4f * Main.rand.NextFloatDirection() * 0f) * (Main.rand.NextFloatDirection() * 9f);
42279 if (dust.velocity.Y < 0f)
42280 {
42281 dust.velocity.Y *= 1f + Main.rand.NextFloat() * 3f;
42282 }
42283 }
42284 }
42285 bool flag = num4 > 0f && num5 <= 0;
42286 if ((Main.rand.Next(6) == 0 || num5 > 0) && !flag)
42287 {
42288 Dust dust2 = Dust.NewDustDirect(base.TopLeft + new Vector2(-6f, 0f), 24, 16, 27, 0f, 0f, 150, Color.Transparent, 0.6f);
42289 dust2.velocity *= 1f;
42290 dust2.velocity.X *= 0.5f;
42291 dust2.velocity.Y = -3f;
42292 dust2.fadeIn = 1.2f;
42293 dust2.noGravity = true;
42294 }
42295 alpha = Utils.Clamp(alpha - 5, 0, 255);
42296 if (++frameCounter >= 12)
42297 {
42298 frameCounter = 0;
42299 if (++frame >= 4)
42300 {
42301 frame = 0;
42302 }
42303 }
42304 if (Main.myPlayer == owner)
42305 {
42306 float num6 = ai[0];
42307 float y2 = position.Y;
42308 Point point2 = base.Center.ToTileCoordinates();
42309 Point point3 = new Point(point2.X, (int)y2 / 16);
42310 Point point4 = new Point(point2.X, (int)num6 / 16);
42311 bool flag2 = point4.Y - point3.Y >= num2;
42312 int x = point4.X;
42313 if (!WorldGen.InWorld(x, point3.Y, 40) || !WorldGen.InWorld(x, point4.Y, 40))
42314 {
42315 flag2 = true;
42316 }
42317 if (!flag2)
42318 {
42319 for (int num7 = point4.Y; num7 >= point3.Y; num7--)
42320 {
42321 if (Main.tile[x, num7].active() && !Main.tileCut[Main.tile[x, num7].type] && Main.tile[x, num7].type != 504)
42322 {
42323 flag2 = true;
42324 break;
42325 }
42326 }
42327 }
42328 if (flag2)
42329 {
42330 int num8 = 0;
42331 for (int num9 = point4.Y; num9 > point3.Y; num9--)
42332 {
42333 if ((WorldGen.TileEmpty(x, num9) || Main.tileCut[Main.tile[x, num9].type]) && WorldGen.PlaceTile(x, num9, 504, mute: false, forced: false, owner))
42334 {
42335 num8++;
42336 if (Main.netMode == 1)
42337 {
42338 NetMessage.SendData(17, -1, -1, null, 1, x, num9, 504f);
42339 }
42340 }
42341 }
42342 timeLeft = num3;
42343 ai[1] = 2f;
42344 netUpdate = true;
42345 base.Top = new Vector2(x * 16 + 8, point3.Y * 16 + 16);
42346 velocity = Vector2.Zero;
42347 }
42348 }
42349 }
42350 if (ai[1] != 2f)
42351 {
42352 return;
42353 }
42354 alpha = 0;
42355 _ = timeLeft;
42356 float num10 = ai[0];
42357 float y3 = position.Y;
42358 Point point5 = base.Center.ToTileCoordinates();
42359 Point end2 = new Point(point5.X, (int)y3 / 16);
42360 Point start2 = new Point(point5.X, (int)num10 / 16);
42361 int x2 = start2.X;
42362 if (localAI[0] == 0f)
42363 {
42364 localAI[0] = 1f;
42365 for (int num11 = start2.Y; num11 >= end2.Y; num11--)
42366 {
42367 Tile tile = Main.tile[x2, num11];
42368 if (tile.active() && tile.type == 504)
42369 {
42370 AI_155_SpawnRopeIn(x2, num11);
42371 }
42372 }
42373 }
42374 else
42375 {
42376 for (int num12 = start2.Y; num12 >= end2.Y; num12--)
42377 {
42378 Tile tile2 = Main.tile[x2, num12];
42379 if (tile2.active() && tile2.type == 504 && Main.rand.Next(80) == 0)
42380 {
42381 Dust dust3 = Dust.NewDustDirect(new Vector2(x2 * 16 - 6, num12 * 16), 28, 16, 27, 0f, 0f, 150, Color.Transparent, 0.6f);
42382 dust3.velocity *= 1f;
42383 dust3.velocity.X = 0f;
42384 dust3.fadeIn = 1.2f;
42385 dust3.noGravity = true;
42386 }
42387 }
42388 }
42389 if (timeLeft == 4)
42390 {
42391 for (int num13 = start2.Y; num13 >= end2.Y; num13--)
42392 {
42393 Tile tile3 = Main.tile[x2, num13];
42394 if (tile3.active() && tile3.type == 504)
42395 {
42396 AI_155_SpawnRopeIn(x2, num13);
42397 }
42398 }
42399 }
42400 if (timeLeft > 4)
42401 {
42402 return;
42403 }
42404 if (!WorldGen.InWorld(x2, end2.Y, 20) || !WorldGen.InWorld(x2, start2.Y, 20))
42405 {
42406 Kill();
42407 return;
42408 }
42409 if (Main.myPlayer == owner)
42410 {
42411 AI_155_RemoveRope(start2, end2);
42412 }
42413 Kill();
42414 }
42415
42417 {
42418 int x = start.X;
42419 for (int num = start.Y; num >= end.Y; num--)
42420 {
42421 Tile tile = Main.tile[x, num];
42422 if (tile.active() && tile.type == 504)
42423 {
42424 WorldGen.KillTile(x, num);
42425 if (Main.netMode != 0)
42426 {
42427 NetMessage.SendData(17, -1, -1, null, 0, x, num);
42428 }
42429 }
42430 }
42431 }
42432
42433 private void AI_155_SpawnRopeIn(int x, int y)
42434 {
42435 Vector2 vector = new Vector2(x * 16 + 8, y * 16 + 8);
42436 if (Main.rand.Next(4) != 0)
42437 {
42438 Gore gore = Gore.NewGoreDirect(vector, Vector2.Zero, Main.rand.Next(61, 64));
42439 gore.velocity = Main.rand.NextVector2Circular(1.5f, 0.8f);
42440 gore.velocity.X += 0.1f * (float)((gore.velocity.X > 0f) ? 1 : (-1));
42441 gore.position = vector - new Vector2(16f, 16f);
42442 gore.alpha = 170;
42443 }
42444 for (int i = 0; i < 5; i++)
42445 {
42446 if (Main.rand.Next(8) == 0)
42447 {
42448 Dust.NewDustDirect(vector + new Vector2(-8f), 16, 16, 31, 0f, 0f, 100, Color.Transparent).velocity *= 0.4f;
42449 }
42450 Dust dust = Dust.NewDustDirect(vector + new Vector2(-8f), 16, 16, 27, 0f, 0f, 100, Color.Transparent, 1.7f);
42451 dust.velocity *= 2f;
42452 dust.noGravity = true;
42453 }
42454 }
42455
42456 private void AI_154_VoidLens()
42457 {
42458 Main.CurrentFrameFlags.HadAnActiveInteractibleProjectile = true;
42459 if (owner == Main.myPlayer)
42460 {
42461 for (int i = 0; i < 1000; i++)
42462 {
42463 if (i == whoAmI)
42464 {
42465 continue;
42466 }
42467 Projectile projectile = Main.projectile[i];
42468 if (projectile.active && projectile.owner == owner && projectile.type == type)
42469 {
42470 if (timeLeft < Main.projectile[i].timeLeft)
42471 {
42472 Kill();
42473 return;
42474 }
42475 Main.projectile[i].Kill();
42476 }
42477 }
42478 }
42479 velocity *= 0.94f;
42480 direction = 1;
42481 if (++frameCounter >= 5)
42482 {
42483 frameCounter = 0;
42484 if (++frame >= Main.projFrames[type])
42485 {
42486 frame = 0;
42487 }
42488 }
42489 if (Opacity < 1f)
42490 {
42491 Opacity += 0.03f;
42492 if (Opacity > 1f)
42493 {
42494 Opacity = 1f;
42495 }
42496 }
42497 new VoidLensHelper(this).Update();
42498 }
42499
42500 private void AI_153_ToiletPop()
42501 {
42502 Vector2 center = base.Center;
42503 float speedY = -2f;
42504 int num = 0;
42505 int num2 = 0;
42506 if (ai[0] == 0f)
42507 {
42508 num = 6;
42509 num2 = 1;
42510 }
42511 else
42512 {
42513 if (!(ai[0] <= 10f))
42514 {
42515 Kill();
42516 return;
42517 }
42518 if (Main.rand.Next(5) == 0)
42519 {
42520 num2 = 1;
42521 }
42522 num = 2;
42523 }
42524 ai[0] += 1f;
42525 for (int i = 0; i < num; i++)
42526 {
42527 Dust dust = Dust.NewDustDirect(center, 3, 6, 216, 0f, speedY);
42528 dust.velocity.X *= 0.5f;
42529 dust.velocity.Y = 0f - Math.Abs(dust.velocity.Y);
42530 dust.position -= dust.velocity;
42531 dust.scale = 0.8f;
42532 }
42533 for (int j = 0; j < num2; j++)
42534 {
42535 Gore gore = Gore.NewGoreDirect(center, Vector2.UnitY * -3f + Main.rand.NextVector2Circular(1f, 1f), Main.rand.Next(580, 583));
42536 gore.velocity.Y = 0f - Math.Abs(gore.velocity.Y);
42537 }
42538 }
42539
42541 {
42542 Player player = Main.player[owner];
42543 if (!player.active)
42544 {
42545 Kill();
42546 return;
42547 }
42548 if (player.gravDir == -1f)
42549 {
42550 player.SetDummyItemTime(0);
42551 Kill();
42552 return;
42553 }
42554 bool flag = false;
42555 Rectangle rectangle = Utils.CenteredRectangle(player.Center, new Vector2(500f, 500f));
42556 for (int i = 0; i < 1000; i++)
42557 {
42558 Projectile projectile = Main.projectile[i];
42559 if (projectile.active && projectile.owner == Main.myPlayer && ProjectileID.Sets.IsAGolfBall[projectile.type] && rectangle.Contains(projectile.Center.ToPoint()))
42560 {
42561 flag = true;
42562 break;
42563 }
42564 }
42565 if (!flag && owner == Main.myPlayer && ai[0] == 0f)
42566 {
42567 player.TryPlacingAGolfBallNearANearbyTee(Main.player[owner].Center);
42568 }
42569 if (!player.channel && ai[0] == 0f)
42570 {
42572 for (int j = 0; j < 1000; j++)
42573 {
42575 Vector2 shotVector = Main.MouseWorld - projectile2.Center;
42576 if (!projectile2.active || !ProjectileID.Sets.IsAGolfBall[projectile2.type] || projectile2.owner != owner || !GolfHelper.ValidateShot(projectile2, player, ref shotVector))
42577 {
42578 continue;
42579 }
42580 float num = Main.rand.NextFloatDirection();
42581 for (float num2 = 0f; num2 < 1f; num2 += 0.1f)
42582 {
42583 Dust dust = Dust.NewDustPerfect(projectile2.Center, 31, ((float)Math.PI * 2f * num2 + num).ToRotationVector2() * 0.8f, 127);
42584 dust.fadeIn = 0f;
42585 if (num2 % 0.2f == 0f)
42586 {
42587 dust.velocity *= 0.4f;
42588 }
42589 }
42591 if (owner == Main.myPlayer)
42592 {
42594 Vector2 vector = Vector2.Normalize(shotVector) * shotStrength.AbsoluteStrength;
42595 GolfHelper.HitGolfBall(projectile2, vector, shotStrength.RoughLandResistance);
42596 NetMessage.SendData(27, -1, -1, null, j);
42597 }
42598 }
42599 ai[0] = 1f;
42600 ai[1] = 0f;
42601 netUpdate = true;
42602 }
42603 if (ai[0] == 1f)
42604 {
42605 ai[1] += 1f;
42606 float num3 = player.HeldItem.useAnimation + 30;
42607 if (ai[1] >= num3)
42608 {
42609 Kill();
42610 return;
42611 }
42612 velocity = Vector2.Zero;
42613 player.ChangeDir(direction);
42614 player.heldProj = whoAmI;
42615 int num4 = player.HeldItem.useAnimation - (int)ai[1];
42616 if (num4 < 2)
42617 {
42618 num4 = 2;
42619 }
42620 player.SetDummyItemTime(num4);
42621 }
42622 if (ai[0] != 0f)
42623 {
42624 return;
42625 }
42626 if (owner == Main.myPlayer)
42627 {
42629 if (mouseWorld != base.Center)
42630 {
42631 netUpdate = true;
42632 base.Center = mouseWorld;
42633 }
42635 {
42636 Kill();
42637 player.mouseInterface = true;
42638 Main.blockMouse = true;
42639 player.SetItemTime(0);
42640 player.itemAnimation = 0;
42641 player.itemAnimationMax = 0;
42642 player.reuseDelay = 0;
42643 return;
42644 }
42645 }
42646 if (position != oldPosition)
42647 {
42648 if (base.Center.X - player.Center.X > 0f)
42649 {
42650 direction = 1;
42651 }
42652 else
42653 {
42654 direction = -1;
42655 }
42656 }
42657 velocity = Vector2.Zero;
42658 player.ChangeDir(direction);
42659 player.heldProj = whoAmI;
42660 ai[1] += 1f;
42661 int num5 = player.HeldItem.useAnimation * 4;
42662 if (ai[1] > (float)(num5 * 3))
42663 {
42664 ai[1] = num5;
42665 }
42666 int num6 = player.HeldItem.useAnimation + Math.Min(num5, (int)ai[1]);
42667 if (num6 < 2)
42668 {
42669 num6 = 2;
42670 }
42671 player.SetDummyItemTime(num6);
42672 }
42673
42675 {
42676 return (int)ai[0] switch
42677 {
42678 0 => Color.Red,
42679 1 => Color.DarkOrange,
42680 2 => Color.Gold,
42681 3 => Color.LimeGreen,
42682 4 => Color.RoyalBlue,
42683 5 => new Color(80, 20, 180),
42684 6 => Color.HotPink,
42685 _ => Color.Transparent,
42686 };
42687 }
42688
42690 {
42691 if (Main.player[owner].dead || Main.player[owner].stoned || Main.player[owner].webbed || Main.player[owner].frozen)
42692 {
42693 Kill();
42694 return;
42695 }
42696 Vector2 mountedCenter = Main.player[owner].MountedCenter;
42697 Vector2 vector = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
42698 float num = mountedCenter.X - vector.X;
42699 float num2 = mountedCenter.Y - vector.Y;
42700 float num3 = (float)Math.Sqrt(num * num + num2 * num2);
42701 rotation = (float)Math.Atan2(num2, num) - 1.57f;
42702 if (ai[0] == 2f && type == 865)
42703 {
42704 float num4 = (float)Math.PI / 2f;
42705 int num5 = (int)Math.Round(rotation / num4);
42706 rotation = (float)num5 * num4;
42707 }
42708 if (Main.myPlayer == owner)
42709 {
42710 int num6 = (int)(base.Center.X / 16f);
42711 int num7 = (int)(base.Center.Y / 16f);
42712 if (num6 > 0 && num7 > 0 && num6 < Main.maxTilesX && num7 < Main.maxTilesY && Main.tile[num6, num7].nactive() && TileID.Sets.CrackedBricks[Main.tile[num6, num7].type] && Main.rand.Next(16) == 0)
42713 {
42715 if (Main.netMode != 0)
42716 {
42717 NetMessage.SendData(17, -1, -1, null, 20, num6, num7);
42718 }
42719 }
42720 }
42721 if (num3 > 2500f)
42722 {
42723 Kill();
42724 }
42725 if (type == 256)
42726 {
42727 rotation = (float)Math.Atan2(num2, num) + 3.9250002f;
42728 }
42729 if (type == 446)
42730 {
42731 Lighting.AddLight(mountedCenter, 0f, 0.4f, 0.3f);
42732 localAI[0] += 1f;
42733 if (localAI[0] >= 28f)
42734 {
42735 localAI[0] = 0f;
42736 }
42737 DelegateMethods.v3_1 = new Vector3(0f, 0.4f, 0.3f);
42739 }
42740 if (type == 652 && ++frameCounter >= 7)
42741 {
42742 frameCounter = 0;
42743 if (++frame >= Main.projFrames[type])
42744 {
42745 frame = 0;
42746 }
42747 }
42748 if (type >= 646 && type <= 649)
42749 {
42751 switch (type)
42752 {
42753 case 646:
42754 vector2 = new Vector3(0.7f, 0.5f, 0.1f);
42755 break;
42756 case 647:
42757 vector2 = new Vector3(0f, 0.6f, 0.7f);
42758 break;
42759 case 648:
42760 vector2 = new Vector3(0.6f, 0.2f, 0.6f);
42761 break;
42762 case 649:
42763 vector2 = new Vector3(0.6f, 0.6f, 0.9f);
42764 break;
42765 }
42767 Lighting.AddLight(base.Center, vector2);
42768 DelegateMethods.v3_1 = vector2;
42770 }
42771 if (ai[0] == 0f)
42772 {
42773 if ((num3 > 300f && type == 13) || (num3 > 400f && type == 32) || (num3 > 440f && type == 73) || (num3 > 440f && type == 74) || (num3 > 375f && type == 165) || (num3 > 350f && type == 256) || (num3 > 500f && type == 315) || (num3 > 550f && type == 322) || (num3 > 400f && type == 331) || (num3 > 550f && type == 332) || (num3 > 400f && type == 372) || (num3 > 300f && type == 396) || (num3 > 550f && type >= 646 && type <= 649) || (num3 > 600f && type == 652) || (num3 > 300f && type == 865) || (num3 > 500f && type == 935) || (num3 > 480f && type >= 486 && type <= 489) || (num3 > 500f && type == 446))
42774 {
42775 ai[0] = 1f;
42776 }
42777 else if (type >= 230 && type <= 235)
42778 {
42779 int num8 = 300 + (type - 230) * 30;
42780 if (num3 > (float)num8)
42781 {
42782 ai[0] = 1f;
42783 }
42784 }
42785 else if (type == 753)
42786 {
42787 int num9 = 420;
42788 if (num3 > (float)num9)
42789 {
42790 ai[0] = 1f;
42791 }
42792 }
42793 Vector2 vector3 = base.Center - new Vector2(5f);
42794 Vector2 vector4 = base.Center + new Vector2(5f);
42795 Point point = (vector3 - new Vector2(16f)).ToTileCoordinates();
42796 Point point2 = (vector4 + new Vector2(32f)).ToTileCoordinates();
42797 int num10 = point.X;
42798 int num11 = point2.X;
42799 int num12 = point.Y;
42800 int num13 = point2.Y;
42801 if (num10 < 0)
42802 {
42803 num10 = 0;
42804 }
42805 if (num11 > Main.maxTilesX)
42806 {
42808 }
42809 if (num12 < 0)
42810 {
42811 num12 = 0;
42812 }
42813 if (num13 > Main.maxTilesY)
42814 {
42816 }
42817 Player player = Main.player[owner];
42819 for (int i = 0; i < player.grapCount; i++)
42820 {
42821 Projectile projectile = Main.projectile[player.grappling[i]];
42822 if (projectile.aiStyle != 7 || projectile.ai[0] != 2f)
42823 {
42824 continue;
42825 }
42826 Point pt = projectile.Center.ToTileCoordinates();
42828 if (tileSafely.type != 314 && !TileID.Sets.Platforms[tileSafely.type])
42829 {
42830 continue;
42831 }
42832 for (int j = -2; j <= 2; j++)
42833 {
42834 for (int k = -2; k <= 2; k++)
42835 {
42836 Point point3 = new Point(pt.X + j, pt.Y + k);
42838 if (tileSafely2.type == 314 || TileID.Sets.Platforms[tileSafely2.type])
42839 {
42840 list.Add(point3);
42841 }
42842 }
42843 }
42844 }
42845 Vector2 vector5 = default(Vector2);
42846 for (int l = num10; l < num11; l++)
42847 {
42848 for (int m = num12; m < num13; m++)
42849 {
42850 if (Main.tile[l, m] == null)
42851 {
42852 Main.tile[l, m] = new Tile();
42853 }
42854 vector5.X = l * 16;
42855 vector5.Y = m * 16;
42856 if (!(vector3.X + 10f > vector5.X) || !(vector3.X < vector5.X + 16f) || !(vector3.Y + 10f > vector5.Y) || !(vector3.Y < vector5.Y + 16f))
42857 {
42858 continue;
42859 }
42860 Tile tile = Main.tile[l, m];
42861 if (!tile.nactive() || !AI_007_GrapplingHooks_CanTileBeLatchedOnTo(tile) || list.Contains(new Point(l, m)) || (type == 403 && tile.type != 314) || Main.player[owner].IsBlacklistedForGrappling(new Point(l, m)))
42862 {
42863 continue;
42864 }
42865 if (Main.player[owner].grapCount < 10)
42866 {
42867 Main.player[owner].grappling[Main.player[owner].grapCount] = whoAmI;
42868 Main.player[owner].grapCount++;
42869 }
42870 if (Main.myPlayer != owner)
42871 {
42872 continue;
42873 }
42874 int num14 = 0;
42875 int num15 = -1;
42876 int num16 = 100000;
42877 if (type == 73 || type == 74)
42878 {
42879 for (int n = 0; n < 1000; n++)
42880 {
42881 if (n != whoAmI && Main.projectile[n].active && Main.projectile[n].owner == owner && Main.projectile[n].aiStyle == 7 && Main.projectile[n].ai[0] == 2f)
42882 {
42883 Main.projectile[n].Kill();
42884 }
42885 }
42886 }
42887 else
42888 {
42889 int num17 = 3;
42890 if (type == 165)
42891 {
42892 num17 = 8;
42893 }
42894 if (type == 256)
42895 {
42896 num17 = 2;
42897 }
42898 if (type == 372)
42899 {
42900 num17 = 2;
42901 }
42902 if (type == 652)
42903 {
42904 num17 = 1;
42905 }
42906 if (type >= 646 && type <= 649)
42907 {
42908 num17 = 4;
42909 }
42910 for (int num18 = 0; num18 < 1000; num18++)
42911 {
42912 if (Main.projectile[num18].active && Main.projectile[num18].owner == owner && Main.projectile[num18].aiStyle == 7)
42913 {
42914 if (Main.projectile[num18].timeLeft < num16)
42915 {
42916 num15 = num18;
42917 num16 = Main.projectile[num18].timeLeft;
42918 }
42919 num14++;
42920 }
42921 }
42922 if (num14 > num17)
42923 {
42924 Main.projectile[num15].Kill();
42925 }
42926 }
42927 WorldGen.KillTile(l, m, fail: true, effectOnly: true);
42928 SoundEngine.PlaySound(0, l * 16, m * 16);
42929 velocity.X = 0f;
42930 velocity.Y = 0f;
42931 ai[0] = 2f;
42932 position.X = l * 16 + 8 - width / 2;
42933 position.Y = m * 16 + 8 - height / 2;
42935 if (tileVisualHitbox.HasValue)
42936 {
42937 base.Center = tileVisualHitbox.Value.Center.ToVector2();
42938 }
42939 damage = 0;
42940 netUpdate = true;
42941 if (Main.myPlayer == owner)
42942 {
42943 if (type == 935)
42944 {
42945 Main.player[owner].DoQueenSlimeHookTeleport(base.Center);
42946 }
42947 NetMessage.SendData(13, -1, -1, null, owner);
42948 }
42949 break;
42950 }
42951 if (ai[0] == 2f)
42952 {
42953 break;
42954 }
42955 }
42956 }
42957 else if (ai[0] == 1f)
42958 {
42959 float num19 = 11f;
42960 if (type == 32)
42961 {
42962 num19 = 15f;
42963 }
42964 if (type == 73 || type == 74)
42965 {
42966 num19 = 17f;
42967 }
42968 if (type == 315)
42969 {
42970 num19 = 20f;
42971 }
42972 if (type == 322)
42973 {
42974 num19 = 22f;
42975 }
42976 if (type >= 230 && type <= 235)
42977 {
42978 num19 = 11f + (float)(type - 230) * 0.75f;
42979 }
42980 if (type == 753)
42981 {
42982 num19 = 15f;
42983 }
42984 if (type == 446)
42985 {
42986 num19 = 20f;
42987 }
42988 if (type >= 486 && type <= 489)
42989 {
42990 num19 = 18f;
42991 }
42992 if (type >= 646 && type <= 649)
42993 {
42994 num19 = 24f;
42995 }
42996 if (type == 652)
42997 {
42998 num19 = 24f;
42999 }
43000 if (type == 332)
43001 {
43002 num19 = 17f;
43003 }
43004 if (num3 < 24f)
43005 {
43006 Kill();
43007 }
43008 num3 = num19 / num3;
43009 num *= num3;
43010 num2 *= num3;
43011 velocity.X = num;
43012 velocity.Y = num2;
43013 }
43014 else if (ai[0] == 2f)
43015 {
43016 Point point4 = base.Center.ToTileCoordinates();
43017 if (Main.tile[point4.X, point4.Y] == null)
43018 {
43019 Main.tile[point4.X, point4.Y] = new Tile();
43020 }
43021 bool flag = true;
43022 if (Main.tile[point4.X, point4.Y].nactive() && AI_007_GrapplingHooks_CanTileBeLatchedOnTo(Main.tile[point4.X, point4.Y]))
43023 {
43024 flag = false;
43025 }
43026 if (flag)
43027 {
43028 ai[0] = 1f;
43029 }
43030 else if (Main.player[owner].grapCount < 10)
43031 {
43032 Main.player[owner].grappling[Main.player[owner].grapCount] = whoAmI;
43033 Main.player[owner].grapCount++;
43034 }
43035 }
43036 }
43037
43039 {
43040 return Main.tileSolid[theTile.type] | (theTile.type == 314) | (type == 865 && TileID.Sets.IsATreeTrunk[theTile.type]) | (type == 865 && theTile.type == 323);
43041 }
43042
43043 private void AI_147_Celeb2Rocket()
43044 {
43045 int num = 0;
43046 int num2 = 1;
43047 int num3 = 1;
43048 localAI[num] += 1f;
43049 alpha = 0;
43050 rotation = velocity.ToRotation() + (float)Math.PI / 2f;
43051 int num4 = (int)ai[0];
43052 Lighting.AddLight(base.Center, GetCeleb2Color().ToVector3() * 0.5f);
43053 switch (num4)
43054 {
43055 case 0:
43056 if (localAI[num] >= 20f)
43057 {
43058 velocity.Y += 0.12f;
43059 penetrate = (maxPenetrate = -1);
43060 }
43061 if (velocity.Y > 16f)
43062 {
43063 velocity.Y = 16f;
43064 }
43065 if (localAI[num] > 20f && localAI[num] % 20f == 0f)
43066 {
43067 AI_147_Explosion();
43068 }
43069 break;
43070 case 1:
43071 {
43072 if (localAI[num] == 10f)
43073 {
43074 velocity.Y -= 10f;
43075 }
43076 if (localAI[num] >= 10f)
43077 {
43078 velocity.Y += 0.25f;
43079 }
43080 if (velocity.Y > 16f)
43081 {
43082 velocity.Y = 16f;
43083 }
43084 if (!(localAI[num] >= 10f))
43085 {
43086 break;
43087 }
43088 scale += 0.015f;
43089 if (scale > 2.5f)
43090 {
43091 scale = 2.5f;
43092 }
43093 if (localAI[num] % 10f != 0f)
43094 {
43095 break;
43096 }
43097 _ = velocity.Y;
43098 _ = 0f;
43099 for (float num5 = 0f; num5 < 1f; num5 += 0.12f)
43100 {
43101 Vector2 spinningpoint = Vector2.UnitX * -8f;
43102 spinningpoint += -Vector2.UnitY.RotatedBy(num5 * ((float)Math.PI * 2f)) * new Vector2(2f, 4f);
43103 spinningpoint = spinningpoint.RotatedBy(rotation - (float)Math.PI / 2f);
43104 int num6 = Dust.NewDust(base.Center, 0, 0, 267, 0f, 0f, 0, Color.Lerp(GetCeleb2Color(), Color.White, Main.rand.NextFloat() * 0.3f));
43105 Main.dust[num6].scale = 0.9f;
43106 Main.dust[num6].fadeIn = 1.1f;
43107 Main.dust[num6].noGravity = true;
43108 Main.dust[num6].position = base.Center + spinningpoint;
43109 Main.dust[num6].velocity = -velocity * 0.35f + spinningpoint * 0.35f;
43110 Main.dust[num6].velocity *= scale;
43111 if (localAI[num] == 10f)
43112 {
43113 Main.dust[num6].velocity = spinningpoint.RotatedBy(velocity.ToRotation()) * 0.3f;
43114 }
43115 }
43116 break;
43117 }
43118 case 2:
43119 if (localAI[num] >= 60f)
43120 {
43121 velocity.Y += 0.15f;
43122 }
43123 if (velocity.Y > 16f)
43124 {
43125 velocity.Y = 16f;
43126 }
43127 break;
43128 case 3:
43129 {
43130 float num7 = localAI[num2];
43131 if (num7 == 0f)
43132 {
43133 float num8 = velocity.Length();
43134 localAI[num2] = num8;
43135 num7 = num8;
43136 }
43137 if (localAI[num] >= 25f && ai[num3] == 0f)
43138 {
43139 if (localAI[num] >= 20f)
43140 {
43141 velocity.Y += 0.15f;
43142 }
43143 if (velocity.Y > 16f)
43144 {
43145 velocity.Y = 16f;
43146 }
43147 }
43148 if (!(localAI[num] >= 20f))
43149 {
43150 break;
43151 }
43152 float num9 = position.X;
43153 float num10 = position.Y;
43154 float num11 = 800f;
43155 bool flag = false;
43156 int num12 = 0;
43157 if (ai[num3] == 0f)
43158 {
43159 for (int i = 0; i < 200; i++)
43160 {
43161 if (Main.npc[i].CanBeChasedBy(this) && (ai[num3] == 0f || ai[num3] == (float)(i + 1)))
43162 {
43163 float num13 = Main.npc[i].position.X + (float)(Main.npc[i].width / 2);
43164 float num14 = Main.npc[i].position.Y + (float)(Main.npc[i].height / 2);
43165 float num15 = Math.Abs(position.X + (float)(width / 2) - num13) + Math.Abs(position.Y + (float)(height / 2) - num14);
43166 if (num15 < num11 && Collision.CanHit(new Vector2(position.X + (float)(width / 2), position.Y + (float)(height / 2)), 1, 1, Main.npc[i].position, Main.npc[i].width, Main.npc[i].height))
43167 {
43168 num11 = num15;
43169 num9 = num13;
43170 num10 = num14;
43171 flag = true;
43172 num12 = i;
43173 }
43174 }
43175 }
43176 if (flag)
43177 {
43178 ai[1] = num12 + 1;
43179 }
43180 flag = false;
43181 }
43182 if (ai[num3] != 0f)
43183 {
43184 int num16 = (int)(ai[num3] - 1f);
43185 if (Main.npc[num16].active && Main.npc[num16].CanBeChasedBy(this, ignoreDontTakeDamage: true))
43186 {
43187 float num17 = Main.npc[num16].position.X + (float)(Main.npc[num16].width / 2);
43188 float num18 = Main.npc[num16].position.Y + (float)(Main.npc[num16].height / 2);
43189 if (Math.Abs(position.X + (float)(width / 2) - num17) + Math.Abs(position.Y + (float)(height / 2) - num18) < 1000f)
43190 {
43191 flag = true;
43192 num9 = Main.npc[num16].position.X + (float)(Main.npc[num16].width / 2);
43193 num10 = Main.npc[num16].position.Y + (float)(Main.npc[num16].height / 2);
43194 }
43195 }
43196 }
43197 if (!friendly)
43198 {
43199 flag = false;
43200 }
43201 if (flag)
43202 {
43203 float num19 = num7;
43204 Vector2 vector2 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
43205 float num20 = num9 - vector2.X;
43206 float num21 = num10 - vector2.Y;
43207 float num22 = (float)Math.Sqrt(num20 * num20 + num21 * num21);
43208 num22 = num19 / num22;
43209 num20 *= num22;
43210 num21 *= num22;
43211 int num23 = 8;
43212 velocity.X = (velocity.X * (float)(num23 - 1) + num20) / (float)num23;
43213 velocity.Y = (velocity.Y * (float)(num23 - 1) + num21) / (float)num23;
43214 }
43215 break;
43216 }
43217 case 4:
43218 {
43219 if (localAI[num] == 1f && ai[1] == 1f)
43220 {
43221 localAI[num] += 45f;
43222 }
43223 float x = velocity.SafeNormalize(Vector2.Zero).RotatedBy(localAI[num] * ((float)Math.PI / 45f)).X;
43224 Vector2 vector = velocity.SafeNormalize(Vector2.Zero).RotatedBy(1.5707963705062866);
43225 position += vector * x * 3f;
43226 scale = 2f;
43227 if (localAI[num] >= 10f)
43228 {
43229 velocity.Y += 0.04f;
43230 }
43231 if (velocity.Y > 16f)
43232 {
43233 velocity.Y = 16f;
43234 }
43235 break;
43236 }
43237 case 5:
43238 if (localAI[num] >= 40f)
43239 {
43240 velocity.Y += 0.08f;
43241 }
43242 if (velocity.Y > 16f)
43243 {
43244 velocity.Y = 16f;
43245 }
43246 break;
43247 case 6:
43248 if (localAI[num] >= 30f)
43249 {
43250 velocity.Y += 0.1f;
43251 }
43252 if (velocity.Y > 16f)
43253 {
43254 velocity.Y = 16f;
43255 }
43256 break;
43257 }
43258 }
43259
43260 private void AI_148_StarSpawner()
43261 {
43262 if (Main.dayTime && !Main.remixWorld)
43263 {
43264 Kill();
43265 return;
43266 }
43267 ai[0] += Main.dayRate;
43268 if (localAI[0] == 0f && Main.netMode != 2)
43269 {
43270 localAI[0] = 1f;
43271 if ((double)Main.LocalPlayer.position.Y < Main.worldSurface * 16.0)
43272 {
43273 Star.StarFall(position.X);
43274 }
43275 }
43276 if (owner != Main.myPlayer || !(ai[0] >= 180f))
43277 {
43278 return;
43279 }
43280 if (ai[1] > -1f)
43281 {
43282 velocity.X *= 0.35f;
43283 if (base.Center.X < Main.player[(int)ai[1]].Center.X)
43284 {
43285 velocity.X = Math.Abs(velocity.X);
43286 }
43287 else
43288 {
43289 velocity.X = 0f - Math.Abs(velocity.X);
43290 }
43291 }
43292 NewProjectile(GetProjectileSource_FromThis(), position.X, position.Y, velocity.X, velocity.Y, 12, 1000, 10f, Main.myPlayer);
43293 Kill();
43294 }
43295
43296 private void AI_147_Explosion()
43297 {
43298 switch ((int)ai[0])
43299 {
43300 case 0:
43301 {
43302 for (int k = 0; k < 4; k++)
43303 {
43304 Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 100, default(Color), 1.5f);
43305 }
43306 for (int l = 0; l < 20; l++)
43307 {
43308 int num5 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 130, 0f, 0f, 200, default(Color), 1.2f);
43309 Main.dust[num5].noGravity = true;
43310 Main.dust[num5].velocity *= 3f;
43311 num5 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 130, 0f, 0f, 200, default(Color), 0.5f);
43312 Main.dust[num5].velocity *= 1.2f;
43313 Main.dust[num5].noGravity = true;
43314 }
43315 for (int m = 0; m < 1; m++)
43316 {
43317 int num6 = 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));
43318 Main.gore[num6].velocity *= 0.3f;
43319 Main.gore[num6].velocity.X += (float)Main.rand.Next(-10, 11) * 0.05f;
43320 Main.gore[num6].velocity.Y += (float)Main.rand.Next(-10, 11) * 0.05f;
43321 }
43322 break;
43323 }
43324 case 1:
43325 {
43326 Color celeb2Color2 = GetCeleb2Color();
43327 Vector2 center2 = base.Center;
43328 Main.rand.NextFloat();
43329 for (float num7 = 0f; num7 < 1f; num7 += 0.0125f)
43330 {
43331 Dust dust4 = Dust.NewDustPerfect(center2, 278, null, 200, Color.Lerp(celeb2Color2, Color.White, Main.rand.NextFloat() * 0.6f));
43332 dust4.scale = 1.1f;
43333 dust4.fadeIn = 1.3f;
43334 dust4.velocity *= Main.rand.NextFloat() * 2f + 2f;
43335 if (dust4.velocity.Y > 0f)
43336 {
43337 dust4.velocity *= 0.3f;
43338 }
43339 dust4.velocity *= 2f;
43340 }
43341 for (int n = 0; n < 3; n++)
43342 {
43343 int num8 = 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));
43344 Main.gore[num8].velocity *= 0.3f;
43345 Main.gore[num8].velocity.X += (float)Main.rand.Next(-10, 11) * 0.05f;
43346 Main.gore[num8].velocity.Y += (float)Main.rand.Next(-10, 11) * 0.05f;
43347 }
43348 int fluff = 20;
43349 int distFluff = 100;
43350 int layerStart = 2;
43351 int layerEnd = 10;
43352 int layerJump = 2;
43353 CreateGroundExplosion(40f, fluff, distFluff, layerStart, layerEnd, layerJump);
43354 break;
43355 }
43356 case 2:
43357 {
43358 Vector2 center3 = base.Center;
43359 Color celeb2Color3 = GetCeleb2Color();
43360 float num9 = 0.05f;
43361 float num10 = 0.13f;
43362 bool flag = Main.rand.Next(4) == 0;
43363 if (flag)
43364 {
43365 num9 = 0.1f;
43366 num10 = 0.1f;
43367 }
43368 float num11 = Main.rand.NextFloatDirection();
43369 for (float num12 = 0f; num12 < 5f; num12 += 1f)
43370 {
43371 Vector2 spinningpoint = new Vector2(0f, -100f);
43372 Vector2 vector4 = center3 + spinningpoint.RotatedBy(num11 + num12 * ((float)Math.PI * 2f / 5f));
43373 Vector2 vector5 = center3 + spinningpoint.RotatedBy(num11 + (num12 + 1f) * ((float)Math.PI * 2f / 5f));
43374 Vector2 vector6 = center3 + spinningpoint.RotatedBy(num11 + (num12 + 0.5f) * ((float)Math.PI * 2f / 5f)) * 0.4f;
43375 for (int num13 = 0; num13 < 2; num13++)
43376 {
43379 if (num13 == 1)
43380 {
43381 value = vector6;
43382 value2 = vector5;
43383 }
43384 for (float num14 = 0f; num14 < 1f; num14 += num10)
43385 {
43388 Vector2 vector9 = (vector7 - vector8).SafeNormalize(Vector2.Zero);
43390 dust5.fadeIn = 1.2f;
43391 dust5.noGravity = true;
43392 dust5.velocity = vector9 * Vector2.Distance(vector7, vector8) * num9;
43393 }
43394 }
43395 }
43396 if (flag)
43397 {
43398 for (int num15 = 0; num15 < 4; num15++)
43399 {
43400 Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 100, default(Color), 1.5f);
43401 }
43402 for (int num16 = 0; num16 < 60; num16++)
43403 {
43404 int num17 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 228, 0f, 0f, 200, default(Color), 2.5f);
43405 Main.dust[num17].noGravity = true;
43406 Main.dust[num17].velocity *= 8f;
43407 num17 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 228, 0f, 0f, 200, default(Color), 1.5f);
43408 Main.dust[num17].velocity *= 4.2f;
43409 Main.dust[num17].noGravity = true;
43410 }
43411 for (int num18 = 0; num18 < 1; num18++)
43412 {
43413 int num19 = 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));
43414 Main.gore[num19].velocity *= 0.3f;
43415 Main.gore[num19].velocity.X += (float)Main.rand.Next(-10, 11) * 0.05f;
43416 Main.gore[num19].velocity.Y += (float)Main.rand.Next(-10, 11) * 0.05f;
43417 }
43418 }
43419 else
43420 {
43421 for (int num20 = 0; num20 < 4; num20++)
43422 {
43423 Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 100, default(Color), 1.5f);
43424 }
43425 for (int num21 = 0; num21 < 40; num21++)
43426 {
43427 int num22 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 228, 0f, 0f, 200, default(Color), 2.5f);
43428 Main.dust[num22].noGravity = true;
43429 Main.dust[num22].velocity *= 4f;
43430 num22 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 228, 0f, 0f, 200, default(Color), 1.5f);
43431 Main.dust[num22].velocity *= 2.2f;
43432 Main.dust[num22].noGravity = true;
43433 }
43434 for (int num23 = 0; num23 < 1; num23++)
43435 {
43436 int num24 = 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));
43437 Main.gore[num24].velocity *= 0.3f;
43438 Main.gore[num24].velocity.X += (float)Main.rand.Next(-10, 11) * 0.05f;
43439 Main.gore[num24].velocity.Y += (float)Main.rand.Next(-10, 11) * 0.05f;
43440 }
43441 }
43442 break;
43443 }
43444 case 3:
43445 {
43446 Color celeb2Color5 = GetCeleb2Color();
43447 Vector2 center4 = base.Center;
43448 for (int num27 = 0; num27 < 4; num27++)
43449 {
43450 Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 100, default(Color), 1.5f);
43451 }
43452 float num28 = Main.rand.NextFloat() * ((float)Math.PI * 2f);
43453 for (int num29 = 0; num29 < 40; num29++)
43454 {
43455 Dust dust6 = Dust.NewDustPerfect(center4, 278, null, 100, Color.Lerp(celeb2Color5, Color.White, Main.rand.NextFloat() * 0.3f));
43456 dust6.scale = 1.3f * (dust6.velocity.Length() / 2f);
43457 dust6.fadeIn = 1.5f * (dust6.velocity.Length() / 2f);
43458 dust6.noGravity = true;
43459 dust6.velocity *= 6f;
43460 if (Math.Abs(dust6.velocity.X) > Math.Abs(dust6.velocity.Y))
43461 {
43462 dust6.velocity.Y *= 0.1f;
43463 }
43464 else
43465 {
43466 dust6.velocity.X *= 0.1f;
43467 }
43468 dust6.velocity = dust6.velocity.RotatedBy(num28);
43469 }
43470 for (int num30 = 0; num30 < 1; num30++)
43471 {
43472 int num31 = 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));
43473 Main.gore[num31].velocity *= 0.3f;
43474 Main.gore[num31].velocity.X += (float)Main.rand.Next(-10, 11) * 0.05f;
43475 Main.gore[num31].velocity.Y += (float)Main.rand.Next(-10, 11) * 0.05f;
43476 }
43477 break;
43478 }
43479 case 4:
43480 {
43481 GetCeleb2Color();
43482 Vector2 center5 = base.Center;
43483 Main.rand.NextFloat();
43484 for (float num32 = 0f; num32 < 1f; num32 += 0.025f)
43485 {
43486 Dust dust7 = Dust.NewDustPerfect(center5, 132, null, 200);
43487 dust7.scale = 1.1f;
43488 dust7.fadeIn = 1.5f;
43489 dust7.velocity *= Main.rand.NextFloat() * 2f + 2f;
43490 if (dust7.velocity.Y > 0f)
43491 {
43492 dust7.velocity *= 0.3f;
43493 }
43494 dust7.velocity *= 2f;
43495 }
43496 for (int num33 = 0; num33 < 3; num33++)
43497 {
43498 int num34 = 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));
43499 Main.gore[num34].velocity *= 0.3f;
43500 Main.gore[num34].velocity.X += (float)Main.rand.Next(-10, 11) * 0.05f;
43501 Main.gore[num34].velocity.Y += (float)Main.rand.Next(-10, 11) * 0.05f;
43502 }
43503 break;
43504 }
43505 case 5:
43506 {
43507 Color celeb2Color4 = GetCeleb2Color();
43508 _ = base.Center;
43509 for (int num25 = 0; num25 < 20; num25++)
43510 {
43511 int num26 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 278, 0f, 0f, 200, Color.Lerp(celeb2Color4, Color.White, Main.rand.NextFloat() * 0.4f), 2.5f);
43512 Main.dust[num26].fadeIn = 1.3f;
43513 Main.dust[num26].scale = 1.1f;
43514 Main.dust[num26].velocity *= 2f;
43515 num26 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 27, 0f, 0f, 200, celeb2Color4, 2.5f);
43516 Main.dust[num26].velocity *= 1.2f;
43517 Main.dust[num26].noGravity = true;
43518 }
43519 break;
43520 }
43521 case 6:
43522 {
43523 Color celeb2Color = GetCeleb2Color();
43524 Vector2 center = base.Center;
43525 for (int i = 0; i < 4; i++)
43526 {
43527 Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 100, default(Color), 1.5f);
43528 }
43529 for (float num = 0f; num < 1f; num += 0.015f)
43530 {
43531 Vector2 vector = Vector2.UnitY.RotatedBy(num * ((float)Math.PI * 2f)) * (1f + Main.rand.NextFloatDirection() * 0.1f);
43533 dust.scale = 1.4f;
43534 dust.velocity = vector * 5f;
43535 dust.velocity.Y += -3f;
43536 dust.velocity *= 2f;
43537 }
43538 for (float num2 = 0f; num2 < 1f; num2 += 0.025f)
43539 {
43540 Vector2 vector2 = Vector2.UnitY.RotatedBy(num2 * ((float)Math.PI * 2f)) * (1f + Main.rand.NextFloatDirection() * 0.2f);
43542 dust2.noGravity = true;
43543 dust2.scale = 0.4f;
43544 dust2.fadeIn = 1.2f;
43545 dust2.velocity = vector2 * 4f;
43546 dust2.velocity.Y += -3f;
43547 dust2.velocity *= 2f;
43548 }
43549 for (float num3 = 0f; num3 < 1f; num3 += 0.07f)
43550 {
43551 Vector2 vector3 = Vector2.UnitY.RotatedBy(num3 * ((float)Math.PI * 2f)) * (1f + Main.rand.NextFloatDirection() * 0.3f);
43553 dust3.noGravity = true;
43554 dust3.scale = 0.4f;
43555 dust3.fadeIn = 1.3f;
43556 dust3.velocity = vector3 * 7f;
43557 dust3.velocity.Y += -3f;
43558 dust3.velocity *= 2f;
43559 }
43560 for (int j = 0; j < 1; j++)
43561 {
43562 int num4 = 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));
43563 Main.gore[num4].velocity *= 0.3f;
43564 Main.gore[num4].velocity.X += (float)Main.rand.Next(-10, 11) * 0.05f;
43565 Main.gore[num4].velocity.Y += (float)Main.rand.Next(-10, 11) * 0.05f;
43566 }
43567 break;
43568 }
43569 }
43570 }
43571
43572 private void CreateGroundExplosion(float MAX_SPREAD, int fluff, int distFluff, int layerStart, int layerEnd, int layerJump)
43573 {
43574 Point point = base.TopLeft.ToTileCoordinates();
43575 Point point2 = base.BottomRight.ToTileCoordinates();
43576 point.X -= fluff;
43577 point.Y -= fluff;
43578 point2.X += fluff;
43579 point2.Y += fluff;
43580 int num = point.X / 2 + point2.X / 2;
43581 int num2 = width / 2 + distFluff;
43582 for (int i = layerStart; i < layerEnd; i += layerJump)
43583 {
43584 int num3 = i;
43585 for (int j = point.X; j <= point2.X; j++)
43586 {
43587 for (int k = point.Y; k <= point2.Y; k++)
43588 {
43589 if (!WorldGen.InWorld(j, k, 10))
43590 {
43591 return;
43592 }
43593 if (Vector2.Distance(base.Center, new Vector2(j * 16, k * 16)) > (float)num2)
43594 {
43595 continue;
43596 }
43599 {
43600 continue;
43601 }
43603 if (tileSafely2.active() && Main.tileSolid[tileSafely2.type] && !Main.tileSolidTop[tileSafely2.type])
43604 {
43605 continue;
43606 }
43608 for (int l = 0; l < num4; l++)
43609 {
43611 obj.velocity.Y -= 3f + (float)num3 * 1.5f;
43612 obj.velocity.Y *= Main.rand.NextFloat();
43613 obj.scale += (float)num3 * 0.03f;
43614 }
43615 if (num3 >= 2)
43616 {
43617 for (int m = 0; m < num4 - 1; m++)
43618 {
43620 obj2.velocity.Y -= 1f + (float)num3;
43621 obj2.velocity.Y *= Main.rand.NextFloat();
43622 }
43623 }
43624 if (num4 > 0 && Main.rand.Next(3) != 0)
43625 {
43626 float num5 = (float)Math.Abs(num - j) / (MAX_SPREAD / 2f);
43627 Gore gore = Gore.NewGoreDirect(position, Vector2.Zero, 61 + Main.rand.Next(3), 1f - (float)num3 * 0.15f + num5 * 0.5f);
43628 gore.velocity.Y -= 0.1f + (float)num3 * 0.5f + num5 * (float)num3 * 1f;
43629 gore.velocity.Y *= Main.rand.NextFloat();
43630 gore.position = new Vector2(j * 16 + 20, k * 16 + 20);
43631 }
43632 }
43633 }
43634 }
43635 }
43636
43637 public void CheckUsability(Player player, ref bool currentlyUsable)
43638 {
43639 if (aiStyle == 160)
43640 {
43641 currentlyUsable = false;
43642 }
43643 }
43644
43645 private void AI_163_Chum()
43646 {
43647 float num = 0.05f;
43648 float num2 = width / 2;
43649 for (int i = 0; i < 1000; i++)
43650 {
43651 if (i != whoAmI && Main.projectile[i].active && Main.projectile[i].type == type && Math.Abs(position.X - Main.projectile[i].position.X) + Math.Abs(position.Y - Main.projectile[i].position.Y) < num2)
43652 {
43653 if (position.X < Main.projectile[i].position.X)
43654 {
43655 velocity.X -= num;
43656 }
43657 else
43658 {
43659 velocity.X += num;
43660 }
43661 if (position.Y < Main.projectile[i].position.Y)
43662 {
43663 velocity.Y -= num;
43664 }
43665 else
43666 {
43667 velocity.Y += num;
43668 }
43669 }
43670 }
43671 if (wet)
43672 {
43673 velocity.X *= 0.9f;
43674 int num3 = (int)(base.Center.X + (float)((width / 2 + 8) * direction)) / 16;
43675 int num4 = (int)(base.Center.Y / 16f);
43676 _ = position.Y / 16f;
43677 int num5 = (int)((position.Y + (float)height) / 16f);
43678 if (Main.tile[num3, num4] == null)
43679 {
43680 Main.tile[num3, num4] = new Tile();
43681 }
43682 if (Main.tile[num3, num5] == null)
43683 {
43684 Main.tile[num3, num5] = new Tile();
43685 }
43686 if (velocity.Y > 0f)
43687 {
43688 velocity.Y *= 0.5f;
43689 }
43690 num3 = (int)(base.Center.X / 16f);
43691 num4 = (int)(base.Center.Y / 16f);
43692 float num6 = AI_061_FishingBobber_GetWaterLine(num3, num4);
43693 if (base.Center.Y > num6)
43694 {
43695 velocity.Y -= 0.1f;
43696 if (velocity.Y < -8f)
43697 {
43698 velocity.Y = -8f;
43699 }
43700 if (base.Center.Y + velocity.Y < num6)
43701 {
43702 velocity.Y = num6 - base.Center.Y;
43703 }
43704 }
43705 else
43706 {
43707 velocity.Y = num6 - base.Center.Y;
43708 }
43709 }
43710 else
43711 {
43712 if (velocity.Y == 0f)
43713 {
43714 velocity.X *= 0.95f;
43715 }
43716 velocity.X *= 0.98f;
43717 velocity.Y += 0.3f;
43718 if (velocity.Y > 15.9f)
43719 {
43720 velocity.Y = 15.9f;
43721 }
43722 }
43723 if (frameCounter == 0)
43724 {
43725 frameCounter = 1;
43726 frame = Main.rand.Next(4);
43727 }
43728 if (frameCounter < 10 && wet)
43729 {
43730 frameCounter++;
43731 for (float num7 = 0f; num7 < 1f; num7 += 0.5f)
43732 {
43733 Gore gore = Gore.NewGoreDirect(position + Vector2.UnitY * 6f, Vector2.Zero, 1201, scale * 0.7f);
43734 gore.velocity = Main.rand.NextVector2CircularEdge(10f, 10f);
43735 if (gore.velocity.Y > 0f)
43736 {
43737 gore.velocity.Y *= -1f;
43738 }
43739 }
43740 for (float num8 = 0f; num8 < 2f; num8 += 1f)
43741 {
43742 Gore gore2 = Gore.NewGoreDirect(position + Vector2.UnitY * 6f, Vector2.Zero, 1208, scale * 0.7f + Main.rand.NextFloat() * 0.15f);
43743 gore2.velocity = Main.rand.NextVector2CircularEdge(4f, 4f);
43744 if (gore2.velocity.Y > 0f)
43745 {
43746 gore2.velocity.Y *= -1f;
43747 }
43748 }
43749 }
43750 scale = Utils.GetLerpValue(0f, 60f, timeLeft, clamped: true);
43751 rotation += velocity.X * 0.14f;
43752 bool flag = !wet && velocity.Length() < 0.8f;
43753 int maxValue = (wet ? 90 : 5);
43754 if (Main.rand.Next(maxValue) == 0 && !flag)
43755 {
43756 Gore gore3 = Gore.NewGoreDirect(position + Vector2.UnitY * 6f, Vector2.Zero, 1201, scale * 0.7f);
43757 if (wet)
43758 {
43759 gore3.velocity = Vector2.UnitX * Main.rand.NextFloatDirection() * 0.75f + Vector2.UnitY * Main.rand.NextFloat();
43760 }
43761 else if (gore3.velocity.Y < 0f)
43762 {
43763 gore3.velocity.Y = 0f - gore3.velocity.Y;
43764 }
43765 }
43766 Vector2 spot = base.Center + Vector2.UnitY * 16f;
43767 if (ai[0] >= 10f && timeLeft > 60)
43768 {
43769 timeLeft = 60;
43770 netUpdate = true;
43771 }
43772 if (ai[0] < 10f && timeLeft > 60)
43773 {
43774 Main.instance.ChumBucketProjectileHelper.AddChumLocation(spot);
43775 }
43776 }
43777
43779 {
43780 int x = (int)base.Center.X / 16;
43781 int num = (int)base.Center.Y / 16;
43783 List<int> list2 = new List<int>();
43784 for (int i = 0; i < 1000; i++)
43785 {
43786 Projectile projectile = Main.projectile[i];
43787 if (projectile.active && projectile.owner == Main.myPlayer && projectile.timeLeft > 60 && projectile.type == 820)
43788 {
43789 list.Add(new Tuple<int, Point>(i, (projectile.Center + Vector2.UnitY * 16f).ToTileCoordinates()));
43790 }
43791 }
43792 if (list.Count == 0)
43793 {
43794 return;
43795 }
43796 GetFishingPondWidth(x, num, out var minX, out var maxX);
43797 Point point = default(Point);
43798 for (int j = minX; j <= maxX; j++)
43799 {
43800 point.X = j;
43801 int num2 = num;
43802 while (Main.tile[j, num2].liquid > 0 && !WorldGen.SolidTile(j, num2) && num2 < Main.maxTilesY - 10)
43803 {
43804 num2 = (point.Y = num2 + 1);
43805 for (int num3 = list.Count - 1; num3 >= 0; num3--)
43806 {
43807 if (list[num3].Item2 == point)
43808 {
43809 list2.Add(list[num3].Item1);
43810 list.RemoveAt(num3);
43811 }
43812 }
43813 if (list.Count == 0)
43814 {
43815 break;
43816 }
43817 }
43818 if (list.Count == 0)
43819 {
43820 break;
43821 }
43822 }
43823 for (int k = 0; k < list2.Count; k++)
43824 {
43826 obj.ai[0] += 1f;
43827 obj.netUpdate = true;
43828 }
43829 }
43830
43832 {
43833 Player player = Main.player[owner];
43834 bool flag = type >= 986 && type <= 993;
43835 timeLeft = 60;
43836 bool flag2 = false;
43837 if (player.inventory[player.selectedItem].fishingPole == 0 || player.CCed || player.noItems)
43838 {
43839 flag2 = true;
43840 }
43841 else if (player.inventory[player.selectedItem].shoot != type && !flag)
43842 {
43843 flag2 = true;
43844 }
43845 else if (player.pulley)
43846 {
43847 flag2 = true;
43848 }
43849 else if (player.dead)
43850 {
43851 flag2 = true;
43852 }
43853 if (flag2)
43854 {
43855 Kill();
43856 return;
43857 }
43858 if (ai[1] > 0f && localAI[1] != 0f)
43859 {
43860 localAI[1] = 0f;
43861 if (!lavaWet && !honeyWet)
43862 {
43863 AI_061_FishingBobber_DoASplash();
43864 }
43865 }
43866 if (ai[0] >= 1f)
43867 {
43868 if (ai[0] == 2f)
43869 {
43870 ai[0] += 1f;
43872 if (!lavaWet && !honeyWet)
43873 {
43874 AI_061_FishingBobber_DoASplash();
43875 }
43876 }
43877 if (localAI[0] < 100f)
43878 {
43879 localAI[0] += 1f;
43880 }
43881 if (frameCounter == 0)
43882 {
43883 frameCounter = 1;
43884 ReduceRemainingChumsInPool();
43885 }
43886 tileCollide = false;
43887 int num = 10;
43888 Vector2 vector = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
43889 float num2 = player.position.X + (float)(player.width / 2) - vector.X;
43890 float num3 = player.position.Y + (float)(player.height / 2) - vector.Y;
43891 float num4 = (float)Math.Sqrt(num2 * num2 + num3 * num3);
43892 if (num4 > 3000f)
43893 {
43894 Kill();
43895 }
43896 num4 = 15.9f / num4;
43897 num2 *= num4;
43898 num3 *= num4;
43899 velocity.X = (velocity.X * (float)(num - 1) + num2) / (float)num;
43900 velocity.Y = (velocity.Y * (float)(num - 1) + num3) / (float)num;
43901 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 1.57f;
43902 if (Main.myPlayer == owner && base.Hitbox.Intersects(player.Hitbox))
43903 {
43904 Kill();
43905 }
43906 return;
43907 }
43908 bool flag3 = false;
43909 Vector2 vector2 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
43910 float num5 = player.position.X + (float)(player.width / 2) - vector2.X;
43911 float num6 = player.position.Y + (float)(player.height / 2) - vector2.Y;
43912 rotation = (float)Math.Atan2(num6, num5) + 1.57f;
43913 if ((float)Math.Sqrt(num5 * num5 + num6 * num6) > 900f)
43914 {
43915 ai[0] = 1f;
43916 }
43917 if (wet)
43918 {
43919 if (shimmerWet)
43920 {
43921 if (Main.myPlayer == owner)
43922 {
43923 Main.player[owner].AddBuff(353, 60);
43924 }
43925 if (localAI[2] == 0f)
43926 {
43927 localAI[2] = 1f;
43928 SoundEngine.PlaySound(19, (int)Main.player[owner].position.X, (int)Main.player[owner].position.Y, 2);
43929 }
43930 }
43931 rotation = 0f;
43932 velocity.X *= 0.9f;
43933 int num7 = (int)(base.Center.X + (float)((width / 2 + 8) * direction)) / 16;
43934 int num8 = (int)(base.Center.Y / 16f);
43935 _ = position.Y / 16f;
43936 int num9 = (int)((position.Y + (float)height) / 16f);
43937 if (Main.tile[num7, num8] == null)
43938 {
43939 Main.tile[num7, num8] = new Tile();
43940 }
43941 if (Main.tile[num7, num9] == null)
43942 {
43943 Main.tile[num7, num9] = new Tile();
43944 }
43945 if (velocity.Y > 0f)
43946 {
43947 velocity.Y *= 0.5f;
43948 }
43949 num7 = (int)(base.Center.X / 16f);
43950 num8 = (int)(base.Center.Y / 16f);
43951 float num10 = AI_061_FishingBobber_GetWaterLine(num7, num8);
43952 if (base.Center.Y > num10)
43953 {
43954 velocity.Y -= 0.1f;
43955 if (velocity.Y < -8f)
43956 {
43957 velocity.Y = -8f;
43958 }
43959 if (base.Center.Y + velocity.Y < num10)
43960 {
43961 velocity.Y = num10 - base.Center.Y;
43962 }
43963 }
43964 else
43965 {
43966 velocity.Y = num10 - base.Center.Y;
43967 }
43968 if ((double)velocity.Y >= -0.01 && (double)velocity.Y <= 0.01)
43969 {
43970 flag3 = true;
43971 }
43972 }
43973 else
43974 {
43975 if (velocity.Y == 0f)
43976 {
43977 velocity.X *= 0.95f;
43978 }
43979 velocity.X *= 0.98f;
43980 velocity.Y += 0.2f;
43981 if (velocity.Y > 15.9f)
43982 {
43983 velocity.Y = 15.9f;
43984 }
43985 }
43986 if (Main.myPlayer == owner && player.GetFishingConditions().BaitItemType == 2673)
43987 {
43988 player.displayedFishingInfo = Language.GetTextValue("GameUI.FishingWarning");
43989 }
43990 if (ai[1] != 0f)
43991 {
43992 flag3 = true;
43993 }
43994 if (!flag3)
43995 {
43996 return;
43997 }
43998 if (ai[1] == 0f && Main.myPlayer == owner)
43999 {
44001 if (Main.rand.Next(300) < finalFishingLevel)
44002 {
44003 localAI[1] += Main.rand.Next(1, 3);
44004 }
44005 localAI[1] += finalFishingLevel / 30;
44006 localAI[1] += Main.rand.Next(1, 3);
44007 if (Main.rand.Next(60) == 0)
44008 {
44009 localAI[1] += 60f;
44010 }
44011 if (localAI[1] > 660f)
44012 {
44013 localAI[1] = 0f;
44014 FishingCheck();
44015 }
44016 }
44017 else if (ai[1] < 0f)
44018 {
44019 if (velocity.Y == 0f || (honeyWet && Math.Abs(velocity.Y) <= 0.01f))
44020 {
44021 velocity.Y = (float)Main.rand.Next(100, 500) * 0.015f;
44022 velocity.X = (float)Main.rand.Next(-100, 101) * 0.015f;
44023 wet = false;
44024 lavaWet = false;
44025 honeyWet = false;
44026 }
44027 ai[1] += Main.rand.Next(1, 5);
44028 if (ai[1] >= 0f)
44029 {
44030 ai[1] = 0f;
44031 localAI[1] = 0f;
44032 netUpdate = true;
44033 }
44034 }
44035 }
44036
44037 private float AI_061_FishingBobber_GetWaterLine(int X, int Y)
44038 {
44039 float result = position.Y + (float)height;
44040 if (Main.tile[X, Y - 1] == null)
44041 {
44042 Main.tile[X, Y - 1] = new Tile();
44043 }
44044 if (Main.tile[X, Y] == null)
44045 {
44046 Main.tile[X, Y] = new Tile();
44047 }
44048 if (Main.tile[X, Y + 1] == null)
44049 {
44050 Main.tile[X, Y + 1] = new Tile();
44051 }
44052 if (Main.tile[X, Y - 1].liquid > 0)
44053 {
44054 result = Y * 16;
44055 result -= (float)(Main.tile[X, Y - 1].liquid / 16);
44056 }
44057 else if (Main.tile[X, Y].liquid > 0)
44058 {
44059 result = (Y + 1) * 16;
44060 result -= (float)(Main.tile[X, Y].liquid / 16);
44061 }
44062 else if (Main.tile[X, Y + 1].liquid > 0)
44063 {
44064 result = (Y + 2) * 16;
44065 result -= (float)(Main.tile[X, Y + 1].liquid / 16);
44066 }
44067 return result;
44068 }
44069
44071 {
44072 for (int i = 0; i < 100; i++)
44073 {
44074 int num = Dust.NewDust(new Vector2(position.X - 6f, position.Y - 10f), width + 12, 24, Dust.dustWater());
44075 Main.dust[num].velocity.Y -= 4f;
44076 Main.dust[num].velocity.X *= 2.5f;
44077 Main.dust[num].scale = 0.8f;
44078 Main.dust[num].alpha = 100;
44079 Main.dust[num].noGravity = true;
44080 }
44081 SoundEngine.PlaySound(19, (int)position.X, (int)position.Y, 0);
44082 }
44083
44085 {
44086 Item item = new Item();
44087 item.SetDefaults(itemType);
44088 if (itemType == 3196)
44089 {
44090 int finalFishingLevel = thePlayer.GetFishingConditions().FinalFishingLevel;
44091 int minValue = (finalFishingLevel / 20 + 3) / 2;
44092 int num = (finalFishingLevel / 10 + 6) / 2;
44093 if (Main.rand.Next(50) < finalFishingLevel)
44094 {
44095 num++;
44096 }
44097 if (Main.rand.Next(100) < finalFishingLevel)
44098 {
44099 num++;
44100 }
44101 if (Main.rand.Next(150) < finalFishingLevel)
44102 {
44103 num++;
44104 }
44105 if (Main.rand.Next(200) < finalFishingLevel)
44106 {
44107 num++;
44108 }
44109 int stack = Main.rand.Next(minValue, num + 1);
44110 item.stack = stack;
44111 }
44112 if (itemType == 3197)
44113 {
44114 int finalFishingLevel2 = thePlayer.GetFishingConditions().FinalFishingLevel;
44115 int minValue2 = (finalFishingLevel2 / 4 + 15) / 2;
44116 int num2 = (finalFishingLevel2 / 2 + 40) / 2;
44117 if (Main.rand.Next(50) < finalFishingLevel2)
44118 {
44119 num2 += 6;
44120 }
44121 if (Main.rand.Next(100) < finalFishingLevel2)
44122 {
44123 num2 += 6;
44124 }
44125 if (Main.rand.Next(150) < finalFishingLevel2)
44126 {
44127 num2 += 6;
44128 }
44129 if (Main.rand.Next(200) < finalFishingLevel2)
44130 {
44131 num2 += 6;
44132 }
44133 int stack2 = Main.rand.Next(minValue2, num2 + 1);
44134 item.stack = stack2;
44135 }
44136 item.newAndShiny = true;
44137 Item item2 = thePlayer.GetItem(owner, item, default(GetItemSettings));
44138 if (item2.stack > 0)
44139 {
44140 int number = Item.NewItem(new EntitySource_FishedOut(this), (int)position.X, (int)position.Y, width, height, itemType, item2.stack, noBroadcast: false, 0, noGrabDelay: true);
44141 if (Main.netMode == 1)
44142 {
44143 NetMessage.SendData(21, -1, -1, null, number, 1f);
44144 }
44145 }
44146 else
44147 {
44148 item.position.X = base.Center.X - (float)(item.width / 2);
44149 item.position.Y = base.Center.Y - (float)(item.height / 2);
44150 item.active = true;
44151 PopupText.NewText(PopupTextContext.RegularItemPickup, item, 0);
44152 }
44153 }
44154
44155 private void AI_146_DD2Victory()
44156 {
44157 }
44158
44159 private void BetsySharpnel(int npcIndex)
44160 {
44161 if (ai[1] != -1f && owner == Main.myPlayer)
44162 {
44163 Vector2 spinningpoint = new Vector2(0f, 6f);
44164 Vector2 center = base.Center;
44165 float num = (float)Math.PI / 4f;
44166 int num2 = 5;
44167 float num3 = (0f - num * 2f) / (float)(num2 - 1);
44168 for (int i = 0; i < num2; i++)
44169 {
44170 int num4 = NewProjectile(GetProjectileSource_FromThis(), center, spinningpoint.RotatedBy(num + num3 * (float)i), 710, damage, knockBack, owner, 0f, -1f);
44172 CopyLocalNPCImmunityTimes(p);
44173 }
44174 }
44175 }
44176
44178 {
44179 for (int i = 0; i < localNPCImmunity.Length; i++)
44180 {
44181 p.localNPCImmunity[i] = localNPCImmunity[i];
44182 }
44183 }
44184
44185 private void AI_001()
44186 {
44187 //IL_21ea: Unknown result type (might be due to invalid IL or missing references)
44188 //IL_5a4d: Unknown result type (might be due to invalid IL or missing references)
44189 //IL_5967: Unknown result type (might be due to invalid IL or missing references)
44190 //IL_596c: Unknown result type (might be due to invalid IL or missing references)
44191 //IL_5a73: Unknown result type (might be due to invalid IL or missing references)
44192 //IL_5a78: Unknown result type (might be due to invalid IL or missing references)
44193 //IL_7f9f: Unknown result type (might be due to invalid IL or missing references)
44194 //IL_81c4: Unknown result type (might be due to invalid IL or missing references)
44195 if (type == 469 && wet && !honeyWet && !shimmerWet)
44196 {
44197 Kill();
44198 }
44199 if (type == 601)
44200 {
44201 Color portalColor = PortalHelper.GetPortalColor(owner, (int)ai[0]);
44202 Vector3 rgb = portalColor.ToVector3();
44203 rgb *= 0.5f;
44204 Lighting.AddLight(base.Center + velocity * 3f, rgb);
44205 if (alpha > 0 && alpha <= 15)
44206 {
44207 Color color = portalColor;
44208 color.A = byte.MaxValue;
44209 for (int i = 0; i < 4; i++)
44210 {
44211 Dust obj = Main.dust[Dust.NewDust(base.Center, 0, 0, 264)];
44212 obj.position = base.Center;
44213 obj.velocity = velocity * 2f + Utils.RandomVector2(Main.rand, -1f, 1f);
44214 obj.color = color;
44215 obj.scale = 1.2f;
44216 obj.noLight = true;
44217 obj.noGravity = true;
44218 obj.customData = Main.player[owner];
44219 }
44220 if (ai[0] != 0f)
44221 {
44223 }
44224 else
44225 {
44227 }
44228 }
44229 alpha -= 15;
44230 if (alpha < 0)
44231 {
44232 alpha = 0;
44233 }
44234 if (++frameCounter >= 4)
44235 {
44236 frameCounter = 0;
44237 if (++frame >= Main.projFrames[type])
44238 {
44239 frame = 0;
44240 }
44241 }
44242 if (alpha == 0)
44243 {
44245 color2.A = byte.MaxValue;
44246 Dust obj2 = Main.dust[Dust.NewDust(base.Center, 0, 0, 263)];
44247 obj2.position = base.Center;
44248 obj2.velocity = velocity / 4f;
44249 obj2.color = color2;
44250 obj2.noGravity = true;
44251 obj2.scale = 0.6f;
44252 }
44253 }
44254 if (type == 472)
44255 {
44256 int num = Dust.NewDust(position, width, height, 30);
44257 Main.dust[num].noGravity = true;
44258 Main.dust[num].velocity *= 0.25f;
44259 Main.dust[num].velocity += velocity * 0.75f;
44260 if (localAI[0] == 0f)
44261 {
44262 localAI[0] = 1f;
44264 for (int j = 0; j < 20; j++)
44265 {
44266 num = Dust.NewDust(position, width, height, 30);
44267 Main.dust[num].noGravity = true;
44268 Main.dust[num].velocity *= 0.25f;
44269 Main.dust[num].velocity += velocity;
44270 Main.dust[num].velocity.X *= 1f + (float)Main.rand.Next(-50, 51) * 0.01f;
44271 Main.dust[num].velocity.Y *= 1f + (float)Main.rand.Next(-50, 51) * 0.01f;
44272 }
44273 }
44274 }
44275 if (type == 323)
44276 {
44277 alpha -= 50;
44278 if (alpha < 0)
44279 {
44280 alpha = 0;
44281 }
44282 }
44283 if (type == 436)
44284 {
44285 if (ai[1] == 0f)
44286 {
44287 ai[1] = 1f;
44289 }
44290 alpha -= 40;
44291 if (alpha < 0)
44292 {
44293 alpha = 0;
44294 }
44295 spriteDirection = direction;
44296 frameCounter++;
44297 if (frameCounter >= 3)
44298 {
44299 frame++;
44300 frameCounter = 0;
44301 if (frame >= 4)
44302 {
44303 frame = 0;
44304 }
44305 }
44306 Lighting.AddLight((int)base.Center.X / 16, (int)base.Center.Y / 16, 0.3f, 1.1f, 0.5f);
44307 }
44308 if (type == 467)
44309 {
44310 if (ai[1] == 0f)
44311 {
44312 ai[1] = 1f;
44314 }
44315 else if (ai[1] == 1f && Main.netMode != 1)
44316 {
44317 int num2 = -1;
44318 float num3 = 2000f;
44319 for (int k = 0; k < 255; k++)
44320 {
44321 if (Main.player[k].active && !Main.player[k].dead)
44322 {
44323 Vector2 center = Main.player[k].Center;
44324 float num4 = Vector2.Distance(center, base.Center);
44325 if ((num4 < num3 || num2 == -1) && Collision.CanHit(base.Center, 1, 1, center, 1, 1))
44326 {
44327 num3 = num4;
44328 num2 = k;
44329 }
44330 }
44331 }
44332 if (num3 < 20f)
44333 {
44334 Kill();
44335 return;
44336 }
44337 if (num2 != -1)
44338 {
44339 ai[1] = 21f;
44340 ai[0] = num2;
44341 netUpdate = true;
44342 }
44343 }
44344 else if (ai[1] > 20f && ai[1] < 200f)
44345 {
44346 ai[1] += 1f;
44347 int num5 = (int)ai[0];
44348 if (!Main.player[num5].active || Main.player[num5].dead)
44349 {
44350 ai[1] = 1f;
44351 ai[0] = 0f;
44352 netUpdate = true;
44353 }
44354 else
44355 {
44356 float num6 = velocity.ToRotation();
44357 Vector2 vector = Main.player[num5].Center - base.Center;
44358 if (vector.Length() < 20f)
44359 {
44360 Kill();
44361 return;
44362 }
44363 float targetAngle = vector.ToRotation();
44364 if (vector == Vector2.Zero)
44365 {
44366 targetAngle = num6;
44367 }
44368 float num7 = num6.AngleLerp(targetAngle, 0.008f);
44369 velocity = new Vector2(velocity.Length(), 0f).RotatedBy(num7);
44370 }
44371 }
44372 if (ai[1] >= 1f && ai[1] < 20f)
44373 {
44374 ai[1] += 1f;
44375 if (ai[1] == 20f)
44376 {
44377 ai[1] = 1f;
44378 }
44379 }
44380 alpha -= 40;
44381 if (alpha < 0)
44382 {
44383 alpha = 0;
44384 }
44385 spriteDirection = direction;
44386 frameCounter++;
44387 if (frameCounter >= 3)
44388 {
44389 frame++;
44390 frameCounter = 0;
44391 if (frame >= 4)
44392 {
44393 frame = 0;
44394 }
44395 }
44396 Lighting.AddLight(base.Center, 1.1f, 0.9f, 0.4f);
44397 localAI[0] += 1f;
44398 if (localAI[0] == 12f)
44399 {
44400 localAI[0] = 0f;
44401 for (int l = 0; l < 12; l++)
44402 {
44403 Vector2 spinningpoint = Vector2.UnitX * -width / 2f;
44404 spinningpoint += -Vector2.UnitY.RotatedBy((float)l * (float)Math.PI / 6f) * new Vector2(8f, 16f);
44405 spinningpoint = spinningpoint.RotatedBy(rotation - (float)Math.PI / 2f);
44406 int num8 = Dust.NewDust(base.Center, 0, 0, 6, 0f, 0f, 160);
44407 Main.dust[num8].scale = 1.1f;
44408 Main.dust[num8].noGravity = true;
44409 Main.dust[num8].position = base.Center + spinningpoint;
44410 Main.dust[num8].velocity = velocity * 0.1f;
44411 Main.dust[num8].velocity = Vector2.Normalize(base.Center - velocity * 3f - Main.dust[num8].position) * 1.25f;
44412 }
44413 }
44414 if (Main.rand.Next(4) == 0)
44415 {
44416 for (int m = 0; m < 1; m++)
44417 {
44418 Vector2 vector2 = -Vector2.UnitX.RotatedByRandom(0.19634954631328583).RotatedBy(velocity.ToRotation());
44419 int num9 = Dust.NewDust(position, width, height, 31, 0f, 0f, 100);
44420 Main.dust[num9].velocity *= 0.1f;
44421 Main.dust[num9].position = base.Center + vector2 * width / 2f;
44422 Main.dust[num9].fadeIn = 0.9f;
44423 }
44424 }
44425 if (Main.rand.Next(32) == 0)
44426 {
44427 for (int n = 0; n < 1; n++)
44428 {
44429 Vector2 vector3 = -Vector2.UnitX.RotatedByRandom(0.39269909262657166).RotatedBy(velocity.ToRotation());
44430 int num10 = Dust.NewDust(position, width, height, 31, 0f, 0f, 155, default(Color), 0.8f);
44431 Main.dust[num10].velocity *= 0.3f;
44432 Main.dust[num10].position = base.Center + vector3 * width / 2f;
44433 if (Main.rand.Next(2) == 0)
44434 {
44435 Main.dust[num10].fadeIn = 1.4f;
44436 }
44437 }
44438 }
44439 if (Main.rand.Next(2) == 0)
44440 {
44441 for (int num11 = 0; num11 < 2; num11++)
44442 {
44443 Vector2 vector4 = -Vector2.UnitX.RotatedByRandom(0.7853981852531433).RotatedBy(velocity.ToRotation());
44444 int num12 = Dust.NewDust(position, width, height, 6, 0f, 0f, 0, default(Color), 1.2f);
44445 Main.dust[num12].velocity *= 0.3f;
44446 Main.dust[num12].noGravity = true;
44447 Main.dust[num12].position = base.Center + vector4 * width / 2f;
44448 if (Main.rand.Next(2) == 0)
44449 {
44450 Main.dust[num12].fadeIn = 1.4f;
44451 }
44452 }
44453 }
44454 }
44455 if (type == 468)
44456 {
44457 if (ai[1] == 0f)
44458 {
44459 ai[1] = 1f;
44461 }
44462 else if (ai[1] == 1f && Main.netMode != 1)
44463 {
44464 int num13 = -1;
44465 float num14 = 2000f;
44466 for (int num15 = 0; num15 < 255; num15++)
44467 {
44468 if (Main.player[num15].active && !Main.player[num15].dead)
44469 {
44470 Vector2 center2 = Main.player[num15].Center;
44471 float num16 = Vector2.Distance(center2, base.Center);
44472 if ((num16 < num14 || num13 == -1) && Collision.CanHit(base.Center, 1, 1, center2, 1, 1))
44473 {
44474 num14 = num16;
44475 num13 = num15;
44476 }
44477 }
44478 }
44479 if (num14 < 20f)
44480 {
44481 Kill();
44482 return;
44483 }
44484 if (num13 != -1)
44485 {
44486 ai[1] = 21f;
44487 ai[0] = num13;
44488 netUpdate = true;
44489 }
44490 }
44491 else if (ai[1] > 20f && ai[1] < 200f)
44492 {
44493 ai[1] += 1f;
44494 int num17 = (int)ai[0];
44495 if (!Main.player[num17].active || Main.player[num17].dead)
44496 {
44497 ai[1] = 1f;
44498 ai[0] = 0f;
44499 netUpdate = true;
44500 }
44501 else
44502 {
44503 float num18 = velocity.ToRotation();
44504 Vector2 vector5 = Main.player[num17].Center - base.Center;
44505 if (vector5.Length() < 20f)
44506 {
44507 Kill();
44508 return;
44509 }
44510 float targetAngle2 = vector5.ToRotation();
44511 if (vector5 == Vector2.Zero)
44512 {
44514 }
44515 float num19 = num18.AngleLerp(targetAngle2, 0.01f);
44516 velocity = new Vector2(velocity.Length(), 0f).RotatedBy(num19);
44517 }
44518 }
44519 if (ai[1] >= 1f && ai[1] < 20f)
44520 {
44521 ai[1] += 1f;
44522 if (ai[1] == 20f)
44523 {
44524 ai[1] = 1f;
44525 }
44526 }
44527 alpha -= 40;
44528 if (alpha < 0)
44529 {
44530 alpha = 0;
44531 }
44532 spriteDirection = direction;
44533 frameCounter++;
44534 if (frameCounter >= 3)
44535 {
44536 frame++;
44537 frameCounter = 0;
44538 if (frame >= 4)
44539 {
44540 frame = 0;
44541 }
44542 }
44543 Lighting.AddLight(base.Center, 0.2f, 0.1f, 0.6f);
44544 localAI[0] += 1f;
44545 if (localAI[0] == 12f)
44546 {
44547 localAI[0] = 0f;
44548 for (int num20 = 0; num20 < 12; num20++)
44549 {
44550 Vector2 spinningpoint2 = Vector2.UnitX * -width / 2f;
44551 spinningpoint2 += -Vector2.UnitY.RotatedBy((float)num20 * (float)Math.PI / 6f) * new Vector2(8f, 16f);
44552 spinningpoint2 = spinningpoint2.RotatedBy(rotation - (float)Math.PI / 2f);
44553 int num21 = Dust.NewDust(base.Center, 0, 0, 27, 0f, 0f, 160);
44554 Main.dust[num21].scale = 1.1f;
44555 Main.dust[num21].noGravity = true;
44556 Main.dust[num21].position = base.Center + spinningpoint2;
44557 Main.dust[num21].velocity = velocity * 0.1f;
44558 Main.dust[num21].velocity = Vector2.Normalize(base.Center - velocity * 3f - Main.dust[num21].position) * 1.25f;
44559 }
44560 }
44561 if (Main.rand.Next(4) == 0)
44562 {
44563 for (int num22 = 0; num22 < 1; num22++)
44564 {
44565 Vector2 vector6 = -Vector2.UnitX.RotatedByRandom(0.19634954631328583).RotatedBy(velocity.ToRotation());
44566 int num23 = Dust.NewDust(position, width, height, 31, 0f, 0f, 100);
44567 Main.dust[num23].velocity *= 0.1f;
44568 Main.dust[num23].position = base.Center + vector6 * width / 2f;
44569 Main.dust[num23].fadeIn = 0.9f;
44570 }
44571 }
44572 if (Main.rand.Next(32) == 0)
44573 {
44574 for (int num24 = 0; num24 < 1; num24++)
44575 {
44576 Vector2 vector7 = -Vector2.UnitX.RotatedByRandom(0.39269909262657166).RotatedBy(velocity.ToRotation());
44577 int num25 = Dust.NewDust(position, width, height, 31, 0f, 0f, 155, default(Color), 0.8f);
44578 Main.dust[num25].velocity *= 0.3f;
44579 Main.dust[num25].position = base.Center + vector7 * width / 2f;
44580 if (Main.rand.Next(2) == 0)
44581 {
44582 Main.dust[num25].fadeIn = 1.4f;
44583 }
44584 }
44585 }
44586 if (Main.rand.Next(2) == 0)
44587 {
44588 for (int num26 = 0; num26 < 2; num26++)
44589 {
44590 Vector2 vector8 = -Vector2.UnitX.RotatedByRandom(0.7853981852531433).RotatedBy(velocity.ToRotation());
44591 int num27 = Dust.NewDust(position, width, height, 27, 0f, 0f, 0, default(Color), 1.2f);
44592 Main.dust[num27].velocity *= 0.3f;
44593 Main.dust[num27].noGravity = true;
44594 Main.dust[num27].position = base.Center + vector8 * width / 2f;
44595 if (Main.rand.Next(2) == 0)
44596 {
44597 Main.dust[num27].fadeIn = 1.4f;
44598 }
44599 }
44600 }
44601 }
44602 if (type == 634 || type == 635)
44603 {
44604 float num28 = 5f;
44605 float num29 = 250f;
44606 float num30 = 6f;
44607 Vector2 vector9 = new Vector2(8f, 10f);
44608 float num31 = 1.2f;
44609 Vector3 rgb2 = new Vector3(0.7f, 0.1f, 0.5f);
44610 int num32 = 4 * MaxUpdates;
44611 int num33 = Utils.SelectRandom<int>(Main.rand, 242, 73, 72, 71, 255);
44612 int num34 = 255;
44613 if (type == 635)
44614 {
44615 vector9 = new Vector2(10f, 20f);
44616 num31 = 1f;
44617 num29 = 500f;
44618 num34 = 88;
44619 num32 = 3 * MaxUpdates;
44620 rgb2 = new Vector3(0.4f, 0.6f, 0.9f);
44621 num33 = Utils.SelectRandom<int>(Main.rand, 242, 59, 88);
44622 }
44623 if (ai[1] == 0f)
44624 {
44625 ai[1] = 1f;
44626 localAI[0] = -Main.rand.Next(48);
44628 }
44629 else if (ai[1] == 1f && owner == Main.myPlayer)
44630 {
44631 int num35 = -1;
44632 float num36 = num29;
44633 for (int num37 = 0; num37 < 200; num37++)
44634 {
44635 if (Main.npc[num37].active && Main.npc[num37].CanBeChasedBy(this))
44636 {
44637 Vector2 center3 = Main.npc[num37].Center;
44638 float num38 = Vector2.Distance(center3, base.Center);
44639 if (num38 < num36 && num35 == -1 && Collision.CanHitLine(base.Center, 1, 1, center3, 1, 1))
44640 {
44641 num36 = num38;
44642 num35 = num37;
44643 }
44644 }
44645 }
44646 if (num36 < 20f)
44647 {
44648 Kill();
44649 return;
44650 }
44651 if (num35 != -1)
44652 {
44653 ai[1] = num28 + 1f;
44654 ai[0] = num35;
44655 netUpdate = true;
44656 }
44657 }
44658 else if (ai[1] > num28)
44659 {
44660 ai[1] += 1f;
44661 int num39 = (int)ai[0];
44662 if (!Main.npc[num39].active || !Main.npc[num39].CanBeChasedBy(this))
44663 {
44664 ai[1] = 1f;
44665 ai[0] = 0f;
44666 netUpdate = true;
44667 }
44668 else
44669 {
44670 velocity.ToRotation();
44671 Vector2 vector10 = Main.npc[num39].Center - base.Center;
44672 if (vector10.Length() < 20f)
44673 {
44674 Kill();
44675 return;
44676 }
44677 if (vector10 != Vector2.Zero)
44678 {
44679 vector10.Normalize();
44680 vector10 *= num30;
44681 }
44682 float num40 = 30f;
44683 velocity = (velocity * (num40 - 1f) + vector10) / num40;
44684 }
44685 }
44686 if (ai[1] >= 1f && ai[1] < num28)
44687 {
44688 ai[1] += 1f;
44689 if (ai[1] == num28)
44690 {
44691 ai[1] = 1f;
44692 }
44693 }
44694 alpha -= 40;
44695 if (alpha < 0)
44696 {
44697 alpha = 0;
44698 }
44699 spriteDirection = direction;
44700 frameCounter++;
44701 if (frameCounter >= num32)
44702 {
44703 frame++;
44704 frameCounter = 0;
44705 if (frame >= 4)
44706 {
44707 frame = 0;
44708 }
44709 }
44710 Lighting.AddLight(base.Center, rgb2);
44711 rotation = velocity.ToRotation();
44712 localAI[0] += 1f;
44713 if (localAI[0] == 48f)
44714 {
44715 localAI[0] = 0f;
44716 }
44717 else if (alpha == 0)
44718 {
44719 for (int num41 = 0; num41 < 2; num41++)
44720 {
44721 Vector2 vector11 = Vector2.UnitX * -30f;
44722 vector11 = -Vector2.UnitY.RotatedBy(localAI[0] * ((float)Math.PI / 24f) + (float)num41 * (float)Math.PI) * vector9 - rotation.ToRotationVector2() * 10f;
44723 int num42 = Dust.NewDust(base.Center, 0, 0, num34, 0f, 0f, 160);
44724 Main.dust[num42].scale = num31;
44725 Main.dust[num42].noGravity = true;
44726 Main.dust[num42].position = base.Center + vector11 + velocity * 2f;
44727 Main.dust[num42].velocity = Vector2.Normalize(base.Center + velocity * 2f * 8f - Main.dust[num42].position) * 2f + velocity * 2f;
44728 }
44729 }
44730 if (Main.rand.Next(12) == 0)
44731 {
44732 for (int num43 = 0; num43 < 1; num43++)
44733 {
44734 Vector2 vector12 = -Vector2.UnitX.RotatedByRandom(0.19634954631328583).RotatedBy(velocity.ToRotation());
44735 int num44 = Dust.NewDust(position, width, height, 31, 0f, 0f, 100);
44736 Main.dust[num44].velocity *= 0.1f;
44737 Main.dust[num44].position = base.Center + vector12 * width / 2f + velocity * 2f;
44738 Main.dust[num44].fadeIn = 0.9f;
44739 }
44740 }
44741 if (Main.rand.Next(64) == 0)
44742 {
44743 for (int num45 = 0; num45 < 1; num45++)
44744 {
44745 Vector2 vector13 = -Vector2.UnitX.RotatedByRandom(0.39269909262657166).RotatedBy(velocity.ToRotation());
44746 int num46 = Dust.NewDust(position, width, height, 31, 0f, 0f, 155, default(Color), 0.8f);
44747 Main.dust[num46].velocity *= 0.3f;
44748 Main.dust[num46].position = base.Center + vector13 * width / 2f;
44749 if (Main.rand.Next(2) == 0)
44750 {
44751 Main.dust[num46].fadeIn = 1.4f;
44752 }
44753 }
44754 }
44755 if (Main.rand.Next(4) == 0)
44756 {
44757 for (int num47 = 0; num47 < 2; num47++)
44758 {
44759 Vector2 vector14 = -Vector2.UnitX.RotatedByRandom(0.7853981852531433).RotatedBy(velocity.ToRotation());
44760 int num48 = Dust.NewDust(position, width, height, num33, 0f, 0f, 0, default(Color), 1.2f);
44761 Main.dust[num48].velocity *= 0.3f;
44762 Main.dust[num48].noGravity = true;
44763 Main.dust[num48].position = base.Center + vector14 * width / 2f;
44764 if (Main.rand.Next(2) == 0)
44765 {
44766 Main.dust[num48].fadeIn = 1.4f;
44767 }
44768 }
44769 }
44770 if (Main.rand.Next(12) == 0 && type == 634)
44771 {
44772 Vector2 vector15 = -Vector2.UnitX.RotatedByRandom(0.19634954631328583).RotatedBy(velocity.ToRotation());
44773 int num49 = Dust.NewDust(position, width, height, num34, 0f, 0f, 100);
44774 Main.dust[num49].velocity *= 0.3f;
44775 Main.dust[num49].position = base.Center + vector15 * width / 2f;
44776 Main.dust[num49].fadeIn = 0.9f;
44777 Main.dust[num49].noGravity = true;
44778 }
44779 if (Main.rand.Next(3) == 0 && type == 635)
44780 {
44781 Vector2 vector16 = -Vector2.UnitX.RotatedByRandom(0.19634954631328583).RotatedBy(velocity.ToRotation());
44782 int num50 = Dust.NewDust(position, width, height, num34, 0f, 0f, 100);
44783 Main.dust[num50].velocity *= 0.3f;
44784 Main.dust[num50].position = base.Center + vector16 * width / 2f;
44785 Main.dust[num50].fadeIn = 1.2f;
44786 Main.dust[num50].scale = 1.5f;
44787 Main.dust[num50].noGravity = true;
44788 }
44789 }
44790 if (type == 459)
44791 {
44792 alpha -= 30;
44793 if (alpha < 0)
44794 {
44795 alpha = 0;
44796 }
44797 spriteDirection = direction;
44798 frameCounter++;
44799 if (frameCounter >= 3)
44800 {
44801 frame++;
44802 frameCounter = 0;
44803 if (frame >= 3)
44804 {
44805 frame = 0;
44806 }
44807 }
44808 position = base.Center;
44809 scale = ai[1];
44810 width = (height = (int)(22f * scale));
44811 base.Center = position;
44812 Lighting.AddLight((int)base.Center.X / 16, (int)base.Center.Y / 16, 0.4f, 0.85f, 0.9f);
44813 int num51 = 0;
44814 if ((double)scale < 0.85)
44815 {
44816 num51 = ((Main.rand.Next(3) == 0) ? 1 : 0);
44817 }
44818 else
44819 {
44820 num51 = 1;
44821 penetrate = -1;
44822 maxPenetrate = -1;
44823 }
44824 for (int num52 = 0; num52 < num51; num52++)
44825 {
44826 int num53 = Dust.NewDust(position, width, height, 226, velocity.X);
44827 Main.dust[num53].position -= Vector2.One * 3f;
44828 Main.dust[num53].scale = 0.5f;
44829 Main.dust[num53].noGravity = true;
44830 Main.dust[num53].velocity = velocity / 3f;
44831 Main.dust[num53].alpha = 255 - (int)(255f * scale);
44832 }
44833 }
44834 if (type == 709)
44835 {
44836 alpha -= 30;
44837 if (alpha < 0)
44838 {
44839 alpha = 0;
44840 }
44841 spriteDirection = direction;
44842 frameCounter++;
44843 if (frameCounter >= 3)
44844 {
44845 frame++;
44846 frameCounter = 0;
44847 if (frame >= 3)
44848 {
44849 frame = 0;
44850 }
44851 }
44852 Lighting.AddLight((int)base.Center.X / 16, (int)base.Center.Y / 16, 0.4f, 0.85f, 0.9f);
44853 if (ai[1] == 0f)
44854 {
44856 }
44857 ai[1] += 1f;
44858 if (ai[1] >= 30f)
44859 {
44860 Kill();
44861 return;
44862 }
44863 }
44864 if (type == 442)
44865 {
44866 frame = 0;
44867 if (alpha != 0)
44868 {
44869 localAI[0] += 1f;
44870 if (localAI[0] >= 4f)
44871 {
44872 alpha -= 90;
44873 if (alpha < 0)
44874 {
44875 alpha = 0;
44876 localAI[0] = 2f;
44877 }
44878 }
44879 }
44880 if (Vector2.Distance(base.Center, new Vector2(ai[0], ai[1]) * 16f + Vector2.One * 8f) <= 16f)
44881 {
44882 Kill();
44883 return;
44884 }
44885 if (alpha == 0)
44886 {
44887 localAI[1] += 1f;
44888 if (localAI[1] >= 120f)
44889 {
44890 Kill();
44891 return;
44892 }
44893 Lighting.AddLight((int)base.Center.X / 16, (int)base.Center.Y / 16, 0.3f, 0.45f, 0.8f);
44894 localAI[0] += 1f;
44895 if (localAI[0] == 3f)
44896 {
44897 localAI[0] = 0f;
44898 for (int num54 = 0; num54 < 8; num54++)
44899 {
44900 Vector2 spinningpoint3 = Vector2.UnitX * -8f;
44901 spinningpoint3 += -Vector2.UnitY.RotatedBy((float)num54 * (float)Math.PI / 4f) * new Vector2(2f, 4f);
44902 spinningpoint3 = spinningpoint3.RotatedBy(rotation - (float)Math.PI / 2f);
44903 int num55 = Dust.NewDust(base.Center, 0, 0, 135);
44904 Main.dust[num55].scale = 1.5f;
44905 Main.dust[num55].noGravity = true;
44906 Main.dust[num55].position = base.Center + spinningpoint3;
44907 Main.dust[num55].velocity = velocity * 0.66f;
44908 }
44909 }
44910 }
44911 }
44912 if (type == 440 || type == 449 || type == 606)
44913 {
44914 if (alpha > 0)
44915 {
44916 alpha -= 25;
44917 }
44918 if (alpha < 0)
44919 {
44920 alpha = 0;
44921 }
44922 if (type == 440)
44923 {
44924 Lighting.AddLight((int)base.Center.X / 16, (int)base.Center.Y / 16, 0.25f, 0.4f, 0.7f);
44925 }
44926 if (type == 449)
44927 {
44928 Lighting.AddLight((int)base.Center.X / 16, (int)base.Center.Y / 16, 0.7f, 0.65f, 0.3f);
44929 }
44930 if (type == 606)
44931 {
44932 Lighting.AddLight(base.Center, 0.7f, 0.3f, 0.3f);
44933 }
44934 float num56 = 100f;
44935 float num57 = 3f;
44936 if (type == 606)
44937 {
44938 num56 = 150f;
44939 num57 = 5f;
44940 }
44941 if (ai[1] == 0f)
44942 {
44943 localAI[0] += num57;
44944 if (localAI[0] == num57 * 1f && type == 606)
44945 {
44946 for (int num58 = 0; num58 < 4; num58++)
44947 {
44948 int num59 = Dust.NewDust(base.Center - velocity / 2f, 0, 0, 182, 0f, 0f, 100, default(Color), 1.4f);
44949 Main.dust[num59].velocity *= 0.2f;
44950 Main.dust[num59].velocity += velocity / 10f;
44951 Main.dust[num59].noGravity = true;
44952 }
44953 }
44954 if (localAI[0] > num56)
44955 {
44956 localAI[0] = num56;
44957 }
44958 }
44959 else
44960 {
44961 localAI[0] -= num57;
44962 if (localAI[0] <= 0f)
44963 {
44964 Kill();
44965 return;
44966 }
44967 }
44968 }
44969 if (type == 438)
44970 {
44971 Lighting.AddLight((int)base.Center.X / 16, (int)base.Center.Y / 16, 0.4f, 0.1f, 0.2f);
44972 }
44973 if (type == 593)
44974 {
44975 Lighting.AddLight((int)base.Center.X / 16, (int)base.Center.Y / 16, 0.4f, 0.1f, 0.3f);
44976 if (++frameCounter >= 12)
44977 {
44978 if (++frame >= Main.projFrames[type])
44979 {
44980 frame = 0;
44981 }
44982 frameCounter = 0;
44983 }
44984 if (Main.rand.Next(2) == 0)
44985 {
44986 Vector2 vector17 = Vector2.UnitY.RotatedByRandom(6.2831854820251465);
44987 Dust obj3 = Main.dust[Dust.NewDust(base.Center - vector17 * 8f, 0, 0, 240)];
44988 obj3.noGravity = true;
44989 obj3.position = base.Center - vector17 * 8f * scale;
44990 obj3.velocity = vector17.RotatedBy(-1.5707963705062866) * 2f;
44991 obj3.velocity = Vector2.Zero;
44992 obj3.scale = 0.5f + Main.rand.NextFloat();
44993 obj3.fadeIn = 0.5f;
44994 }
44995 }
44996 if (type == 592)
44997 {
44998 Lighting.AddLight((int)base.Center.X / 16, (int)base.Center.Y / 16, 0.15f, 0.15f, 0.4f);
44999 }
45000 if (type == 462)
45001 {
45002 int num60 = Dust.NewDust(base.Center, 0, 0, 229, 0f, 0f, 100);
45003 Main.dust[num60].noLight = true;
45004 Main.dust[num60].noGravity = true;
45005 Main.dust[num60].velocity = velocity;
45006 Main.dust[num60].position -= Vector2.One * 4f;
45007 Main.dust[num60].scale = 0.8f;
45008 if (++frameCounter >= 9)
45009 {
45010 frameCounter = 0;
45011 if (++frame >= 5)
45012 {
45013 frame = 0;
45014 }
45015 }
45016 }
45017 if (type == 437)
45018 {
45019 if (ai[1] == 0f)
45020 {
45021 ai[1] = 1f;
45023 }
45024 if (localAI[0] == 0f)
45025 {
45026 localAI[0] = 1f;
45027 for (int num61 = 0; num61 < 4; num61++)
45028 {
45029 int num62 = Dust.NewDust(position, width, height, 226, velocity.X);
45030 Main.dust[num62].position = Vector2.Lerp(Main.dust[num62].position, base.Center, 0.25f);
45031 Main.dust[num62].scale = 0.5f;
45032 Main.dust[num62].noGravity = true;
45033 Main.dust[num62].velocity /= 2f;
45034 Main.dust[num62].velocity += velocity * 0.66f;
45035 }
45036 }
45037 if (ai[0] < 16f)
45038 {
45039 for (int num63 = 0; num63 < 2; num63++)
45040 {
45041 int num64 = Dust.NewDust(position, width, height, 226, velocity.X);
45042 Main.dust[num64].position = position + new Vector2(((direction == 1) ? 1 : 0) * width, 2 + (height - 4) * num63);
45043 Main.dust[num64].scale = 0.3f;
45044 Main.dust[num64].noGravity = true;
45045 Main.dust[num64].velocity = Vector2.Zero;
45046 }
45047 }
45048 }
45049 if (type == 435)
45050 {
45051 if (ai[1] == 0f)
45052 {
45053 ai[1] = 1f;
45055 }
45056 alpha -= 40;
45057 if (alpha < 0)
45058 {
45059 alpha = 0;
45060 }
45061 spriteDirection = direction;
45062 frameCounter++;
45063 if (frameCounter >= 3)
45064 {
45065 frame++;
45066 frameCounter = 0;
45067 if (frame >= 4)
45068 {
45069 frame = 0;
45070 }
45071 }
45072 Lighting.AddLight((int)base.Center.X / 16, (int)base.Center.Y / 16, 0.3f, 0.8f, 1.1f);
45073 }
45074 if (type == 682)
45075 {
45076 if (ai[1] == 0f)
45077 {
45078 ai[1] = 1f;
45080 for (int num65 = 0; num65 < 8; num65++)
45081 {
45082 Dust dust = Dust.NewDustDirect(position, width, height, 272);
45083 dust.velocity *= 1f;
45084 dust.velocity += velocity * 0.65f;
45085 dust.scale = 0.6f;
45086 dust.fadeIn = 0.8f;
45087 dust.noGravity = true;
45088 dust.noLight = true;
45089 dust.position += dust.velocity * 3f;
45090 }
45091 }
45092 alpha -= 40;
45093 if (alpha < 0)
45094 {
45095 alpha = 0;
45096 }
45097 spriteDirection = direction;
45098 frameCounter++;
45099 if (frameCounter >= 3)
45100 {
45101 frame++;
45102 frameCounter = 0;
45103 if (frame >= 4)
45104 {
45105 frame = 0;
45106 }
45107 }
45108 Lighting.AddLight((int)base.Center.X / 16, (int)base.Center.Y / 16, 0.5f, 0.2f, 1.1f);
45109 }
45110 if (type == 684)
45111 {
45112 alpha -= 40;
45113 if (alpha < 0)
45114 {
45115 alpha = 0;
45116 }
45117 spriteDirection = direction;
45118 localAI[0] += 1f;
45119 for (int num66 = 0; num66 < 1; num66++)
45120 {
45121 Vector2 spinningpoint4 = Utils.RandomVector2(Main.rand, -0.5f, 0.5f) * new Vector2(20f, 80f);
45122 spinningpoint4 = spinningpoint4.RotatedBy(velocity.ToRotation());
45123 Dust dust2 = Dust.NewDustDirect(base.Center, 0, 0, 60);
45124 dust2.alpha = 127;
45125 dust2.fadeIn = 1.5f;
45126 dust2.scale = 1.3f;
45127 dust2.velocity *= 0.3f;
45128 dust2.position = base.Center + spinningpoint4;
45129 dust2.noGravity = true;
45130 dust2.noLight = true;
45131 dust2.color = new Color(255, 255, 255, 0);
45132 }
45133 Lighting.AddLight(base.Center, 1.1f, 0.3f, 0.4f);
45134 }
45135 if (type == 408)
45136 {
45137 alpha -= 40;
45138 if (alpha < 0)
45139 {
45140 alpha = 0;
45141 }
45142 spriteDirection = direction;
45143 }
45144 if (type == 282)
45145 {
45146 int num67 = Dust.NewDust(position, width, height, 171, 0f, 0f, 100);
45147 Main.dust[num67].scale = (float)Main.rand.Next(1, 10) * 0.1f;
45148 Main.dust[num67].noGravity = true;
45149 Main.dust[num67].fadeIn = 1.5f;
45150 Main.dust[num67].velocity *= 0.25f;
45151 Main.dust[num67].velocity += velocity * 0.25f;
45152 }
45153 if (type == 275 || type == 276)
45154 {
45155 frameCounter++;
45156 if (frameCounter > 1)
45157 {
45158 frameCounter = 0;
45159 frame++;
45160 if (frame > 1)
45161 {
45162 frame = 0;
45163 }
45164 }
45165 }
45166 if (type == 225 && Main.rand.Next(2) == 0)
45167 {
45168 int num68 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 40);
45169 Main.dust[num68].noGravity = true;
45170 Main.dust[num68].scale = 1.3f;
45171 Main.dust[num68].velocity *= 0.5f;
45172 }
45173 if (type == 174)
45174 {
45175 if (alpha == 0)
45176 {
45177 int num69 = Dust.NewDust(oldPosition - velocity * 3f, width, height, 76, 0f, 0f, 50);
45178 Main.dust[num69].noGravity = true;
45179 Main.dust[num69].noLight = true;
45180 Main.dust[num69].velocity *= 0.5f;
45181 }
45182 alpha -= 50;
45183 if (alpha < 0)
45184 {
45185 alpha = 0;
45186 }
45187 if (ai[1] == 0f)
45188 {
45189 ai[1] = 1f;
45191 }
45192 }
45193 else if (type == 605 || type == 920 || type == 921 || type == 926 || type == 937)
45194 {
45195 if (type == 920 && frameCounter == 0)
45196 {
45197 frameCounter = 1;
45198 frame = Main.rand.Next(3);
45199 }
45200 if (type != 920 && type != 921 && alpha == 0 && Main.rand.Next(3) == 0)
45201 {
45202 int num70 = 4;
45203 Color newColor = new Color(78, 136, 255, 150);
45204 float num71 = 1.2f;
45205 bool noGravity = true;
45206 int num72 = 0;
45207 if (type == 921)
45208 {
45209 num70 = 243;
45210 newColor = default(Color);
45211 }
45212 if (type == 926)
45213 {
45214 num70 = 4;
45216 newColor.A = 150;
45217 num71 = 1.2f;
45218 num72 = 8;
45219 noGravity = Main.rand.Next(2) == 0;
45220 }
45221 if (type == 937)
45222 {
45223 num70 = 4;
45225 newColor.A = 150;
45226 }
45227 int num73 = Dust.NewDust(position - new Vector2(num72, num72) + velocity, width + num72 * 2, height + num72 * 2, num70, 0f, 0f, 50, newColor, num71);
45228 Main.dust[num73].velocity *= 0.3f;
45229 Main.dust[num73].velocity += velocity * 0.3f;
45230 Main.dust[num73].noGravity = noGravity;
45231 }
45232 alpha -= 50;
45233 if (alpha < 0)
45234 {
45235 alpha = 0;
45236 }
45237 if (type != 937 && ai[1] == 0f)
45238 {
45239 ai[1] = 1f;
45240 if (type == 926)
45241 {
45243 }
45244 else
45245 {
45247 }
45248 }
45249 }
45250 else if (type == 176)
45251 {
45252 if (alpha == 0)
45253 {
45254 int num74 = Dust.NewDust(oldPosition, width, height, 22, 0f, 0f, 100, default(Color), 0.5f);
45255 Main.dust[num74].noGravity = true;
45256 Main.dust[num74].noLight = true;
45257 Main.dust[num74].velocity *= 0.15f;
45258 Main.dust[num74].fadeIn = 0.8f;
45259 }
45260 alpha -= 50;
45261 if (alpha < 0)
45262 {
45263 alpha = 0;
45264 }
45265 if (ai[1] == 0f)
45266 {
45267 ai[1] = 1f;
45269 }
45270 }
45271 if (type == 350)
45272 {
45273 alpha -= 100;
45274 if (alpha < 0)
45275 {
45276 alpha = 0;
45277 }
45278 Lighting.AddLight((int)base.Center.X / 16, (int)base.Center.Y / 16, 0.9f, 0.6f, 0.2f);
45279 if (alpha == 0)
45280 {
45281 int num75 = 2;
45282 if (Main.rand.Next(3) != 0)
45283 {
45284 int num76 = Dust.NewDust(new Vector2(base.Center.X - (float)num75, base.Center.Y - (float)num75 - 2f) - velocity * 0.5f, num75 * 2, num75 * 2, 6, 0f, 0f, 100);
45285 Main.dust[num76].scale *= 1.3f + (float)Main.rand.Next(10) * 0.05f;
45286 Main.dust[num76].velocity *= 0.2f;
45287 Main.dust[num76].noGravity = true;
45288 Main.dust[num76].noLight = true;
45289 Main.dust[num76].velocity += velocity * 0.25f;
45290 }
45291 if (Main.rand.Next(4) == 0)
45292 {
45293 int num77 = (num77 = Dust.NewDust(new Vector2(base.Center.X - (float)num75, base.Center.Y - (float)num75 - 2f) - velocity * 0.5f, num75 * 2, num75 * 2, 31, 0f, 0f, 100, default(Color), 0.5f));
45294 Main.dust[num77].fadeIn = 0.6f + (float)Main.rand.Next(5) * 0.1f;
45295 Main.dust[num77].velocity *= 0.05f;
45296 Main.dust[num77].velocity += velocity * 0.25f;
45297 }
45298 }
45299 if (ai[1] == 0f)
45300 {
45301 ai[1] = 1f;
45303 }
45304 }
45305 if (type == 325)
45306 {
45307 alpha -= 100;
45308 if (alpha < 0)
45309 {
45310 alpha = 0;
45311 }
45312 Lighting.AddLight((int)base.Center.X / 16, (int)base.Center.Y / 16, 0.9f, 0.6f, 0.2f);
45313 if (alpha == 0)
45314 {
45315 int num78 = 2;
45316 if (Main.rand.Next(3) != 0)
45317 {
45318 int num79 = Dust.NewDust(new Vector2(base.Center.X - (float)num78, base.Center.Y - (float)num78 - 2f) - velocity * 0.5f, num78 * 2, num78 * 2, 6, 0f, 0f, 100);
45319 Main.dust[num79].scale *= 1.2f + (float)Main.rand.Next(10) * 0.05f;
45320 Main.dust[num79].velocity *= 0.2f;
45321 Main.dust[num79].noGravity = true;
45322 Main.dust[num79].noLight = true;
45323 Main.dust[num79].velocity += velocity * 0.25f;
45324 }
45325 if (Main.rand.Next(4) == 0)
45326 {
45327 int num80 = (num80 = Dust.NewDust(new Vector2(base.Center.X - (float)num78, base.Center.Y - (float)num78 - 2f) - velocity * 0.5f, num78 * 2, num78 * 2, 31, 0f, 0f, 100, default(Color), 0.5f));
45328 Main.dust[num80].fadeIn = 0.5f + (float)Main.rand.Next(5) * 0.05f;
45329 Main.dust[num80].velocity *= 0.05f;
45330 }
45331 }
45332 if (ai[1] == 0f)
45333 {
45334 ai[1] = 1f;
45336 }
45337 }
45338 if (type == 469)
45339 {
45340 localAI[1] += 1f;
45341 if (localAI[1] > 2f)
45342 {
45343 alpha -= 50;
45344 if (alpha < 0)
45345 {
45346 alpha = 0;
45347 }
45348 }
45349 }
45350 else if (type == 83 && ai[1] == 0f)
45351 {
45352 ai[1] = 1f;
45354 }
45355 else if (type == 408 && ai[1] == 0f)
45356 {
45357 ai[1] = 1f;
45358 SoundEngine.PlaySound(4, (int)position.X, (int)position.Y, 19);
45359 }
45360 else if (type == 259 && ai[1] == 0f)
45361 {
45362 ai[1] = 1f;
45364 }
45365 else if (type == 110 && ai[1] == 0f)
45366 {
45367 ai[1] = 1f;
45369 }
45370 else if (type == 302 && ai[1] == 0f)
45371 {
45372 ai[1] = 1f;
45374 }
45375 else if (type == 438 && ai[1] == 0f)
45376 {
45377 ai[1] = 1f;
45379 }
45380 else if (type == 593 && ai[1] == 0f)
45381 {
45382 ai[1] = 1f;
45384 }
45385 else if (type == 592 && ai[1] == 0f)
45386 {
45387 ai[1] = 1f;
45389 }
45390 else if (type == 462 && ai[1] == 0f)
45391 {
45392 ai[1] = 1f;
45393 if (Main.rand.Next(2) == 0)
45394 {
45396 }
45397 else
45398 {
45400 }
45401 Vector2 vector18 = Vector2.Normalize(velocity);
45402 int num81 = Main.rand.Next(5, 10);
45403 for (int num82 = 0; num82 < num81; num82++)
45404 {
45405 int num83 = Dust.NewDust(base.Center, 0, 0, 229, 0f, 0f, 100);
45406 Main.dust[num83].velocity.Y -= 1f;
45407 Main.dust[num83].velocity += vector18 * 2f;
45408 Main.dust[num83].position -= Vector2.One * 4f;
45409 Main.dust[num83].noGravity = true;
45410 }
45411 }
45412 else if (type == 84 && ai[1] == 0f)
45413 {
45414 ai[1] = 1f;
45416 }
45417 else if (type == 389 && ai[1] == 0f)
45418 {
45419 ai[1] = 1f;
45421 }
45422 else if (type == 257 && ai[1] == 0f)
45423 {
45424 ai[1] = 1f;
45426 }
45427 else if (type == 100 && ai[1] == 0f)
45428 {
45429 ai[1] = 1f;
45431 }
45432 else if (type == 98 && ai[1] == 0f)
45433 {
45434 ai[1] = 1f;
45436 }
45437 else if (type == 184 && ai[1] == 0f)
45438 {
45439 ai[1] = 1f;
45441 }
45442 else if (type == 980 && ai[1] == 0f)
45443 {
45444 ai[1] = 1f;
45446 }
45447 else if (type == 195 && ai[1] == 0f)
45448 {
45449 ai[1] = 1f;
45451 }
45452 else if (type == 275 && ai[1] == 0f)
45453 {
45454 ai[1] = 1f;
45456 }
45457 else if (type == 276 && ai[1] == 0f)
45458 {
45459 ai[1] = 1f;
45461 }
45462 else if ((type == 81 || type == 82) && ai[1] == 0f)
45463 {
45465 ai[1] = 1f;
45466 }
45467 else if (type == 180 && ai[1] == 0f)
45468 {
45470 ai[1] = 1f;
45471 }
45472 else if (type == 248 && ai[1] == 0f)
45473 {
45475 ai[1] = 1f;
45476 }
45477 else if (type == 576 && ai[1] == 0f)
45478 {
45479 ai[1] = 1f;
45481 }
45482 else if (type == 577 && soundDelay == 0)
45483 {
45484 soundDelay = -1;
45486 for (int num84 = 0; num84 < 5; num84++)
45487 {
45488 Vector2 center4 = base.Center;
45489 int num85 = ((num84 != 0) ? 3 : 0);
45490 float num86 = ((num84 == 0) ? (12f + 8f * Main.rand.NextFloat()) : (12f * Main.rand.NextFloat()));
45491 Vector2 vector19 = velocity.SafeNormalize(Vector2.Zero) * num86 + Main.rand.NextVector2Circular(1f, 1f) * num85;
45492 Dust obj4 = Main.dust[Dust.NewDust(center4, 8, 8, 229, 0f, 0f, 100, Color.Transparent, 1f + Main.rand.NextFloat() * 0.5f)];
45493 obj4.noGravity = true;
45494 obj4.velocity = vector19;
45495 obj4.position = center4;
45496 }
45497 }
45498 else if (type == 710)
45499 {
45500 alpha -= 25;
45501 if (alpha < 0)
45502 {
45503 alpha = 0;
45504 }
45505 if (Main.rand.Next(4) == 0)
45506 {
45507 int num87;
45508 if (Main.rand.Next(2) == 0)
45509 {
45510 num87 = Dust.NewDust(position, width, height, 31, 0f, 0f, 100, default(Color), 1.6f);
45511 Main.dust[num87].noGravity = true;
45512 }
45513 num87 = Dust.NewDust(position, width, height, 6, 0f, 0f, 100, default(Color), 1.2f);
45514 Main.dust[num87].noGravity = true;
45515 Main.dust[num87].velocity *= 2f;
45516 Main.dust[num87].velocity += velocity;
45517 if (ai[1] == -1f)
45518 {
45519 Main.dust[num87].fadeIn = 1.5f;
45520 }
45521 else
45522 {
45523 Main.dust[num87].fadeIn = 1.22f;
45524 }
45525 if (wet)
45526 {
45527 Kill();
45528 }
45529 }
45530 }
45531 else if (type == 639)
45532 {
45533 if (localAI[0] == 0f && localAI[1] == 0f)
45534 {
45535 localAI[0] = base.Center.X;
45536 localAI[1] = base.Center.Y;
45537 ai[0] = velocity.X;
45538 ai[1] = velocity.Y;
45539 }
45540 alpha -= 25;
45541 if (alpha < 0)
45542 {
45543 alpha = 0;
45544 }
45545 }
45546 else if (type == 640)
45547 {
45548 alpha -= 25;
45549 if (alpha < 0)
45550 {
45551 alpha = 0;
45552 }
45553 if (velocity == Vector2.Zero)
45554 {
45555 ai[0] = 0f;
45556 bool flag = true;
45557 for (int num88 = 1; num88 < oldPos.Length; num88++)
45558 {
45559 if (oldPos[num88] != oldPos[0])
45560 {
45561 flag = false;
45562 }
45563 }
45564 if (flag)
45565 {
45566 Kill();
45567 return;
45568 }
45569 if (Main.rand.Next(extraUpdates) == 0 && (velocity != Vector2.Zero || Main.rand.Next((localAI[1] == 2f) ? 2 : 6) == 0))
45570 {
45571 for (int num89 = 0; num89 < 2; num89++)
45572 {
45573 float num90 = rotation + ((Main.rand.Next(2) == 1) ? (-1f) : 1f) * ((float)Math.PI / 2f);
45574 float num91 = (float)Main.rand.NextDouble() * 0.8f + 1f;
45575 Vector2 vector20 = new Vector2((float)Math.Cos(num90) * num91, (float)Math.Sin(num90) * num91);
45576 int num92 = Dust.NewDust(base.Center, 0, 0, 229, vector20.X, vector20.Y);
45577 Main.dust[num92].noGravity = true;
45578 Main.dust[num92].scale = 1.2f;
45579 }
45580 if (Main.rand.Next(10) == 0)
45581 {
45582 Vector2 vector21 = velocity.RotatedBy(1.5707963705062866) * ((float)Main.rand.NextDouble() - 0.5f) * width;
45583 int num93 = Dust.NewDust(base.Center + vector21 - Vector2.One * 4f, 8, 8, 31, 0f, 0f, 100, default(Color), 1.5f);
45584 Main.dust[num93].velocity *= 0.5f;
45585 Main.dust[num93].velocity.Y = 0f - Math.Abs(Main.dust[num93].velocity.Y);
45586 }
45587 }
45588 }
45589 else if (numUpdates == 1)
45590 {
45591 float num94 = rotation + (float)Math.PI / 2f + ((Main.rand.Next(2) == 1) ? (-1f) : 1f) * ((float)Math.PI / 2f);
45592 float num95 = (float)Main.rand.NextDouble() * 0.25f + 0.25f;
45593 Vector2 vector22 = new Vector2((float)Math.Cos(num94) * num95, (float)Math.Sin(num94) * num95);
45594 int num96 = Dust.NewDust(position, 0, 0, 229, vector22.X, vector22.Y);
45595 Main.dust[num96].noGravity = true;
45596 Main.dust[num96].scale = 1.2f;
45597 }
45598 }
45599 if (type == 41)
45600 {
45601 int num97 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 100, default(Color), 1.6f);
45602 Main.dust[num97].noGravity = true;
45603 num97 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100, default(Color), 2f);
45604 Main.dust[num97].noGravity = true;
45605 }
45606 else if (type == 55)
45607 {
45608 int num98 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 18, 0f, 0f, 0, default(Color), 0.9f);
45609 Main.dust[num98].noGravity = true;
45610 }
45611 else if (type == 719)
45612 {
45613 if (Main.rand.Next(2) == 0)
45614 {
45615 Dust.NewDustDirect(position - velocity, width, height, 147, 0f, 0f, 0, default(Color), 0.9f).noGravity = true;
45616 }
45617 if (localAI[0] == 0f)
45618 {
45619 localAI[0] = 1f;
45620 for (int num99 = 0; num99 < 20; num99++)
45621 {
45622 Dust dust3 = Dust.NewDustDirect(position - velocity, width, height, 147, 0f, 0f, 0, default(Color), 1.3f);
45623 dust3.noGravity = true;
45624 dust3.velocity += velocity * 0.75f;
45625 }
45626 for (int num100 = 0; num100 < 10; num100++)
45627 {
45628 Dust dust4 = Dust.NewDustDirect(position - velocity, width, height, 147, 0f, 0f, 0, default(Color), 1.3f);
45629 dust4.noGravity = true;
45630 dust4.velocity *= 2f;
45631 }
45632 }
45633 }
45634 else if (type == 763)
45635 {
45636 if (localAI[0] == 0f)
45637 {
45638 localAI[0] = 1f;
45639 for (int num101 = 0; num101 < 5; num101++)
45640 {
45641 Dust dust5 = Dust.NewDustDirect(position - velocity, width, height, 40, 0f, 0f, 0, default(Color), 1.1f);
45642 dust5.noGravity = true;
45643 dust5.velocity *= 1.5f;
45644 }
45645 }
45646 }
45647 else if (type == 772)
45648 {
45649 if (Main.rand.Next(7) == 0)
45650 {
45651 for (int num102 = 0; num102 < 1; num102++)
45652 {
45653 Dust dust6 = Dust.NewDustDirect(position - velocity, width, height, Main.rand.NextFromList<int>(86, 87, 88, 89, 90, 91, 138), 0f, 0f, 0, default(Color), 0.7f);
45654 dust6.noGravity = true;
45655 dust6.velocity = velocity * 0.6f;
45656 dust6.fadeIn = 0.8f;
45657 }
45658 }
45659 }
45660 else if (type == 374)
45661 {
45662 if (localAI[0] == 0f)
45663 {
45665 localAI[0] = 1f;
45666 }
45667 if (Main.rand.Next(2) == 0)
45668 {
45669 int num103 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 18, 0f, 0f, 0, default(Color), 0.9f);
45670 Main.dust[num103].noGravity = true;
45671 Main.dust[num103].velocity *= 0.5f;
45672 }
45673 }
45674 else if (type == 376)
45675 {
45676 if (localAI[0] == 0f)
45677 {
45679 }
45680 localAI[0] += 1f;
45681 if (localAI[0] > 3f)
45682 {
45683 int num104 = 1;
45684 if (localAI[0] > 5f)
45685 {
45686 num104 = 2;
45687 }
45688 for (int num105 = 0; num105 < num104; num105++)
45689 {
45690 int num106 = Dust.NewDust(new Vector2(position.X, position.Y + 2f), width, height, 6, velocity.X * 0.2f, velocity.Y * 0.2f, 100, default(Color), 2f);
45691 Main.dust[num106].noGravity = true;
45692 Main.dust[num106].velocity.X *= 0.3f;
45693 Main.dust[num106].velocity.Y *= 0.3f;
45694 Main.dust[num106].noLight = true;
45695 }
45696 if (wet && !lavaWet)
45697 {
45698 Kill();
45699 return;
45700 }
45701 }
45702 }
45703 else if (type == 91 && Main.rand.Next(2) == 0)
45704 {
45705 int num108 = Dust.NewDust(Type: (Main.rand.Next(2) != 0) ? 58 : 15, Position: position, Width: width, Height: height, SpeedX: velocity.X * 0.25f, SpeedY: velocity.Y * 0.25f, Alpha: 150, newColor: default(Color), Scale: 0.9f);
45706 Main.dust[num108].velocity *= 0.25f;
45707 }
45708 if (type == 163 || type == 310 || type == 1008 || type == 1010 || type == 1009 || type == 1011)
45709 {
45710 if (alpha > 0)
45711 {
45712 alpha -= 25;
45713 }
45714 if (alpha < 0)
45715 {
45716 alpha = 0;
45717 }
45718 }
45719 switch (type)
45720 {
45721 case 14:
45722 case 20:
45723 case 36:
45724 case 83:
45725 case 84:
45726 case 89:
45727 case 100:
45728 case 104:
45729 case 110:
45730 case 158:
45731 case 159:
45732 case 160:
45733 case 161:
45734 case 180:
45735 case 279:
45736 case 283:
45737 case 284:
45738 case 285:
45739 case 286:
45740 case 287:
45741 case 389:
45742 if (alpha > 0)
45743 {
45744 alpha -= 15;
45745 }
45746 if (alpha < 0)
45747 {
45748 alpha = 0;
45749 }
45750 break;
45751 case 576:
45752 case 577:
45753 localAI[1] += 1f;
45754 if (localAI[1] > 2f)
45755 {
45756 if (alpha > 0)
45757 {
45758 alpha -= 15;
45759 }
45760 if (alpha < 0)
45761 {
45762 alpha = 0;
45763 }
45764 }
45765 break;
45766 }
45767 if (type == 484)
45768 {
45769 int num109 = Dust.NewDust(position, width, height, 78);
45770 Main.dust[num109].noGravity = true;
45771 Main.dust[num109].velocity *= 0.1f;
45772 Main.dust[num109].scale = 0.75f;
45773 Main.dust[num109].position = (Main.dust[num109].position + base.Center) / 2f;
45774 Main.dust[num109].position += velocity * Main.rand.Next(0, 101) * 0.01f;
45775 }
45776 if (type == 242 || type == 302 || type == 438 || type == 462 || type == 592)
45777 {
45778 float num110 = (float)Math.Sqrt(velocity.X * velocity.X + velocity.Y * velocity.Y);
45779 if (alpha > 0)
45780 {
45781 alpha -= (byte)((double)num110 * 0.9);
45782 }
45783 if (alpha < 0)
45784 {
45785 alpha = 0;
45786 }
45787 }
45788 if (type == 660)
45789 {
45790 DelegateMethods.v3_1 = new Vector3(0.6f, 1f, 1f) * 0.2f;
45791 Utils.PlotTileLine(base.Center, base.Center + velocity * 10f, 8f, DelegateMethods.CastLightOpen);
45792 if (alpha > 0)
45793 {
45795 alpha = 0;
45796 scale = 1.1f;
45797 frame = Main.rand.Next(14);
45798 float num111 = 16f;
45799 for (int num112 = 0; (float)num112 < num111; num112++)
45800 {
45801 Vector2 spinningpoint5 = Vector2.UnitX * 0f;
45802 spinningpoint5 += -Vector2.UnitY.RotatedBy((float)num112 * ((float)Math.PI * 2f / num111)) * new Vector2(1f, 4f);
45803 spinningpoint5 = spinningpoint5.RotatedBy(velocity.ToRotation());
45804 int num113 = Dust.NewDust(base.Center, 0, 0, 180);
45805 Main.dust[num113].scale = 1.5f;
45806 Main.dust[num113].noGravity = true;
45807 Main.dust[num113].position = base.Center + spinningpoint5;
45808 Main.dust[num113].velocity = velocity * 0f + spinningpoint5.SafeNormalize(Vector2.UnitY) * 1f;
45809 }
45810 }
45811 }
45812 if (type == 712)
45813 {
45814 DelegateMethods.v3_1 = new Vector3(0.4f, 0.4f, 0.4f) * 0.7f;
45815 Utils.PlotTileLine(base.Center, base.Center + velocity * 10f, 8f, DelegateMethods.CastLightOpen);
45816 if (alpha == 255)
45817 {
45818 frame = Main.rand.Next(2) * 4;
45819 }
45820 if (++frameCounter >= 4)
45821 {
45822 frameCounter = 0;
45823 frame++;
45824 if (frame == 4)
45825 {
45826 frame = 0;
45827 }
45828 if (frame >= 8)
45829 {
45830 frame = 4;
45831 }
45832 }
45833 if (alpha > 0)
45834 {
45835 alpha = 0;
45836 scale = 1.1f;
45837 frame = Main.rand.Next(14);
45838 float num114 = 4f;
45839 for (int num115 = 0; (float)num115 < num114; num115++)
45840 {
45841 Vector2 spinningpoint6 = Vector2.UnitX * 0f;
45842 spinningpoint6 += -Vector2.UnitY.RotatedBy((float)num115 * ((float)Math.PI * 2f / num114)) * new Vector2(1f, 4f);
45843 spinningpoint6 = spinningpoint6.RotatedBy(velocity.ToRotation());
45844 int num116 = Dust.NewDust(base.Center, 0, 0, 15);
45845 Main.dust[num116].scale = 1.7f;
45846 Main.dust[num116].noGravity = true;
45847 Main.dust[num116].position = base.Center + spinningpoint6 + velocity.SafeNormalize(Vector2.Zero) * 50f;
45848 Main.dust[num116].velocity = Main.dust[num116].velocity * 2f + spinningpoint6.SafeNormalize(Vector2.UnitY) * 0.3f + velocity.SafeNormalize(Vector2.Zero) * 3f;
45849 Main.dust[num116].velocity *= 0.7f;
45850 Main.dust[num116].position += Main.dust[num116].velocity * 5f;
45851 }
45852 }
45853 }
45854 if (type == 661)
45855 {
45856 if (alpha <= 0)
45857 {
45858 for (int num117 = 0; num117 < 3; num117++)
45859 {
45860 int num118 = Dust.NewDust(position, width, height, 240);
45861 Main.dust[num118].noGravity = true;
45862 Main.dust[num118].velocity *= 0.3f;
45863 Main.dust[num118].noLight = true;
45864 }
45865 }
45866 if (alpha > 0)
45867 {
45868 alpha -= 55;
45869 scale = 1.3f;
45870 if (alpha < 0)
45871 {
45872 alpha = 0;
45873 float num119 = 16f;
45874 for (int num120 = 0; (float)num120 < num119; num120++)
45875 {
45876 Vector2 spinningpoint7 = Vector2.UnitX * 0f;
45877 spinningpoint7 += -Vector2.UnitY.RotatedBy((float)num120 * ((float)Math.PI * 2f / num119)) * new Vector2(1f, 4f);
45878 spinningpoint7 = spinningpoint7.RotatedBy(velocity.ToRotation());
45879 int num121 = Dust.NewDust(base.Center, 0, 0, 62);
45880 Main.dust[num121].scale = 1.5f;
45881 Main.dust[num121].noLight = true;
45882 Main.dust[num121].noGravity = true;
45883 Main.dust[num121].position = base.Center + spinningpoint7;
45884 Main.dust[num121].velocity = Main.dust[num121].velocity * 4f + velocity * 0.3f;
45885 }
45886 }
45887 }
45888 }
45889 if (type == 706)
45890 {
45891 if (wet)
45892 {
45893 Kill();
45894 return;
45895 }
45896 SlotId val;
45897 if (localAI[1] == 0f)
45898 {
45899 float[] array = localAI;
45901 array[0] = ((SlotId)(ref val)).ToFloat();
45902 localAI[1] += 1f;
45903 for (int num122 = 0; num122 < 15; num122++)
45904 {
45905 if (Main.rand.Next(4) != 0)
45906 {
45907 Dust dust7 = Dust.NewDustDirect(base.Center - base.Size / 4f, width / 2, height / 2, Utils.SelectRandom<int>(Main.rand, 6, 31, 31));
45908 dust7.noGravity = true;
45909 dust7.velocity *= 2.3f;
45910 dust7.fadeIn = 1.5f;
45911 dust7.noLight = true;
45912 }
45913 }
45914 }
45916 if (activeSound != null)
45917 {
45918 activeSound.Position = base.Center;
45919 }
45920 else
45921 {
45922 float[] array2 = localAI;
45923 val = SlotId.Invalid;
45924 array2[0] = ((SlotId)(ref val)).ToFloat();
45925 }
45926 if (alpha <= 0)
45927 {
45928 for (int num123 = 0; num123 < 2; num123++)
45929 {
45930 if (Main.rand.Next(4) != 0)
45931 {
45932 Dust dust8 = Dust.NewDustDirect(base.Center - base.Size / 4f, width / 2, height / 2, Utils.SelectRandom<int>(Main.rand, 6, 31, 31));
45933 dust8.noGravity = true;
45934 dust8.velocity *= 2.3f;
45935 dust8.fadeIn = 1.5f;
45936 dust8.noLight = true;
45937 }
45938 }
45939 Vector2 spinningpoint8 = new Vector2(0f, (float)Math.Cos((float)frameCounter * ((float)Math.PI * 2f) / 40f - (float)Math.PI / 2f)) * 16f;
45940 spinningpoint8 = spinningpoint8.RotatedBy(rotation);
45941 Vector2 vector23 = velocity.SafeNormalize(Vector2.Zero);
45942 for (int num124 = 0; num124 < 1; num124++)
45943 {
45944 Dust dust9 = Dust.NewDustDirect(base.Center - base.Size / 4f, width / 2, height / 2, 6);
45945 dust9.noGravity = true;
45946 dust9.position = base.Center + spinningpoint8;
45947 dust9.velocity *= 0f;
45948 dust9.fadeIn = 1.4f;
45949 dust9.scale = 1.15f;
45950 dust9.noLight = true;
45951 dust9.position += velocity * 1.2f;
45952 dust9.velocity += vector23 * 2f;
45953 Dust dust10 = Dust.NewDustDirect(base.Center - base.Size / 4f, width / 2, height / 2, 6);
45954 dust10.noGravity = true;
45955 dust10.position = base.Center + spinningpoint8;
45956 dust10.velocity *= 0f;
45957 dust10.fadeIn = 1.4f;
45958 dust10.scale = 1.15f;
45959 dust10.noLight = true;
45960 dust10.position += velocity * 0.5f;
45961 dust10.position += velocity * 1.2f;
45962 dust10.velocity += vector23 * 2f;
45963 }
45964 }
45965 if (++frameCounter >= 40)
45966 {
45967 frameCounter = 0;
45968 }
45969 frame = frameCounter / 5;
45970 if (alpha > 0)
45971 {
45972 alpha -= 55;
45973 if (alpha < 0)
45974 {
45975 alpha = 0;
45976 float num125 = 16f;
45977 for (int num126 = 0; (float)num126 < num125; num126++)
45978 {
45979 Vector2 spinningpoint9 = Vector2.UnitX * 0f;
45980 spinningpoint9 += -Vector2.UnitY.RotatedBy((float)num126 * ((float)Math.PI * 2f / num125)) * new Vector2(1f, 4f);
45981 spinningpoint9 = spinningpoint9.RotatedBy(velocity.ToRotation());
45982 int num127 = Dust.NewDust(base.Center, 0, 0, 6);
45983 Main.dust[num127].scale = 1.5f;
45984 Main.dust[num127].noLight = true;
45985 Main.dust[num127].noGravity = true;
45986 Main.dust[num127].position = base.Center + spinningpoint9;
45987 Main.dust[num127].velocity = Main.dust[num127].velocity * 4f + velocity * 0.3f;
45988 }
45989 }
45990 }
45991 DelegateMethods.v3_1 = new Vector3(1f, 0.6f, 0.2f);
45992 Utils.PlotTileLine(base.Center, base.Center + velocity * 4f, 40f, DelegateMethods.CastLightOpen);
45993 }
45994 if (type == 638)
45995 {
45996 float num128 = velocity.Length();
45997 if (alpha > 0)
45998 {
45999 alpha -= (byte)((double)num128 * 0.3);
46000 }
46001 if (alpha < 0)
46002 {
46003 alpha = 0;
46004 }
46005 Rectangle hitbox = base.Hitbox;
46006 hitbox.Offset((int)velocity.X, (int)velocity.Y);
46007 bool flag2 = false;
46008 for (int num129 = 0; num129 < 200; num129++)
46009 {
46010 NPC nPC = Main.npc[num129];
46011 if (nPC.active && !nPC.dontTakeDamage && nPC.immune[owner] == 0 && localNPCImmunity[num129] == 0 && nPC.Hitbox.Intersects(hitbox) && !nPC.friendly)
46012 {
46013 flag2 = true;
46014 break;
46015 }
46016 }
46017 if (flag2)
46018 {
46019 int num130 = Main.rand.Next(15, 31);
46020 for (int num131 = 0; num131 < num130; num131++)
46021 {
46022 int num132 = Dust.NewDust(base.Center, 0, 0, 229, 0f, 0f, 100, default(Color), 0.8f);
46023 Main.dust[num132].velocity *= 1.6f;
46024 Main.dust[num132].velocity.Y -= 1f;
46025 Main.dust[num132].velocity += velocity;
46026 Main.dust[num132].noGravity = true;
46027 }
46028 }
46029 }
46030 if (type == 257 || type == 593)
46031 {
46032 if (alpha > 0)
46033 {
46034 alpha -= 10;
46035 }
46036 if (alpha < 0)
46037 {
46038 alpha = 0;
46039 }
46040 }
46041 if (type == 876)
46042 {
46043 if (ai[1] == 0f)
46044 {
46045 tileCollide = true;
46046 }
46047 else
46048 {
46049 tileCollide = false;
46050 }
46051 if (alpha > 0)
46052 {
46053 alpha -= 10;
46054 }
46055 if (alpha < 0)
46056 {
46057 alpha = 0;
46058 }
46059 }
46060 if (type == 88)
46061 {
46062 if (alpha > 0)
46063 {
46064 alpha -= 10;
46065 }
46066 if (alpha < 0)
46067 {
46068 alpha = 0;
46069 }
46070 }
46071 if (type == 532)
46072 {
46073 ai[0] += 1f;
46074 }
46075 bool flag3 = true;
46076 bool flag4 = false;
46077 switch (type)
46078 {
46079 case 5:
46080 case 14:
46081 case 20:
46082 case 36:
46083 case 38:
46084 case 55:
46085 case 83:
46086 case 84:
46087 case 88:
46088 case 89:
46089 case 98:
46090 case 100:
46091 case 104:
46092 case 110:
46093 case 158:
46094 case 159:
46095 case 160:
46096 case 161:
46097 case 180:
46098 case 184:
46099 case 242:
46100 case 248:
46101 case 257:
46102 case 259:
46103 case 265:
46104 case 270:
46105 case 279:
46106 case 283:
46107 case 284:
46108 case 285:
46109 case 286:
46110 case 287:
46111 case 299:
46112 case 302:
46113 case 323:
46114 case 325:
46115 case 348:
46116 case 349:
46117 case 350:
46118 case 355:
46119 case 374:
46120 case 376:
46121 case 389:
46122 case 435:
46123 case 436:
46124 case 438:
46125 case 440:
46126 case 442:
46127 case 449:
46128 case 459:
46129 case 462:
46130 case 467:
46131 case 468:
46132 case 469:
46133 case 472:
46134 case 483:
46135 case 484:
46136 case 485:
46137 case 498:
46138 case 576:
46139 case 577:
46140 case 585:
46141 case 592:
46142 case 593:
46143 case 601:
46144 case 606:
46145 case 616:
46146 case 634:
46147 case 635:
46148 case 638:
46149 case 639:
46150 case 660:
46151 case 661:
46152 case 682:
46153 case 684:
46154 case 706:
46155 case 709:
46156 case 710:
46157 case 712:
46158 case 876:
46159 case 980:
46160 case 981:
46161 flag3 = false;
46162 break;
46163 case 1006:
46164 flag4 = true;
46165 break;
46166 }
46167 if (flag3)
46168 {
46169 ai[0] += 1f;
46170 }
46171 if (type == 1006 && Main.rand.Next(8) == 0)
46172 {
46173 Dust dust11 = Dust.NewDustPerfect(base.Center + Main.rand.NextVector2Circular(4f, 4f), 306, velocity * 1.25f, 0, Main.hslToRgb(Main.rand.NextFloat(), 1f, 0.5f), 1f + Main.rand.NextFloat() * 0.4f);
46174 dust11.noGravity = true;
46175 dust11.fadeIn = dust11.scale + 0.05f;
46177 dust12.color = Color.White;
46178 dust12.scale -= 0.3f;
46179 }
46180 if (type == 270)
46181 {
46182 int num133 = 0;
46183 num133 = Player.FindClosest(base.Center, 1, 1);
46184 ai[1] += 1f;
46185 if (ai[1] < 110f && ai[1] > 30f)
46186 {
46187 float num134 = velocity.Length();
46188 Vector2 vector24 = Main.player[num133].Center - base.Center;
46189 vector24.Normalize();
46190 vector24 *= num134;
46191 velocity = (velocity * 24f + vector24) / 25f;
46192 velocity.Normalize();
46193 velocity *= num134;
46194 }
46195 if (velocity.Length() < 18f)
46196 {
46197 velocity *= 1.02f;
46198 }
46199 if (localAI[0] == 0f)
46200 {
46201 localAI[0] = 1f;
46203 for (int num135 = 0; num135 < 10; num135++)
46204 {
46205 int num136 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 5, velocity.X, velocity.Y, 0, default(Color), 2f);
46206 Main.dust[num136].noGravity = true;
46207 Main.dust[num136].velocity = base.Center - Main.dust[num136].position;
46208 Main.dust[num136].velocity.Normalize();
46209 Main.dust[num136].velocity *= -5f;
46210 Main.dust[num136].velocity += velocity / 2f;
46211 }
46212 }
46213 }
46214 if (type == 585)
46215 {
46216 if (localAI[0] == 0f)
46217 {
46218 localAI[0] = 1f;
46220 for (int num137 = 0; num137 < 3; num137++)
46221 {
46222 int num138 = Dust.NewDust(position, width, height, 27, velocity.X, velocity.Y, 0, default(Color), 2f);
46223 Main.dust[num138].noGravity = true;
46224 Main.dust[num138].velocity = base.Center - Main.dust[num138].position;
46225 Main.dust[num138].velocity.Normalize();
46226 Main.dust[num138].velocity *= -5f;
46227 Main.dust[num138].velocity += velocity / 2f;
46228 Main.dust[num138].noLight = true;
46229 }
46230 }
46231 if (alpha > 0)
46232 {
46233 alpha -= 50;
46234 }
46235 if (alpha < 0)
46236 {
46237 alpha = 0;
46238 }
46239 frameCounter++;
46240 if (frameCounter >= 12)
46241 {
46242 frameCounter = 0;
46243 }
46244 frame = frameCounter / 2;
46245 if (frame > 3)
46246 {
46247 frame = 6 - frame;
46248 }
46249 Vector3 vector25 = NPCID.Sets.MagicAuraColor[54].ToVector3();
46251 if (Main.rand.Next(3) == 0)
46252 {
46253 int num139 = Dust.NewDust(new Vector2(position.X + 4f, position.Y + 4f), width - 8, height - 8, 27, velocity.X * 0.2f, velocity.Y * 0.2f, 100, default(Color), 2f);
46254 Main.dust[num139].position -= velocity * 2f;
46255 Main.dust[num139].noLight = true;
46256 Main.dust[num139].noGravity = true;
46257 Main.dust[num139].velocity.X *= 0.3f;
46258 Main.dust[num139].velocity.Y *= 0.3f;
46259 }
46260 }
46261 if (type == 594)
46262 {
46263 int num140 = (int)(43f - ai[1]) / 13;
46264 if (num140 < 1)
46265 {
46266 num140 = 1;
46267 }
46268 int num141 = ((ai[1] < 20f) ? 6 : 31);
46269 for (int num142 = 0; num142 < num140; num142++)
46270 {
46271 int num143 = Dust.NewDust(new Vector2(position.X + 4f, position.Y + 4f), width - 8, height - 8, num141, velocity.X * 0.2f, velocity.Y * 0.2f, 0, default(Color), 2f);
46272 Main.dust[num143].position -= velocity * 2f;
46273 Main.dust[num143].noLight = true;
46274 Main.dust[num143].noGravity = true;
46275 Main.dust[num143].velocity.X *= 0.3f;
46276 Main.dust[num143].velocity.Y *= 0.3f;
46277 if (num141 == 6)
46278 {
46279 Main.dust[num143].fadeIn = Main.rand.NextFloat() * 2f;
46280 }
46281 }
46282 ai[1] += 1f;
46283 if (ai[1] > (float)(43 * MaxUpdates))
46284 {
46285 Kill();
46286 return;
46287 }
46288 }
46289 if (type == 622)
46290 {
46291 int num144 = 229;
46292 if (Main.rand.Next(3) != 0)
46293 {
46294 int num145 = Dust.NewDust(new Vector2(position.X + 4f, position.Y + 4f), width - 8, height - 8, num144, velocity.X * 0.2f, velocity.Y * 0.2f, 0, default(Color), 1.2f);
46295 Main.dust[num145].position -= velocity * 2f;
46296 Main.dust[num145].noLight = true;
46297 Main.dust[num145].noGravity = true;
46298 Main.dust[num145].velocity.X *= 0.3f;
46299 Main.dust[num145].velocity.Y *= 0.3f;
46300 }
46301 ai[1] += 1f;
46302 if (ai[1] > (float)(23 * MaxUpdates))
46303 {
46304 Kill();
46305 return;
46306 }
46307 }
46308 if (type == 587)
46309 {
46310 Color newColor2 = Main.hslToRgb(ai[1], 1f, 0.5f);
46311 newColor2.A = 200;
46312 localAI[0] += 1f;
46313 if (!(localAI[0] < 2f))
46314 {
46315 if (localAI[0] == 2f)
46316 {
46318 for (int num146 = 0; num146 < 4; num146++)
46319 {
46320 int num147 = Dust.NewDust(position, width, height, 76, velocity.X, velocity.Y, 0, newColor2, 1.1f);
46321 Main.dust[num147].noGravity = true;
46322 Main.dust[num147].velocity = base.Center - Main.dust[num147].position;
46323 Main.dust[num147].velocity.Normalize();
46324 Main.dust[num147].velocity *= -3f;
46325 Main.dust[num147].velocity += velocity / 2f;
46326 }
46327 }
46328 else
46329 {
46330 frame++;
46331 if (frame > 2)
46332 {
46333 frame = 0;
46334 }
46335 for (int num148 = 0; num148 < 1; num148++)
46336 {
46337 int num149 = Dust.NewDust(new Vector2(position.X + 4f, position.Y + 4f), width - 8, height - 8, 76, velocity.X * 0.2f, velocity.Y * 0.2f, 0, newColor2, 0.9f);
46338 Main.dust[num149].position = base.Center;
46339 Main.dust[num149].noGravity = true;
46340 Main.dust[num149].velocity = velocity * 0.5f;
46341 }
46342 }
46343 }
46344 }
46345 if (type == 349)
46346 {
46347 frame = (int)ai[0];
46348 velocity.Y += 0.2f;
46349 if (localAI[0] == 0f || localAI[0] == 2f)
46350 {
46351 scale += 0.01f;
46352 alpha -= 50;
46353 if (alpha <= 0)
46354 {
46355 localAI[0] = 1f;
46356 alpha = 0;
46357 }
46358 }
46359 else if (localAI[0] == 1f)
46360 {
46361 scale -= 0.01f;
46362 alpha += 50;
46363 if (alpha >= 255)
46364 {
46365 localAI[0] = 2f;
46366 alpha = 255;
46367 }
46368 }
46369 }
46370 if (type == 348)
46371 {
46372 if (localAI[1] == 0f)
46373 {
46374 localAI[1] = 1f;
46376 }
46377 if (ai[0] == 0f || ai[0] == 2f)
46378 {
46379 scale += 0.01f;
46380 alpha -= 50;
46381 if (alpha <= 0)
46382 {
46383 ai[0] = 1f;
46384 alpha = 0;
46385 }
46386 }
46387 else if (ai[0] == 1f)
46388 {
46389 scale -= 0.01f;
46390 alpha += 50;
46391 if (alpha >= 255)
46392 {
46393 ai[0] = 2f;
46394 alpha = 255;
46395 }
46396 }
46397 }
46398 if (type == 572)
46399 {
46400 if (localAI[0] == 0f)
46401 {
46402 localAI[0] = 1f;
46404 }
46405 for (int num150 = 0; num150 < 2; num150++)
46406 {
46407 int num151 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 40, velocity.X, velocity.Y, 100);
46408 Main.dust[num151].velocity *= 0.5f;
46409 Main.dust[num151].velocity += velocity;
46410 Main.dust[num151].velocity *= 0.5f;
46411 Main.dust[num151].noGravity = true;
46412 Main.dust[num151].scale = 1.2f;
46413 Main.dust[num151].position = (base.Center + position) / 2f;
46414 }
46415 }
46416 if (type == 577)
46417 {
46418 Lighting.AddLight(base.Center, 0.1f, 0.3f, 0.4f);
46419 }
46420 else if (type == 576)
46421 {
46422 Lighting.AddLight(base.Center, 0.4f, 0.2f, 0.4f);
46423 for (int num152 = 0; num152 < 5; num152++)
46424 {
46425 Dust obj5 = Main.dust[Dust.NewDust(position, width, height, 242, velocity.X, velocity.Y, 100)];
46426 obj5.velocity = Vector2.Zero;
46427 obj5.position -= velocity / 5f * num152;
46428 obj5.noGravity = true;
46429 obj5.scale = 0.8f;
46430 obj5.noLight = true;
46431 }
46432 }
46433 else if (type == 581)
46434 {
46435 if (localAI[0] == 0f)
46436 {
46437 localAI[0] = 1f;
46439 }
46440 for (int num153 = 0; num153 < 2; num153++)
46441 {
46442 int num154 = Utils.SelectRandom<int>(Main.rand, 229, 161, 161);
46443 Dust obj6 = Main.dust[Dust.NewDust(position, width, height, num154, velocity.X, velocity.Y, 100)];
46444 obj6.velocity = obj6.velocity / 4f + velocity / 2f;
46445 obj6.noGravity = true;
46446 obj6.scale = 1.2f;
46447 obj6.position = base.Center;
46448 obj6.noLight = true;
46449 }
46450 }
46451 else if (type == 671)
46452 {
46453 if (localAI[0] == 0f)
46454 {
46455 localAI[0] = 1f;
46456 for (int num155 = 0; num155 < 8; num155++)
46457 {
46458 int num156 = Utils.SelectRandom<int>(Main.rand, 27, 62);
46459 Dust obj7 = Main.dust[Dust.NewDust(position, width, height, num156, velocity.X, velocity.Y, 100)];
46460 obj7.velocity = (Main.rand.NextFloatDirection() * (float)Math.PI).ToRotationVector2() * 2f + velocity.SafeNormalize(Vector2.Zero) * 3f;
46461 obj7.noGravity = true;
46462 obj7.scale = 1.5f;
46463 obj7.fadeIn = 1.2f;
46464 obj7.position = base.Center;
46465 obj7.noLight = true;
46466 }
46467 }
46468 alpha -= 20;
46469 if (alpha < 0)
46470 {
46471 alpha = 0;
46472 }
46473 for (int num157 = 0; num157 < 2; num157++)
46474 {
46475 int num158 = Utils.SelectRandom<int>(Main.rand, 27, 27, 62);
46476 Dust obj8 = Main.dust[Dust.NewDust(position, width, height, num158, velocity.X, velocity.Y, 100)];
46477 obj8.velocity = obj8.velocity / 4f + velocity / 2f;
46478 obj8.noGravity = true;
46479 obj8.scale = 1.2f;
46480 obj8.position = base.Center;
46481 obj8.noLight = true;
46482 }
46483 }
46484 else if (type == 811)
46485 {
46486 if (localAI[0] == 0f)
46487 {
46489 localAI[0] = 1f;
46490 for (int num159 = 0; num159 < 8; num159++)
46491 {
46492 Dust obj9 = Main.dust[Dust.NewDust(position, width, height, 5, velocity.X, velocity.Y, 100)];
46493 obj9.velocity = (Main.rand.NextFloatDirection() * (float)Math.PI).ToRotationVector2() * 2f + velocity.SafeNormalize(Vector2.Zero) * 3f;
46494 obj9.scale = 1.5f;
46495 obj9.fadeIn = 1.7f;
46496 obj9.position = base.Center;
46497 }
46498 }
46499 alpha -= 20;
46500 if (alpha < 0)
46501 {
46502 alpha = 0;
46503 }
46504 for (int num160 = 0; num160 < 2; num160++)
46505 {
46506 Dust obj10 = Main.dust[Dust.NewDust(position, width, height, 5, velocity.X, velocity.Y, 100)];
46507 obj10.velocity = obj10.velocity / 4f + velocity / 2f;
46508 obj10.scale = 1.2f;
46509 obj10.position = base.Center + Main.rand.NextFloat() * velocity * 2f;
46510 }
46511 }
46512 else if (type == 819)
46513 {
46514 if (localAI[0] == 0f)
46515 {
46516 localAI[0] = 1f;
46517 for (int num161 = 0; num161 < 8; num161++)
46518 {
46519 Dust obj11 = Main.dust[Dust.NewDust(position, width, height, 5, velocity.X, velocity.Y, 100)];
46520 obj11.velocity = (Main.rand.NextFloatDirection() * (float)Math.PI).ToRotationVector2() * 2f + velocity.SafeNormalize(Vector2.Zero) * 2f;
46521 obj11.scale = 0.9f;
46522 obj11.fadeIn = 1.3f;
46523 obj11.position = base.Center;
46524 }
46525 }
46526 alpha -= 20;
46527 if (alpha < 0)
46528 {
46529 alpha = 0;
46530 }
46531 for (int num162 = 1; num162 < 6; num162++)
46532 {
46533 Dust obj12 = Main.dust[Dust.NewDust(position, width, height, 5, 0f, 0f, 100)];
46534 obj12.velocity = obj12.velocity * 0.5f + velocity * 0.5f;
46535 obj12.velocity *= 0.25f;
46536 obj12.scale = 0.9f;
46537 obj12.position = base.Center - velocity * num162 / 5f;
46538 }
46539 if (Main.rand.Next(2) == 0)
46540 {
46541 Dust dust13 = Dust.NewDustPerfect(base.Center - velocity * 3f, 267, velocity * 0.5f, 0, Color.Red * (Main.rand.NextFloat() * 0.3f + 0.1f));
46542 dust13.noGravity = true;
46543 dust13.scale = 0.7f;
46544 }
46545 Lighting.AddLight(base.Center, 0.3f, 0.05f, 0.05f);
46546 }
46547 else if (type == 814)
46548 {
46549 if (localAI[0] == 0f)
46550 {
46552 localAI[0] = 1f;
46553 for (int num163 = 0; num163 < 8; num163++)
46554 {
46555 Dust obj13 = Main.dust[Dust.NewDust(position, width, height, 5, velocity.X, velocity.Y, 100)];
46556 obj13.velocity = (Main.rand.NextFloatDirection() * (float)Math.PI).ToRotationVector2() * 2f + velocity.SafeNormalize(Vector2.Zero) * 2f;
46557 obj13.scale = 0.9f;
46558 obj13.fadeIn = 1.1f;
46559 obj13.position = base.Center;
46560 }
46561 }
46562 alpha -= 20;
46563 if (alpha < 0)
46564 {
46565 alpha = 0;
46566 }
46567 for (int num164 = 0; num164 < 2; num164++)
46568 {
46569 Dust obj14 = Main.dust[Dust.NewDust(position, width, height, 5, velocity.X, velocity.Y, 100)];
46570 obj14.velocity = obj14.velocity / 4f + velocity / 2f;
46571 obj14.scale = 1.2f;
46572 obj14.position = base.Center + Main.rand.NextFloat() * velocity * 2f;
46573 }
46574 for (int num165 = 1; num165 < oldPos.Length && !(oldPos[num165] == Vector2.Zero); num165++)
46575 {
46576 if (Main.rand.Next(3) == 0)
46577 {
46578 Dust obj15 = Main.dust[Dust.NewDust(oldPos[num165], width, height, 5, velocity.X, velocity.Y, 100)];
46579 obj15.velocity = obj15.velocity / 4f + velocity / 2f;
46580 obj15.scale = 1.2f;
46581 obj15.position = oldPos[num165] + base.Size / 2f + Main.rand.NextFloat() * velocity * 2f;
46582 }
46583 }
46584 }
46585 else if (type == 675)
46586 {
46587 if (localAI[0] == 0f)
46588 {
46589 localAI[0] = 1f;
46591 }
46592 alpha -= 20;
46593 if (alpha < 0)
46594 {
46595 alpha = 0;
46596 }
46597 }
46598 else if (type == 676)
46599 {
46600 if (localAI[0] == 0f)
46601 {
46602 localAI[0] = 1f;
46604 }
46605 alpha -= 20;
46606 if (alpha < 0)
46607 {
46608 alpha = 0;
46609 }
46610 for (int num166 = 0; num166 < 2; num166++)
46611 {
46612 if (Main.rand.Next(5) != 0)
46613 {
46614 int num167 = Utils.SelectRandom<int>(Main.rand, 4, 256);
46615 Dust dust14 = Main.dust[Dust.NewDust(position, width, height, num167, velocity.X, velocity.Y, 100)];
46616 dust14.velocity = dust14.velocity / 4f + velocity / 2f;
46617 dust14.scale = 0.8f + Main.rand.NextFloat() * 0.4f;
46618 dust14.position = base.Center;
46619 dust14.position += new Vector2(width * 2, 0f).RotatedBy((float)Math.PI * 2f * Main.rand.NextFloat()) * Main.rand.NextFloat();
46620 dust14.noLight = true;
46621 if (dust14.type == 4)
46622 {
46623 dust14.color = new Color(80, 170, 40, 120);
46624 }
46625 }
46626 }
46627 }
46628 else if (type == 686)
46629 {
46630 if (localAI[0] == 0f)
46631 {
46632 localAI[0] = 1f;
46634 }
46635 if (ai[0] >= 2f)
46636 {
46637 alpha -= 25;
46638 if (alpha < 0)
46639 {
46640 alpha = 0;
46641 }
46642 }
46643 if (Main.rand.Next(4) == 0)
46644 {
46645 Dust dust15 = Dust.NewDustDirect(position, width, height, 55, 0f, 0f, 200);
46646 dust15.scale *= 0.7f;
46647 dust15.velocity += velocity * 1f;
46648 }
46649 if (Main.rand.Next(3) == 0 && oldPos[9] != Vector2.Zero)
46650 {
46651 Dust dust16 = Dust.NewDustDirect(oldPos[9], width, height, 55, 0f, 0f, 50);
46652 dust16.scale *= 0.85f;
46653 dust16.velocity += velocity * 0.85f;
46654 dust16.color = Color.Purple;
46655 }
46656 }
46657 else if (type == 711)
46658 {
46659 if (localAI[0] == 0f)
46660 {
46661 localAI[0] = 1f;
46662 for (int num168 = 0; num168 < 10; num168++)
46663 {
46664 Dust dust17 = Dust.NewDustDirect(position, width, height, 55, 0f, 0f, 200);
46665 dust17.scale *= 0.65f;
46666 dust17.velocity *= 1.5f;
46667 dust17.velocity += velocity * 0.3f;
46668 dust17.fadeIn = 0.7f;
46669 }
46670 }
46671 if (ai[0] >= 2f)
46672 {
46673 alpha -= 25;
46674 if (alpha < 0)
46675 {
46676 alpha = 0;
46677 }
46678 }
46679 if (Main.rand.Next(4) == 0)
46680 {
46681 Dust dust18 = Dust.NewDustDirect(position, width, height, 55, 0f, 0f, 200);
46682 dust18.scale *= 0.7f;
46683 dust18.velocity += velocity * 1f;
46684 }
46685 if (Main.rand.Next(3) == 0 && oldPos[9] != Vector2.Zero)
46686 {
46687 Dust dust19 = Dust.NewDustDirect(oldPos[9], width, height, 55, 0f, 0f, 50);
46688 dust19.scale *= 0.85f;
46689 dust19.velocity += velocity * 0.85f;
46690 dust19.color = Color.Purple;
46691 }
46692 }
46693 if (type == 299)
46694 {
46695 if (localAI[0] == 6f)
46696 {
46698 for (int num169 = 0; num169 < 40; num169++)
46699 {
46700 int num170 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 181, 0f, 0f, 100);
46701 Main.dust[num170].velocity *= 3f;
46702 Main.dust[num170].velocity += velocity * 0.75f;
46703 Main.dust[num170].scale *= 1.2f;
46704 Main.dust[num170].noGravity = true;
46705 }
46706 }
46707 localAI[0] += 1f;
46708 if (localAI[0] > 6f)
46709 {
46710 for (int num171 = 0; num171 < 3; num171++)
46711 {
46712 int num172 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 181, velocity.X * 0.2f, velocity.Y * 0.2f, 100);
46713 Main.dust[num172].velocity *= 0.6f;
46714 Main.dust[num172].scale *= 1.4f;
46715 Main.dust[num172].noGravity = true;
46716 }
46717 }
46718 }
46719 else if (type == 270 || type == 837)
46720 {
46721 if (type == 270)
46722 {
46723 alpha = 0;
46724 }
46725 if (alpha > 0)
46726 {
46727 alpha -= 50;
46728 }
46729 if (alpha < 0)
46730 {
46731 alpha = 0;
46732 }
46733 frame++;
46734 if (frame > 2)
46735 {
46736 frame = 0;
46737 }
46738 if (type == 270)
46739 {
46740 for (int num173 = 0; num173 < 2; num173++)
46741 {
46742 int num174 = Dust.NewDust(new Vector2(position.X + 4f, position.Y + 4f), width - 8, height - 8, 5, velocity.X * 0.2f, velocity.Y * 0.2f, 100, default(Color), 1.5f);
46743 Main.dust[num174].position -= velocity;
46744 Main.dust[num174].noGravity = true;
46745 Main.dust[num174].velocity.X *= 0.3f;
46746 Main.dust[num174].velocity.Y *= 0.3f;
46747 }
46748 }
46749 else
46750 {
46751 for (int num175 = 0; num175 < 2; num175++)
46752 {
46753 int num176 = Dust.NewDust(new Vector2(position.X + 4f, position.Y + 4f), width - 8, height - 8, 6, velocity.X * 0.2f, velocity.Y * 0.2f, 100, default(Color), 2f);
46754 Main.dust[num176].position -= velocity * 2f;
46755 Main.dust[num176].noGravity = true;
46756 Main.dust[num176].velocity.X *= 0.3f;
46757 Main.dust[num176].velocity.Y *= 0.3f;
46758 }
46759 }
46760 }
46761 if (type == 259)
46762 {
46763 if (alpha > 0)
46764 {
46765 alpha -= 10;
46766 }
46767 if (alpha < 0)
46768 {
46769 alpha = 0;
46770 }
46771 }
46772 if (type == 265)
46773 {
46774 if (alpha > 0)
46775 {
46776 alpha -= 50;
46777 }
46778 if (alpha < 0)
46779 {
46780 alpha = 0;
46781 }
46782 if (alpha == 0)
46783 {
46784 int num177 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 163, velocity.X, velocity.Y, 100, default(Color), 1.2f);
46785 Main.dust[num177].noGravity = true;
46786 Main.dust[num177].velocity *= 0.3f;
46787 Main.dust[num177].velocity -= velocity * 0.4f;
46788 }
46789 }
46790 if (type == 355)
46791 {
46792 if (alpha > 0)
46793 {
46794 alpha -= 50;
46795 }
46796 if (alpha < 0)
46797 {
46798 alpha = 0;
46799 }
46800 if (alpha == 0)
46801 {
46802 int num178 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 205, velocity.X, velocity.Y, 100, default(Color), 1.2f);
46803 Main.dust[num178].noGravity = true;
46804 Main.dust[num178].velocity *= 0.3f;
46805 Main.dust[num178].velocity -= velocity * 0.4f;
46806 }
46807 }
46808 if (type == 981 && Main.rand.Next(6) == 0)
46809 {
46810 int num179 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 279, velocity.X, velocity.Y, 100, default(Color), 1.2f);
46811 Main.dust[num179].noLightEmittence = true;
46812 Main.dust[num179].noGravity = true;
46813 Main.dust[num179].velocity *= 0.2f;
46814 }
46815 if (type == 357)
46816 {
46817 if (alpha < 170)
46818 {
46819 for (int num180 = 0; num180 < 10; num180++)
46820 {
46821 float x = position.X - velocity.X / 10f * (float)num180;
46822 float y = position.Y - velocity.Y / 10f * (float)num180;
46823 int num181 = Dust.NewDust(new Vector2(x, y), 1, 1, 206);
46824 Main.dust[num181].alpha = alpha;
46825 Main.dust[num181].position.X = x;
46826 Main.dust[num181].position.Y = y;
46827 Main.dust[num181].velocity *= 0f;
46828 Main.dust[num181].noGravity = true;
46829 }
46830 }
46831 if (alpha > 0)
46832 {
46833 alpha -= 25;
46834 }
46835 if (alpha < 0)
46836 {
46837 alpha = 0;
46838 }
46839 }
46840 else if (type == 207 || type == 837)
46841 {
46842 if (type == 207 && alpha < 170)
46843 {
46844 for (int num182 = 0; num182 < 10; num182++)
46845 {
46846 float x2 = position.X - velocity.X / 10f * (float)num182;
46847 float y2 = position.Y - velocity.Y / 10f * (float)num182;
46848 int num183 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 75);
46849 Main.dust[num183].alpha = alpha;
46850 Main.dust[num183].position.X = x2;
46851 Main.dust[num183].position.Y = y2;
46852 Main.dust[num183].velocity *= 0f;
46853 Main.dust[num183].noGravity = true;
46854 }
46855 }
46856 float num184 = (float)Math.Sqrt(velocity.X * velocity.X + velocity.Y * velocity.Y);
46857 float num185 = localAI[0];
46858 if (num185 == 0f)
46859 {
46860 localAI[0] = num184;
46861 num185 = num184;
46862 }
46863 if (alpha > 0)
46864 {
46865 alpha -= 25;
46866 }
46867 if (alpha < 0)
46868 {
46869 alpha = 0;
46870 }
46871 float num186 = position.X;
46872 float num187 = position.Y;
46873 float num188 = 300f;
46874 bool flag5 = false;
46875 int num189 = 0;
46876 if (ai[1] == 0f)
46877 {
46878 for (int num190 = 0; num190 < 200; num190++)
46879 {
46880 if (Main.npc[num190].CanBeChasedBy(this) && (ai[1] == 0f || ai[1] == (float)(num190 + 1)))
46881 {
46882 float num191 = Main.npc[num190].position.X + (float)(Main.npc[num190].width / 2);
46883 float num192 = Main.npc[num190].position.Y + (float)(Main.npc[num190].height / 2);
46884 float num193 = Math.Abs(position.X + (float)(width / 2) - num191) + Math.Abs(position.Y + (float)(height / 2) - num192);
46885 if (num193 < num188 && Collision.CanHit(new Vector2(position.X + (float)(width / 2), position.Y + (float)(height / 2)), 1, 1, Main.npc[num190].position, Main.npc[num190].width, Main.npc[num190].height))
46886 {
46887 num188 = num193;
46888 num186 = num191;
46889 num187 = num192;
46890 flag5 = true;
46891 num189 = num190;
46892 }
46893 }
46894 }
46895 if (flag5)
46896 {
46897 ai[1] = num189 + 1;
46898 }
46899 flag5 = false;
46900 }
46901 if (ai[1] > 0f)
46902 {
46903 int num194 = (int)(ai[1] - 1f);
46904 if (Main.npc[num194].active && Main.npc[num194].CanBeChasedBy(this, ignoreDontTakeDamage: true) && !Main.npc[num194].dontTakeDamage)
46905 {
46906 float num195 = Main.npc[num194].position.X + (float)(Main.npc[num194].width / 2);
46907 float num196 = Main.npc[num194].position.Y + (float)(Main.npc[num194].height / 2);
46908 if (Math.Abs(position.X + (float)(width / 2) - num195) + Math.Abs(position.Y + (float)(height / 2) - num196) < 1000f)
46909 {
46910 flag5 = true;
46911 num186 = Main.npc[num194].position.X + (float)(Main.npc[num194].width / 2);
46912 num187 = Main.npc[num194].position.Y + (float)(Main.npc[num194].height / 2);
46913 }
46914 }
46915 else
46916 {
46917 ai[1] = 0f;
46918 }
46919 }
46920 if (!friendly)
46921 {
46922 flag5 = false;
46923 }
46924 if (flag5)
46925 {
46926 float num197 = num185;
46927 Vector2 vector26 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
46928 float num198 = num186 - vector26.X;
46929 float num199 = num187 - vector26.Y;
46930 float num200 = (float)Math.Sqrt(num198 * num198 + num199 * num199);
46931 num200 = num197 / num200;
46932 num198 *= num200;
46933 num199 *= num200;
46934 int num201 = 8;
46935 if (type == 837)
46936 {
46937 num201 = 32;
46938 }
46939 velocity.X = (velocity.X * (float)(num201 - 1) + num198) / (float)num201;
46940 velocity.Y = (velocity.Y * (float)(num201 - 1) + num199) / (float)num201;
46941 }
46942 }
46943 else if (type == 81 || type == 91)
46944 {
46945 if (ai[0] >= 20f)
46946 {
46947 ai[0] = 20f;
46948 velocity.Y += 0.07f;
46949 }
46950 }
46951 else if (type == 174 || type == 605 || type == 920 || type == 921 || type == 926)
46952 {
46953 if (ai[0] >= 5f)
46954 {
46955 ai[0] = 5f;
46956 velocity.Y += 0.15f;
46957 }
46958 }
46959 else if (type == 937)
46960 {
46961 if (ai[0] >= 5f)
46962 {
46963 ai[0] = 5f;
46964 velocity.Y += 0.07f;
46965 }
46966 }
46967 else if (type == 962)
46968 {
46969 frame = (int)ai[1];
46970 if (localAI[0] == 0f)
46971 {
46972 localAI[0] = 1f;
46973 rotation = velocity.ToRotation();
46974 for (int num202 = 0; num202 < 5; num202++)
46975 {
46976 Dust dust20 = Dust.NewDustPerfect(base.Center + Main.rand.NextVector2Circular(24f, 24f), 16, velocity * MathHelper.Lerp(0.2f, 0.7f, Main.rand.NextFloat()));
46977 dust20.velocity += Main.rand.NextVector2Circular(0.5f, 0.5f);
46978 dust20.scale = 0.8f + Main.rand.NextFloat() * 0.5f;
46979 }
46980 for (int num203 = 0; num203 < 5; num203++)
46981 {
46982 Dust dust21 = Dust.NewDustPerfect(base.Center + Main.rand.NextVector2Circular(24f, 24f), 16, Main.rand.NextVector2Circular(2f, 2f) + velocity * MathHelper.Lerp(0.2f, 0.5f, Main.rand.NextFloat()));
46983 dust21.velocity += Main.rand.NextVector2Circular(0.5f, 0.5f);
46984 dust21.scale = 0.8f + Main.rand.NextFloat() * 0.5f;
46985 dust21.fadeIn = 1f;
46986 }
46987 }
46988 if (ai[0] >= 5f)
46989 {
46990 velocity.Y += 0.15f;
46991 }
46992 }
46993 else if (type == 337)
46994 {
46995 if (position.Y > Main.player[owner].position.Y - 300f)
46996 {
46997 tileCollide = true;
46998 }
46999 if ((double)position.Y < Main.worldSurface * 16.0)
47000 {
47001 tileCollide = true;
47002 }
47003 frame = (int)ai[1];
47004 if (Main.rand.Next(2) == 0)
47005 {
47006 int num204 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 197);
47007 Main.dust[num204].velocity *= 0.5f;
47008 Main.dust[num204].noGravity = true;
47009 }
47010 }
47011 else if (type == 645)
47012 {
47013 if (ai[1] != -1f && position.Y > ai[1])
47014 {
47015 tileCollide = true;
47016 }
47017 if (position.HasNaNs())
47018 {
47019 Kill();
47020 return;
47021 }
47022 bool num205 = WorldGen.SolidTile(Framing.GetTileSafely((int)position.X / 16, (int)position.Y / 16));
47023 Dust dust22 = Main.dust[Dust.NewDust(new Vector2(position.X, position.Y), width, height, 229)];
47024 dust22.position = base.Center;
47025 dust22.velocity = Vector2.Zero;
47026 dust22.noGravity = true;
47027 if (num205)
47028 {
47029 dust22.noLight = true;
47030 }
47031 if (ai[1] == -1f)
47032 {
47033 ai[0] += 1f;
47034 velocity = Vector2.Zero;
47035 tileCollide = false;
47036 penetrate = -1;
47037 position = base.Center;
47038 width = (height = 140);
47039 base.Center = position;
47040 alpha -= 10;
47041 if (alpha < 0)
47042 {
47043 alpha = 0;
47044 }
47045 if (++frameCounter >= MaxUpdates * 3)
47046 {
47047 frameCounter = 0;
47048 frame++;
47049 }
47050 if (ai[0] >= (float)(Main.projFrames[type] * MaxUpdates * 3))
47051 {
47052 Kill();
47053 }
47054 return;
47055 }
47056 alpha = 255;
47057 if (numUpdates == 0)
47058 {
47059 int num206 = -1;
47060 float num207 = 60f;
47061 for (int num208 = 0; num208 < 200; num208++)
47062 {
47063 NPC nPC2 = Main.npc[num208];
47064 if (nPC2.CanBeChasedBy(this))
47065 {
47066 float num209 = Distance(nPC2.Center);
47067 if (num209 < num207 && Collision.CanHitLine(base.Center, 0, 0, nPC2.Center, 0, 0))
47068 {
47069 num207 = num209;
47070 num206 = num208;
47071 }
47072 }
47073 }
47074 if (num206 != -1)
47075 {
47076 ai[0] = 0f;
47077 ai[1] = -1f;
47078 netUpdate = true;
47079 return;
47080 }
47081 }
47082 }
47083 else if (type >= 424 && type <= 426)
47084 {
47085 if (position.Y > Main.player[owner].position.Y - 300f)
47086 {
47087 tileCollide = true;
47088 }
47089 if ((double)position.Y < Main.worldSurface * 16.0)
47090 {
47091 tileCollide = true;
47092 }
47093 scale = ai[1];
47094 rotation += velocity.X * 2f;
47095 Vector2 vector27 = base.Center + Vector2.Normalize(velocity) * 10f;
47096 Dust obj16 = Main.dust[Dust.NewDust(position, width, height, 6)];
47097 obj16.position = vector27;
47098 obj16.velocity = velocity.RotatedBy(1.5707963705062866) * 0.33f + velocity / 4f;
47099 obj16.position += velocity.RotatedBy(1.5707963705062866);
47100 obj16.fadeIn = 0.5f;
47101 obj16.noGravity = true;
47102 Dust obj17 = Main.dust[Dust.NewDust(position, width, height, 6)];
47103 obj17.position = vector27;
47104 obj17.velocity = velocity.RotatedBy(-1.5707963705062866) * 0.33f + velocity / 4f;
47105 obj17.position += velocity.RotatedBy(-1.5707963705062866);
47106 obj17.fadeIn = 0.5f;
47107 obj17.noGravity = true;
47108 for (int num210 = 0; num210 < 1; num210++)
47109 {
47110 int num211 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6);
47111 Main.dust[num211].velocity *= 0.5f;
47112 Main.dust[num211].scale *= 1.3f;
47113 Main.dust[num211].fadeIn = 1f;
47114 Main.dust[num211].noGravity = true;
47115 }
47116 }
47117 else if (type == 344)
47118 {
47119 if (WorldGen.SolidTile((int)position.X / 16, (int)(position.Y + velocity.Y) / 16 + 1) || WorldGen.SolidTile((int)(position.X + (float)width) / 16, (int)(position.Y + velocity.Y) / 16 + 1))
47120 {
47121 Kill();
47122 return;
47123 }
47124 localAI[1] += 1f;
47125 if (localAI[1] > 5f)
47126 {
47127 alpha -= 50;
47128 if (alpha < 0)
47129 {
47130 alpha = 0;
47131 }
47132 }
47133 frame = (int)ai[1];
47134 if (localAI[1] >= 20f)
47135 {
47136 velocity.Y += 0.15f;
47137 velocity.X *= 0.96f;
47138 }
47139 if (localAI[1] >= 25f)
47140 {
47141 localAI[1] = 20f;
47143 float num212 = 0f;
47144 int num213 = 60;
47145 for (int num214 = 0; num214 < 1000; num214++)
47146 {
47147 Projectile projectile = Main.projectile[num214];
47148 if (projectile.whoAmI != whoAmI && projectile.active && projectile.type == type)
47149 {
47150 Vector2 vector28 = projectile.position - position;
47151 if (!(vector28.Length() > (float)num213))
47152 {
47153 num212 += 1f;
47154 float num215 = Utils.Remap(vector28.Length(), 0f, num213, 1f, 0f);
47155 zero.X += (float)(-Math.Sign(vector28.X)) * num215;
47156 }
47157 }
47158 }
47159 if (num212 > 0f)
47160 {
47162 vector29.Y = 0f;
47163 if (vector29.X == 0f)
47164 {
47165 vector29.X = 1f;
47166 }
47167 velocity += vector29 * 0.25f;
47168 }
47169 }
47170 }
47171 else if (type == 336 || type == 345)
47172 {
47173 if (type == 345 && localAI[0] == 0f)
47174 {
47175 localAI[0] = 1f;
47177 }
47178 if (ai[0] >= 50f)
47179 {
47180 ai[0] = 50f;
47181 velocity.Y += 0.5f;
47182 }
47183 }
47184 else if (type == 246)
47185 {
47186 alpha -= 20;
47187 if (alpha < 0)
47188 {
47189 alpha = 0;
47190 }
47191 if (ai[0] >= 60f)
47192 {
47193 ai[0] = 60f;
47194 velocity.Y += 0.15f;
47195 }
47196 }
47197 else if (type == 311)
47198 {
47199 if (alpha > 0)
47200 {
47201 alpha -= 50;
47202 }
47203 if (alpha < 0)
47204 {
47205 alpha = 0;
47206 }
47207 if (ai[0] >= 30f)
47208 {
47209 ai[0] = 30f;
47210 if (ai[1] == 0f)
47211 {
47212 ai[1] = 1f;
47213 }
47214 velocity.Y += 0.5f;
47215 }
47216 }
47217 else if (type == 312)
47218 {
47219 if (ai[0] >= 5f)
47220 {
47221 alpha = 0;
47222 }
47223 if (ai[0] >= 20f)
47224 {
47225 ai[0] = 30f;
47226 velocity.Y += 0.5f;
47227 }
47228 Lighting.AddLight(base.Center, 0.6f, 0.4f, 0.3f);
47229 }
47230 else if (type != 239 && type != 264)
47231 {
47232 if (type == 176)
47233 {
47234 if (ai[0] >= 15f)
47235 {
47236 ai[0] = 15f;
47237 velocity.Y += 0.05f;
47238 }
47239 }
47240 else if (type == 275 || type == 276)
47241 {
47242 if (alpha > 0)
47243 {
47244 alpha -= 30;
47245 }
47246 if (alpha < 0)
47247 {
47248 alpha = 0;
47249 }
47250 if (ai[0] >= 35f)
47251 {
47252 ai[0] = 35f;
47253 velocity.Y += 0.025f;
47254 }
47255 if (Main.expertMode)
47256 {
47257 float num216 = 18f;
47258 int num217 = Player.FindClosest(base.Center, 1, 1);
47259 Vector2 vector30 = Main.player[num217].Center - base.Center;
47260 vector30.Normalize();
47261 vector30 *= num216;
47262 int num218 = 70;
47263 velocity = (velocity * (num218 - 1) + vector30) / num218;
47264 if (velocity.Length() < 14f)
47265 {
47266 velocity.Normalize();
47267 velocity *= 14f;
47268 }
47269 tileCollide = false;
47270 if (timeLeft > 180)
47271 {
47272 timeLeft = 180;
47273 }
47274 }
47275 }
47276 else if (type == 172)
47277 {
47278 if (ai[0] >= 17f)
47279 {
47280 ai[0] = 17f;
47281 velocity.Y += 0.085f;
47282 }
47283 }
47284 else if (type == 117)
47285 {
47286 if (ai[0] >= 35f)
47287 {
47288 ai[0] = 35f;
47289 velocity.Y += 0.06f;
47290 }
47291 }
47292 else if (type == 120)
47293 {
47294 int num219 = Dust.NewDust(new Vector2(position.X - velocity.X, position.Y - velocity.Y), width, height, 67, velocity.X, velocity.Y, 100, default(Color), 1.2f);
47295 Main.dust[num219].noGravity = true;
47296 Main.dust[num219].velocity *= 0.3f;
47297 if (ai[0] >= 30f)
47298 {
47299 ai[0] = 30f;
47300 velocity.Y += 0.05f;
47301 }
47302 }
47303 else if (type == 195)
47304 {
47305 int num220 = 40;
47306 if (ai[0] >= (float)num220)
47307 {
47308 ai[0] = num220;
47309 velocity.Y += 0.15f;
47310 tileCollide = true;
47311 }
47312 else
47313 {
47314 tileCollide = velocity.Y > 0f;
47315 }
47316 }
47317 else if (type == 267 || type == 477 || type == 478 || type == 479)
47318 {
47319 localAI[0] += 1f;
47320 if (localAI[0] > 3f)
47321 {
47322 alpha = 0;
47323 }
47324 if (ai[0] >= 20f)
47325 {
47326 ai[0] = 20f;
47327 if (type != 477)
47328 {
47329 velocity.Y += 0.075f;
47330 }
47331 }
47332 if (type == 479 && Main.myPlayer == owner)
47333 {
47334 if (ai[1] >= 0f)
47335 {
47336 maxPenetrate = (penetrate = -1);
47337 }
47338 else if (penetrate < 0)
47339 {
47340 maxPenetrate = (penetrate = 1);
47341 }
47342 if (ai[1] >= 0f)
47343 {
47344 ai[1] += 1f;
47345 }
47346 if (ai[1] > (float)Main.rand.Next(5, 30))
47347 {
47348 ai[1] = -1000f;
47349 float num221 = velocity.Length();
47350 Vector2 vector31 = velocity;
47351 vector31.Normalize();
47352 int num222 = Main.rand.Next(2, 4);
47353 if (Main.rand.Next(4) == 0)
47354 {
47355 num222++;
47356 }
47357 for (int num223 = 0; num223 < num222; num223++)
47358 {
47359 Vector2 vector32 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101));
47360 vector32.Normalize();
47361 vector32 += vector31 * 2f;
47362 vector32.Normalize();
47363 vector32 *= num221;
47364 NewProjectile(GetProjectileSource_FromThis(), base.Center.X, base.Center.Y, vector32.X, vector32.Y, type, damage, knockBack, owner, 0f, -1000f);
47365 }
47366 }
47367 }
47368 if (type == 478 && Main.myPlayer == owner)
47369 {
47370 ai[1] += 1f;
47371 if (ai[1] > (float)Main.rand.Next(5, 20))
47372 {
47373 if (timeLeft > 40)
47374 {
47375 timeLeft -= 20;
47376 }
47377 ai[1] = 0f;
47378 NewProjectile(GetProjectileSource_FromThis(), base.Center.X, base.Center.Y, 0f, 0f, 480, (int)((double)damage * 0.8), knockBack * 0.5f, owner);
47379 }
47380 }
47381 }
47382 else if (type == 408)
47383 {
47384 if (ai[0] >= 45f)
47385 {
47386 ai[0] = 45f;
47387 velocity.Y += 0.05f;
47388 }
47389 }
47390 else if (type == 616)
47391 {
47392 if (alpha < 170)
47393 {
47394 float num224 = 3f;
47395 for (int num225 = 0; (float)num225 < num224; num225++)
47396 {
47397 int num226 = Dust.NewDust(position, 1, 1, 229);
47398 Main.dust[num226].position = base.Center - velocity / num224 * num225;
47399 Main.dust[num226].velocity *= 0f;
47400 Main.dust[num226].noGravity = true;
47401 Main.dust[num226].alpha = 200;
47402 Main.dust[num226].scale = 0.5f;
47403 }
47404 }
47405 float num227 = (float)Math.Sqrt(velocity.X * velocity.X + velocity.Y * velocity.Y);
47406 float num228 = localAI[0];
47407 if (num228 == 0f)
47408 {
47409 localAI[0] = num227;
47410 num228 = num227;
47411 }
47412 if (alpha > 0)
47413 {
47414 alpha -= 25;
47415 }
47416 if (alpha < 0)
47417 {
47418 alpha = 0;
47419 }
47420 float num229 = position.X;
47421 float num230 = position.Y;
47422 float num231 = 800f;
47423 bool flag6 = false;
47424 int num232 = 0;
47425 ai[0] += 1f;
47426 if (ai[0] > 20f)
47427 {
47428 ai[0] -= 1f;
47429 if (ai[1] == 0f)
47430 {
47431 for (int num233 = 0; num233 < 200; num233++)
47432 {
47433 if (Main.npc[num233].CanBeChasedBy(this) && (ai[1] == 0f || ai[1] == (float)(num233 + 1)))
47434 {
47435 float num234 = Main.npc[num233].position.X + (float)(Main.npc[num233].width / 2);
47436 float num235 = Main.npc[num233].position.Y + (float)(Main.npc[num233].height / 2);
47437 float num236 = Math.Abs(position.X + (float)(width / 2) - num234) + Math.Abs(position.Y + (float)(height / 2) - num235);
47438 if (num236 < num231 && Collision.CanHit(new Vector2(position.X + (float)(width / 2), position.Y + (float)(height / 2)), 1, 1, Main.npc[num233].position, Main.npc[num233].width, Main.npc[num233].height))
47439 {
47440 num231 = num236;
47441 num229 = num234;
47442 num230 = num235;
47443 flag6 = true;
47444 num232 = num233;
47445 }
47446 }
47447 }
47448 if (flag6)
47449 {
47450 ai[1] = num232 + 1;
47451 }
47452 flag6 = false;
47453 }
47454 if (ai[1] != 0f)
47455 {
47456 int num237 = (int)(ai[1] - 1f);
47457 if (Main.npc[num237].active && Main.npc[num237].CanBeChasedBy(this, ignoreDontTakeDamage: true))
47458 {
47459 float num238 = Main.npc[num237].position.X + (float)(Main.npc[num237].width / 2);
47460 float num239 = Main.npc[num237].position.Y + (float)(Main.npc[num237].height / 2);
47461 if (Math.Abs(position.X + (float)(width / 2) - num238) + Math.Abs(position.Y + (float)(height / 2) - num239) < 1000f)
47462 {
47463 flag6 = true;
47464 num229 = Main.npc[num237].position.X + (float)(Main.npc[num237].width / 2);
47465 num230 = Main.npc[num237].position.Y + (float)(Main.npc[num237].height / 2);
47466 }
47467 }
47468 }
47469 if (!friendly)
47470 {
47471 flag6 = false;
47472 }
47473 if (flag6)
47474 {
47475 float num240 = num228;
47476 Vector2 vector33 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
47477 float num241 = num229 - vector33.X;
47478 float num242 = num230 - vector33.Y;
47479 float num243 = (float)Math.Sqrt(num241 * num241 + num242 * num242);
47480 num243 = num240 / num243;
47481 num241 *= num243;
47482 num242 *= num243;
47483 int num244 = 8;
47484 velocity.X = (velocity.X * (float)(num244 - 1) + num241) / (float)num244;
47485 velocity.Y = (velocity.Y * (float)(num244 - 1) + num242) / (float)num244;
47486 }
47487 }
47488 }
47489 else if (type == 507 || type == 508 || type == 662 || type == 680 || type == 685)
47490 {
47491 if (ai[0] > 60f)
47492 {
47493 velocity.X *= 0.98f;
47494 velocity.Y += 0.3f;
47495 }
47496 }
47497 else if (type == 495)
47498 {
47499 int num245 = Dust.NewDust(new Vector2(position.X - velocity.X, position.Y - velocity.Y), width, height, 27, velocity.X, velocity.Y, 100, default(Color), 1.2f);
47500 Main.dust[num245].noGravity = true;
47501 Main.dust[num245].velocity *= 0.3f;
47502 if (ai[0] >= 30f)
47503 {
47504 ai[0] = 30f;
47505 velocity.Y += 0.04f;
47506 }
47507 }
47508 else if (type == 498)
47509 {
47510 if (localAI[0] == 0f)
47511 {
47512 localAI[0] += 1f;
47514 }
47515 ai[0] += 1f;
47516 if (ai[0] >= 50f)
47517 {
47518 velocity.X *= 0.98f;
47519 velocity.Y += 0.15f;
47520 rotation += (float)direction * 0.5f;
47521 }
47522 else
47523 {
47524 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 1.57f;
47525 }
47526 }
47527 else if (type == 437)
47528 {
47529 if (ai[0] >= 12f)
47530 {
47531 if (ai[0] >= 20f)
47532 {
47533 Kill();
47534 }
47535 alpha += 30;
47536 }
47537 }
47538 else if (type != 442 && type != 634 && type != 635 && type != 675)
47539 {
47540 if (type == 686 || type == 711)
47541 {
47542 if (ai[0] >= 10f)
47543 {
47544 velocity.Y += 0.1f;
47545 }
47546 if (ai[0] >= 20f)
47547 {
47548 velocity.Y += 0.1f;
47549 }
47550 if (ai[0] > 20f)
47551 {
47552 ai[0] = 20f;
47553 }
47554 velocity.X *= 0.99f;
47555 if (velocity.Y > 32f)
47556 {
47557 velocity.Y = 32f;
47558 }
47559 }
47560 else if (type == 639)
47561 {
47562 if (timeLeft <= MaxUpdates * 45 - 14)
47563 {
47564 velocity.Y += 0.1f;
47565 }
47566 }
47567 else if (type == 710)
47568 {
47569 if (ai[0] >= 0f)
47570 {
47571 ai[0] += 1f;
47572 if (ai[0] >= 20f)
47573 {
47574 velocity.Y += 0.2f;
47575 if (velocity.Y > 0f)
47576 {
47577 velocity.X *= 0.98f;
47578 }
47579 if (velocity.Y > 12f)
47580 {
47581 velocity.Y = 12f;
47582 }
47583 }
47584 }
47585 }
47586 else if (ai[0] >= 15f)
47587 {
47588 ai[0] = 15f;
47589 if (flag4)
47590 {
47591 velocity.Y -= 0.1f;
47592 }
47593 else
47594 {
47595 velocity.Y += 0.1f;
47596 }
47597 }
47598 }
47599 }
47600 if (type == 921 || type == 926 || type == 937)
47601 {
47602 rotation += (Math.Abs(velocity.X) + Math.Abs(velocity.Y)) * 0.05f;
47603 }
47604 else if (type == 248)
47605 {
47606 if (velocity.X < 0f)
47607 {
47608 rotation -= (Math.Abs(velocity.X) + Math.Abs(velocity.Y)) * 0.05f;
47609 }
47610 else
47611 {
47612 rotation += (Math.Abs(velocity.X) + Math.Abs(velocity.Y)) * 0.05f;
47613 }
47614 }
47615 else if (type == 270 || type == 585 || type == 601 || type == 706 || type == 837)
47616 {
47617 spriteDirection = direction;
47618 if (direction < 0)
47619 {
47620 rotation = (float)Math.Atan2(0f - velocity.Y, 0f - velocity.X);
47621 }
47622 else
47623 {
47624 rotation = (float)Math.Atan2(velocity.Y, velocity.X);
47625 }
47626 }
47627 else if (type == 311)
47628 {
47629 if (ai[1] != 0f)
47630 {
47631 rotation += velocity.X * 0.1f + (float)Main.rand.Next(-10, 11) * 0.025f;
47632 }
47633 else
47634 {
47635 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 1.57f;
47636 }
47637 }
47638 else if (type == 312)
47639 {
47640 rotation += velocity.X * 0.02f;
47641 }
47642 else if (type == 675)
47643 {
47644 rotation += velocity.X * 0.03f;
47645 }
47646 else if (type != 676)
47647 {
47648 if (type == 408)
47649 {
47650 rotation = velocity.ToRotation();
47651 if (direction == -1)
47652 {
47653 rotation += (float)Math.PI;
47654 }
47655 }
47656 else if (type == 435 || type == 459 || type == 682 || type == 709)
47657 {
47658 rotation = velocity.ToRotation();
47659 if (direction == -1)
47660 {
47661 rotation += (float)Math.PI;
47662 }
47663 }
47664 else if (type == 660)
47665 {
47666 rotation = velocity.ToRotation() + (float)Math.PI / 4f;
47667 }
47668 else if (type == 662 || type == 685)
47669 {
47670 rotation = velocity.ToRotation() - (float)Math.PI - (float)Math.PI / 4f;
47671 }
47672 else if (type == 680 || type == 684 || type == 686 || type == 711 || type == 712)
47673 {
47674 rotation = velocity.ToRotation() + (float)Math.PI / 2f;
47675 }
47676 else if (type == 436)
47677 {
47678 rotation = velocity.ToRotation();
47679 rotation += (float)Math.PI;
47680 if (direction == -1)
47681 {
47682 rotation += (float)Math.PI;
47683 }
47684 }
47685 else if (type == 469)
47686 {
47687 if (velocity.X > 0f)
47688 {
47689 spriteDirection = -1;
47690 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 1.57f;
47691 }
47692 else
47693 {
47694 spriteDirection = 1;
47695 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 1.57f;
47696 }
47697 }
47698 else if (type == 477)
47699 {
47700 if (localAI[1] < 5f)
47701 {
47702 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 1.57f;
47703 localAI[1] += 1f;
47704 }
47705 else
47706 {
47707 rotation = (rotation * 2f + (float)Math.Atan2(velocity.Y, velocity.X) + 1.57f) / 3f;
47708 }
47709 }
47710 else if (type == 532)
47711 {
47712 rotation += 0.2f + Math.Abs(velocity.X) * 0.1f;
47713 }
47714 else if (type == 483)
47715 {
47716 rotation += velocity.X * 0.05f;
47717 }
47718 else if (type == 772)
47719 {
47720 rotation += (float)Math.Sign(velocity.X) * (Math.Abs(velocity.X) + Math.Abs(velocity.Y)) * 0.05f;
47721 }
47722 else if (type == 485)
47723 {
47724 Vector2 vector34 = new Vector2(ai[0], ai[1]);
47725 velocity = (velocity * 39f + vector34) / 40f;
47726 int num246 = Dust.NewDust(position, width, height, 6);
47727 Main.dust[num246].noGravity = true;
47728 Main.dust[num246].velocity *= 0.2f;
47729 Main.dust[num246].position = (Main.dust[num246].position + base.Center) / 2f;
47730 frameCounter++;
47731 if (frameCounter >= 2)
47732 {
47733 frameCounter = 0;
47734 frame++;
47735 if (frame >= 5)
47736 {
47737 frame = 0;
47738 }
47739 }
47740 if (velocity.X < 0f)
47741 {
47742 spriteDirection = -1;
47743 rotation = (float)Math.Atan2(0f - velocity.Y, 0f - velocity.X);
47744 }
47745 else
47746 {
47747 spriteDirection = 1;
47748 rotation = (float)Math.Atan2(velocity.Y, velocity.X);
47749 }
47750 }
47751 else if (type == 640)
47752 {
47753 if (velocity != Vector2.Zero)
47754 {
47755 rotation = velocity.ToRotation() + (float)Math.PI / 2f;
47756 }
47757 }
47758 else if (type == 325)
47759 {
47760 rotation = velocity.ToRotation() - (float)Math.PI / 2f;
47761 }
47762 else if (type != 344 && type != 498)
47763 {
47764 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 1.57f;
47765 }
47766 }
47767 bool flag7 = true;
47768 int num247 = type;
47769 if (num247 == 577)
47770 {
47771 flag7 = false;
47772 }
47773 if (flag7)
47774 {
47775 if (flag4 && velocity.Y < -16f)
47776 {
47777 velocity.Y = -16f;
47778 }
47779 if (velocity.Y > 16f)
47780 {
47781 velocity.Y = 16f;
47782 }
47783 }
47784 }
47785
47786 private void AI_010()
47787 {
47788 if (type == 31 && ai[0] != 2f)
47789 {
47790 if (Main.rand.Next(2) == 0)
47791 {
47792 int num = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 32, 0f, velocity.Y / 2f);
47793 Main.dust[num].velocity.X *= 0.4f;
47794 }
47795 }
47796 else if (type == 39)
47797 {
47798 if (Main.rand.Next(2) == 0)
47799 {
47800 int num2 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 38, 0f, velocity.Y / 2f);
47801 Main.dust[num2].velocity.X *= 0.4f;
47802 }
47803 }
47804 else if (type >= 411 && type <= 414)
47805 {
47806 if (Main.rand.Next(3) == 0)
47807 {
47808 int num3 = 9;
47809 if (type == 412 || type == 414)
47810 {
47811 num3 = 11;
47812 }
47813 if (type == 413)
47814 {
47815 num3 = 19;
47816 }
47817 int num4 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, num3, 0f, velocity.Y / 2f);
47818 Main.dust[num4].noGravity = true;
47819 Main.dust[num4].velocity -= velocity * 0.5f;
47820 }
47821 }
47822 else if (type == 40)
47823 {
47824 if (Main.rand.Next(2) == 0)
47825 {
47826 int num5 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 36, 0f, velocity.Y / 2f);
47827 Main.dust[num5].velocity *= 0.4f;
47828 }
47829 }
47830 else if (type == 42 || type == 31)
47831 {
47832 if (Main.rand.Next(2) == 0)
47833 {
47834 int num6 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 32);
47835 Main.dust[num6].velocity.X *= 0.4f;
47836 }
47837 }
47838 else if (type == 56 || type == 65)
47839 {
47840 if (Main.rand.Next(2) == 0)
47841 {
47842 int num7 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 14);
47843 Main.dust[num7].velocity.X *= 0.4f;
47844 }
47845 }
47846 else if (type == 67 || type == 68)
47847 {
47848 if (Main.rand.Next(2) == 0)
47849 {
47850 int num8 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 51);
47851 Main.dust[num8].velocity.X *= 0.4f;
47852 }
47853 }
47854 else if (type == 71)
47855 {
47856 if (Main.rand.Next(2) == 0)
47857 {
47858 int num9 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 53);
47859 Main.dust[num9].velocity.X *= 0.4f;
47860 }
47861 }
47862 else if (type == 179)
47863 {
47864 if (Main.rand.Next(2) == 0)
47865 {
47866 int num10 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 149);
47867 Main.dust[num10].velocity.X *= 0.4f;
47868 }
47869 }
47870 else if (type == 241 || type == 354)
47871 {
47872 if (Main.rand.Next(2) == 0)
47873 {
47874 int num11 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 36);
47875 Main.dust[num11].velocity.X *= 0.4f;
47876 }
47877 }
47878 else if (type >= 736 && type <= 738)
47879 {
47880 if (Main.rand.Next(40) == 0)
47881 {
47882 int num12 = Dust.NewDust(position, width, height, type - 736 + 275);
47883 if (num12 >= 0)
47884 {
47885 Main.dust[num12].velocity = Main.dust[num12].velocity * 0.5f + velocity * 0.5f;
47886 }
47887 }
47888 }
47889 else if (type != 109 && Main.rand.Next(20) == 0)
47890 {
47891 Dust.NewDust(new Vector2(position.X, position.Y), width, height, 0);
47892 }
47893 if (type >= 736 && type <= 738)
47894 {
47895 if (localAI[0] == 0f)
47896 {
47897 frame = Main.rand.Next(3);
47898 scale = 1f - (float)Main.rand.Next(30) * 0.01f;
47899 }
47900 localAI[0] += 1f;
47901 }
47902 tileCollide = true;
47903 localAI[1] = 0f;
47904 if (Main.myPlayer == owner && ai[0] == 0f)
47905 {
47906 tileCollide = false;
47907 if (Main.player[owner].channel && (type < 736 || type > 738) && type != 40)
47908 {
47909 localAI[1] = -1f;
47910 float num13 = 12f;
47911 Vector2 vector = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
47912 float num14 = (float)Main.mouseX + Main.screenPosition.X - vector.X;
47913 float num15 = (float)Main.mouseY + Main.screenPosition.Y - vector.Y;
47914 if (Main.player[owner].gravDir == -1f)
47915 {
47916 num15 = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - vector.Y;
47917 }
47918 float num16 = (float)Math.Sqrt(num14 * num14 + num15 * num15);
47919 num16 = (float)Math.Sqrt(num14 * num14 + num15 * num15);
47920 if (num16 > num13)
47921 {
47922 num16 = num13 / num16;
47923 num14 *= num16;
47924 num15 *= num16;
47925 if (num14 != velocity.X || num15 != velocity.Y)
47926 {
47927 netUpdate = true;
47928 }
47929 velocity.X = num14;
47930 velocity.Y = num15;
47931 }
47932 else
47933 {
47934 if (num14 != velocity.X || num15 != velocity.Y)
47935 {
47936 netUpdate = true;
47937 }
47938 velocity.X = num14;
47939 velocity.Y = num15;
47940 }
47941 }
47942 else
47943 {
47944 ai[0] = 1f;
47945 netUpdate = true;
47946 }
47947 }
47948 if (ai[0] == 1f && type != 109)
47949 {
47950 if (type == 42 || type == 65 || type == 68 || type == 354)
47951 {
47952 ai[1] += 1f;
47953 if (ai[1] >= 60f)
47954 {
47955 ai[1] = 60f;
47956 velocity.Y += 0.2f;
47957 }
47958 }
47959 else
47960 {
47961 velocity.Y += 0.41f;
47962 }
47963 }
47964 else if (ai[0] == 2f && type != 109)
47965 {
47966 velocity.Y += 0.2f;
47967 if ((double)velocity.X < -0.04)
47968 {
47969 velocity.X += 0.04f;
47970 }
47971 else if ((double)velocity.X > 0.04)
47972 {
47973 velocity.X -= 0.04f;
47974 }
47975 else
47976 {
47977 velocity.X = 0f;
47978 }
47979 }
47980 if (owner == Main.myPlayer && tileCollide)
47981 {
47982 for (int i = (int)(position.X / 16f); i <= (int)((position.X + (float)width) / 16f); i++)
47983 {
47984 for (int j = (int)(position.Y / 16f); j <= (int)((position.Y + (float)height) / 16f); j++)
47985 {
47986 if (!WorldGen.InWorld(i, j))
47987 {
47988 continue;
47989 }
47990 Tile tile = Main.tile[i, j];
47991 if (tile == null || !tile.active())
47992 {
47993 continue;
47994 }
47995 if ((tile.type >= 185 && tile.type <= 187) || tile.type == 165 || tile.type == 12 || tile.type == 665 || tile.type == 639 || tile.type == 105 || tile.type == 178)
47996 {
47997 WorldGen.KillTile(i, j);
47998 }
47999 else if (tile.topSlope() && !TileID.Sets.Platforms[tile.type])
48000 {
48001 WorldGen.SlopeTile(i, j);
48002 if (Main.netMode != 0)
48003 {
48004 NetMessage.SendData(17, -1, -1, null, 14, i, j);
48005 }
48006 position.Y -= 16f;
48007 }
48008 }
48009 }
48010 }
48011 if (type >= 736 && type <= 738)
48012 {
48013 if (frame == 0)
48014 {
48015 rotation -= 0.1f;
48016 }
48017 else if (frame == 1)
48018 {
48019 rotation += 0.1f;
48020 }
48021 else
48022 {
48023 rotation += 0.15f;
48024 }
48025 if (velocity.Y > 10f)
48026 {
48027 velocity.Y = 10f;
48028 }
48029 }
48030 else
48031 {
48032 rotation += 0.1f;
48033 if (velocity.Y > 10f)
48034 {
48035 velocity.Y = 10f;
48036 }
48037 }
48038 }
48039
48040 private void AI_026()
48041 {
48042 if (!Main.player[owner].active)
48043 {
48044 active = false;
48045 return;
48046 }
48047 bool flag = false;
48048 bool flag2 = false;
48049 bool flag3 = false;
48050 bool flag4 = false;
48051 bool flag5 = false;
48052 int num = 85;
48053 bool flag6 = type >= 191 && type <= 194;
48054 if (type == 324)
48055 {
48056 num = 120;
48057 }
48058 if (type == 112)
48059 {
48060 num = 100;
48061 }
48062 if (type == 127)
48063 {
48064 num = 50;
48065 }
48066 switch (type)
48067 {
48068 case 816:
48069 case 821:
48070 case 825:
48071 case 854:
48072 case 858:
48073 case 859:
48074 case 860:
48075 case 885:
48076 case 889:
48077 case 891:
48078 case 897:
48079 case 899:
48080 case 900:
48081 case 934:
48082 num = 95;
48083 break;
48084 case 884:
48085 case 890:
48086 num = 80;
48087 break;
48088 case 881:
48089 num = 95;
48090 if (Main.player[owner].ownedProjectileCounts[881] > 0)
48091 {
48092 num = 120;
48093 }
48094 break;
48095 }
48096 if (type == 960)
48097 {
48098 Main.CurrentFrameFlags.HadAnActiveInteractibleProjectile = true;
48099 flag = true;
48100 }
48101 if (flag6)
48102 {
48103 if (lavaWet)
48104 {
48105 ai[0] = 1f;
48106 ai[1] = 0f;
48107 }
48108 num = 60 + 30 * minionPos;
48109 }
48110 else if (type == 266)
48111 {
48112 num = 60 + 30 * minionPos;
48113 }
48114 bool flag7 = ai[0] == -1f || ai[0] == -2f;
48115 bool num2 = ai[0] == -1f;
48116 bool flag8 = ai[0] == -2f;
48117 if (type == 111)
48118 {
48119 if (Main.player[owner].dead)
48120 {
48121 Main.player[owner].bunny = false;
48122 }
48123 if (Main.player[owner].bunny)
48124 {
48125 timeLeft = 2;
48126 }
48127 }
48128 if (type == 112)
48129 {
48130 if (Main.player[owner].dead)
48131 {
48132 Main.player[owner].penguin = false;
48133 }
48134 if (Main.player[owner].penguin)
48135 {
48136 timeLeft = 2;
48137 }
48138 }
48139 if (type == 334)
48140 {
48141 if (Main.player[owner].dead)
48142 {
48143 Main.player[owner].puppy = false;
48144 }
48145 if (Main.player[owner].puppy)
48146 {
48147 timeLeft = 2;
48148 }
48149 }
48150 if (type == 353)
48151 {
48152 if (Main.player[owner].dead)
48153 {
48154 Main.player[owner].grinch = false;
48155 }
48156 if (Main.player[owner].grinch)
48157 {
48158 timeLeft = 2;
48159 }
48160 }
48161 if (type == 127)
48162 {
48163 if (Main.player[owner].dead)
48164 {
48165 Main.player[owner].turtle = false;
48166 }
48167 if (Main.player[owner].turtle)
48168 {
48169 timeLeft = 2;
48170 }
48171 }
48172 if (type == 175)
48173 {
48174 if (Main.player[owner].dead)
48175 {
48176 Main.player[owner].eater = false;
48177 }
48178 if (Main.player[owner].eater)
48179 {
48180 timeLeft = 2;
48181 }
48182 }
48183 if (type == 197)
48184 {
48185 if (Main.player[owner].dead)
48186 {
48187 Main.player[owner].skeletron = false;
48188 }
48189 if (Main.player[owner].skeletron)
48190 {
48191 timeLeft = 2;
48192 }
48193 }
48194 if (type == 198)
48195 {
48196 if (Main.player[owner].dead)
48197 {
48198 Main.player[owner].hornet = false;
48199 }
48200 if (Main.player[owner].hornet)
48201 {
48202 timeLeft = 2;
48203 }
48204 }
48205 if (type == 199)
48206 {
48207 if (Main.player[owner].dead)
48208 {
48209 Main.player[owner].tiki = false;
48210 }
48211 if (Main.player[owner].tiki)
48212 {
48213 timeLeft = 2;
48214 }
48215 }
48216 if (type == 200)
48217 {
48218 if (Main.player[owner].dead)
48219 {
48220 Main.player[owner].lizard = false;
48221 }
48222 if (Main.player[owner].lizard)
48223 {
48224 timeLeft = 2;
48225 }
48226 }
48227 if (type == 208)
48228 {
48229 if (Main.player[owner].dead)
48230 {
48231 Main.player[owner].parrot = false;
48232 }
48233 if (Main.player[owner].parrot)
48234 {
48235 timeLeft = 2;
48236 }
48237 }
48238 if (type == 209)
48239 {
48240 if (Main.player[owner].dead)
48241 {
48242 Main.player[owner].truffle = false;
48243 }
48244 if (Main.player[owner].truffle)
48245 {
48246 timeLeft = 2;
48247 }
48248 }
48249 if (type == 210)
48250 {
48251 if (Main.player[owner].dead)
48252 {
48253 Main.player[owner].sapling = false;
48254 }
48255 if (Main.player[owner].sapling)
48256 {
48257 timeLeft = 2;
48258 }
48259 }
48260 if (type == 324)
48261 {
48262 if (Main.player[owner].dead)
48263 {
48264 Main.player[owner].cSapling = false;
48265 }
48266 if (Main.player[owner].cSapling)
48267 {
48268 timeLeft = 2;
48269 }
48270 }
48271 if (type == 313)
48272 {
48273 if (Main.player[owner].dead)
48274 {
48275 Main.player[owner].spider = false;
48276 }
48277 if (Main.player[owner].spider)
48278 {
48279 timeLeft = 2;
48280 }
48281 }
48282 if (type == 314)
48283 {
48284 if (Main.player[owner].dead)
48285 {
48286 Main.player[owner].squashling = false;
48287 }
48288 if (Main.player[owner].squashling)
48289 {
48290 timeLeft = 2;
48291 }
48292 }
48293 if (type == 211)
48294 {
48295 if (Main.player[owner].dead)
48296 {
48297 Main.player[owner].wisp = false;
48298 }
48299 if (Main.player[owner].wisp)
48300 {
48301 timeLeft = 2;
48302 }
48303 }
48304 if (type == 236)
48305 {
48306 if (Main.player[owner].dead)
48307 {
48308 Main.player[owner].dino = false;
48309 }
48310 if (Main.player[owner].dino)
48311 {
48312 timeLeft = 2;
48313 }
48314 }
48315 if (type == 499)
48316 {
48317 if (Main.player[owner].dead)
48318 {
48319 Main.player[owner].babyFaceMonster = false;
48320 }
48321 if (Main.player[owner].babyFaceMonster)
48322 {
48323 timeLeft = 2;
48324 }
48325 }
48326 if (type == 765)
48327 {
48328 if (Main.player[owner].dead)
48329 {
48330 Main.player[owner].petFlagSugarGlider = false;
48331 }
48332 if (Main.player[owner].petFlagSugarGlider)
48333 {
48334 timeLeft = 2;
48335 }
48336 }
48337 if (type == 266)
48338 {
48339 if (Main.player[owner].dead)
48340 {
48341 Main.player[owner].slime = false;
48342 }
48343 if (Main.player[owner].slime)
48344 {
48345 timeLeft = 2;
48346 }
48347 }
48348 if (type == 268)
48349 {
48350 if (Main.player[owner].dead)
48351 {
48352 Main.player[owner].eyeSpring = false;
48353 }
48354 if (Main.player[owner].eyeSpring)
48355 {
48356 timeLeft = 2;
48357 }
48358 }
48359 if (type == 269)
48360 {
48361 if (Main.player[owner].dead)
48362 {
48363 Main.player[owner].snowman = false;
48364 }
48365 if (Main.player[owner].snowman)
48366 {
48367 timeLeft = 2;
48368 }
48369 }
48370 if (type == 319)
48371 {
48372 if (Main.player[owner].dead)
48373 {
48374 Main.player[owner].blackCat = false;
48375 }
48376 if (Main.player[owner].blackCat)
48377 {
48378 timeLeft = 2;
48379 }
48380 }
48381 if (type == 380)
48382 {
48383 if (Main.player[owner].dead)
48384 {
48385 Main.player[owner].zephyrfish = false;
48386 }
48387 if (Main.player[owner].zephyrfish)
48388 {
48389 timeLeft = 2;
48390 }
48391 }
48392 if (type == 774)
48393 {
48394 if (Main.player[owner].dead)
48395 {
48396 Main.player[owner].petFlagBabyShark = false;
48397 }
48398 if (Main.player[owner].petFlagBabyShark)
48399 {
48400 timeLeft = 2;
48401 }
48402 }
48403 if (type == 815)
48404 {
48405 if (Main.player[owner].dead)
48406 {
48407 Main.player[owner].petFlagLilHarpy = false;
48408 }
48409 if (Main.player[owner].petFlagLilHarpy)
48410 {
48411 timeLeft = 2;
48412 }
48413 }
48414 if (type == 816)
48415 {
48416 if (Main.player[owner].dead)
48417 {
48418 Main.player[owner].petFlagFennecFox = false;
48419 }
48420 if (Main.player[owner].petFlagFennecFox)
48421 {
48422 timeLeft = 2;
48423 }
48424 }
48425 if (type == 817)
48426 {
48427 if (Main.player[owner].dead)
48428 {
48429 Main.player[owner].petFlagGlitteryButterfly = false;
48430 }
48431 if (Main.player[owner].petFlagGlitteryButterfly)
48432 {
48433 timeLeft = 2;
48434 }
48435 }
48436 if (type == 821)
48437 {
48438 if (Main.player[owner].dead)
48439 {
48440 Main.player[owner].petFlagBabyImp = false;
48441 }
48442 if (Main.player[owner].petFlagBabyImp)
48443 {
48444 timeLeft = 2;
48445 }
48446 }
48447 if (type == 825)
48448 {
48449 if (Main.player[owner].dead)
48450 {
48451 Main.player[owner].petFlagBabyRedPanda = false;
48452 }
48453 if (Main.player[owner].petFlagBabyRedPanda)
48454 {
48455 timeLeft = 2;
48456 }
48457 }
48458 if (type == 854)
48459 {
48460 if (Main.player[owner].dead)
48461 {
48462 Main.player[owner].petFlagPlantero = false;
48463 }
48464 if (Main.player[owner].petFlagPlantero)
48465 {
48466 timeLeft = 2;
48467 }
48468 }
48469 if (type == 858)
48470 {
48471 if (Main.player[owner].dead)
48472 {
48473 Main.player[owner].petFlagDynamiteKitten = false;
48474 }
48475 if (Main.player[owner].petFlagDynamiteKitten)
48476 {
48477 timeLeft = 2;
48478 }
48479 }
48480 if (type == 859)
48481 {
48482 if (Main.player[owner].dead)
48483 {
48484 Main.player[owner].petFlagBabyWerewolf = false;
48485 }
48486 if (Main.player[owner].petFlagBabyWerewolf)
48487 {
48488 timeLeft = 2;
48489 }
48490 }
48491 if (type == 860)
48492 {
48493 if (Main.player[owner].dead)
48494 {
48495 Main.player[owner].petFlagShadowMimic = false;
48496 }
48497 if (Main.player[owner].petFlagShadowMimic)
48498 {
48499 timeLeft = 2;
48500 }
48501 }
48502 if (type == 875)
48503 {
48504 if (Main.player[owner].dead)
48505 {
48506 Main.player[owner].petFlagVoltBunny = false;
48507 }
48508 if (Main.player[owner].petFlagVoltBunny)
48509 {
48510 timeLeft = 2;
48511 }
48512 }
48513 if (type == 881)
48514 {
48515 if (Main.player[owner].dead)
48516 {
48517 Main.player[owner].petFlagKingSlimePet = false;
48518 }
48519 if (Main.player[owner].petFlagKingSlimePet)
48520 {
48521 timeLeft = 2;
48522 }
48523 }
48524 if (type == 884)
48525 {
48526 if (Main.player[owner].dead)
48527 {
48528 Main.player[owner].petFlagBrainOfCthulhuPet = false;
48529 }
48530 if (Main.player[owner].petFlagBrainOfCthulhuPet)
48531 {
48532 timeLeft = 2;
48533 }
48534 }
48535 if (type == 885)
48536 {
48537 if (Main.player[owner].dead)
48538 {
48539 Main.player[owner].petFlagSkeletronPet = false;
48540 }
48541 if (Main.player[owner].petFlagSkeletronPet)
48542 {
48543 timeLeft = 2;
48544 }
48545 }
48546 if (type == 886)
48547 {
48548 if (Main.player[owner].dead)
48549 {
48550 Main.player[owner].petFlagQueenBeePet = false;
48551 }
48552 if (Main.player[owner].petFlagQueenBeePet)
48553 {
48554 timeLeft = 2;
48555 }
48556 }
48557 if (type == 889)
48558 {
48559 if (Main.player[owner].dead)
48560 {
48561 Main.player[owner].petFlagSkeletronPrimePet = false;
48562 }
48563 if (Main.player[owner].petFlagSkeletronPrimePet)
48564 {
48565 timeLeft = 2;
48566 }
48567 }
48568 if (type == 890)
48569 {
48570 if (Main.player[owner].dead)
48571 {
48572 Main.player[owner].petFlagPlanteraPet = false;
48573 }
48574 if (Main.player[owner].petFlagPlanteraPet)
48575 {
48576 timeLeft = 2;
48577 }
48578 }
48579 if (type == 891)
48580 {
48581 if (Main.player[owner].dead)
48582 {
48583 Main.player[owner].petFlagGolemPet = false;
48584 }
48585 if (Main.player[owner].petFlagGolemPet)
48586 {
48587 timeLeft = 2;
48588 }
48589 }
48590 if (type == 892)
48591 {
48592 if (Main.player[owner].dead)
48593 {
48594 Main.player[owner].petFlagDukeFishronPet = false;
48595 }
48596 if (Main.player[owner].petFlagDukeFishronPet)
48597 {
48598 timeLeft = 2;
48599 }
48600 }
48601 if (type == 894)
48602 {
48603 if (Main.player[owner].dead)
48604 {
48605 Main.player[owner].petFlagMoonLordPet = false;
48606 }
48607 if (Main.player[owner].petFlagMoonLordPet)
48608 {
48609 timeLeft = 2;
48610 }
48611 }
48612 if (type == 897)
48613 {
48614 if (Main.player[owner].dead)
48615 {
48616 Main.player[owner].petFlagEverscreamPet = false;
48617 }
48618 if (Main.player[owner].petFlagEverscreamPet)
48619 {
48620 timeLeft = 2;
48621 }
48622 }
48623 if (type == 899)
48624 {
48625 if (Main.player[owner].dead)
48626 {
48627 Main.player[owner].petFlagMartianPet = false;
48628 }
48629 if (Main.player[owner].petFlagMartianPet)
48630 {
48631 timeLeft = 2;
48632 }
48633 }
48634 if (type == 900)
48635 {
48636 if (Main.player[owner].dead)
48637 {
48638 Main.player[owner].petFlagDD2OgrePet = false;
48639 }
48640 if (Main.player[owner].petFlagDD2OgrePet)
48641 {
48642 timeLeft = 2;
48643 }
48644 }
48645 if (type == 901)
48646 {
48647 if (Main.player[owner].dead)
48648 {
48649 Main.player[owner].petFlagDD2BetsyPet = false;
48650 }
48651 if (Main.player[owner].petFlagDD2BetsyPet)
48652 {
48653 timeLeft = 2;
48654 }
48655 }
48656 if (type == 934)
48657 {
48658 if (Main.player[owner].dead)
48659 {
48660 Main.player[owner].petFlagQueenSlimePet = false;
48661 }
48662 if (Main.player[owner].petFlagQueenSlimePet)
48663 {
48664 timeLeft = 2;
48665 }
48666 }
48667 if (type == 956)
48668 {
48669 if (Main.player[owner].dead)
48670 {
48671 Main.player[owner].petFlagBerniePet = false;
48672 }
48673 if (Main.player[owner].petFlagBerniePet)
48674 {
48675 timeLeft = 2;
48676 }
48677 }
48678 if (type == 958)
48679 {
48680 if (Main.player[owner].dead)
48681 {
48682 Main.player[owner].petFlagDeerclopsPet = false;
48683 }
48684 if (Main.player[owner].petFlagDeerclopsPet)
48685 {
48686 timeLeft = 2;
48687 }
48688 }
48689 if (type == 959)
48690 {
48691 if (Main.player[owner].dead)
48692 {
48693 Main.player[owner].petFlagPigPet = false;
48694 }
48695 if (Main.player[owner].petFlagPigPet)
48696 {
48697 timeLeft = 2;
48698 }
48699 }
48700 if (type == 960)
48701 {
48702 if (Main.player[owner].dead)
48703 {
48704 Main.player[owner].petFlagChesterPet = false;
48705 }
48706 if (Main.player[owner].petFlagChesterPet)
48707 {
48708 timeLeft = 2;
48709 }
48710 }
48711 if (type == 994)
48712 {
48713 if (Main.player[owner].dead)
48714 {
48715 Main.player[owner].petFlagJunimoPet = false;
48716 }
48717 if (Main.player[owner].petFlagJunimoPet)
48718 {
48719 timeLeft = 2;
48720 }
48721 }
48722 if (type == 998)
48723 {
48724 if (Main.player[owner].dead)
48725 {
48726 Main.player[owner].petFlagBlueChickenPet = false;
48727 }
48728 if (Main.player[owner].petFlagBlueChickenPet)
48729 {
48730 timeLeft = 2;
48731 }
48732 }
48733 if (type == 1003)
48734 {
48735 if (Main.player[owner].dead)
48736 {
48737 Main.player[owner].petFlagSpiffo = false;
48738 }
48739 if (Main.player[owner].petFlagSpiffo)
48740 {
48741 timeLeft = 2;
48742 }
48743 }
48744 if (type == 1004)
48745 {
48746 if (Main.player[owner].dead)
48747 {
48748 Main.player[owner].petFlagCaveling = false;
48749 }
48750 if (Main.player[owner].petFlagCaveling)
48751 {
48752 timeLeft = 2;
48753 }
48754 }
48755 if (flag6)
48756 {
48757 if (Main.player[owner].dead)
48758 {
48759 Main.player[owner].pygmy = false;
48760 }
48761 if (Main.player[owner].pygmy)
48762 {
48763 timeLeft = Main.rand.Next(2, 10);
48764 }
48765 }
48766 if (type >= 390 && type <= 392)
48767 {
48768 if (Main.player[owner].dead)
48769 {
48770 Main.player[owner].spiderMinion = false;
48771 }
48772 if (Main.player[owner].spiderMinion)
48773 {
48774 timeLeft = 2;
48775 }
48776 }
48777 if (type == 398)
48778 {
48779 if (Main.player[owner].dead)
48780 {
48781 Main.player[owner].miniMinotaur = false;
48782 }
48783 if (Main.player[owner].miniMinotaur)
48784 {
48785 timeLeft = 2;
48786 }
48787 }
48788 if (flag7)
48789 {
48790 timeLeft = 2;
48791 }
48792 if (flag6 || type == 266 || (type >= 390 && type <= 392))
48793 {
48794 num = 10;
48795 int num3 = 40 * (minionPos + 1) * Main.player[owner].direction;
48796 if (Main.player[owner].position.X + (float)(Main.player[owner].width / 2) < position.X + (float)(width / 2) - (float)num + (float)num3)
48797 {
48798 flag2 = true;
48799 }
48800 else if (Main.player[owner].position.X + (float)(Main.player[owner].width / 2) > position.X + (float)(width / 2) + (float)num + (float)num3)
48801 {
48802 flag3 = true;
48803 }
48804 }
48805 else if (type == 891)
48806 {
48807 num = 30;
48808 float num4 = -50 * -Main.player[owner].direction;
48809 float num5 = Main.player[owner].Center.X + num4;
48810 if (num5 < position.X + (float)(width / 2) - (float)num)
48811 {
48812 flag2 = true;
48813 }
48814 else if (num5 > position.X + (float)(width / 2) + (float)num)
48815 {
48816 flag3 = true;
48817 }
48818 }
48819 else if (type == 960 && !flag7)
48820 {
48821 num = 10;
48822 Player player = Main.player[owner];
48823 int num6 = ((player.Center.X - base.Center.X > 0f) ? 1 : (-1));
48824 if (player.velocity.X != 0f)
48825 {
48826 num6 = player.direction;
48827 }
48828 float num7 = -70 * num6;
48829 float num8 = player.Center.X + num7;
48830 if (num8 < base.Center.X - (float)num)
48831 {
48832 flag2 = true;
48833 }
48834 else if (num8 > base.Center.X + (float)num)
48835 {
48836 flag3 = true;
48837 }
48838 }
48839 else if (Main.player[owner].position.X + (float)(Main.player[owner].width / 2) < position.X + (float)(width / 2) - (float)num)
48840 {
48841 flag2 = true;
48842 }
48843 else if (Main.player[owner].position.X + (float)(Main.player[owner].width / 2) > position.X + (float)(width / 2) + (float)num)
48844 {
48845 flag3 = true;
48846 }
48847 if (num2)
48848 {
48849 flag2 = false;
48850 flag3 = true;
48851 num = 30;
48852 }
48853 if (flag8)
48854 {
48855 flag2 = false;
48856 flag3 = false;
48857 }
48858 if (type == 175)
48859 {
48860 float num9 = 0.1f;
48861 tileCollide = false;
48862 int num10 = 300;
48863 Vector2 vector = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
48864 float num11 = Main.player[owner].position.X + (float)(Main.player[owner].width / 2) - vector.X;
48865 float num12 = Main.player[owner].position.Y + (float)(Main.player[owner].height / 2) - vector.Y;
48866 if (type == 127)
48867 {
48868 num12 = Main.player[owner].position.Y - vector.Y;
48869 }
48870 float num13 = (float)Math.Sqrt(num11 * num11 + num12 * num12);
48871 float num14 = 7f;
48872 float num15 = 2000f;
48873 bool num16 = num13 > num15;
48874 if (num13 < (float)num10 && Main.player[owner].velocity.Y == 0f && position.Y + (float)height <= Main.player[owner].position.Y + (float)Main.player[owner].height && !Collision.SolidCollision(position, width, height))
48875 {
48876 ai[0] = 0f;
48877 if (velocity.Y < -6f)
48878 {
48879 velocity.Y = -6f;
48880 }
48881 }
48882 if (num13 < 150f)
48883 {
48884 if (Math.Abs(velocity.X) > 2f || Math.Abs(velocity.Y) > 2f)
48885 {
48886 velocity *= 0.99f;
48887 }
48888 num9 = 0.01f;
48889 if (num11 < -2f)
48890 {
48891 num11 = -2f;
48892 }
48893 if (num11 > 2f)
48894 {
48895 num11 = 2f;
48896 }
48897 if (num12 < -2f)
48898 {
48899 num12 = -2f;
48900 }
48901 if (num12 > 2f)
48902 {
48903 num12 = 2f;
48904 }
48905 }
48906 else
48907 {
48908 if (num13 > 300f)
48909 {
48910 num9 = 0.2f;
48911 }
48912 num13 = num14 / num13;
48913 num11 *= num13;
48914 num12 *= num13;
48915 }
48916 if (num16)
48917 {
48918 int num17 = 17;
48919 for (int i = 0; i < 12; i++)
48920 {
48921 float speedX = 1f - Main.rand.NextFloat() * 2f;
48922 float speedY = 1f - Main.rand.NextFloat() * 2f;
48923 int num18 = Dust.NewDust(position, width, height, num17, speedX, speedY);
48924 Main.dust[num18].noLightEmittence = true;
48925 Main.dust[num18].noGravity = true;
48926 }
48927 base.Center = Main.player[owner].Center;
48928 velocity = Vector2.Zero;
48929 if (Main.myPlayer == owner)
48930 {
48931 netUpdate = true;
48932 }
48933 }
48934 if (Math.Abs(num11) > Math.Abs(num12) || num9 == 0.05f)
48935 {
48936 if (velocity.X < num11)
48937 {
48938 velocity.X += num9;
48939 if (num9 > 0.05f && velocity.X < 0f)
48940 {
48941 velocity.X += num9;
48942 }
48943 }
48944 if (velocity.X > num11)
48945 {
48946 velocity.X -= num9;
48947 if (num9 > 0.05f && velocity.X > 0f)
48948 {
48949 velocity.X -= num9;
48950 }
48951 }
48952 }
48953 if (Math.Abs(num11) <= Math.Abs(num12) || num9 == 0.05f)
48954 {
48955 if (velocity.Y < num12)
48956 {
48957 velocity.Y += num9;
48958 if (num9 > 0.05f && velocity.Y < 0f)
48959 {
48960 velocity.Y += num9;
48961 }
48962 }
48963 if (velocity.Y > num12)
48964 {
48965 velocity.Y -= num9;
48966 if (num9 > 0.05f && velocity.Y > 0f)
48967 {
48968 velocity.Y -= num9;
48969 }
48970 }
48971 }
48972 rotation = (float)Math.Atan2(velocity.Y, velocity.X) - 1.57f;
48973 frameCounter++;
48974 if (frameCounter > 6)
48975 {
48976 frame++;
48977 frameCounter = 0;
48978 }
48979 if (frame > 1)
48980 {
48981 frame = 0;
48982 }
48983 return;
48984 }
48985 if (type == 197)
48986 {
48987 float num19 = 0.1f;
48988 tileCollide = false;
48989 int num20 = 300;
48990 Vector2 vector2 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
48991 float num21 = Main.player[owner].position.X + (float)(Main.player[owner].width / 2) - vector2.X;
48992 float num22 = Main.player[owner].position.Y + (float)(Main.player[owner].height / 2) - vector2.Y;
48993 if (type == 127)
48994 {
48995 num22 = Main.player[owner].position.Y - vector2.Y;
48996 }
48997 float num23 = (float)Math.Sqrt(num21 * num21 + num22 * num22);
48998 float num24 = 3f;
48999 if (num23 > 500f)
49000 {
49001 localAI[0] = 10000f;
49002 }
49003 if (localAI[0] >= 10000f)
49004 {
49005 num24 = 14f;
49006 }
49007 float num25 = 2000f;
49008 bool num26 = num23 > num25;
49009 if (num23 < (float)num20 && Main.player[owner].velocity.Y == 0f && position.Y + (float)height <= Main.player[owner].position.Y + (float)Main.player[owner].height && !Collision.SolidCollision(position, width, height))
49010 {
49011 ai[0] = 0f;
49012 if (velocity.Y < -6f)
49013 {
49014 velocity.Y = -6f;
49015 }
49016 }
49017 if (num23 < 150f)
49018 {
49019 if (Math.Abs(velocity.X) > 2f || Math.Abs(velocity.Y) > 2f)
49020 {
49021 velocity *= 0.99f;
49022 }
49023 num19 = 0.01f;
49024 if (num21 < -2f)
49025 {
49026 num21 = -2f;
49027 }
49028 if (num21 > 2f)
49029 {
49030 num21 = 2f;
49031 }
49032 if (num22 < -2f)
49033 {
49034 num22 = -2f;
49035 }
49036 if (num22 > 2f)
49037 {
49038 num22 = 2f;
49039 }
49040 }
49041 else
49042 {
49043 if (num23 > 300f)
49044 {
49045 num19 = 0.2f;
49046 }
49047 num23 = num24 / num23;
49048 num21 *= num23;
49049 num22 *= num23;
49050 }
49051 if (num26)
49052 {
49053 int num27 = 26;
49054 for (int j = 0; j < 12; j++)
49055 {
49056 float speedX2 = 1f - Main.rand.NextFloat() * 2f;
49057 float speedY2 = 1f - Main.rand.NextFloat() * 2f;
49058 int num28 = Dust.NewDust(position, width, height, num27, speedX2, speedY2);
49059 Main.dust[num28].noLightEmittence = true;
49060 Main.dust[num28].noGravity = true;
49061 }
49062 base.Center = Main.player[owner].Center;
49063 velocity = Vector2.Zero;
49064 if (Main.myPlayer == owner)
49065 {
49066 netUpdate = true;
49067 }
49068 }
49069 if (velocity.X < num21)
49070 {
49071 velocity.X += num19;
49072 if (num19 > 0.05f && velocity.X < 0f)
49073 {
49074 velocity.X += num19;
49075 }
49076 }
49077 if (velocity.X > num21)
49078 {
49079 velocity.X -= num19;
49080 if (num19 > 0.05f && velocity.X > 0f)
49081 {
49082 velocity.X -= num19;
49083 }
49084 }
49085 if (velocity.Y < num22)
49086 {
49087 velocity.Y += num19;
49088 if (num19 > 0.05f && velocity.Y < 0f)
49089 {
49090 velocity.Y += num19;
49091 }
49092 }
49093 if (velocity.Y > num22)
49094 {
49095 velocity.Y -= num19;
49096 if (num19 > 0.05f && velocity.Y > 0f)
49097 {
49098 velocity.Y -= num19;
49099 }
49100 }
49101 localAI[0] += Main.rand.Next(10);
49102 if (localAI[0] > 10000f)
49103 {
49104 if (localAI[1] == 0f)
49105 {
49106 if (velocity.X < 0f)
49107 {
49108 localAI[1] = -1f;
49109 }
49110 else
49111 {
49112 localAI[1] = 1f;
49113 }
49114 }
49115 rotation += 0.25f * localAI[1];
49116 if (localAI[0] > 12000f)
49117 {
49118 localAI[0] = 0f;
49119 }
49120 }
49121 else
49122 {
49123 localAI[1] = 0f;
49124 float num29 = velocity.X * 0.1f;
49125 if (rotation > num29)
49126 {
49127 rotation -= (Math.Abs(velocity.X) + Math.Abs(velocity.Y)) * 0.01f;
49128 if (rotation < num29)
49129 {
49130 rotation = num29;
49131 }
49132 }
49133 if (rotation < num29)
49134 {
49135 rotation += (Math.Abs(velocity.X) + Math.Abs(velocity.Y)) * 0.01f;
49136 if (rotation > num29)
49137 {
49138 rotation = num29;
49139 }
49140 }
49141 }
49142 if ((double)rotation > 6.28)
49143 {
49144 rotation -= 6.28f;
49145 }
49146 if ((double)rotation < -6.28)
49147 {
49148 rotation += 6.28f;
49149 }
49150 return;
49151 }
49152 if (type == 198 || type == 380 || type == 774 || type == 815 || type == 817 || type == 886 || type == 892 || type == 894 || type == 901)
49153 {
49154 float num30 = 0.4f;
49155 if (type == 380)
49156 {
49157 num30 = 0.3f;
49158 }
49159 if (type == 774)
49160 {
49161 num30 = 0.3f;
49162 }
49163 tileCollide = false;
49164 int num31 = 100;
49165 float num32 = 50f;
49166 float num33 = 400f;
49167 float num34 = num33 / 2f;
49168 float num35 = 2000f;
49169 bool flag9 = false;
49170 Vector2 vector3 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
49171 float num36 = Main.player[owner].position.X + (float)(Main.player[owner].width / 2) - vector3.X;
49172 float num37 = Main.player[owner].position.Y + (float)(Main.player[owner].height / 2) - vector3.Y;
49173 if (type == 774)
49174 {
49175 num32 = 2f;
49176 float num38 = (float)Math.Sin((float)Math.PI * 2f * ((float)Main.player[owner].miscCounter / 60f));
49177 float num39 = Utils.GetLerpValue(0.5f, 1f, num38, clamped: true);
49178 if (new Vector2(num36 - (float)(70 * Main.player[owner].direction), num37 - 60f).Length() > 50f)
49179 {
49180 num38 = 0f;
49181 num39 = 0f;
49182 }
49183 num37 += -60f + num39 * -8f + num38 * 8f;
49184 num36 += (float)(70 * -Main.player[owner].direction);
49185 }
49186 else
49187 {
49188 if (type != 892 && type != 894)
49189 {
49190 num37 += (float)Main.rand.Next(-10, 21);
49191 num36 += (float)Main.rand.Next(-10, 21);
49192 }
49193 num36 += (float)(60 * -Main.player[owner].direction);
49194 num37 -= 60f;
49195 }
49197 if (type == 127)
49198 {
49199 num37 = Main.player[owner].position.Y - vector3.Y;
49200 }
49201 float num40 = (float)Math.Sqrt(num36 * num36 + num37 * num37);
49202 float num41 = num40;
49203 float num42 = 14f;
49204 if (type == 380)
49205 {
49206 num42 = 6f;
49207 }
49208 if (type == 815 || type == 817)
49209 {
49210 num42 = ((!(num40 < num33)) ? 10f : 6f);
49211 }
49212 if (type == 892 || type == 894 || type == 901)
49213 {
49214 if (num40 < num34)
49215 {
49216 num42 = 6f;
49217 }
49218 num42 = ((!(num40 < num33)) ? 12f : 9f);
49219 }
49220 if (type == 774)
49221 {
49222 num42 = 5f;
49223 }
49224 if (num40 < (float)num31 && Main.player[owner].velocity.Y == 0f && position.Y + (float)height <= Main.player[owner].position.Y + (float)Main.player[owner].height && !Collision.SolidCollision(position, width, height))
49225 {
49226 ai[0] = 0f;
49227 if (velocity.Y < -6f)
49228 {
49229 velocity.Y = -6f;
49230 }
49231 }
49232 if (num40 < num32)
49233 {
49234 if (Math.Abs(velocity.X) > 2f || Math.Abs(velocity.Y) > 2f)
49235 {
49236 if (type == 892 || type == 892)
49237 {
49238 velocity *= 0.95f;
49239 }
49240 else
49241 {
49242 velocity *= 0.99f;
49243 }
49244 }
49245 num30 = 0.01f;
49246 }
49247 else
49248 {
49249 if (type == 892 || type == 894 || type == 901)
49250 {
49251 if (num40 < 100f)
49252 {
49253 num30 = 0.1f;
49254 }
49255 if (num40 > num35)
49256 {
49257 flag9 = true;
49258 }
49259 else if (num40 > num33)
49260 {
49261 num30 = 0.7f;
49262 }
49263 else if (num40 > num34)
49264 {
49265 num30 = 0.5f;
49266 }
49267 }
49268 else if (type == 815 || type == 817)
49269 {
49270 if (num40 < 100f)
49271 {
49272 num30 = 0.1f;
49273 }
49274 if (num40 > num35)
49275 {
49276 flag9 = true;
49277 }
49278 else if (type != 815 && num40 > num33)
49279 {
49280 num30 = 0.5f;
49281 }
49282 }
49283 else if (type == 380)
49284 {
49285 if (num40 < 100f)
49286 {
49287 num30 = 0.1f;
49288 }
49289 if (num40 > 300f)
49290 {
49291 num30 = 0.4f;
49292 }
49293 if (num40 > num35)
49294 {
49295 flag9 = true;
49296 }
49297 }
49298 else if (type == 198 || type == 886)
49299 {
49300 if (num40 < 100f)
49301 {
49302 num30 = 0.1f;
49303 }
49304 if (num40 > 300f)
49305 {
49306 num30 = 0.6f;
49307 }
49308 if (num40 > num35)
49309 {
49310 flag9 = true;
49311 }
49312 }
49313 else if (type == 774)
49314 {
49315 if (num40 < 40f)
49316 {
49317 num30 = 0.1f;
49318 }
49319 if (num40 > 300f)
49320 {
49321 num30 = 0.6f;
49322 }
49323 if (num40 > num35)
49324 {
49325 flag9 = true;
49326 }
49327 }
49328 num40 = num42 / num40;
49329 num36 *= num40;
49330 num37 *= num40;
49331 }
49332 if (velocity.X < num36)
49333 {
49334 velocity.X += num30;
49335 if (num30 > 0.05f && velocity.X < 0f)
49336 {
49337 velocity.X += num30;
49338 }
49339 }
49340 if (velocity.X > num36)
49341 {
49342 velocity.X -= num30;
49343 if (num30 > 0.05f && velocity.X > 0f)
49344 {
49345 velocity.X -= num30;
49346 }
49347 }
49348 if (velocity.Y < num37)
49349 {
49350 velocity.Y += num30;
49351 if (num30 > 0.05f && velocity.Y < 0f)
49352 {
49353 velocity.Y += num30 * 2f;
49354 }
49355 }
49356 if (velocity.Y > num37)
49357 {
49358 velocity.Y -= num30;
49359 if (num30 > 0.05f && velocity.Y > 0f)
49360 {
49361 velocity.Y -= num30 * 2f;
49362 }
49363 }
49364 if ((double)velocity.X > 0.25)
49365 {
49366 direction = -1;
49367 }
49368 else if ((double)velocity.X < -0.25)
49369 {
49370 direction = 1;
49371 }
49372 spriteDirection = direction;
49373 rotation = velocity.X * 0.05f;
49374 if (flag9)
49375 {
49376 int num43 = 33;
49377 if (type == 198 || type == 886)
49378 {
49379 num43 = 147;
49380 }
49381 if (type == 815)
49382 {
49383 num43 = 31;
49384 }
49385 if (type == 817)
49386 {
49387 num43 = 21;
49388 }
49389 for (int k = 0; k < 12; k++)
49390 {
49391 float speedX3 = 1f - Main.rand.NextFloat() * 2f;
49392 float speedY3 = 1f - Main.rand.NextFloat() * 2f;
49393 int num44 = Dust.NewDust(position, width, height, num43, speedX3, speedY3);
49394 Main.dust[num44].noLightEmittence = true;
49395 Main.dust[num44].noGravity = true;
49396 }
49397 base.Center = Main.player[owner].Center;
49398 velocity = Vector2.Zero;
49399 if (Main.myPlayer == owner)
49400 {
49401 netUpdate = true;
49402 }
49403 }
49404 bool flag10 = false;
49405 int num45 = 3;
49406 int num46 = 0;
49407 int num47 = 3;
49408 if (type == 380)
49409 {
49410 num45 = 6;
49411 }
49412 if (type == 815)
49413 {
49414 num45 = 5;
49415 num46 = 0;
49416 num47 = 5;
49417 if (num41 > num33)
49418 {
49419 num46 = 6;
49420 num47 = 9;
49421 }
49422 }
49423 if (type == 817)
49424 {
49425 num45 = 5;
49426 num46 = 0;
49427 num47 = 2;
49428 flag10 = true;
49429 }
49430 if (type == 901)
49431 {
49432 num45 = 4;
49433 num46 = 0;
49434 num47 = 5;
49435 if (num41 > num33 / 2f)
49436 {
49437 num45 = 3;
49438 num46 = 6;
49439 num47 = 11;
49440 }
49441 }
49442 if (type == 892)
49443 {
49444 num45 = 6;
49445 num46 = 0;
49446 num47 = Main.projFrames[type] - 1;
49447 }
49448 if (type == 886 || type == 894)
49449 {
49450 num45 = 4;
49451 num46 = 0;
49452 num47 = Main.projFrames[type] - 1;
49453 }
49454 if (type == 774)
49455 {
49456 if (Main.player[owner].velocity.Length() < 2f && vector4.Length() < 10f)
49457 {
49458 direction = -Main.player[owner].direction;
49459 spriteDirection = direction;
49460 }
49461 num45 = 6;
49462 if (!wet)
49463 {
49464 num46 += 4;
49465 num47 += 4;
49466 }
49467 rotation = velocity.X * 0.05f + Math.Abs(velocity.Y * -0.05f);
49468 }
49469 if (flag10)
49470 {
49471 int num48 = num45 * (num47 - num46) * 2;
49472 frameCounter++;
49473 if (frameCounter >= num48)
49474 {
49475 frameCounter = 0;
49476 }
49477 frame = frameCounter / num45;
49478 if (frame > num47)
49479 {
49480 frame = num47 + (num47 - frame);
49481 }
49482 frame = (int)MathHelper.Clamp(frame, num46, num47);
49483 }
49484 else if (++frameCounter >= num45)
49485 {
49486 frameCounter = 0;
49487 frame++;
49489 {
49490 frame = num46;
49491 }
49492 }
49493 return;
49494 }
49495 if (type == 211)
49496 {
49497 float num49 = 0.2f;
49498 float num50 = 5f;
49499 tileCollide = false;
49500 Vector2 vector5 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
49501 float num51 = Main.player[owner].position.X + (float)(Main.player[owner].width / 2) - vector5.X;
49502 float num52 = Main.player[owner].position.Y + Main.player[owner].gfxOffY + (float)(Main.player[owner].height / 2) - vector5.Y;
49503 if (Main.player[owner].controlLeft)
49504 {
49505 num51 -= 120f;
49506 }
49507 else if (Main.player[owner].controlRight)
49508 {
49509 num51 += 120f;
49510 }
49511 if (Main.player[owner].controlDown)
49512 {
49513 num52 += 120f;
49514 }
49515 else
49516 {
49517 if (Main.player[owner].controlUp)
49518 {
49519 num52 -= 120f;
49520 }
49521 num52 -= 60f;
49522 }
49523 float num53 = (float)Math.Sqrt(num51 * num51 + num52 * num52);
49524 if (num53 > 1000f)
49525 {
49526 position.X += num51;
49527 position.Y += num52;
49528 }
49529 if (localAI[0] == 1f)
49530 {
49531 if (num53 < 10f)
49532 {
49533 Player player2 = Main.player[owner];
49534 if (Math.Abs(player2.velocity.X) + Math.Abs(player2.velocity.Y) < num50 && (player2.velocity.Y == 0f || (player2.mount.Active && player2.mount.CanFly())))
49535 {
49536 localAI[0] = 0f;
49537 }
49538 }
49539 num50 = 12f;
49540 if (num53 < num50)
49541 {
49542 velocity.X = num51;
49543 velocity.Y = num52;
49544 }
49545 else
49546 {
49547 num53 = num50 / num53;
49548 velocity.X = num51 * num53;
49549 velocity.Y = num52 * num53;
49550 }
49551 if ((double)velocity.X > 0.5)
49552 {
49553 direction = -1;
49554 }
49555 else if ((double)velocity.X < -0.5)
49556 {
49557 direction = 1;
49558 }
49559 spriteDirection = direction;
49560 rotation -= (0.2f + Math.Abs(velocity.X) * 0.025f) * (float)direction;
49561 frameCounter++;
49562 if (frameCounter > 3)
49563 {
49564 frame++;
49565 frameCounter = 0;
49566 }
49567 if (frame < 5)
49568 {
49569 frame = 5;
49570 }
49571 if (frame > 9)
49572 {
49573 frame = 5;
49574 }
49575 for (int l = 0; l < 2; l++)
49576 {
49577 int num54 = Dust.NewDust(new Vector2(position.X + 3f, position.Y + 4f), 14, 14, 156);
49578 Main.dust[num54].velocity *= 0.2f;
49579 Main.dust[num54].noGravity = true;
49580 Main.dust[num54].scale = 1.25f;
49581 Main.dust[num54].shader = GameShaders.Armor.GetSecondaryShader(Main.player[owner].cLight, Main.player[owner]);
49582 }
49583 return;
49584 }
49585 if (num53 > 200f)
49586 {
49587 localAI[0] = 1f;
49588 }
49589 if ((double)velocity.X > 0.5)
49590 {
49591 direction = -1;
49592 }
49593 else if ((double)velocity.X < -0.5)
49594 {
49595 direction = 1;
49596 }
49597 spriteDirection = direction;
49598 if (num53 < 10f)
49599 {
49600 velocity.X = num51;
49601 velocity.Y = num52;
49602 rotation = velocity.X * 0.05f;
49603 if (num53 < num50)
49604 {
49605 position += velocity;
49606 velocity *= 0f;
49607 num49 = 0f;
49608 }
49609 direction = -Main.player[owner].direction;
49610 }
49611 num53 = num50 / num53;
49612 num51 *= num53;
49613 num52 *= num53;
49614 if (velocity.X < num51)
49615 {
49616 velocity.X += num49;
49617 if (velocity.X < 0f)
49618 {
49619 velocity.X *= 0.99f;
49620 }
49621 }
49622 if (velocity.X > num51)
49623 {
49624 velocity.X -= num49;
49625 if (velocity.X > 0f)
49626 {
49627 velocity.X *= 0.99f;
49628 }
49629 }
49630 if (velocity.Y < num52)
49631 {
49632 velocity.Y += num49;
49633 if (velocity.Y < 0f)
49634 {
49635 velocity.Y *= 0.99f;
49636 }
49637 }
49638 if (velocity.Y > num52)
49639 {
49640 velocity.Y -= num49;
49641 if (velocity.Y > 0f)
49642 {
49643 velocity.Y *= 0.99f;
49644 }
49645 }
49646 if (velocity.X != 0f || velocity.Y != 0f)
49647 {
49648 rotation = velocity.X * 0.05f;
49649 }
49650 frameCounter++;
49651 if (frameCounter > 3)
49652 {
49653 frame++;
49654 frameCounter = 0;
49655 }
49656 if (frame > 4)
49657 {
49658 frame = 0;
49659 }
49660 return;
49661 }
49662 if (type == 199)
49663 {
49664 float num55 = 0.1f;
49665 tileCollide = false;
49666 int num56 = 200;
49667 Vector2 vector6 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
49668 float num57 = Main.player[owner].position.X + (float)(Main.player[owner].width / 2) - vector6.X;
49669 float num58 = Main.player[owner].position.Y + (float)(Main.player[owner].height / 2) - vector6.Y;
49670 num58 -= 60f;
49671 num57 -= 2f;
49672 if (type == 127)
49673 {
49674 num58 = Main.player[owner].position.Y - vector6.Y;
49675 }
49676 float num59 = (float)Math.Sqrt(num57 * num57 + num58 * num58);
49677 float num60 = 4f;
49678 float num61 = num59;
49679 float num62 = 2000f;
49680 bool num63 = num59 > num62;
49681 if (num59 < (float)num56 && Main.player[owner].velocity.Y == 0f && position.Y + (float)height <= Main.player[owner].position.Y + (float)Main.player[owner].height && !Collision.SolidCollision(position, width, height))
49682 {
49683 ai[0] = 0f;
49684 if (velocity.Y < -6f)
49685 {
49686 velocity.Y = -6f;
49687 }
49688 }
49689 if (num59 < 4f)
49690 {
49691 velocity.X = num57;
49692 velocity.Y = num58;
49693 num55 = 0f;
49694 }
49695 else
49696 {
49697 if (num59 > 350f)
49698 {
49699 num55 = 0.2f;
49700 num60 = 10f;
49701 }
49702 num59 = num60 / num59;
49703 num57 *= num59;
49704 num58 *= num59;
49705 }
49706 if (num63)
49707 {
49708 int num64 = 2;
49709 for (int m = 0; m < 12; m++)
49710 {
49711 float speedX4 = 1f - Main.rand.NextFloat() * 2f;
49712 float speedY4 = 1f - Main.rand.NextFloat() * 2f;
49713 int num65 = Dust.NewDust(position, width, height, num64, speedX4, speedY4);
49714 Main.dust[num65].noLightEmittence = true;
49715 Main.dust[num65].noGravity = true;
49716 }
49717 base.Center = Main.player[owner].Center;
49718 velocity = Vector2.Zero;
49719 if (Main.myPlayer == owner)
49720 {
49721 netUpdate = true;
49722 }
49723 }
49724 if (velocity.X < num57)
49725 {
49726 velocity.X += num55;
49727 if (velocity.X < 0f)
49728 {
49729 velocity.X += num55;
49730 }
49731 }
49732 if (velocity.X > num57)
49733 {
49734 velocity.X -= num55;
49735 if (velocity.X > 0f)
49736 {
49737 velocity.X -= num55;
49738 }
49739 }
49740 if (velocity.Y < num58)
49741 {
49742 velocity.Y += num55;
49743 if (velocity.Y < 0f)
49744 {
49745 velocity.Y += num55;
49746 }
49747 }
49748 if (velocity.Y > num58)
49749 {
49750 velocity.Y -= num55;
49751 if (velocity.Y > 0f)
49752 {
49753 velocity.Y -= num55;
49754 }
49755 }
49756 direction = -Main.player[owner].direction;
49757 spriteDirection = 1;
49758 rotation = velocity.Y * 0.05f * (float)(-direction);
49759 if (num61 >= 50f)
49760 {
49761 frameCounter++;
49762 if (frameCounter <= 6)
49763 {
49764 return;
49765 }
49766 frameCounter = 0;
49767 if (velocity.X < 0f)
49768 {
49769 if (frame < 2)
49770 {
49771 frame++;
49772 }
49773 if (frame > 2)
49774 {
49775 frame--;
49776 }
49777 }
49778 else
49779 {
49780 if (frame < 6)
49781 {
49782 frame++;
49783 }
49784 if (frame > 6)
49785 {
49786 frame--;
49787 }
49788 }
49789 }
49790 else
49791 {
49792 frameCounter++;
49793 if (frameCounter > 6)
49794 {
49795 frame += direction;
49796 frameCounter = 0;
49797 }
49798 if (frame > 7)
49799 {
49800 frame = 0;
49801 }
49802 if (frame < 0)
49803 {
49804 frame = 7;
49805 }
49806 }
49807 return;
49808 }
49809 if (type == 885 || type == 889)
49810 {
49811 Player player3 = Main.player[owner];
49812 float num66 = 0.15f;
49813 tileCollide = false;
49814 int num67 = 150;
49815 Vector2 center = base.Center;
49816 float num68 = player3.Center.X - center.X;
49817 float num69 = player3.Center.Y - center.Y;
49818 num69 -= 65f;
49819 num68 -= (float)(30 * player3.direction);
49820 float num70 = (float)Math.Sqrt(num68 * num68 + num69 * num69);
49821 float num71 = 8f;
49822 float num72 = num70;
49823 float num73 = 2000f;
49824 bool num74 = num70 > num73;
49825 if (num70 < (float)num67 && player3.velocity.Y == 0f && position.Y + (float)height <= player3.position.Y + (float)player3.height && !Collision.SolidCollision(position, width, height) && velocity.Y < -6f)
49826 {
49827 velocity.Y = -6f;
49828 }
49829 if (num70 < 10f)
49830 {
49831 velocity *= 0.9f;
49832 if (velocity.Length() < 0.5f)
49833 {
49834 velocity = Vector2.Zero;
49835 }
49836 num66 = 0f;
49837 }
49838 else
49839 {
49840 if (num70 > (float)num67)
49841 {
49842 num66 = 0.2f;
49843 num71 = 12f;
49844 }
49845 num70 = num71 / num70;
49846 num68 *= num70;
49847 num69 *= num70;
49848 }
49849 if (num74)
49850 {
49851 int num75 = 234;
49852 if (type == 889)
49853 {
49854 num75 = 60;
49855 }
49856 for (int n = 0; n < 12; n++)
49857 {
49858 float speedX5 = 1f - Main.rand.NextFloat() * 2f;
49859 float speedY5 = 1f - Main.rand.NextFloat() * 2f;
49860 int num76 = Dust.NewDust(position, width, height, num75, speedX5, speedY5);
49861 Main.dust[num76].noLightEmittence = true;
49862 Main.dust[num76].noGravity = true;
49863 }
49864 base.Center = player3.Center;
49865 velocity = Vector2.Zero;
49866 if (Main.myPlayer == owner)
49867 {
49868 netUpdate = true;
49869 }
49870 }
49871 if (velocity.X < num68)
49872 {
49873 velocity.X += num66;
49874 if (velocity.X < 0f)
49875 {
49876 velocity.X += num66;
49877 }
49878 }
49879 if (velocity.X > num68)
49880 {
49881 velocity.X -= num66;
49882 if (velocity.X > 0f)
49883 {
49884 velocity.X -= num66;
49885 }
49886 }
49887 if (velocity.Y < num69)
49888 {
49889 velocity.Y += num66;
49890 if (velocity.Y < 0f)
49891 {
49892 velocity.Y += num66;
49893 }
49894 }
49895 if (velocity.Y > num69)
49896 {
49897 velocity.Y -= num66;
49898 if (velocity.Y > 0f)
49899 {
49900 velocity.Y -= num66;
49901 }
49902 }
49903 direction = -player3.direction;
49904 spriteDirection = -direction;
49905 int num77 = 100;
49906 if (num72 >= (float)num67)
49907 {
49908 rotation += 0.5f;
49909 if (rotation > (float)Math.PI * 2f)
49910 {
49911 rotation -= (float)Math.PI * 2f;
49912 }
49913 frame = 6;
49914 frameCounter = 0;
49915 if (type == 885)
49916 {
49917 localAI[0] = 0f;
49918 }
49919 if (type == 889)
49920 {
49921 localAI[0] += 3f;
49922 if (localAI[0] > (float)num77)
49923 {
49924 localAI[0] = num77;
49925 }
49926 }
49927 return;
49928 }
49929 rotation *= 0.95f;
49930 if (rotation < 0.05f)
49931 {
49932 rotation = 0f;
49933 }
49934 frameCounter++;
49935 if (type == 885)
49936 {
49937 switch (frameCounter)
49938 {
49939 case 10:
49940 localAI[0] = 0f;
49941 break;
49942 case 20:
49943 localAI[0] = 1f;
49944 break;
49945 case 30:
49946 localAI[0] = 2f;
49947 break;
49948 case 40:
49949 localAI[0] = 1f;
49950 break;
49951 }
49952 }
49953 if (type == 889)
49954 {
49955 localAI[0] -= 3f;
49956 if (localAI[0] < 0f)
49957 {
49958 localAI[0] = 0f;
49959 }
49960 }
49961 if (frameCounter % 5 == 0)
49962 {
49963 frame++;
49964 if (frame > 5)
49965 {
49966 frame = 0;
49967 }
49968 }
49969 if (frameCounter >= 40)
49970 {
49971 frameCounter = 0;
49972 }
49973 return;
49974 }
49975 bool flag11 = ai[1] == 0f;
49976 if (flag)
49977 {
49978 flag11 = true;
49979 }
49980 if (flag11)
49981 {
49982 int num78 = 500;
49983 if (type == 127)
49984 {
49985 num78 = 200;
49986 }
49987 if (type == 208)
49988 {
49989 num78 = 300;
49990 }
49991 switch (type)
49992 {
49993 case 816:
49994 case 825:
49995 case 854:
49996 case 858:
49997 case 859:
49998 case 860:
49999 case 881:
50000 case 884:
50001 case 890:
50002 case 891:
50003 case 897:
50004 case 900:
50005 case 934:
50006 num78 = 400;
50007 break;
50008 case 821:
50009 case 899:
50010 num78 = 500;
50011 break;
50012 }
50013 if (flag6 || type == 266 || (type >= 390 && type <= 392))
50014 {
50015 num78 += 40 * minionPos;
50016 if (localAI[0] > 0f)
50017 {
50018 num78 += 500;
50019 }
50020 if (type == 266 && localAI[0] > 0f)
50021 {
50022 num78 += 100;
50023 }
50024 if (type >= 390 && type <= 392 && localAI[0] > 0f)
50025 {
50026 num78 += 400;
50027 }
50028 }
50029 if (Main.player[owner].rocketDelay2 > 0)
50030 {
50031 ai[0] = 1f;
50032 }
50033 Vector2 vector7 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
50034 float num79 = Main.player[owner].position.X + (float)(Main.player[owner].width / 2) - vector7.X;
50035 float num80 = Main.player[owner].position.Y + (float)(Main.player[owner].height / 2) - vector7.Y;
50036 float num81 = (float)Math.Sqrt(num79 * num79 + num80 * num80);
50037 if (!flag7)
50038 {
50039 if (num81 > 2000f)
50040 {
50041 position.X = Main.player[owner].position.X + (float)(Main.player[owner].width / 2) - (float)(width / 2);
50042 position.Y = Main.player[owner].position.Y + (float)(Main.player[owner].height / 2) - (float)(height / 2);
50043 }
50044 else if (num81 > (float)num78 || (Math.Abs(num80) > 300f && ((!flag6 && type != 266 && (type < 390 || type > 392)) || !(localAI[0] > 0f))))
50045 {
50046 if (type != 324)
50047 {
50048 if (num80 > 0f && velocity.Y < 0f)
50049 {
50050 velocity.Y = 0f;
50051 }
50053 {
50054 velocity.Y = 0f;
50055 }
50056 }
50057 ai[0] = 1f;
50058 }
50059 }
50060 }
50061 if ((type == 209 || type == 956) && ai[0] != 0f)
50062 {
50063 if (Main.player[owner].velocity.Y == 0f && alpha >= 100)
50064 {
50065 position.X = Main.player[owner].position.X + (float)(Main.player[owner].width / 2) - (float)(width / 2);
50066 position.Y = Main.player[owner].position.Y + (float)Main.player[owner].height - (float)height;
50067 ai[0] = 0f;
50068 }
50069 else
50070 {
50071 velocity.X = 0f;
50072 velocity.Y = 0f;
50073 if (type == 956 && alpha < 100)
50074 {
50075 int num82 = Dust.NewDust(position, width, height, 6, velocity.X, velocity.Y, 0, default(Color), 1.2f);
50076 Main.dust[num82].velocity.X += Main.rand.NextFloat() - 0.5f;
50077 Main.dust[num82].velocity.Y += (Main.rand.NextFloat() + 0.5f) * -1f;
50078 if (Main.rand.Next(3) != 0)
50079 {
50080 Main.dust[num82].noGravity = true;
50081 }
50082 }
50083 alpha += 5;
50084 if (alpha > 255)
50085 {
50086 alpha = 255;
50087 }
50088 }
50089 }
50090 else if (ai[0] != 0f && !flag7)
50091 {
50092 float num83 = 0.2f;
50093 int num84 = 200;
50094 if (type == 127)
50095 {
50096 num84 = 100;
50097 }
50098 if (flag6 || type == 816 || type == 821 || type == 825 || type == 854 || type == 858 || type == 859 || type == 860)
50099 {
50100 num83 = 0.5f;
50101 num84 = 100;
50102 }
50103 if (type == 875)
50104 {
50105 num83 = 2f;
50106 num84 = 100;
50107 }
50108 tileCollide = false;
50109 Vector2 vector8 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
50110 float num85 = Main.player[owner].position.X + (float)(Main.player[owner].width / 2) - vector8.X;
50111 if (flag6 || type == 266 || (type >= 390 && type <= 392))
50112 {
50113 num85 -= (float)(40 * Main.player[owner].direction);
50114 float num86 = 700f;
50115 if (flag6)
50116 {
50117 num86 += 100f;
50118 }
50119 bool flag12 = false;
50120 int num87 = -1;
50121 for (int num88 = 0; num88 < 200; num88++)
50122 {
50123 if (!Main.npc[num88].CanBeChasedBy(this))
50124 {
50125 continue;
50126 }
50127 float num89 = Main.npc[num88].position.X + (float)(Main.npc[num88].width / 2);
50128 float num90 = Main.npc[num88].position.Y + (float)(Main.npc[num88].height / 2);
50129 if (Math.Abs(Main.player[owner].position.X + (float)(Main.player[owner].width / 2) - num89) + Math.Abs(Main.player[owner].position.Y + (float)(Main.player[owner].height / 2) - num90) < num86)
50130 {
50131 if (Collision.CanHit(position, width, height, Main.npc[num88].position, Main.npc[num88].width, Main.npc[num88].height))
50132 {
50133 num87 = num88;
50134 }
50135 flag12 = true;
50136 break;
50137 }
50138 }
50139 if (!flag12)
50140 {
50141 num85 -= (float)(40 * minionPos * Main.player[owner].direction);
50142 }
50143 if (flag12 && num87 >= 0)
50144 {
50145 ai[0] = 0f;
50146 }
50147 }
50148 float num91 = Main.player[owner].position.Y + (float)(Main.player[owner].height / 2) - vector8.Y;
50149 if (type == 127)
50150 {
50151 num91 = Main.player[owner].position.Y - vector8.Y;
50152 }
50153 float num92 = (float)Math.Sqrt(num85 * num85 + num91 * num91);
50154 float num93 = num92;
50155 float num94 = 10f;
50156 float num95 = num92;
50157 if (type == 111)
50158 {
50159 num94 = 11f;
50160 }
50161 if (type == 127)
50162 {
50163 num94 = 9f;
50164 }
50165 if (type == 875)
50166 {
50167 num83 = 1.8f;
50168 num94 = 16f;
50169 }
50170 if (type == 324)
50171 {
50172 num94 = 20f;
50173 }
50174 if (flag6 || type == 816 || type == 821 || type == 825 || type == 854 || type == 858 || type == 859 || type == 860 || type == 956 || type == 958 || type == 959 || type == 960 || type == 994 || type == 998 || type == 1003 || type == 1004)
50175 {
50176 num83 = 0.4f;
50177 num94 = 12f;
50178 if (flag6)
50179 {
50180 num83 = 0.8f;
50181 }
50182 if (num94 < Math.Abs(Main.player[owner].velocity.X) + Math.Abs(Main.player[owner].velocity.Y))
50183 {
50184 num94 = Math.Abs(Main.player[owner].velocity.X) + Math.Abs(Main.player[owner].velocity.Y);
50185 }
50186 }
50187 if (type == 208 && Math.Abs(Main.player[owner].velocity.X) + Math.Abs(Main.player[owner].velocity.Y) > 4f)
50188 {
50189 num84 = -1;
50190 }
50191 if (num92 < (float)num84 && Main.player[owner].velocity.Y == 0f && position.Y + (float)height <= Main.player[owner].position.Y + (float)Main.player[owner].height && !Collision.SolidCollision(position, width, height))
50192 {
50193 ai[0] = 0f;
50194 if (velocity.Y < -6f)
50195 {
50196 velocity.Y = -6f;
50197 }
50198 }
50199 if (num92 < 60f)
50200 {
50201 num85 = velocity.X;
50202 num91 = velocity.Y;
50203 }
50204 else
50205 {
50206 num92 = num94 / num92;
50207 num85 *= num92;
50208 num91 *= num92;
50209 }
50210 if (type == 324)
50211 {
50212 if (num95 > 1000f)
50213 {
50214 if ((double)(Math.Abs(velocity.X) + Math.Abs(velocity.Y)) < (double)num94 - 1.25)
50215 {
50216 velocity *= 1.025f;
50217 }
50218 if ((double)(Math.Abs(velocity.X) + Math.Abs(velocity.Y)) > (double)num94 + 1.25)
50219 {
50220 velocity *= 0.975f;
50221 }
50222 }
50223 else if (num95 > 600f)
50224 {
50225 if (Math.Abs(velocity.X) + Math.Abs(velocity.Y) < num94 - 1f)
50226 {
50227 velocity *= 1.05f;
50228 }
50229 if (Math.Abs(velocity.X) + Math.Abs(velocity.Y) > num94 + 1f)
50230 {
50231 velocity *= 0.95f;
50232 }
50233 }
50234 else if (num95 > 400f)
50235 {
50236 if ((double)(Math.Abs(velocity.X) + Math.Abs(velocity.Y)) < (double)num94 - 0.5)
50237 {
50238 velocity *= 1.075f;
50239 }
50240 if ((double)(Math.Abs(velocity.X) + Math.Abs(velocity.Y)) > (double)num94 + 0.5)
50241 {
50242 velocity *= 0.925f;
50243 }
50244 }
50245 else
50246 {
50247 if ((double)(Math.Abs(velocity.X) + Math.Abs(velocity.Y)) < (double)num94 - 0.25)
50248 {
50249 velocity *= 1.1f;
50250 }
50251 if ((double)(Math.Abs(velocity.X) + Math.Abs(velocity.Y)) > (double)num94 + 0.25)
50252 {
50253 velocity *= 0.9f;
50254 }
50255 }
50256 velocity.X = (velocity.X * 34f + num85) / 35f;
50257 velocity.Y = (velocity.Y * 34f + num91) / 35f;
50258 }
50259 else if (type == 875)
50260 {
50261 if (num93 < (float)num84)
50262 {
50263 if (velocity.X < num85)
50264 {
50265 velocity.X += num83;
50266 }
50267 else if (velocity.X > num85)
50268 {
50269 velocity.X -= num83;
50270 }
50271 if (velocity.Y < num91)
50272 {
50273 velocity.Y += num83;
50274 }
50275 else if (velocity.Y > num91)
50276 {
50277 velocity.Y -= num83;
50278 }
50279 }
50280 else
50281 {
50282 velocity = Vector2.Lerp(velocity, new Vector2(num85, num91), 0.75f);
50283 }
50284 }
50285 else
50286 {
50287 if (velocity.X < num85)
50288 {
50289 velocity.X += num83;
50290 if (velocity.X < 0f)
50291 {
50292 velocity.X += num83 * 1.5f;
50293 }
50294 }
50295 if (velocity.X > num85)
50296 {
50297 velocity.X -= num83;
50298 if (velocity.X > 0f)
50299 {
50300 velocity.X -= num83 * 1.5f;
50301 }
50302 }
50303 if (velocity.Y < num91)
50304 {
50305 velocity.Y += num83;
50306 if (velocity.Y < 0f)
50307 {
50308 velocity.Y += num83 * 1.5f;
50309 }
50310 }
50311 if (velocity.Y > num91)
50312 {
50313 velocity.Y -= num83;
50314 if (velocity.Y > 0f)
50315 {
50316 velocity.Y -= num83 * 1.5f;
50317 }
50318 }
50319 }
50320 if (type == 111)
50321 {
50322 frame = 7;
50323 }
50324 if (flag6 && frame < 12)
50325 {
50326 frame = Main.rand.Next(12, 18);
50327 frameCounter = 0;
50328 }
50329 if (type != 313)
50330 {
50331 if ((double)velocity.X > 0.5)
50332 {
50333 spriteDirection = -1;
50334 }
50335 else if ((double)velocity.X < -0.5)
50336 {
50337 spriteDirection = 1;
50338 }
50339 }
50340 if (type == 112)
50341 {
50342 frameCounter++;
50343 if (frame < 3)
50344 {
50345 frame = 3;
50346 frameCounter = 0;
50347 }
50348 if (frameCounter > 3)
50349 {
50350 frameCounter = 0;
50351 frame++;
50352 if (frame >= Main.projFrames[type])
50353 {
50354 frame = 3;
50355 }
50356 }
50357 rotation = velocity.X * 0.125f;
50358 }
50359 else if (type == 900)
50360 {
50361 spriteDirection = -1;
50362 if (velocity.X > 0f)
50363 {
50364 spriteDirection = 1;
50365 }
50366 frameCounter++;
50367 if (frame < 10)
50368 {
50369 frame = 10;
50370 frameCounter = 0;
50371 }
50372 if (frameCounter > 3)
50373 {
50374 frameCounter = 0;
50375 frame++;
50376 if (frame >= Main.projFrames[type])
50377 {
50378 frame = 10;
50379 }
50380 }
50381 rotation = velocity.X * 0.125f;
50382 }
50383 else if (type == 899)
50384 {
50385 spriteDirection = -1;
50386 if (velocity.X > 0f)
50387 {
50388 spriteDirection = 1;
50389 }
50390 frameCounter++;
50391 if (frame < 10)
50392 {
50393 frame = 10;
50394 frameCounter = 0;
50395 }
50396 if (frameCounter > 3)
50397 {
50398 frameCounter = 0;
50399 frame++;
50400 if (frame >= Main.projFrames[type])
50401 {
50402 frame = 10;
50403 }
50404 }
50405 Vector2 v = velocity;
50406 v.Normalize();
50407 rotation = v.ToRotation();
50408 if (velocity.X < 0f)
50409 {
50410 rotation += (float)Math.PI;
50411 }
50412 }
50413 else if (type == 897)
50414 {
50415 spriteDirection = 1;
50416 frameCounter++;
50417 if (frame < 8)
50418 {
50419 frame = 8;
50420 frameCounter = 0;
50421 }
50422 if (frameCounter > 3)
50423 {
50424 frameCounter = 0;
50425 frame++;
50426 if (frame >= Main.projFrames[type])
50427 {
50428 frame = 8;
50429 }
50430 }
50431 Vector2 v2 = velocity;
50432 v2.Normalize();
50433 rotation = v2.ToRotation() + (float)Math.PI / 2f;
50434 }
50435 else if (type == 891)
50436 {
50437 spriteDirection = 1;
50438 frameCounter++;
50439 if (frame < 9)
50440 {
50441 frame = 9;
50442 frameCounter = 0;
50443 }
50444 if (frameCounter > 3)
50445 {
50446 frameCounter = 0;
50447 frame++;
50448 if (frame >= Main.projFrames[type])
50449 {
50450 frame = 9;
50451 }
50452 }
50453 Vector2 v3 = velocity;
50454 v3.Normalize();
50455 rotation = v3.ToRotation() + (float)Math.PI / 2f;
50456 }
50457 else if (type == 890)
50458 {
50459 spriteDirection = -1;
50460 if (velocity.X > 0f)
50461 {
50462 spriteDirection = 1;
50463 }
50464 frameCounter++;
50465 if (frame < 9)
50466 {
50467 frame = 9;
50468 frameCounter = 0;
50469 }
50470 if (frameCounter > 3)
50471 {
50472 frameCounter = 0;
50473 frame++;
50474 if (frame >= Main.projFrames[type])
50475 {
50476 frame = 9;
50477 }
50478 }
50479 rotation = velocity.X * 0.025f;
50480 }
50481 else if (type == 884)
50482 {
50483 spriteDirection = -1;
50484 if (velocity.X > 0f)
50485 {
50486 spriteDirection = 1;
50487 }
50488 frameCounter++;
50489 if (frame < 9)
50490 {
50491 frame = 9;
50492 frameCounter = 0;
50493 }
50494 if (frameCounter > 3)
50495 {
50496 frameCounter = 0;
50497 frame++;
50498 if (frame >= Main.projFrames[type])
50499 {
50500 frame = 9;
50501 }
50502 }
50503 Vector2 v4 = velocity;
50504 v4.Normalize();
50505 rotation = v4.ToRotation() + (float)Math.PI / 2f;
50506 }
50507 else if (type == 881 || type == 934)
50508 {
50509 int num96 = 1226;
50510 if (type == 934)
50511 {
50512 num96 = 1261;
50513 }
50514 if (frame < 6 || frame > 11)
50515 {
50516 Gore.NewGore(new Vector2(base.Center.X, position.Y), velocity * 0.5f, num96);
50517 }
50518 frameCounter++;
50519 if (frameCounter > 4)
50520 {
50521 frame++;
50522 frameCounter = 0;
50523 }
50524 if (frame < 6 || frame > 11)
50525 {
50526 frame = 6;
50527 }
50528 Vector2 v5 = velocity;
50529 v5.Normalize();
50530 rotation = v5.ToRotation() + (float)Math.PI / 2f;
50531 }
50532 else if (type == 875)
50533 {
50534 if (++frameCounter > 4)
50535 {
50536 frame++;
50537 frameCounter = 0;
50538 }
50539 if (frame < 7 || frame > 10)
50540 {
50541 frame = 7;
50542 }
50543 Vector2 v6 = velocity;
50544 v6.Normalize();
50545 rotation = v6.ToRotation() + ((spriteDirection == -1) ? 0f : ((float)Math.PI));
50546 }
50547 else if (type == 825)
50548 {
50549 if (++frameCounter > 4)
50550 {
50551 frame++;
50552 frameCounter = 0;
50553 }
50554 if (frame < 21 || frame > 25)
50555 {
50556 frame = 21;
50557 }
50558 rotation = velocity.X * 0.025f;
50559 }
50560 else if (type == 854)
50561 {
50562 if (frame < 13)
50563 {
50564 Gore.NewGore(new Vector2(base.Center.X, position.Y), velocity * 0.5f, 1269);
50565 }
50566 if (++frameCounter > 4)
50567 {
50568 frame++;
50569 frameCounter = 0;
50570 }
50571 if (frame < 13 || frame > 18)
50572 {
50573 frame = 13;
50574 }
50575 Vector2 v7 = velocity;
50576 v7.Normalize();
50577 rotation = v7.ToRotation() + (float)Math.PI / 2f;
50578 }
50579 else if (type == 858)
50580 {
50581 if (++frameCounter > 4)
50582 {
50583 frame++;
50584 frameCounter = 0;
50585 }
50586 if (frame < 10 || frame > 13)
50587 {
50588 frame = 10;
50589 }
50590 Vector2 v8 = velocity;
50591 v8.Normalize();
50592 rotation = v8.ToRotation() + ((spriteDirection == -1) ? 0f : ((float)Math.PI));
50593 }
50594 else if (type == 859)
50595 {
50596 if (++frameCounter > 4)
50597 {
50598 frame++;
50599 frameCounter = 0;
50600 }
50601 if (frame < 18 || frame > 23)
50602 {
50603 frame = 18;
50604 }
50605 rotation = velocity.X * 0.025f;
50606 }
50607 else if (type == 860)
50608 {
50609 if (frame < 6)
50610 {
50611 frame = 8;
50612 frameCounter = 0;
50613 }
50614 if (++frameCounter > 4)
50615 {
50616 frame++;
50617 frameCounter = 0;
50618 }
50619 if (frame > 13)
50620 {
50621 frame = 6;
50622 }
50623 Vector2 v9 = velocity;
50624 v9.Normalize();
50625 rotation = v9.ToRotation() + (float)Math.PI / 2f;
50626 }
50627 else if (type == 816)
50628 {
50629 if (++frameCounter > 4)
50630 {
50631 frame++;
50632 frameCounter = 0;
50633 }
50634 if (frame < 11 || frame > 16)
50635 {
50636 frame = 11;
50637 }
50638 rotation = velocity.X * 0.025f;
50639 }
50640 else if (type == 821)
50641 {
50642 if (++frameCounter > 4)
50643 {
50644 frame++;
50645 frameCounter = 0;
50646 }
50647 if (frame < 19 || frame > 22)
50648 {
50649 frame = 19;
50650 }
50651 rotation = velocity.X * 0.025f;
50652 }
50653 else if (type == 958)
50654 {
50655 spriteDirection = -1;
50656 if (velocity.X > 0f)
50657 {
50658 spriteDirection = 1;
50659 }
50660 if (frame < 13)
50661 {
50662 frame = 13;
50663 frameCounter = 0;
50664 }
50665 if (++frameCounter > 4)
50666 {
50667 frame++;
50668 frameCounter = 0;
50669 }
50670 if (frame > 16)
50671 {
50672 frame = 13;
50673 }
50674 rotation = MathHelper.Clamp(velocity.X * 0.025f, -0.4f, 0.4f);
50675 }
50676 else if (type == 960)
50677 {
50678 spriteDirection = -1;
50679 if (velocity.X > 0f)
50680 {
50681 spriteDirection = 1;
50682 }
50683 frame = 4;
50684 frameCounter = 0;
50685 Vector2 v10 = velocity;
50686 v10.Normalize();
50687 rotation = v10.ToRotation() + (float)Math.PI / 2f;
50688 }
50689 else if (type == 959)
50690 {
50691 spriteDirection = -1;
50692 if (velocity.X > 0f)
50693 {
50694 spriteDirection = 1;
50695 }
50696 frame = 11;
50697 frameCounter = 0;
50698 rotation = MathHelper.Clamp(velocity.X * 0.025f, -0.4f, 0.4f);
50699 float num97 = Vector2.Dot(velocity.SafeNormalize(Vector2.UnitX), new Vector2(0f, -1f));
50700 if (num97 > 0f && Main.rand.NextFloat() < 0.3f + num97 * 0.3f)
50701 {
50702 Dust dust = Dust.NewDustDirect(position, width, height, 16, velocity.X * 0.7f, velocity.Y * 1.2f, 150, default(Color), 0.6f);
50703 dust.noGravity = true;
50704 dust.fadeIn = 1f;
50705 dust.velocity.X = velocity.X * 0.3f;
50706 dust.position = base.Top + new Vector2(0f, -10f) + new Vector2(Main.rand.NextFloatDirection() * 30f, Main.rand.NextFloatDirection() * 10f);
50707 dust.velocity *= 0.7f;
50708 dust.position += dust.velocity * 2f;
50709 }
50710 }
50711 else if (type == 994)
50712 {
50713 spriteDirection = -1;
50714 if (velocity.X > 0f)
50715 {
50716 spriteDirection = 1;
50717 }
50718 frameCounter++;
50719 if (frameCounter > 5)
50720 {
50721 frame++;
50722 frameCounter = 0;
50723 }
50724 if (frame < 13 || frame > 15)
50725 {
50726 frame = 13;
50727 }
50728 rotation = MathHelper.Clamp(velocity.X * 0.025f, -0.4f, 0.4f);
50729 }
50730 else if (type == 998)
50731 {
50732 spriteDirection = 1;
50733 if (velocity.X > 0f)
50734 {
50735 spriteDirection = -1;
50736 }
50737 frameCounter++;
50738 if (frameCounter > 4)
50739 {
50740 frame++;
50741 frameCounter = 0;
50742 }
50744 {
50745 frame = 6;
50746 }
50747 rotation = MathHelper.Clamp(velocity.X * 0.025f, -0.4f, 0.4f);
50748 }
50749 else if (type == 1003)
50750 {
50751 spriteDirection = 1;
50752 if (velocity.X > 0f)
50753 {
50754 spriteDirection = -1;
50755 }
50756 frameCounter++;
50757 if (frameCounter > 3)
50758 {
50759 frame++;
50760 frameCounter = 0;
50761 }
50762 if (frame < 12 || frame > 15)
50763 {
50764 frame = 12;
50765 }
50766 rotation = MathHelper.Clamp(velocity.X * 0.025f, -0.35f, 0.35f);
50767 }
50768 else if (type == 1004)
50769 {
50770 spriteDirection = 1;
50771 if (velocity.X > 0f)
50772 {
50773 spriteDirection = -1;
50774 }
50775 frameCounter++;
50776 if (frameCounter > 3)
50777 {
50778 frame++;
50779 frameCounter = 0;
50780 }
50781 if (frame < 10 || frame > 14)
50782 {
50783 frame = 10;
50784 }
50785 rotation = MathHelper.Clamp(velocity.X * 0.025f, -0.35f, 0.35f);
50786 }
50787 else if (type == 112)
50788 {
50789 if (spriteDirection == -1)
50790 {
50791 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 1.57f;
50792 }
50793 else
50794 {
50795 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 1.57f;
50796 }
50797 }
50798 else if (type >= 390 && type <= 392)
50799 {
50800 int num98 = (int)(base.Center.X / 16f);
50801 int num99 = (int)(base.Center.Y / 16f);
50802 if (Main.tile[num98, num99] != null && Main.tile[num98, num99].wall > 0)
50803 {
50804 rotation = velocity.ToRotation() + (float)Math.PI / 2f;
50805 frameCounter += (int)(Math.Abs(velocity.X) + Math.Abs(velocity.Y));
50806 if (frameCounter > 5)
50807 {
50808 frame++;
50809 frameCounter = 0;
50810 }
50811 if (frame > 7)
50812 {
50813 frame = 4;
50814 }
50815 if (frame < 4)
50816 {
50817 frame = 7;
50818 }
50819 }
50820 else
50821 {
50822 frameCounter++;
50823 if (frameCounter > 2)
50824 {
50825 frame++;
50826 frameCounter = 0;
50827 }
50828 if (frame < 8 || frame > 10)
50829 {
50830 frame = 8;
50831 }
50832 rotation = velocity.X * 0.1f;
50833 }
50834 }
50835 else if (type == 334)
50836 {
50837 frameCounter++;
50838 if (frameCounter > 1)
50839 {
50840 frame++;
50841 frameCounter = 0;
50842 }
50843 if (frame < 7 || frame > 10)
50844 {
50845 frame = 7;
50846 }
50847 rotation = velocity.X * 0.1f;
50848 }
50849 else if (type == 353)
50850 {
50851 frameCounter++;
50852 if (frameCounter > 6)
50853 {
50854 frame++;
50855 frameCounter = 0;
50856 }
50857 if (frame < 10 || frame > 13)
50858 {
50859 frame = 10;
50860 }
50861 rotation = velocity.X * 0.05f;
50862 }
50863 else if (type == 127)
50864 {
50865 frameCounter += 3;
50866 if (frameCounter > 6)
50867 {
50868 frame++;
50869 frameCounter = 0;
50870 }
50871 if (frame <= 5 || frame > 15)
50872 {
50873 frame = 6;
50874 }
50875 rotation = velocity.X * 0.1f;
50876 }
50877 else if (type == 269)
50878 {
50879 if (frame == 6)
50880 {
50881 frameCounter = 0;
50882 }
50883 else if (frame < 4 || frame > 6)
50884 {
50885 frameCounter = 0;
50886 frame = 4;
50887 }
50888 else
50889 {
50890 frameCounter++;
50891 if (frameCounter > 6)
50892 {
50893 frame++;
50894 frameCounter = 0;
50895 }
50896 }
50897 rotation = velocity.X * 0.05f;
50898 }
50899 else if (type == 266)
50900 {
50901 frameCounter++;
50902 if (frameCounter > 6)
50903 {
50904 frame++;
50905 frameCounter = 0;
50906 }
50908 {
50909 frame = 2;
50910 }
50911 rotation = velocity.X * 0.1f;
50912 }
50913 else if (type == 324)
50914 {
50915 frameCounter++;
50916 if (frameCounter > 1)
50917 {
50918 frame++;
50919 frameCounter = 0;
50920 }
50922 {
50923 frame = 6;
50924 }
50925 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 1.58f;
50926 Lighting.AddLight((int)base.Center.X / 16, (int)base.Center.Y / 16, 0.9f, 0.6f, 0.2f);
50927 for (int num100 = 0; num100 < 2; num100++)
50928 {
50929 int num101 = 4;
50930 int num102 = Dust.NewDust(new Vector2(base.Center.X - (float)num101, base.Center.Y - (float)num101) - velocity * 0f, num101 * 2, num101 * 2, 6, 0f, 0f, 100);
50931 Main.dust[num102].scale *= 1.8f + (float)Main.rand.Next(10) * 0.1f;
50932 Main.dust[num102].velocity *= 0.2f;
50933 if (num100 == 1)
50934 {
50935 Main.dust[num102].position -= velocity * 0.5f;
50936 }
50937 Main.dust[num102].noGravity = true;
50938 num102 = Dust.NewDust(new Vector2(base.Center.X - (float)num101, base.Center.Y - (float)num101) - velocity * 0f, num101 * 2, num101 * 2, 31, 0f, 0f, 100, default(Color), 0.5f);
50939 Main.dust[num102].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f;
50940 Main.dust[num102].velocity *= 0.05f;
50941 if (num100 == 1)
50942 {
50943 Main.dust[num102].position -= velocity * 0.5f;
50944 }
50945 }
50946 }
50947 else if (type == 268)
50948 {
50949 frameCounter++;
50950 if (frameCounter > 4)
50951 {
50952 frame++;
50953 frameCounter = 0;
50954 }
50956 {
50957 frame = 6;
50958 }
50959 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 1.58f;
50960 }
50961 else if (type == 200)
50962 {
50963 frameCounter += 3;
50964 if (frameCounter > 6)
50965 {
50966 frame++;
50967 frameCounter = 0;
50968 }
50970 {
50971 frame = 6;
50972 }
50973 rotation = velocity.X * 0.1f;
50974 }
50975 else if (type == 208)
50976 {
50977 rotation = velocity.X * 0.075f;
50978 frameCounter++;
50979 if (frameCounter > 6)
50980 {
50981 frame++;
50982 frameCounter = 0;
50983 }
50984 if (frame > 4)
50985 {
50986 frame = 1;
50987 }
50988 if (frame < 1)
50989 {
50990 frame = 1;
50991 }
50992 }
50993 else if (type == 236)
50994 {
50995 rotation = velocity.Y * 0.05f * (float)direction;
50996 if (velocity.Y < 0f)
50997 {
50998 frameCounter += 2;
50999 }
51000 else
51001 {
51002 frameCounter++;
51003 }
51004 if (frameCounter >= 6)
51005 {
51006 frame++;
51007 frameCounter = 0;
51008 }
51009 if (frame > 12)
51010 {
51011 frame = 9;
51012 }
51013 if (frame < 9)
51014 {
51015 frame = 9;
51016 }
51017 }
51018 else if (type == 499)
51019 {
51020 rotation = velocity.Y * 0.05f * (float)direction;
51021 if (velocity.Y < 0f)
51022 {
51023 frameCounter += 2;
51024 }
51025 else
51026 {
51027 frameCounter++;
51028 }
51029 if (frameCounter >= 6)
51030 {
51031 frame++;
51032 frameCounter = 0;
51033 }
51034 if (frame >= 12)
51035 {
51036 frame = 8;
51037 }
51038 if (frame < 8)
51039 {
51040 frame = 8;
51041 }
51042 }
51043 else if (type == 765)
51044 {
51045 rotation = velocity.Y * 0.05f * (float)direction;
51046 frameCounter++;
51047 if (frameCounter >= 8)
51048 {
51049 frame++;
51050 frameCounter = 0;
51051 }
51052 if (frame >= 10)
51053 {
51054 frame = 8;
51055 }
51056 if (frame < 6)
51057 {
51058 frame = 6;
51059 }
51060 }
51061 else if (type == 314)
51062 {
51063 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 1.58f;
51064 frameCounter++;
51065 if (frameCounter >= 3)
51066 {
51067 frame++;
51068 frameCounter = 0;
51069 }
51070 if (frame > 12)
51071 {
51072 frame = 7;
51073 }
51074 if (frame < 7)
51075 {
51076 frame = 7;
51077 }
51078 }
51079 else if (type == 319)
51080 {
51081 rotation = velocity.X * 0.05f;
51082 frameCounter++;
51083 if (frameCounter >= 6)
51084 {
51085 frame++;
51086 frameCounter = 0;
51087 }
51088 if (frame > 10)
51089 {
51090 frame = 6;
51091 }
51092 if (frame < 6)
51093 {
51094 frame = 6;
51095 }
51096 }
51097 else if (type == 210)
51098 {
51099 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 1.58f;
51100 frameCounter += 3;
51101 if (frameCounter > 6)
51102 {
51103 frame++;
51104 frameCounter = 0;
51105 }
51106 if (frame > 11)
51107 {
51108 frame = 7;
51109 }
51110 if (frame < 7)
51111 {
51112 frame = 7;
51113 }
51114 }
51115 else if (type == 313)
51116 {
51117 position.Y += height;
51118 height = 54;
51119 position.Y -= height;
51120 position.X += width / 2;
51121 width = 54;
51122 position.X -= width / 2;
51123 rotation += velocity.X * 0.01f;
51124 frameCounter = 0;
51125 frame = 11;
51126 }
51127 else if (type == 398)
51128 {
51129 if ((double)velocity.X > 0.5)
51130 {
51131 spriteDirection = 1;
51132 }
51133 else if ((double)velocity.X < -0.5)
51134 {
51135 spriteDirection = -1;
51136 }
51137 frameCounter++;
51138 if (frameCounter > 1)
51139 {
51140 frame++;
51141 frameCounter = 0;
51142 }
51144 {
51145 frame = 6;
51146 }
51147 rotation = velocity.X * 0.1f;
51148 }
51149 else if (spriteDirection == -1)
51150 {
51151 rotation = (float)Math.Atan2(velocity.Y, velocity.X);
51152 }
51153 else
51154 {
51155 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + 3.14f;
51156 }
51157 if (!flag6 && type != 499 && type != 765 && type != 816 && type != 821 && type != 825 && type != 859 && type != 881 && type != 884 && type != 890 && type != 891 && type != 900 && type != 934 && type != 958 && type != 959 && type != 960 && type != 994 && type != 998 && type != 1003 && type != 1004)
51158 {
51159 if (type == 899)
51160 {
51161 int num103 = 6;
51162 if (Main.rand.Next(4) == 0)
51163 {
51164 num103 = 31;
51165 }
51166 int num104 = Dust.NewDust(base.Center + new Vector2(-8f, 0f) - velocity * 0.25f, 15, 15, num103, (0f - velocity.X) * 0.5f, velocity.Y * 0.5f, 0, default(Color), 1.3f);
51167 Main.dust[num104].velocity.X = Main.dust[num104].velocity.X * 0.2f;
51168 Main.dust[num104].velocity.Y = Main.dust[num104].velocity.Y * 0.2f - 0.2f;
51169 Main.dust[num104].noGravity = true;
51170 }
51171 else if (type == 897)
51172 {
51173 int num105 = 6;
51174 if (Main.rand.Next(4) == 0)
51175 {
51176 num105 = 31;
51177 }
51178 int num106 = Dust.NewDust(base.Center + new Vector2(-8f, -8f) - velocity * 0.25f, 15, 15, num105, (0f - velocity.X) * 0.5f, velocity.Y * 0.5f, 0, default(Color), 1.3f);
51179 Main.dust[num106].velocity.X = Main.dust[num106].velocity.X * 0.2f;
51180 Main.dust[num106].velocity.Y = Main.dust[num106].velocity.Y * 0.2f - 0.2f;
51181 Main.dust[num106].noGravity = true;
51182 }
51183 else if (type == 875)
51184 {
51185 if (Main.rand.Next(3) == 0)
51186 {
51187 Gore.NewGorePerfect(base.Center + new Vector2(-10f + (float)Main.rand.Next(-20, 20) * 0.5f, -10f + (float)Main.rand.Next(-20, 20) * 0.5f), velocity * 0.1f, 1225, 0.5f + Main.rand.NextFloat() * 1f);
51188 Vector2 vector9 = Main.rand.NextVector2CircularEdge(2f, 2f) + velocity * -0.5f;
51189 vector9 *= 0.5f;
51190 int num107 = Dust.NewDust(base.Center - velocity * 1.5f - new Vector2(7f, 7f), 15, 15, 226, vector9.X, vector9.Y, 0, default(Color), 0.65f);
51191 Main.dust[num107].noGravity = true;
51192 }
51193 }
51194 else if (type == 860)
51195 {
51196 int num108 = Dust.NewDust(new Vector2(position.X + (float)(width / 2) - 4f, position.Y + (float)(height / 2) - 4f) + velocity, 8, 8, 27, (0f - velocity.X) * 0.5f, velocity.Y * 0.5f);
51197 Main.dust[num108].velocity.X = Main.dust[num108].velocity.X * 0.2f;
51198 Main.dust[num108].velocity.Y = Main.dust[num108].velocity.Y * 0.2f - 0.2f;
51199 Main.dust[num108].velocity += new Vector2((float)Main.rand.Next(-10, 10) * 0.4f, (float)Main.rand.Next(-10, 10) * 0.4f) * 0.5f;
51200 Main.dust[num108].noGravity = true;
51201 }
51202 else if (type == 858)
51203 {
51204 int num109 = 6;
51205 if (Main.rand.Next(4) == 0)
51206 {
51207 num109 = 31;
51208 }
51209 int num110 = Dust.NewDust(new Vector2(position.X + (float)(width / 2) - 4f, position.Y + (float)(height / 2) - 4f) - velocity, 10, 10, num109, (0f - velocity.X) * 0.5f, velocity.Y * 0.5f, 0, default(Color), 1.3f);
51210 Main.dust[num110].velocity.X = Main.dust[num110].velocity.X * 0.2f;
51211 Main.dust[num110].velocity.Y = Main.dust[num110].velocity.Y * 0.2f - 0.2f;
51212 Main.dust[num110].noGravity = true;
51213 }
51214 else if (type == 112)
51215 {
51216 int num111 = 6;
51217 if (Main.rand.Next(4) == 0)
51218 {
51219 num111 = 31;
51220 }
51221 int num112 = Dust.NewDust(base.Center + new Vector2(12 * spriteDirection, 4f).RotatedBy(rotation) + new Vector2(-5f, -5f), 10, 10, num111, (0f - velocity.X) * 0.5f, velocity.Y * 0.5f, 0, default(Color), 1.3f);
51222 Main.dust[num112].velocity.X = Main.dust[num112].velocity.X * 0.2f;
51223 Main.dust[num112].velocity.Y = Main.dust[num112].velocity.Y * 0.2f - 0.2f;
51224 Main.dust[num112].noGravity = true;
51225 }
51226 else if (type == 854)
51227 {
51228 if (Main.rand.Next(6) == 0)
51229 {
51230 Vector2 vector10 = base.Center / 16f;
51231 int i2 = (int)vector10.X;
51232 int num113 = (int)vector10.Y;
51234 if (!WorldGen.SolidTile(tileSafely) && tileSafely.liquid == 0)
51235 {
51236 Gore gore = Gore.NewGorePerfect(base.Center + new Vector2((float)Main.rand.Next(-30, 30) * 0.5f, (float)Main.rand.Next(-30, 30) * 0.5f), velocity * -0.2f, 910);
51237 gore.Frame.CurrentColumn = 0;
51238 gore.timeLeft = 1;
51239 }
51240 }
51241 }
51242 else if (type != 398 && type != 390 && type != 391 && type != 392 && type != 127 && type != 200 && type != 208 && type != 210 && type != 236 && type != 266 && type != 268 && type != 269 && type != 313 && type != 314 && type != 319 && type != 324 && type != 334 && type != 353)
51243 {
51244 int num114 = Dust.NewDust(new Vector2(position.X + (float)(width / 2) - 4f, position.Y + (float)(height / 2) - 4f) - velocity, 8, 8, 16, (0f - velocity.X) * 0.5f, velocity.Y * 0.5f, 50, default(Color), 1.7f);
51245 Main.dust[num114].velocity.X = Main.dust[num114].velocity.X * 0.2f;
51246 Main.dust[num114].velocity.Y = Main.dust[num114].velocity.Y * 0.2f;
51247 Main.dust[num114].noGravity = true;
51248 }
51249 }
51250 }
51251 else
51252 {
51253 if (flag6)
51254 {
51255 float num115 = 40 * minionPos;
51256 int num116 = 30;
51257 int num117 = 60;
51258 localAI[0] -= 1f;
51259 if (localAI[0] < 0f)
51260 {
51261 localAI[0] = 0f;
51262 }
51263 if (ai[1] > 0f)
51264 {
51265 ai[1] -= 1f;
51266 }
51267 else
51268 {
51269 float num118 = position.X;
51270 float num119 = position.Y;
51271 float num120 = 100000f;
51272 float num121 = num120;
51273 int num122 = -1;
51274 float num123 = 20f;
51275 NPC ownerMinionAttackTargetNPC = OwnerMinionAttackTargetNPC;
51276 if (ownerMinionAttackTargetNPC != null && ownerMinionAttackTargetNPC.CanBeChasedBy(this))
51277 {
51278 float num124 = ownerMinionAttackTargetNPC.position.X + (float)(ownerMinionAttackTargetNPC.width / 2);
51279 float num125 = ownerMinionAttackTargetNPC.position.Y + (float)(ownerMinionAttackTargetNPC.height / 2);
51280 float num126 = Math.Abs(position.X + (float)(width / 2) - num124) + Math.Abs(position.Y + (float)(height / 2) - num125);
51281 if (num126 < num120)
51282 {
51283 if (num122 == -1 && num126 <= num121)
51284 {
51285 num121 = num126;
51286 num118 = num124;
51287 num119 = num125;
51288 }
51289 if (Collision.CanHit(position, width, height, ownerMinionAttackTargetNPC.position, ownerMinionAttackTargetNPC.width, ownerMinionAttackTargetNPC.height))
51290 {
51291 num120 = num126;
51292 num118 = num124;
51293 num119 = num125;
51295 }
51296 }
51297 }
51298 if (num122 == -1)
51299 {
51300 for (int num127 = 0; num127 < 200; num127++)
51301 {
51302 if (!Main.npc[num127].CanBeChasedBy(this))
51303 {
51304 continue;
51305 }
51306 float num128 = Main.npc[num127].position.X + (float)(Main.npc[num127].width / 2);
51307 float num129 = Main.npc[num127].position.Y + (float)(Main.npc[num127].height / 2);
51308 float num130 = Math.Abs(position.X + (float)(width / 2) - num128) + Math.Abs(position.Y + (float)(height / 2) - num129);
51309 if (num130 < num120)
51310 {
51311 if (num122 == -1 && num130 <= num121)
51312 {
51313 num121 = num130;
51314 num118 = num128 + Main.npc[num127].velocity.X * num123;
51315 num119 = num129 + Main.npc[num127].velocity.Y * num123;
51316 }
51317 if (Collision.CanHit(position, width, height, Main.npc[num127].position, Main.npc[num127].width, Main.npc[num127].height))
51318 {
51319 num120 = num130;
51320 num118 = num128 + Main.npc[num127].velocity.X * num123;
51321 num119 = num129 + Main.npc[num127].velocity.Y * num123;
51322 num122 = num127;
51323 }
51324 }
51325 }
51326 }
51327 if (num122 == -1 && num121 < num120)
51328 {
51329 num120 = num121;
51330 }
51331 float num131 = 400f;
51332 if ((double)position.Y > Main.worldSurface * 16.0)
51333 {
51334 num131 = 200f;
51335 }
51336 if (num120 < num131 + num115 && num122 == -1)
51337 {
51338 float num132 = num118 - (position.X + (float)(width / 2));
51339 if (num132 < -5f)
51340 {
51341 flag2 = true;
51342 flag3 = false;
51343 }
51344 else if (num132 > 5f)
51345 {
51346 flag3 = true;
51347 flag2 = false;
51348 }
51349 }
51350 else if (num122 >= 0 && num120 < 800f + num115)
51351 {
51352 localAI[0] = num117;
51353 float num133 = num118 - (position.X + (float)(width / 2));
51354 if (num133 > 450f || num133 < -450f)
51355 {
51356 if (num133 < -50f)
51357 {
51358 flag2 = true;
51359 flag3 = false;
51360 }
51361 else if (num133 > 50f)
51362 {
51363 flag3 = true;
51364 flag2 = false;
51365 }
51366 }
51367 else if (owner == Main.myPlayer)
51368 {
51369 ai[1] = num116;
51370 Vector2 vector11 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)(height / 2) - 8f);
51371 float num134 = num118 - vector11.X + (float)Main.rand.Next(-20, 21);
51372 float num135 = Math.Abs(num134) * 0.1f;
51373 num135 = num135 * (float)Main.rand.Next(0, 100) * 0.001f;
51374 float num136 = num119 - vector11.Y + (float)Main.rand.Next(-20, 21) - num135;
51375 float num137 = (float)Math.Sqrt(num134 * num134 + num136 * num136);
51376 num137 = 11f / num137;
51377 num134 *= num137;
51378 num136 *= num137;
51379 int num138 = damage;
51380 int num139 = 195;
51381 int num140 = NewProjectile(GetProjectileSource_FromThis(), vector11.X, vector11.Y, num134, num136, num139, num138, knockBack, Main.myPlayer);
51382 Main.projectile[num140].timeLeft = 300;
51383 if (num134 < 0f)
51384 {
51385 direction = -1;
51386 }
51387 if (num134 > 0f)
51388 {
51389 direction = 1;
51390 }
51391 netUpdate = true;
51392 }
51393 }
51394 }
51395 }
51396 bool flag13 = false;
51398 bool flag14 = false;
51399 if (type == 266 || (type >= 390 && type <= 392))
51400 {
51401 float num141 = 40 * minionPos;
51402 int num142 = 60;
51403 localAI[0] -= 1f;
51404 if (localAI[0] < 0f)
51405 {
51406 localAI[0] = 0f;
51407 }
51408 if (ai[1] > 0f)
51409 {
51410 ai[1] -= 1f;
51411 }
51412 else
51413 {
51414 float num143 = position.X;
51415 float num144 = position.Y;
51416 float num145 = 100000f;
51417 float num146 = num145;
51418 int num147 = -1;
51419 NPC ownerMinionAttackTargetNPC2 = OwnerMinionAttackTargetNPC;
51420 if (ownerMinionAttackTargetNPC2 != null && ownerMinionAttackTargetNPC2.CanBeChasedBy(this))
51421 {
51422 float x = ownerMinionAttackTargetNPC2.Center.X;
51423 float y = ownerMinionAttackTargetNPC2.Center.Y;
51424 float num148 = Math.Abs(position.X + (float)(width / 2) - x) + Math.Abs(position.Y + (float)(height / 2) - y);
51425 if (num148 < num145)
51426 {
51427 if (num147 == -1 && num148 <= num146)
51428 {
51429 num146 = num148;
51430 num143 = x;
51431 num144 = y;
51432 }
51433 if (Collision.CanHit(position, width, height, ownerMinionAttackTargetNPC2.position, ownerMinionAttackTargetNPC2.width, ownerMinionAttackTargetNPC2.height))
51434 {
51435 num145 = num148;
51436 num143 = x;
51437 num144 = y;
51439 }
51440 }
51441 }
51442 if (num147 == -1)
51443 {
51444 for (int num149 = 0; num149 < 200; num149++)
51445 {
51446 if (!Main.npc[num149].CanBeChasedBy(this))
51447 {
51448 continue;
51449 }
51450 float num150 = Main.npc[num149].position.X + (float)(Main.npc[num149].width / 2);
51451 float num151 = Main.npc[num149].position.Y + (float)(Main.npc[num149].height / 2);
51452 float num152 = Math.Abs(position.X + (float)(width / 2) - num150) + Math.Abs(position.Y + (float)(height / 2) - num151);
51453 if (num152 < num145)
51454 {
51455 if (num147 == -1 && num152 <= num146)
51456 {
51457 num146 = num152;
51458 num143 = num150;
51459 num144 = num151;
51460 }
51461 if (Collision.CanHit(position, width, height, Main.npc[num149].position, Main.npc[num149].width, Main.npc[num149].height))
51462 {
51463 num145 = num152;
51464 num143 = num150;
51465 num144 = num151;
51466 num147 = num149;
51467 }
51468 }
51469 }
51470 }
51471 if (type >= 390 && type <= 392 && !Collision.SolidCollision(position, width, height))
51472 {
51473 tileCollide = true;
51474 }
51475 if (num147 == -1 && num146 < num145)
51476 {
51477 num145 = num146;
51478 }
51479 else if (num147 >= 0)
51480 {
51481 flag13 = true;
51482 vector12 = new Vector2(num143, num144) - base.Center;
51483 if (type >= 390 && type <= 392)
51484 {
51485 if (Main.npc[num147].position.Y > position.Y + (float)height)
51486 {
51487 int num153 = (int)(base.Center.X / 16f);
51488 int num154 = (int)((position.Y + (float)height + 1f) / 16f);
51489 if (Main.tile[num153, num154] != null && Main.tile[num153, num154].active() && TileID.Sets.Platforms[Main.tile[num153, num154].type])
51490 {
51491 tileCollide = false;
51492 }
51493 }
51494 Rectangle rectangle = new Rectangle((int)position.X, (int)position.Y, width, height);
51495 Rectangle value = new Rectangle((int)Main.npc[num147].position.X, (int)Main.npc[num147].position.Y, Main.npc[num147].width, Main.npc[num147].height);
51496 int num155 = 10;
51497 value.X -= num155;
51498 value.Y -= num155;
51499 value.Width += num155 * 2;
51500 value.Height += num155 * 2;
51501 if (rectangle.Intersects(value))
51502 {
51503 flag14 = true;
51504 Vector2 vector13 = Main.npc[num147].Center - base.Center;
51505 if (velocity.Y > 0f && vector13.Y < 0f)
51506 {
51507 velocity.Y *= 0.5f;
51508 }
51509 if (velocity.Y < 0f && vector13.Y > 0f)
51510 {
51511 velocity.Y *= 0.5f;
51512 }
51513 if (velocity.X > 0f && vector13.X < 0f)
51514 {
51515 velocity.X *= 0.5f;
51516 }
51517 if (velocity.X < 0f && vector13.X > 0f)
51518 {
51519 velocity.X *= 0.5f;
51520 }
51521 if (vector13.Length() > 14f)
51522 {
51523 vector13.Normalize();
51524 vector13 *= 14f;
51525 }
51526 rotation = (rotation * 5f + vector13.ToRotation() + (float)Math.PI / 2f) / 6f;
51527 velocity = (velocity * 9f + vector13) / 10f;
51528 for (int num156 = 0; num156 < 1000; num156++)
51529 {
51530 if (whoAmI != num156 && owner == Main.projectile[num156].owner && Main.projectile[num156].type >= 390 && Main.projectile[num156].type <= 392 && (Main.projectile[num156].Center - base.Center).Length() < 15f)
51531 {
51532 float num157 = 0.5f;
51533 if (base.Center.Y > Main.projectile[num156].Center.Y)
51534 {
51535 Main.projectile[num156].velocity.Y -= num157;
51536 velocity.Y += num157;
51537 }
51538 else
51539 {
51540 Main.projectile[num156].velocity.Y += num157;
51541 velocity.Y -= num157;
51542 }
51543 if (base.Center.X > Main.projectile[num156].Center.X)
51544 {
51545 velocity.X += num157;
51546 Main.projectile[num156].velocity.X -= num157;
51547 }
51548 else
51549 {
51550 velocity.X -= num157;
51551 Main.projectile[num156].velocity.Y += num157;
51552 }
51553 }
51554 }
51555 }
51556 }
51557 }
51558 float num158 = 300f;
51559 if ((double)position.Y > Main.worldSurface * 16.0)
51560 {
51561 num158 = 150f;
51562 }
51563 if (type >= 390 && type <= 392)
51564 {
51565 num158 = 500f;
51566 if ((double)position.Y > Main.worldSurface * 16.0)
51567 {
51568 num158 = 250f;
51569 }
51570 }
51571 if (num145 < num158 + num141 && num147 == -1)
51572 {
51573 float num159 = num143 - (position.X + (float)(width / 2));
51574 if (num159 < -5f)
51575 {
51576 flag2 = true;
51577 flag3 = false;
51578 }
51579 else if (num159 > 5f)
51580 {
51581 flag3 = true;
51582 flag2 = false;
51583 }
51584 }
51585 bool flag15 = false;
51586 if (type >= 390 && type <= 392 && localAI[1] > 0f)
51587 {
51588 flag15 = true;
51589 localAI[1] -= 1f;
51590 }
51591 if (num147 >= 0 && num145 < 800f + num141)
51592 {
51593 friendly = true;
51594 localAI[0] = num142;
51595 float num160 = num143 - (position.X + (float)(width / 2));
51596 if (num160 < -10f)
51597 {
51598 flag2 = true;
51599 flag3 = false;
51600 }
51601 else if (num160 > 10f)
51602 {
51603 flag3 = true;
51604 flag2 = false;
51605 }
51606 if (num144 < base.Center.Y - 100f && num160 > -50f && num160 < 50f && velocity.Y == 0f)
51607 {
51608 float num161 = Math.Abs(num144 - base.Center.Y);
51609 if (num161 < 120f)
51610 {
51611 velocity.Y = -10f;
51612 }
51613 else if (num161 < 210f)
51614 {
51615 velocity.Y = -13f;
51616 }
51617 else if (num161 < 270f)
51618 {
51619 velocity.Y = -15f;
51620 }
51621 else if (num161 < 310f)
51622 {
51623 velocity.Y = -17f;
51624 }
51625 else if (num161 < 380f)
51626 {
51627 velocity.Y = -18f;
51628 }
51629 }
51630 if (flag15)
51631 {
51632 friendly = false;
51633 if (velocity.X < 0f)
51634 {
51635 flag2 = true;
51636 }
51637 else if (velocity.X > 0f)
51638 {
51639 flag3 = true;
51640 }
51641 }
51642 }
51643 else
51644 {
51645 friendly = false;
51646 }
51647 }
51648 }
51649 if (ai[1] != 0f)
51650 {
51651 flag2 = false;
51652 flag3 = false;
51653 }
51654 else if (flag6 && localAI[0] == 0f)
51655 {
51656 direction = Main.player[owner].direction;
51657 }
51658 else if (type >= 390 && type <= 392)
51659 {
51660 int num162 = (int)(base.Center.X / 16f);
51661 int num163 = (int)(base.Center.Y / 16f);
51662 if (Main.tile[num162, num163] != null && Main.tile[num162, num163].wall > 0)
51663 {
51664 flag2 = (flag3 = false);
51665 }
51666 }
51667 if (type == 127)
51668 {
51669 if ((double)rotation > -0.1 && (double)rotation < 0.1)
51670 {
51671 rotation = 0f;
51672 }
51673 else if (rotation < 0f)
51674 {
51675 rotation += 0.1f;
51676 }
51677 else
51678 {
51679 rotation -= 0.1f;
51680 }
51681 }
51682 else if (type != 313 && !flag14)
51683 {
51684 rotation = 0f;
51685 }
51686 if (type < 390 || type > 392)
51687 {
51688 tileCollide = true;
51689 }
51690 float num164 = 0.08f;
51691 float num165 = 6.5f;
51692 if (type == 127)
51693 {
51694 num165 = 2f;
51695 num164 = 0.04f;
51696 }
51697 if (type == 112)
51698 {
51699 num165 = 6f;
51700 num164 = 0.06f;
51701 }
51702 if (type == 334)
51703 {
51704 num165 = 8f;
51705 num164 = 0.08f;
51706 }
51707 if (type == 268)
51708 {
51709 num165 = 8f;
51710 num164 = 0.4f;
51711 }
51712 if (type == 324)
51713 {
51714 num164 = 0.1f;
51715 num165 = 3f;
51716 }
51717 if (type == 858)
51718 {
51719 num164 = 0.3f;
51720 num165 = 7f;
51721 }
51722 if (flag6 || type == 266 || (type >= 390 && type <= 392) || type == 816 || type == 821 || type == 825 || type == 859 || type == 860 || type == 881 || type == 884 || type == 890 || type == 891 || type == 897 || type == 899 || type == 900 || type == 934 || type == 956 || type == 958 || type == 959 || type == 960 || type == 994 || type == 998 || type == 1003 || type == 1004)
51723 {
51724 num165 = 6f;
51725 num164 = 0.2f;
51726 if (num165 < Math.Abs(Main.player[owner].velocity.X) + Math.Abs(Main.player[owner].velocity.Y))
51727 {
51728 num165 = Math.Abs(Main.player[owner].velocity.X) + Math.Abs(Main.player[owner].velocity.Y);
51729 num164 = 0.3f;
51730 }
51731 if (flag6)
51732 {
51733 num164 *= 2f;
51734 }
51735 }
51736 if (type == 875)
51737 {
51738 num165 = 7f;
51739 num164 = 0.25f;
51740 if (num165 < Math.Abs(Main.player[owner].velocity.X) + Math.Abs(Main.player[owner].velocity.Y))
51741 {
51742 num165 = Math.Abs(Main.player[owner].velocity.X) + Math.Abs(Main.player[owner].velocity.Y);
51743 num164 = 0.35f;
51744 }
51745 }
51746 if (type >= 390 && type <= 392)
51747 {
51748 num164 *= 2f;
51749 }
51750 if (flag7)
51751 {
51752 num165 = 6f;
51753 }
51754 if (flag2)
51755 {
51756 if ((double)velocity.X > -3.5)
51757 {
51758 velocity.X -= num164;
51759 }
51760 else
51761 {
51762 velocity.X -= num164 * 0.25f;
51763 }
51764 }
51765 else if (flag3)
51766 {
51767 if ((double)velocity.X < 3.5)
51768 {
51769 velocity.X += num164;
51770 }
51771 else
51772 {
51773 velocity.X += num164 * 0.25f;
51774 }
51775 }
51776 else
51777 {
51778 velocity.X *= 0.9f;
51779 if (velocity.X >= 0f - num164 && velocity.X <= num164)
51780 {
51781 velocity.X = 0f;
51782 }
51783 }
51784 if (type == 208)
51785 {
51786 velocity.X *= 0.95f;
51787 if ((double)velocity.X > -0.1 && (double)velocity.X < 0.1)
51788 {
51789 velocity.X = 0f;
51790 }
51791 flag2 = false;
51792 flag3 = false;
51793 }
51794 if (flag2 || flag3)
51795 {
51796 int num166 = (int)(position.X + (float)(width / 2)) / 16;
51797 int j2 = (int)(position.Y + (float)(height / 2)) / 16;
51798 if (type == 236)
51799 {
51800 num166 += direction;
51801 }
51802 if (flag2)
51803 {
51804 num166--;
51805 }
51806 if (flag3)
51807 {
51808 num166++;
51809 }
51810 num166 += (int)velocity.X;
51812 {
51813 flag5 = true;
51814 }
51815 }
51816 if (Main.player[owner].position.Y + (float)Main.player[owner].height - 8f > position.Y + (float)height)
51817 {
51818 flag4 = true;
51819 }
51820 if (type == 268 && frameCounter < 10)
51821 {
51822 flag5 = false;
51823 }
51824 if (type == 860 && velocity.X != 0f)
51825 {
51826 flag5 = true;
51827 }
51828 if ((type == 881 || type == 934) && velocity.X != 0f)
51829 {
51830 flag5 = true;
51831 }
51832 Collision.StepUp(ref position, ref velocity, width, height, ref stepSpeed, ref gfxOffY);
51833 if (velocity.Y == 0f || type == 200)
51834 {
51835 if (!flag4 && (velocity.X < 0f || velocity.X > 0f))
51836 {
51837 int num167 = (int)(position.X + (float)(width / 2)) / 16;
51838 int j3 = (int)(position.Y + (float)(height / 2)) / 16 + 1;
51839 if (flag2)
51840 {
51841 num167--;
51842 }
51843 if (flag3)
51844 {
51845 num167++;
51846 }
51848 }
51849 if (flag5)
51850 {
51851 int num168 = (int)(position.X + (float)(width / 2)) / 16;
51852 int num169 = (int)(position.Y + (float)height) / 16;
51853 if (WorldGen.SolidTileAllowBottomSlope(num168, num169) || Main.tile[num168, num169].halfBrick() || Main.tile[num168, num169].slope() > 0 || type == 200)
51854 {
51855 if (type == 200)
51856 {
51857 velocity.Y = -3.1f;
51858 }
51859 else
51860 {
51861 try
51862 {
51863 num168 = (int)(position.X + (float)(width / 2)) / 16;
51864 num169 = (int)(position.Y + (float)(height / 2)) / 16;
51865 if (flag2)
51866 {
51867 num168--;
51868 }
51869 if (flag3)
51870 {
51871 num168++;
51872 }
51873 num168 += (int)velocity.X;
51875 {
51876 velocity.Y = -5.1f;
51877 }
51878 else if (!WorldGen.SolidTile(num168, num169 - 2))
51879 {
51880 velocity.Y = -7.1f;
51881 }
51882 else if (WorldGen.SolidTile(num168, num169 - 5))
51883 {
51884 velocity.Y = -11.1f;
51885 }
51886 else if (WorldGen.SolidTile(num168, num169 - 4))
51887 {
51888 velocity.Y = -10.1f;
51889 }
51890 else
51891 {
51892 velocity.Y = -9.1f;
51893 }
51894 }
51895 catch
51896 {
51897 velocity.Y = -9.1f;
51898 }
51899 }
51900 if (type == 127)
51901 {
51902 ai[0] = 1f;
51903 }
51904 }
51905 }
51906 else if (type == 266 && (flag2 || flag3))
51907 {
51908 velocity.Y -= 6f;
51909 }
51910 }
51911 if (velocity.X > num165)
51912 {
51913 velocity.X = num165;
51914 }
51915 if (velocity.X < 0f - num165)
51916 {
51917 velocity.X = 0f - num165;
51918 }
51919 if (velocity.X < 0f)
51920 {
51921 direction = -1;
51922 }
51923 if (velocity.X > 0f)
51924 {
51925 direction = 1;
51926 }
51927 if (velocity.X > num164 && flag3)
51928 {
51929 direction = 1;
51930 }
51931 if (velocity.X < 0f - num164 && flag2)
51932 {
51933 direction = -1;
51934 }
51935 if (type != 313)
51936 {
51937 if (direction == -1)
51938 {
51939 spriteDirection = 1;
51940 }
51941 if (direction == 1)
51942 {
51943 spriteDirection = -1;
51944 }
51945 }
51946 if (type == 398 || type == 958 || type == 960 || type == 956 || type == 959 || type == 994)
51947 {
51948 spriteDirection = direction;
51949 }
51950 bool flag16 = position.X - oldPosition.X == 0f;
51951 if (type == 956)
51952 {
51953 if (alpha > 0)
51954 {
51955 int num170 = Dust.NewDust(position, width, height, 6, velocity.X, velocity.Y, 0, default(Color), 1.2f);
51956 Main.dust[num170].velocity.X += Main.rand.NextFloat() - 0.5f;
51957 Main.dust[num170].velocity.Y += (Main.rand.NextFloat() + 0.5f) * -1f;
51958 if (Main.rand.Next(3) != 0)
51959 {
51960 Main.dust[num170].noGravity = true;
51961 }
51962 alpha -= 5;
51963 if (alpha < 0)
51964 {
51965 alpha = 0;
51966 }
51967 }
51968 if (velocity.Y != 0f)
51969 {
51970 frame = 10;
51971 }
51972 else if (flag16)
51973 {
51974 spriteDirection = 1;
51975 if (Main.player[owner].Center.X < base.Center.X)
51976 {
51977 spriteDirection = -1;
51978 }
51979 frame = 0;
51980 }
51981 else
51982 {
51983 float num171 = velocity.Length();
51984 frameCounter += (int)num171;
51985 if (frameCounter > 7)
51986 {
51987 frame++;
51988 frameCounter = 0;
51989 }
51991 {
51992 frame = 1;
51993 }
51994 }
51995 velocity.Y += 0.4f;
51996 if (velocity.Y > 10f)
51997 {
51998 velocity.Y = 10f;
51999 }
52000 }
52001 else if (type == 958)
52002 {
52003 if (velocity.Y != 0f)
52004 {
52005 localAI[0] = 0f;
52006 frame = 4;
52007 }
52008 else if (flag16)
52009 {
52010 spriteDirection = 1;
52011 if (Main.player[owner].Center.X < base.Center.X)
52012 {
52013 spriteDirection = -1;
52014 }
52015 localAI[0] += 1f;
52016 if (localAI[0] > 200f)
52017 {
52018 frame = 1 + (int)(localAI[0] - 200f) / 6;
52019 if (localAI[0] >= 218f)
52020 {
52021 frame = 0;
52022 localAI[0] = Main.rand.Next(100);
52023 }
52024 }
52025 else
52026 {
52027 frame = 0;
52028 }
52029 }
52030 else
52031 {
52032 localAI[0] = 0f;
52033 float num172 = velocity.Length();
52034 frameCounter += (int)num172;
52035 if (frameCounter > 6)
52036 {
52037 frame++;
52038 frameCounter = 0;
52039 }
52040 if (frame < 5 || frame > 12)
52041 {
52042 frame = 5;
52043 }
52044 }
52045 velocity.Y += 0.4f;
52046 if (velocity.Y > 10f)
52047 {
52048 velocity.Y = 10f;
52049 }
52050 }
52051 else if (type == 959)
52052 {
52053 if (velocity.Y != 0f)
52054 {
52055 frame = ((velocity.Y > 0f) ? 10 : 9);
52056 }
52057 else if (flag16)
52058 {
52059 spriteDirection = 1;
52060 if (Main.player[owner].Center.X < base.Center.X)
52061 {
52062 spriteDirection = -1;
52063 }
52064 frame = 0;
52065 }
52066 else
52067 {
52068 float num173 = velocity.Length();
52069 frameCounter += (int)num173;
52070 if (frameCounter > 6)
52071 {
52072 frame++;
52073 frameCounter = 0;
52074 }
52076 {
52077 frame = 1;
52078 }
52079 }
52080 velocity.Y += 0.4f;
52081 if (velocity.Y > 10f)
52082 {
52083 velocity.Y = 10f;
52084 }
52085 }
52086 else if (type == 998)
52087 {
52088 if (velocity.Y != 0f)
52089 {
52090 frame = 1;
52091 }
52092 else if (flag16)
52093 {
52094 spriteDirection = -1;
52095 if (Main.player[owner].Center.X < base.Center.X)
52096 {
52097 spriteDirection = 1;
52098 }
52099 frame = 0;
52100 }
52101 else
52102 {
52103 float num174 = velocity.Length();
52104 frameCounter += (int)num174;
52105 if (frameCounter > 6)
52106 {
52107 frame++;
52108 frameCounter = 0;
52109 }
52111 {
52112 frame = 0;
52113 }
52114 }
52115 velocity.Y += 0.4f;
52116 if (velocity.Y > 10f)
52117 {
52118 velocity.Y = 10f;
52119 }
52120 }
52121 else if (type == 1003)
52122 {
52123 if (velocity.Y != 0f)
52124 {
52125 frame = 1;
52126 }
52127 else if (flag16)
52128 {
52129 spriteDirection = -1;
52130 if (Main.player[owner].Center.X < base.Center.X)
52131 {
52132 spriteDirection = 1;
52133 }
52134 frame = 0;
52135 }
52136 else
52137 {
52138 float num175 = velocity.Length();
52139 frameCounter += (int)num175;
52140 if (frameCounter > 6)
52141 {
52142 frame++;
52143 frameCounter = 0;
52144 }
52145 if (frame < 2 || frame > 11)
52146 {
52147 frame = 2;
52148 }
52149 }
52150 velocity.Y += 0.4f;
52151 if (velocity.Y > 10f)
52152 {
52153 velocity.Y = 10f;
52154 }
52155 }
52156 else if (type == 1004)
52157 {
52158 if (velocity.Y != 0f)
52159 {
52160 frame = 1;
52161 }
52162 else if (flag16)
52163 {
52164 spriteDirection = -1;
52165 if (Main.player[owner].Center.X < base.Center.X)
52166 {
52167 spriteDirection = 1;
52168 }
52169 frame = 0;
52170 }
52171 else
52172 {
52173 float num176 = velocity.Length();
52174 frameCounter += (int)num176;
52175 if (frameCounter > 6)
52176 {
52177 frame++;
52178 frameCounter = 0;
52179 }
52181 {
52182 frame = 2;
52183 }
52184 }
52185 velocity.Y += 0.4f;
52186 if (velocity.Y > 10f)
52187 {
52188 velocity.Y = 10f;
52189 }
52190 }
52191 else if (type == 994)
52192 {
52193 if (velocity.Y != 0f)
52194 {
52195 frame = 4;
52196 }
52197 else if (flag16)
52198 {
52199 spriteDirection = 1;
52200 if (Main.player[owner].Center.X < base.Center.X)
52201 {
52202 spriteDirection = -1;
52203 }
52204 frameCounter++;
52205 if (frameCounter > 5)
52206 {
52207 frame++;
52208 frameCounter = 0;
52209 }
52210 if (frame > 3)
52211 {
52212 frame = 0;
52213 }
52214 }
52215 else
52216 {
52217 float num177 = velocity.Length();
52218 frameCounter += (int)num177;
52219 if (frameCounter > 6)
52220 {
52221 frame++;
52222 frameCounter = 0;
52223 }
52224 if (frame < 5 || frame > 12)
52225 {
52226 frame = 5;
52227 }
52228 }
52229 velocity.Y += 0.4f;
52230 if (velocity.Y > 10f)
52231 {
52232 velocity.Y = 10f;
52233 }
52234 }
52235 else if (type == 960)
52236 {
52237 _ = Main.player[owner];
52238 if (velocity.Y != 0f)
52239 {
52240 localAI[0] = 0f;
52241 localAI[1] = 0f;
52242 frameCounter = 0;
52243 frame = 4;
52244 }
52245 else if (flag16)
52246 {
52247 if (!flag7)
52248 {
52249 spriteDirection = 1;
52250 if (Main.player[owner].Center.X < base.Center.X)
52251 {
52252 spriteDirection = -1;
52253 }
52254 }
52255 if (frame >= 5 && frame < 12)
52256 {
52257 frameCounter++;
52258 if (frameCounter > 3)
52259 {
52260 frame++;
52261 frameCounter = 0;
52262 }
52263 if (frame >= 12)
52264 {
52265 frame = 0;
52266 }
52267 }
52268 else if (Chester_IsAnyPlayerTrackingThisProjectile())
52269 {
52270 if (localAI[0] == 0f)
52271 {
52272 if (localAI[1] == 0f)
52273 {
52274 localAI[1] = 1f;
52275 frameCounter = 0;
52276 }
52277 frame = 13;
52278 frameCounter++;
52279 if (frameCounter > 6)
52280 {
52281 localAI[0] = 1f;
52282 frame = 14;
52283 frameCounter = 0;
52284 }
52285 }
52286 else
52287 {
52288 frameCounter++;
52289 if (frameCounter > 6)
52290 {
52291 frame++;
52292 if (frame > 18)
52293 {
52294 frame = 14;
52295 }
52296 frameCounter = 0;
52297 }
52298 }
52299 }
52300 else
52301 {
52302 localAI[0] = 0f;
52303 if (localAI[1] == 1f)
52304 {
52305 localAI[1] = 0f;
52306 frameCounter = 0;
52307 }
52308 if (frame >= 12 && frame <= 19)
52309 {
52310 frame = 19;
52311 frameCounter++;
52312 if (frameCounter > 6)
52313 {
52314 frame = 0;
52315 frameCounter = 0;
52316 }
52317 }
52318 else
52319 {
52320 frameCounter++;
52321 if (frameCounter >= 24)
52322 {
52323 frameCounter = 0;
52324 }
52325 frame = frameCounter / 6;
52326 }
52327 }
52328 }
52329 else
52330 {
52331 localAI[0] = 0f;
52332 localAI[1] = 0f;
52333 float val = velocity.Length();
52334 frameCounter += (int)Math.Max(2f, val);
52335 if (frameCounter > 6)
52336 {
52337 frame++;
52338 frameCounter = 0;
52339 }
52340 if (frame < 5 || frame > 12)
52341 {
52342 frame = 5;
52343 }
52344 }
52345 velocity.Y += 0.4f;
52346 if (velocity.Y > 10f)
52347 {
52348 velocity.Y = 10f;
52349 }
52350 }
52351 else if (type == 816)
52352 {
52353 if (velocity.Y != 0f)
52354 {
52355 frame = 4;
52356 }
52357 else if (flag16)
52358 {
52359 spriteDirection = -1;
52360 if (Main.player[owner].Center.X < base.Center.X)
52361 {
52362 spriteDirection = 1;
52363 }
52364 if (++frameCounter > 5)
52365 {
52366 frame++;
52367 frameCounter = 0;
52368 }
52370 {
52371 frame = 0;
52372 }
52373 }
52374 else
52375 {
52376 int num178 = 5;
52377 float num179 = velocity.Length();
52378 if (num179 > 4f)
52379 {
52380 num178 = 3;
52381 }
52382 else if (num179 > 2f)
52383 {
52384 num178 = 4;
52385 }
52386 if (++frameCounter > num178)
52387 {
52388 frame++;
52389 frameCounter = 0;
52390 }
52391 if (frame < 4 || frame > 10)
52392 {
52393 frame = 4;
52394 }
52395 }
52396 velocity.Y += 0.4f;
52397 if (velocity.Y > 10f)
52398 {
52399 velocity.Y = 10f;
52400 }
52401 }
52402 if (type == 860)
52403 {
52404 if (velocity.Y != 0f)
52405 {
52406 localAI[0] = 0f;
52407 if (frame >= 5)
52408 {
52409 frame = 5;
52410 frameCounter = 0;
52411 }
52412 else if (++frameCounter > 5)
52413 {
52414 frame++;
52415 frameCounter = 0;
52416 }
52417 }
52418 else if (Math.Abs(velocity.X) < 1f)
52419 {
52420 if (localAI[0] > 800f)
52421 {
52422 frameCounter++;
52423 if (frameCounter > 3)
52424 {
52425 frameCounter = 0;
52426 frame++;
52427 if (frame > 3)
52428 {
52429 frame = 3;
52430 }
52431 }
52432 localAI[0] += 1f;
52433 if (localAI[0] > 850f)
52434 {
52435 localAI[0] = 0f;
52436 }
52437 if (frame == 3 && localAI[0] == 820f)
52438 {
52439 for (int num180 = 0; num180 < 3 + Main.rand.Next(3); num180++)
52440 {
52441 int num181 = Gore.NewGore(new Vector2(position.X, base.Center.Y - 10f), Vector2.Zero, 1218);
52442 Main.gore[num181].velocity = new Vector2((float)Main.rand.Next(1, 10) * 0.3f * (float)(-spriteDirection), 0f - (2f + (float)Main.rand.Next(4) * 0.3f));
52443 }
52444 }
52445 }
52446 else if (frame == 0)
52447 {
52448 localAI[0] += 1f;
52449 frame = 0;
52450 frameCounter = 0;
52451 }
52452 else
52453 {
52454 localAI[0] = 0f;
52455 if (frame > 5)
52456 {
52457 frame = 5;
52458 frameCounter = 0;
52459 }
52460 if (++frameCounter > 4)
52461 {
52462 frame--;
52463 frameCounter = 0;
52464 }
52465 }
52466 }
52467 velocity.Y += 0.4f;
52468 if (velocity.Y > 10f)
52469 {
52470 velocity.Y = 10f;
52471 }
52472 }
52473 if (type == 859)
52474 {
52475 if (velocity.Y != 0f)
52476 {
52477 frame = 4;
52478 }
52479 else if (flag16)
52480 {
52481 spriteDirection = -1;
52482 if (Main.player[owner].Center.X < base.Center.X)
52483 {
52484 spriteDirection = 1;
52485 }
52486 if (frame == 6)
52487 {
52488 if (++frameCounter > 5)
52489 {
52490 frame = 0;
52491 frameCounter = 0;
52492 }
52493 }
52494 else if (frame > 3)
52495 {
52496 frame = 6;
52497 frameCounter = 0;
52498 }
52499 else
52500 {
52501 if (++frameCounter > 5)
52502 {
52503 frame++;
52504 frameCounter = 0;
52505 }
52507 {
52508 frame = 0;
52509 }
52510 }
52511 }
52512 else
52513 {
52514 float num182 = velocity.Length();
52515 int num183 = 8;
52516 if (num182 < 3f)
52517 {
52518 num183 = 4;
52519 }
52520 if (num182 < 1f)
52521 {
52522 num183 = 2;
52523 }
52524 frameCounter += (int)num182;
52525 if (frameCounter > num183)
52526 {
52527 frame++;
52528 frameCounter = 0;
52529 }
52530 if (frame < 5 || frame > 17)
52531 {
52532 frame = 5;
52533 }
52534 }
52535 velocity.Y += 0.4f;
52536 if (velocity.Y > 10f)
52537 {
52538 velocity.Y = 10f;
52539 }
52540 }
52541 else if (type == 858)
52542 {
52543 if (velocity.Y != 0f)
52544 {
52545 frame = 1;
52546 }
52547 else if (flag16)
52548 {
52549 spriteDirection = -1;
52550 if (Main.player[owner].Center.X < base.Center.X)
52551 {
52552 spriteDirection = 1;
52553 }
52554 frame = 0;
52555 }
52556 else
52557 {
52558 float num184 = velocity.Length();
52559 frameCounter += (int)num184;
52560 if (frameCounter > 3)
52561 {
52562 frame++;
52563 frameCounter = 0;
52564 }
52566 {
52567 frame = 2;
52568 }
52569 }
52570 velocity.Y += 0.4f;
52571 if (velocity.Y > 10f)
52572 {
52573 velocity.Y = 10f;
52574 }
52575 }
52576 else if (type == 900)
52577 {
52578 spriteDirection = direction;
52579 if (velocity.Y != 0f)
52580 {
52581 frame = 1;
52582 frameCounter = 0;
52583 }
52584 else if (flag16)
52585 {
52586 spriteDirection = 1;
52587 if (Main.player[owner].Center.X < base.Center.X)
52588 {
52589 spriteDirection = -1;
52590 }
52591 frame = 0;
52592 frameCounter = 0;
52593 }
52594 else
52595 {
52596 frameCounter += 1 + (int)Math.Abs(velocity.X * 0.3f);
52597 if (frame < 2)
52598 {
52599 frame = 2;
52600 frameCounter = 0;
52601 }
52602 if (frameCounter > 4)
52603 {
52604 frame++;
52605 frameCounter = 0;
52606 }
52607 if (frame > 9)
52608 {
52609 frame = 2;
52610 }
52611 }
52612 velocity.Y += 0.4f;
52613 if (velocity.Y > 10f)
52614 {
52615 velocity.Y = 10f;
52616 }
52617 }
52618 else if (type == 899)
52619 {
52620 spriteDirection = direction;
52621 if (velocity.Y != 0f)
52622 {
52623 frame = 1;
52624 frameCounter = 0;
52625 }
52626 else if (flag16)
52627 {
52628 spriteDirection = 1;
52629 if (Main.player[owner].Center.X < base.Center.X)
52630 {
52631 spriteDirection = -1;
52632 }
52633 frame = 0;
52634 frameCounter = 0;
52635 }
52636 else
52637 {
52638 frameCounter += 1 + (int)Math.Abs(velocity.X * 0.3f);
52639 if (frame < 2)
52640 {
52641 frame = 2;
52642 frameCounter = 0;
52643 }
52644 if (frameCounter > 4)
52645 {
52646 frame++;
52647 frameCounter = 0;
52648 }
52649 if (frame > 9)
52650 {
52651 frame = 2;
52652 }
52653 }
52654 velocity.Y += 0.4f;
52655 if (velocity.Y > 10f)
52656 {
52657 velocity.Y = 10f;
52658 }
52659 }
52660 else if (type == 897)
52661 {
52662 spriteDirection = direction;
52663 if (velocity.Y != 0f)
52664 {
52665 frame = 1;
52666 frameCounter = 0;
52667 }
52668 else if (flag16)
52669 {
52670 spriteDirection = 1;
52671 if (Main.player[owner].Center.X < base.Center.X)
52672 {
52673 spriteDirection = -1;
52674 }
52675 frame = 0;
52676 frameCounter = 0;
52677 }
52678 else
52679 {
52680 frameCounter += 1 + (int)Math.Abs(velocity.X * 0.3f);
52681 if (frame < 2)
52682 {
52683 frame = 2;
52684 frameCounter = 0;
52685 }
52686 if (frameCounter > 4)
52687 {
52688 frame++;
52689 frameCounter = 0;
52690 }
52691 if (frame > 7)
52692 {
52693 frame = 2;
52694 }
52695 }
52696 velocity.Y += 0.4f;
52697 if (velocity.Y > 10f)
52698 {
52699 velocity.Y = 10f;
52700 }
52701 }
52702 else if (type == 891)
52703 {
52704 spriteDirection = direction;
52705 if (velocity.Y != 0f)
52706 {
52707 frame = 1;
52708 frameCounter = 0;
52709 }
52710 else if (flag16)
52711 {
52712 spriteDirection = Main.player[owner].direction;
52713 frame = 0;
52714 frameCounter = 0;
52715 }
52716 else
52717 {
52718 frameCounter += 1 + (int)Math.Abs(velocity.X * 0.3f);
52719 if (frame < 2)
52720 {
52721 frame = 2;
52722 frameCounter = 0;
52723 }
52724 if (frameCounter > 4)
52725 {
52726 frame++;
52727 frameCounter = 0;
52728 }
52729 if (frame > 8)
52730 {
52731 frame = 2;
52732 }
52733 }
52734 velocity.Y += 0.4f;
52735 if (velocity.Y > 10f)
52736 {
52737 velocity.Y = 10f;
52738 }
52739 }
52740 else if (type == 890)
52741 {
52742 spriteDirection = direction;
52743 if (velocity.Y != 0f)
52744 {
52745 frame = 1;
52746 frameCounter = 0;
52747 }
52748 else if (flag16)
52749 {
52750 spriteDirection = 1;
52751 if (Main.player[owner].Center.X < base.Center.X)
52752 {
52753 spriteDirection = -1;
52754 }
52755 frame = 0;
52756 frameCounter = 0;
52757 }
52758 else
52759 {
52760 frameCounter += 1 + (int)Math.Abs(velocity.X * 0.3f);
52761 if (frame < 2)
52762 {
52763 frame = 2;
52764 frameCounter = 0;
52765 }
52766 if (frameCounter > 4)
52767 {
52768 frame++;
52769 frameCounter = 0;
52770 }
52771 if (frame > 7)
52772 {
52773 frame = 2;
52774 }
52775 }
52776 velocity.Y += 0.4f;
52777 if (velocity.Y > 10f)
52778 {
52779 velocity.Y = 10f;
52780 }
52781 }
52782 else if (type == 884)
52783 {
52784 spriteDirection = direction;
52785 if (velocity.Y != 0f)
52786 {
52787 if (velocity.Y < 0f)
52788 {
52789 frame = 9;
52790 }
52791 else
52792 {
52793 frame = 1;
52794 }
52795 frameCounter = 0;
52796 }
52797 else if (flag16)
52798 {
52799 spriteDirection = 1;
52800 if (Main.player[owner].Center.X < base.Center.X)
52801 {
52802 spriteDirection = -1;
52803 }
52804 frame = 0;
52805 frameCounter = 0;
52806 }
52807 else
52808 {
52809 frameCounter += 1 + (int)Math.Abs(velocity.X * 0.5f);
52810 if (frameCounter > 6)
52811 {
52812 frame++;
52813 frameCounter = 0;
52814 }
52815 if (frame > 8)
52816 {
52817 frame = 2;
52818 }
52819 }
52820 velocity.Y += 0.4f;
52821 if (velocity.Y > 10f)
52822 {
52823 velocity.Y = 10f;
52824 }
52825 }
52826 else if (type == 881 || type == 934)
52827 {
52828 spriteDirection = 1;
52829 if (Main.player[owner].Center.X < base.Center.X)
52830 {
52831 spriteDirection = -1;
52832 }
52833 if (velocity.Y > 0f)
52834 {
52835 frameCounter++;
52836 if (frameCounter > 2)
52837 {
52838 frame++;
52839 if (frame >= 2)
52840 {
52841 frame = 2;
52842 }
52843 frameCounter = 0;
52844 }
52845 }
52846 else if (velocity.Y < 0f)
52847 {
52848 frameCounter++;
52849 if (frameCounter > 2)
52850 {
52851 frame++;
52852 if (frame >= 5)
52853 {
52854 frame = 0;
52855 }
52856 frameCounter = 0;
52857 }
52858 }
52859 else if (frame == 0)
52860 {
52861 frame = 0;
52862 }
52863 else if (++frameCounter > 3)
52864 {
52865 frame++;
52866 if (frame >= 6)
52867 {
52868 frame = 0;
52869 }
52870 frameCounter = 0;
52871 }
52872 if (wet && Main.player[owner].position.Y + (float)Main.player[owner].height < position.Y + (float)height && localAI[0] == 0f)
52873 {
52874 if (velocity.Y > -4f)
52875 {
52876 velocity.Y -= 0.2f;
52877 }
52878 if (velocity.Y > 0f)
52879 {
52880 velocity.Y *= 0.95f;
52881 }
52882 }
52883 else
52884 {
52885 velocity.Y += 0.4f;
52886 }
52887 if (velocity.Y > 10f)
52888 {
52889 velocity.Y = 10f;
52890 }
52891 }
52892 else if (type == 875)
52893 {
52894 if (velocity.Y != 0f)
52895 {
52896 if (velocity.Y < 0f)
52897 {
52898 frame = 3;
52899 }
52900 else
52901 {
52902 frame = 6;
52903 }
52904 frameCounter = 0;
52905 }
52906 else if (flag16)
52907 {
52908 spriteDirection = -1;
52909 if (Main.player[owner].Center.X < base.Center.X)
52910 {
52911 spriteDirection = 1;
52912 }
52913 frame = 0;
52914 frameCounter = 0;
52915 }
52916 else
52917 {
52918 frameCounter += 1 + (int)Math.Abs(velocity.X * 0.75f);
52919 if (frameCounter > 6)
52920 {
52921 frame++;
52922 frameCounter = 0;
52923 }
52924 if (frame > 6)
52925 {
52926 frame = 0;
52927 }
52928 }
52929 velocity.Y += 0.4f;
52930 if (velocity.Y > 10f)
52931 {
52932 velocity.Y = 10f;
52933 }
52934 }
52935 else if (type == 854)
52936 {
52937 if (velocity.Y != 0f)
52938 {
52939 frame = 7;
52940 }
52941 else if (flag16)
52942 {
52943 spriteDirection = -1;
52944 if (Main.player[owner].Center.X < base.Center.X)
52945 {
52946 spriteDirection = 1;
52947 }
52948 if (++frameCounter > 5)
52949 {
52950 frame++;
52951 frameCounter = 0;
52952 }
52954 {
52955 frame = 0;
52956 }
52957 }
52958 else
52959 {
52960 int num185 = 3;
52961 float num186 = velocity.Length();
52962 if (num186 > 4f)
52963 {
52964 num185 = 1;
52965 }
52966 else if (num186 > 2f)
52967 {
52968 num185 = 2;
52969 }
52970 if (++frameCounter > num185)
52971 {
52972 frame++;
52973 frameCounter = 0;
52974 }
52975 if (frame < 4 || frame > 12)
52976 {
52977 frame = 4;
52978 }
52979 }
52980 velocity.Y += 0.4f;
52981 if (velocity.Y > 10f)
52982 {
52983 velocity.Y = 10f;
52984 }
52985 }
52986 else if (type == 825)
52987 {
52988 if (velocity.Y != 0f)
52989 {
52990 localAI[0] = 0f;
52991 frame = 12;
52992 }
52993 else if (flag16)
52994 {
52995 spriteDirection = -1;
52996 if (Main.player[owner].Center.X < base.Center.X)
52997 {
52998 spriteDirection = 1;
52999 }
53000 if (frame >= 1 && frame <= 2)
53001 {
53002 localAI[0] = 0f;
53003 if (++frameCounter > 5)
53004 {
53005 frame++;
53006 frameCounter = 0;
53007 }
53008 if (frame > 2)
53009 {
53010 frame = 0;
53011 }
53012 }
53013 else if (frame >= 3 && frame <= 11)
53014 {
53015 localAI[0] = 0f;
53016 if (++frameCounter > 5)
53017 {
53018 frame++;
53019 frameCounter = 0;
53020 }
53021 if (frame > 11)
53022 {
53023 frame = 0;
53024 }
53025 }
53026 else
53027 {
53028 if (frame == 13)
53029 {
53030 if (++frameCounter > 8)
53031 {
53032 frame++;
53033 frameCounter = 0;
53034 }
53035 if (frame == 14)
53036 {
53037 frame = 0;
53038 }
53039 }
53040 if (frame != 0)
53041 {
53042 frame = 13;
53043 }
53044 else
53045 {
53046 frame = 0;
53047 }
53048 if (frame == 0)
53049 {
53050 localAI[0] += 1f;
53051 if (localAI[0] > 300f && Main.rand.Next(50) == 0)
53052 {
53053 switch (Main.rand.Next(2))
53054 {
53055 case 0:
53056 frame = 1;
53057 break;
53058 case 1:
53059 frame = 3;
53060 break;
53061 }
53062 }
53063 }
53064 }
53065 }
53066 else
53067 {
53068 localAI[0] = 0f;
53069 int num187 = 3;
53070 float num188 = velocity.Length();
53071 if (num188 > 4f)
53072 {
53073 num187 = 2;
53074 }
53075 else if (num188 > 2f)
53076 {
53077 num187 = 1;
53078 }
53079 if (++frameCounter > num187)
53080 {
53081 frame++;
53082 frameCounter = 0;
53083 }
53084 if (frame < 13)
53085 {
53086 frame = 13;
53087 }
53088 if (frame > 19)
53089 {
53090 frame = 14;
53091 }
53092 }
53093 velocity.Y += 0.4f;
53094 if (velocity.Y > 10f)
53095 {
53096 velocity.Y = 10f;
53097 }
53098 }
53099 else if (type == 821)
53100 {
53101 if (velocity.Y != 0f)
53102 {
53103 localAI[0] = 0f;
53104 frame = 12;
53105 }
53106 else if (flag16)
53107 {
53108 spriteDirection = -1;
53109 if (Main.player[owner].Center.X < base.Center.X)
53110 {
53111 spriteDirection = 1;
53112 }
53113 localAI[0] += 1f;
53114 if (localAI[0] > 400f)
53115 {
53116 int num189 = 7;
53117 if (frame == 9)
53118 {
53119 num189 = 25;
53120 }
53121 if (++frameCounter > num189)
53122 {
53123 frame++;
53124 frameCounter = 0;
53125 }
53126 if (frame < 5)
53127 {
53128 frame = 5;
53129 }
53130 if (frame > 11)
53131 {
53132 localAI[0] = 0f;
53133 frame = 0;
53134 }
53135 }
53136 else
53137 {
53138 if (++frameCounter > 6)
53139 {
53140 frame++;
53141 frameCounter = 0;
53142 }
53144 {
53145 frame = 0;
53146 }
53147 }
53148 }
53149 else
53150 {
53151 localAI[0] = 0f;
53152 int num190 = 4;
53153 float num191 = velocity.Length();
53154 if (num191 > 3f)
53155 {
53156 num190 = 3;
53157 }
53158 if (num191 > 5f)
53159 {
53160 num190 = 2;
53161 }
53162 if (++frameCounter > num190)
53163 {
53164 frame++;
53165 if (num190 == 0)
53166 {
53167 frame++;
53168 }
53169 frameCounter = 0;
53170 }
53171 if (frame < 13 || frame > 18)
53172 {
53173 frame = 13;
53174 }
53175 }
53176 velocity.Y += 0.4f;
53177 if (velocity.Y > 10f)
53178 {
53179 velocity.Y = 10f;
53180 }
53181 }
53182 else if (flag6)
53183 {
53184 if (ai[1] > 0f)
53185 {
53186 if (localAI[1] == 0f)
53187 {
53188 localAI[1] = 1f;
53189 frame = 1;
53190 }
53191 if (frame != 0)
53192 {
53193 frameCounter++;
53194 if (frameCounter > 4)
53195 {
53196 frame++;
53197 frameCounter = 0;
53198 }
53199 if (frame >= 4)
53200 {
53201 frame = 0;
53202 }
53203 }
53204 }
53205 else if (velocity.Y == 0f)
53206 {
53207 localAI[1] = 0f;
53208 if (flag16)
53209 {
53210 frame = 0;
53211 frameCounter = 0;
53212 }
53213 else if ((double)velocity.X < -0.8 || (double)velocity.X > 0.8)
53214 {
53215 frameCounter += (int)Math.Abs(velocity.X);
53216 frameCounter++;
53217 if (frameCounter > 6)
53218 {
53219 frame++;
53220 frameCounter = 0;
53221 }
53222 if (frame < 5)
53223 {
53224 frame = 5;
53225 }
53226 if (frame >= 11)
53227 {
53228 frame = 5;
53229 }
53230 }
53231 else
53232 {
53233 frame = 0;
53234 frameCounter = 0;
53235 }
53236 }
53237 else if (velocity.Y < 0f)
53238 {
53239 frameCounter = 0;
53240 frame = 4;
53241 }
53242 else if (velocity.Y > 0f)
53243 {
53244 frameCounter = 0;
53245 frame = 4;
53246 }
53247 velocity.Y += 0.4f;
53248 if (velocity.Y > 10f)
53249 {
53250 velocity.Y = 10f;
53251 }
53252 _ = velocity;
53253 }
53254 else if (type == 268)
53255 {
53256 if (velocity.Y == 0f)
53257 {
53258 if (frame > 5)
53259 {
53260 frameCounter = 0;
53261 }
53262 if (flag16)
53263 {
53264 int num192 = 3;
53265 frameCounter++;
53266 if (frameCounter < num192)
53267 {
53268 frame = 0;
53269 }
53270 else if (frameCounter < num192 * 2)
53271 {
53272 frame = 1;
53273 }
53274 else if (frameCounter < num192 * 3)
53275 {
53276 frame = 2;
53277 }
53278 else if (frameCounter < num192 * 4)
53279 {
53280 frame = 3;
53281 }
53282 else
53283 {
53284 frameCounter = num192 * 4;
53285 }
53286 }
53287 else
53288 {
53289 velocity.X *= 0.8f;
53290 frameCounter++;
53291 int num193 = 3;
53292 if (frameCounter < num193)
53293 {
53294 frame = 0;
53295 }
53296 else if (frameCounter < num193 * 2)
53297 {
53298 frame = 1;
53299 }
53300 else if (frameCounter < num193 * 3)
53301 {
53302 frame = 2;
53303 }
53304 else if (frameCounter < num193 * 4)
53305 {
53306 frame = 3;
53307 }
53308 else if (flag2 || flag3)
53309 {
53310 velocity.X *= 2f;
53311 frame = 4;
53312 velocity.Y = -6.1f;
53313 frameCounter = 0;
53314 for (int num194 = 0; num194 < 4; num194++)
53315 {
53316 int num195 = Dust.NewDust(new Vector2(position.X, position.Y + (float)height - 2f), width, 4, 5);
53317 Main.dust[num195].velocity += velocity;
53318 Main.dust[num195].velocity *= 0.4f;
53319 }
53320 }
53321 else
53322 {
53323 frameCounter = num193 * 4;
53324 }
53325 }
53326 }
53327 else if (velocity.Y < 0f)
53328 {
53329 frameCounter = 0;
53330 frame = 5;
53331 }
53332 else
53333 {
53334 frame = 4;
53335 frameCounter = 3;
53336 }
53337 velocity.Y += 0.4f;
53338 if (velocity.Y > 10f)
53339 {
53340 velocity.Y = 10f;
53341 }
53342 }
53343 else if (type == 269)
53344 {
53345 if (velocity.Y >= 0f && (double)velocity.Y <= 0.8)
53346 {
53347 if (flag16)
53348 {
53349 frame = 0;
53350 frameCounter = 0;
53351 }
53352 else if ((double)velocity.X < -0.8 || (double)velocity.X > 0.8)
53353 {
53354 int num196 = Dust.NewDust(new Vector2(position.X, position.Y + (float)height - 2f), width, 6, 76);
53355 Main.dust[num196].noGravity = true;
53356 Main.dust[num196].velocity *= 0.3f;
53357 Main.dust[num196].noLight = true;
53358 frameCounter += (int)Math.Abs(velocity.X);
53359 frameCounter++;
53360 if (frameCounter > 6)
53361 {
53362 frame++;
53363 frameCounter = 0;
53364 }
53365 if (frame > 3)
53366 {
53367 frame = 0;
53368 }
53369 }
53370 else
53371 {
53372 frame = 0;
53373 frameCounter = 0;
53374 }
53375 }
53376 else
53377 {
53378 frameCounter = 0;
53379 frame = 2;
53380 }
53381 velocity.Y += 0.4f;
53382 if (velocity.Y > 10f)
53383 {
53384 velocity.Y = 10f;
53385 }
53386 }
53387 else if (type == 313)
53388 {
53389 int i3 = (int)(base.Center.X / 16f);
53390 int num197 = (int)(base.Center.Y / 16f);
53391 int num198 = 0;
53395 if (tileSafely2.wall > 0)
53396 {
53397 num198++;
53398 }
53399 if (tileSafely3.wall > 0)
53400 {
53401 num198++;
53402 }
53403 if (tileSafely4.wall > 0)
53404 {
53405 num198++;
53406 }
53407 if (num198 > 1)
53408 {
53409 position.Y += height;
53410 height = 34;
53411 position.Y -= height;
53412 position.X += width / 2;
53413 width = 34;
53414 position.X -= width / 2;
53415 Vector2 vector14 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
53416 float num199 = Main.player[owner].Center.X - vector14.X;
53417 float num200 = Main.player[owner].Center.Y - vector14.Y;
53418 float num201 = (float)Math.Sqrt(num199 * num199 + num200 * num200);
53419 float num202 = 4f / num201;
53420 num199 *= num202;
53421 num200 *= num202;
53422 if (num201 < 120f)
53423 {
53424 velocity.X *= 0.9f;
53425 velocity.Y *= 0.9f;
53426 if ((double)(Math.Abs(velocity.X) + Math.Abs(velocity.Y)) < 0.1)
53427 {
53428 velocity *= 0f;
53429 }
53430 }
53431 else
53432 {
53433 velocity.X = (velocity.X * 9f + num199) / 10f;
53434 velocity.Y = (velocity.Y * 9f + num200) / 10f;
53435 }
53436 if (num201 >= 120f)
53437 {
53438 spriteDirection = direction;
53439 rotation = (float)Math.Atan2(velocity.Y * (float)(-direction), velocity.X * (float)(-direction));
53440 }
53441 frameCounter += (int)(Math.Abs(velocity.X) + Math.Abs(velocity.Y));
53442 if (frameCounter > 6)
53443 {
53444 frame++;
53445 frameCounter = 0;
53446 }
53447 if (frame > 10)
53448 {
53449 frame = 5;
53450 }
53451 if (frame < 5)
53452 {
53453 frame = 10;
53454 }
53455 }
53456 else
53457 {
53458 rotation = 0f;
53459 if (direction == -1)
53460 {
53461 spriteDirection = 1;
53462 }
53463 if (direction == 1)
53464 {
53465 spriteDirection = -1;
53466 }
53467 position.Y += height;
53468 height = 30;
53469 position.Y -= height;
53470 position.X += width / 2;
53471 width = 30;
53472 position.X -= width / 2;
53473 if (velocity.Y >= 0f && (double)velocity.Y <= 0.8)
53474 {
53475 if (flag16)
53476 {
53477 frame = 0;
53478 frameCounter = 0;
53479 }
53480 else if ((double)velocity.X < -0.8 || (double)velocity.X > 0.8)
53481 {
53482 frameCounter += (int)Math.Abs(velocity.X);
53483 frameCounter++;
53484 if (frameCounter > 6)
53485 {
53486 frame++;
53487 frameCounter = 0;
53488 }
53489 if (frame > 3)
53490 {
53491 frame = 0;
53492 }
53493 }
53494 else
53495 {
53496 frame = 0;
53497 frameCounter = 0;
53498 }
53499 }
53500 else
53501 {
53502 frameCounter = 0;
53503 frame = 4;
53504 }
53505 velocity.Y += 0.4f;
53506 if (velocity.Y > 10f)
53507 {
53508 velocity.Y = 10f;
53509 }
53510 }
53511 }
53512 else if (type >= 390 && type <= 392)
53513 {
53514 int i4 = (int)(base.Center.X / 16f);
53515 int num203 = (int)(base.Center.Y / 16f);
53516 int num204 = 0;
53520 if (tileSafely5.wall > 0)
53521 {
53522 num204++;
53523 }
53524 if (tileSafely6.wall > 0)
53525 {
53526 num204++;
53527 }
53528 if (tileSafely7.wall > 0)
53529 {
53530 num204++;
53531 }
53532 if (num204 > 1)
53533 {
53534 position.Y += height;
53535 height = 34;
53536 position.Y -= height;
53537 position.X += width / 2;
53538 width = 34;
53539 position.X -= width / 2;
53540 float num205 = 9f;
53541 float num206 = 40 * (minionPos + 1);
53542 Vector2 v11 = Main.player[owner].Center - base.Center;
53543 if (flag13)
53544 {
53545 v11 = vector12;
53546 num206 = 10f;
53547 }
53548 else if (!Collision.CanHitLine(base.Center, 1, 1, Main.player[owner].Center, 1, 1))
53549 {
53550 ai[0] = 1f;
53551 }
53552 if (v11.Length() < num206)
53553 {
53554 velocity *= 0.9f;
53555 if ((double)(Math.Abs(velocity.X) + Math.Abs(velocity.Y)) < 0.1)
53556 {
53557 velocity *= 0f;
53558 }
53559 }
53560 else if (v11.Length() < 800f || !flag13)
53561 {
53562 velocity = (velocity * 9f + v11.SafeNormalize(Vector2.Zero) * num205) / 10f;
53563 }
53564 if (v11.Length() >= num206)
53565 {
53566 spriteDirection = direction;
53567 rotation = velocity.ToRotation() + (float)Math.PI / 2f;
53568 }
53569 else
53570 {
53571 rotation = v11.ToRotation() + (float)Math.PI / 2f;
53572 }
53573 frameCounter += (int)(Math.Abs(velocity.X) + Math.Abs(velocity.Y));
53574 if (frameCounter > 5)
53575 {
53576 frame++;
53577 frameCounter = 0;
53578 }
53579 if (frame > 7)
53580 {
53581 frame = 4;
53582 }
53583 if (frame < 4)
53584 {
53585 frame = 7;
53586 }
53587 }
53588 else
53589 {
53590 if (!flag14)
53591 {
53592 rotation = 0f;
53593 }
53594 if (direction == -1)
53595 {
53596 spriteDirection = 1;
53597 }
53598 if (direction == 1)
53599 {
53600 spriteDirection = -1;
53601 }
53602 position.Y += height;
53603 height = 30;
53604 position.Y -= height;
53605 position.X += width / 2;
53606 width = 30;
53607 position.X -= width / 2;
53608 if (!flag13 && !Collision.CanHitLine(base.Center, 1, 1, Main.player[owner].Center, 1, 1))
53609 {
53610 ai[0] = 1f;
53611 }
53612 if (!flag14 && frame >= 4 && frame <= 7)
53613 {
53614 Vector2 vector15 = Main.player[owner].Center - base.Center;
53615 if (flag13)
53616 {
53618 }
53619 float num207 = 0f - vector15.Y;
53620 if (!(vector15.Y > 0f))
53621 {
53622 if (num207 < 120f)
53623 {
53624 velocity.Y = -10f;
53625 }
53626 else if (num207 < 210f)
53627 {
53628 velocity.Y = -13f;
53629 }
53630 else if (num207 < 270f)
53631 {
53632 velocity.Y = -15f;
53633 }
53634 else if (num207 < 310f)
53635 {
53636 velocity.Y = -17f;
53637 }
53638 else if (num207 < 380f)
53639 {
53640 velocity.Y = -18f;
53641 }
53642 }
53643 }
53644 if (flag14)
53645 {
53646 frameCounter++;
53647 if (frameCounter > 3)
53648 {
53649 frame++;
53650 frameCounter = 0;
53651 }
53652 if (frame >= 8)
53653 {
53654 frame = 4;
53655 }
53656 if (frame <= 3)
53657 {
53658 frame = 7;
53659 }
53660 }
53661 else if (velocity.Y >= 0f && (double)velocity.Y <= 0.8)
53662 {
53663 if (flag16)
53664 {
53665 frame = 0;
53666 frameCounter = 0;
53667 }
53668 else if ((double)velocity.X < -0.8 || (double)velocity.X > 0.8)
53669 {
53670 frameCounter += (int)Math.Abs(velocity.X);
53671 frameCounter++;
53672 if (frameCounter > 5)
53673 {
53674 frame++;
53675 frameCounter = 0;
53676 }
53677 if (frame > 2)
53678 {
53679 frame = 0;
53680 }
53681 }
53682 else
53683 {
53684 frame = 0;
53685 frameCounter = 0;
53686 }
53687 }
53688 else
53689 {
53690 frameCounter = 0;
53691 frame = 3;
53692 }
53693 velocity.Y += 0.4f;
53694 if (velocity.Y > 10f)
53695 {
53696 velocity.Y = 10f;
53697 }
53698 }
53699 }
53700 else if (type == 314)
53701 {
53702 if (velocity.Y >= 0f && (double)velocity.Y <= 0.8)
53703 {
53704 if (flag16)
53705 {
53706 frame = 0;
53707 frameCounter = 0;
53708 }
53709 else if ((double)velocity.X < -0.8 || (double)velocity.X > 0.8)
53710 {
53711 frameCounter += (int)Math.Abs(velocity.X);
53712 frameCounter++;
53713 if (frameCounter > 6)
53714 {
53715 frame++;
53716 frameCounter = 0;
53717 }
53718 if (frame > 6)
53719 {
53720 frame = 1;
53721 }
53722 }
53723 else
53724 {
53725 frame = 0;
53726 frameCounter = 0;
53727 }
53728 }
53729 else
53730 {
53731 frameCounter = 0;
53732 frame = 7;
53733 }
53734 velocity.Y += 0.4f;
53735 if (velocity.Y > 10f)
53736 {
53737 velocity.Y = 10f;
53738 }
53739 }
53740 else if (type == 319)
53741 {
53742 if (velocity.Y >= 0f && (double)velocity.Y <= 0.8)
53743 {
53744 if (flag16)
53745 {
53746 frame = 0;
53747 frameCounter = 0;
53748 }
53749 else if ((double)velocity.X < -0.8 || (double)velocity.X > 0.8)
53750 {
53751 frameCounter += (int)Math.Abs(velocity.X);
53752 frameCounter++;
53753 if (frameCounter > 8)
53754 {
53755 frame++;
53756 frameCounter = 0;
53757 }
53758 if (frame > 5)
53759 {
53760 frame = 2;
53761 }
53762 }
53763 else
53764 {
53765 frame = 0;
53766 frameCounter = 0;
53767 }
53768 }
53769 else
53770 {
53771 frameCounter = 0;
53772 frame = 1;
53773 }
53774 velocity.Y += 0.4f;
53775 if (velocity.Y > 10f)
53776 {
53777 velocity.Y = 10f;
53778 }
53779 }
53780 else if (type == 236)
53781 {
53782 if (velocity.Y >= 0f && (double)velocity.Y <= 0.8)
53783 {
53784 if (flag16)
53785 {
53786 frame = 0;
53787 frameCounter = 0;
53788 }
53789 else if ((double)velocity.X < -0.8 || (double)velocity.X > 0.8)
53790 {
53791 if (frame < 2)
53792 {
53793 frame = 2;
53794 }
53795 frameCounter += (int)Math.Abs(velocity.X);
53796 frameCounter++;
53797 if (frameCounter > 6)
53798 {
53799 frame++;
53800 frameCounter = 0;
53801 }
53802 if (frame > 8)
53803 {
53804 frame = 2;
53805 }
53806 }
53807 else
53808 {
53809 frame = 0;
53810 frameCounter = 0;
53811 }
53812 }
53813 else
53814 {
53815 frameCounter = 0;
53816 frame = 1;
53817 }
53818 velocity.Y += 0.4f;
53819 if (velocity.Y > 10f)
53820 {
53821 velocity.Y = 10f;
53822 }
53823 }
53824 else if (type == 499)
53825 {
53826 if (velocity.Y >= 0f && (double)velocity.Y <= 0.8)
53827 {
53828 if (flag16)
53829 {
53830 frame = 0;
53831 frameCounter = 0;
53832 }
53833 else if ((double)velocity.X < -0.8 || (double)velocity.X > 0.8)
53834 {
53835 if (frame < 2)
53836 {
53837 frame = 2;
53838 }
53839 frameCounter += (int)Math.Abs(velocity.X);
53840 frameCounter++;
53841 if (frameCounter > 6)
53842 {
53843 frame++;
53844 frameCounter = 0;
53845 }
53846 if (frame >= 8)
53847 {
53848 frame = 2;
53849 }
53850 }
53851 else
53852 {
53853 frame = 0;
53854 frameCounter = 0;
53855 }
53856 }
53857 else
53858 {
53859 frameCounter = 0;
53860 frame = 1;
53861 }
53862 velocity.Y += 0.4f;
53863 if (velocity.Y > 10f)
53864 {
53865 velocity.Y = 10f;
53866 }
53867 }
53868 else if (type == 765)
53869 {
53870 if (velocity.Y >= 0f && (double)velocity.Y <= 0.8)
53871 {
53872 if (flag16)
53873 {
53874 frame = 0;
53875 frameCounter = 0;
53876 }
53877 else if ((double)velocity.X < -0.8 || (double)velocity.X > 0.8)
53878 {
53879 if (frame < 1)
53880 {
53881 frame = 1;
53882 }
53883 frameCounter += (int)Math.Abs(velocity.X);
53884 frameCounter++;
53885 if (frameCounter > 6)
53886 {
53887 frame++;
53888 frameCounter = 0;
53889 }
53890 if (frame >= 6)
53891 {
53892 frame = 1;
53893 }
53894 }
53895 else
53896 {
53897 frame = 0;
53898 frameCounter = 0;
53899 }
53900 }
53901 else
53902 {
53903 frame = 0;
53904 frameCounter = 0;
53905 }
53906 velocity.Y += 0.4f;
53907 if (velocity.Y > 10f)
53908 {
53909 velocity.Y = 10f;
53910 }
53911 }
53912 else if (type == 266)
53913 {
53914 if (velocity.Y >= 0f && (double)velocity.Y <= 0.8)
53915 {
53916 if (flag16)
53917 {
53918 frameCounter++;
53919 }
53920 else
53921 {
53922 frameCounter += 3;
53923 }
53924 }
53925 else
53926 {
53927 frameCounter += 5;
53928 }
53929 if (frameCounter >= 20)
53930 {
53931 frameCounter -= 20;
53932 frame++;
53933 }
53934 if (frame > 1)
53935 {
53936 frame = 0;
53937 }
53938 if (wet && Main.player[owner].position.Y + (float)Main.player[owner].height < position.Y + (float)height && localAI[0] == 0f)
53939 {
53940 if (velocity.Y > -4f)
53941 {
53942 velocity.Y -= 0.2f;
53943 }
53944 if (velocity.Y > 0f)
53945 {
53946 velocity.Y *= 0.95f;
53947 }
53948 }
53949 else
53950 {
53951 velocity.Y += 0.4f;
53952 }
53953 if (velocity.Y > 10f)
53954 {
53955 velocity.Y = 10f;
53956 }
53957 }
53958 else if (type == 334)
53959 {
53960 if (velocity.Y == 0f)
53961 {
53962 if (flag16)
53963 {
53964 if (frame > 0)
53965 {
53966 frameCounter += 2;
53967 if (frameCounter > 6)
53968 {
53969 frame++;
53970 frameCounter = 0;
53971 }
53972 if (frame >= 7)
53973 {
53974 frame = 0;
53975 }
53976 }
53977 else
53978 {
53979 frame = 0;
53980 frameCounter = 0;
53981 }
53982 }
53983 else if ((double)velocity.X < -0.8 || (double)velocity.X > 0.8)
53984 {
53985 frameCounter += (int)Math.Abs((double)velocity.X * 0.75);
53986 frameCounter++;
53987 if (frameCounter > 6)
53988 {
53989 frame++;
53990 frameCounter = 0;
53991 }
53992 if (frame >= 7 || frame < 1)
53993 {
53994 frame = 1;
53995 }
53996 }
53997 else if (frame > 0)
53998 {
53999 frameCounter += 2;
54000 if (frameCounter > 6)
54001 {
54002 frame++;
54003 frameCounter = 0;
54004 }
54005 if (frame >= 7)
54006 {
54007 frame = 0;
54008 }
54009 }
54010 else
54011 {
54012 frame = 0;
54013 frameCounter = 0;
54014 }
54015 }
54016 else if (velocity.Y < 0f)
54017 {
54018 frameCounter = 0;
54019 frame = 2;
54020 }
54021 else if (velocity.Y > 0f)
54022 {
54023 frameCounter = 0;
54024 frame = 4;
54025 }
54026 velocity.Y += 0.4f;
54027 if (velocity.Y > 10f)
54028 {
54029 velocity.Y = 10f;
54030 }
54031 }
54032 else if (type == 353)
54033 {
54034 if (velocity.Y == 0f)
54035 {
54036 if (flag16)
54037 {
54038 frame = 0;
54039 frameCounter = 0;
54040 }
54041 else if ((double)velocity.X < -0.8 || (double)velocity.X > 0.8)
54042 {
54043 frameCounter += (int)Math.Abs(velocity.X);
54044 frameCounter++;
54045 if (frameCounter > 6)
54046 {
54047 frame++;
54048 frameCounter = 0;
54049 }
54050 if (frame > 9)
54051 {
54052 frame = 2;
54053 }
54054 }
54055 else
54056 {
54057 frame = 0;
54058 frameCounter = 0;
54059 }
54060 }
54061 else if (velocity.Y < 0f)
54062 {
54063 frameCounter = 0;
54064 frame = 1;
54065 }
54066 else if (velocity.Y > 0f)
54067 {
54068 frameCounter = 0;
54069 frame = 1;
54070 }
54071 velocity.Y += 0.4f;
54072 if (velocity.Y > 10f)
54073 {
54074 velocity.Y = 10f;
54075 }
54076 }
54077 else if (type == 111)
54078 {
54079 if (velocity.Y == 0f)
54080 {
54081 if (flag16)
54082 {
54083 frame = 0;
54084 frameCounter = 0;
54085 }
54086 else if ((double)velocity.X < -0.8 || (double)velocity.X > 0.8)
54087 {
54088 frameCounter += (int)Math.Abs(velocity.X);
54089 frameCounter++;
54090 if (frameCounter > 6)
54091 {
54092 frame++;
54093 frameCounter = 0;
54094 }
54095 if (frame >= 7)
54096 {
54097 frame = 0;
54098 }
54099 }
54100 else
54101 {
54102 frame = 0;
54103 frameCounter = 0;
54104 }
54105 }
54106 else if (velocity.Y < 0f)
54107 {
54108 frameCounter = 0;
54109 frame = 4;
54110 }
54111 else if (velocity.Y > 0f)
54112 {
54113 frameCounter = 0;
54114 frame = 6;
54115 }
54116 velocity.Y += 0.4f;
54117 if (velocity.Y > 10f)
54118 {
54119 velocity.Y = 10f;
54120 }
54121 }
54122 else if (type == 112)
54123 {
54124 if (velocity.Y == 0f)
54125 {
54126 if (flag16)
54127 {
54128 frame = 0;
54129 frameCounter = 0;
54130 }
54131 else if ((double)velocity.X < -0.8 || (double)velocity.X > 0.8)
54132 {
54133 frameCounter += (int)Math.Abs(velocity.X);
54134 frameCounter++;
54135 if (frameCounter > 6)
54136 {
54137 frame++;
54138 frameCounter = 0;
54139 }
54140 if (frame >= 3)
54141 {
54142 frame = 0;
54143 }
54144 }
54145 else
54146 {
54147 frame = 0;
54148 frameCounter = 0;
54149 }
54150 }
54151 else if (velocity.Y != 0f)
54152 {
54153 frameCounter = 0;
54154 frame = 1;
54155 }
54156 velocity.Y += 0.4f;
54157 if (velocity.Y > 10f)
54158 {
54159 velocity.Y = 10f;
54160 }
54161 }
54162 else if (type == 127)
54163 {
54164 if (velocity.Y == 0f)
54165 {
54166 if (flag16)
54167 {
54168 frame = 0;
54169 frameCounter = 0;
54170 }
54171 else if ((double)velocity.X < -0.1 || (double)velocity.X > 0.1)
54172 {
54173 frameCounter += (int)Math.Abs(velocity.X);
54174 frameCounter++;
54175 if (frameCounter > 6)
54176 {
54177 frame++;
54178 frameCounter = 0;
54179 }
54180 if (frame > 5)
54181 {
54182 frame = 0;
54183 }
54184 }
54185 else
54186 {
54187 frame = 0;
54188 frameCounter = 0;
54189 }
54190 }
54191 else
54192 {
54193 frame = 0;
54194 frameCounter = 0;
54195 }
54196 velocity.Y += 0.4f;
54197 if (velocity.Y > 10f)
54198 {
54199 velocity.Y = 10f;
54200 }
54201 }
54202 else if (type == 200)
54203 {
54204 if (velocity.Y == 0f)
54205 {
54206 if (flag16)
54207 {
54208 frame = 0;
54209 frameCounter = 0;
54210 }
54211 else if ((double)velocity.X < -0.1 || (double)velocity.X > 0.1)
54212 {
54213 frameCounter += (int)Math.Abs(velocity.X);
54214 frameCounter++;
54215 if (frameCounter > 6)
54216 {
54217 frame++;
54218 frameCounter = 0;
54219 }
54220 if (frame > 5)
54221 {
54222 frame = 0;
54223 }
54224 }
54225 else
54226 {
54227 frame = 0;
54228 frameCounter = 0;
54229 }
54230 }
54231 else
54232 {
54233 rotation = velocity.X * 0.1f;
54234 frameCounter++;
54235 if (velocity.Y < 0f)
54236 {
54237 frameCounter += 2;
54238 }
54239 if (frameCounter > 6)
54240 {
54241 frame++;
54242 frameCounter = 0;
54243 }
54244 if (frame > 9)
54245 {
54246 frame = 6;
54247 }
54248 if (frame < 6)
54249 {
54250 frame = 6;
54251 }
54252 }
54253 velocity.Y += 0.1f;
54254 if (velocity.Y > 4f)
54255 {
54256 velocity.Y = 4f;
54257 }
54258 }
54259 else if (type == 208)
54260 {
54261 if (velocity.Y == 0f && flag16)
54262 {
54263 if (Main.player[owner].position.X + (float)(Main.player[owner].width / 2) < position.X + (float)(width / 2))
54264 {
54265 direction = -1;
54266 }
54267 else if (Main.player[owner].position.X + (float)(Main.player[owner].width / 2) > position.X + (float)(width / 2))
54268 {
54269 direction = 1;
54270 }
54271 rotation = 0f;
54272 frame = 0;
54273 }
54274 else
54275 {
54276 rotation = velocity.X * 0.075f;
54277 frameCounter++;
54278 if (frameCounter > 6)
54279 {
54280 frame++;
54281 frameCounter = 0;
54282 }
54283 if (frame > 4)
54284 {
54285 frame = 1;
54286 }
54287 if (frame < 1)
54288 {
54289 frame = 1;
54290 }
54291 }
54292 velocity.Y += 0.1f;
54293 if (velocity.Y > 4f)
54294 {
54295 velocity.Y = 4f;
54296 }
54297 }
54298 else if (type == 209)
54299 {
54300 if (alpha > 0)
54301 {
54302 alpha -= 5;
54303 if (alpha < 0)
54304 {
54305 alpha = 0;
54306 }
54307 }
54308 if (velocity.Y == 0f)
54309 {
54310 if (flag16)
54311 {
54312 frame = 0;
54313 frameCounter = 0;
54314 }
54315 else if ((double)velocity.X < -0.1 || (double)velocity.X > 0.1)
54316 {
54317 frameCounter += (int)Math.Abs(velocity.X);
54318 frameCounter++;
54319 if (frameCounter > 6)
54320 {
54321 frame++;
54322 frameCounter = 0;
54323 }
54324 if (frame > 11)
54325 {
54326 frame = 2;
54327 }
54328 if (frame < 2)
54329 {
54330 frame = 2;
54331 }
54332 }
54333 else
54334 {
54335 frame = 0;
54336 frameCounter = 0;
54337 }
54338 }
54339 else
54340 {
54341 frame = 1;
54342 frameCounter = 0;
54343 rotation = 0f;
54344 }
54345 velocity.Y += 0.4f;
54346 if (velocity.Y > 10f)
54347 {
54348 velocity.Y = 10f;
54349 }
54350 }
54351 else if (type == 324)
54352 {
54353 if (velocity.Y == 0f)
54354 {
54355 if ((double)velocity.X < -0.1 || (double)velocity.X > 0.1)
54356 {
54357 frameCounter += (int)Math.Abs(velocity.X);
54358 frameCounter++;
54359 if (frameCounter > 6)
54360 {
54361 frame++;
54362 frameCounter = 0;
54363 }
54364 if (frame > 5)
54365 {
54366 frame = 2;
54367 }
54368 if (frame < 2)
54369 {
54370 frame = 2;
54371 }
54372 }
54373 else
54374 {
54375 frame = 0;
54376 frameCounter = 0;
54377 }
54378 }
54379 else
54380 {
54381 frameCounter = 0;
54382 frame = 1;
54383 }
54384 velocity.Y += 0.4f;
54385 if (velocity.Y > 14f)
54386 {
54387 velocity.Y = 14f;
54388 }
54389 }
54390 else if (type == 210)
54391 {
54392 if (velocity.Y == 0f)
54393 {
54394 if ((double)velocity.X < -0.1 || (double)velocity.X > 0.1)
54395 {
54396 frameCounter += (int)Math.Abs(velocity.X);
54397 frameCounter++;
54398 if (frameCounter > 6)
54399 {
54400 frame++;
54401 frameCounter = 0;
54402 }
54403 if (frame > 6)
54404 {
54405 frame = 0;
54406 }
54407 }
54408 else
54409 {
54410 frame = 0;
54411 frameCounter = 0;
54412 }
54413 }
54414 else
54415 {
54416 rotation = velocity.X * 0.05f;
54417 frameCounter++;
54418 if (frameCounter > 6)
54419 {
54420 frame++;
54421 frameCounter = 0;
54422 }
54423 if (frame > 11)
54424 {
54425 frame = 7;
54426 }
54427 if (frame < 7)
54428 {
54429 frame = 7;
54430 }
54431 }
54432 velocity.Y += 0.4f;
54433 if (velocity.Y > 10f)
54434 {
54435 velocity.Y = 10f;
54436 }
54437 }
54438 else if (type == 398)
54439 {
54440 if (velocity.Y == 0f)
54441 {
54442 if (flag16)
54443 {
54444 frame = 0;
54445 frameCounter = 0;
54446 }
54447 else if ((double)velocity.X < -0.8 || (double)velocity.X > 0.8)
54448 {
54449 frameCounter += (int)Math.Abs(velocity.X);
54450 frameCounter++;
54451 if (frameCounter > 6)
54452 {
54453 frame++;
54454 frameCounter = 0;
54455 }
54456 if (frame >= 5)
54457 {
54458 frame = 0;
54459 }
54460 }
54461 else
54462 {
54463 frame = 0;
54464 frameCounter = 0;
54465 }
54466 }
54467 else if (velocity.Y != 0f)
54468 {
54469 frameCounter = 0;
54470 frame = 5;
54471 }
54472 velocity.Y += 0.4f;
54473 if (velocity.Y > 10f)
54474 {
54475 velocity.Y = 10f;
54476 }
54477 }
54478 }
54479 if (type == 891)
54480 {
54481 _ = Main.player[owner];
54482 DelegateMethods.v3_1 = new Vector3(1f, 0.61f, 0.16f) * 1.5f;
54483 Utils.PlotTileLine(base.Center, base.Center + velocity * 6f, 20f, DelegateMethods.CastLightOpen);
54485 }
54486 }
54487
54489 {
54490 for (int i = 0; i < 255; i++)
54491 {
54492 Player player = Main.player[i];
54493 if (player.active && player.piggyBankProjTracker.IsTracking(this))
54494 {
54495 return true;
54496 }
54497 }
54498 return false;
54499 }
54500
54501 private void AI_062()
54502 {
54503 float num = 0f;
54504 float num2 = 0f;
54505 float num3 = 20f;
54506 float num4 = 40f;
54507 float num5 = 0.69f;
54508 if (type == 963)
54509 {
54510 if (Main.player[owner].dead)
54511 {
54512 Main.player[owner].abigailMinion = false;
54513 }
54514 if (Main.player[owner].abigailMinion)
54515 {
54516 timeLeft = 2;
54517 }
54518 originalDamage = Main.player[owner].highestAbigailCounterOriginalDamage;
54519 num2 = Main.player[owner].ownedProjectileCounts[970] - 1;
54520 num3 = Math.Max(4f, 18f - num2 * 1.75f);
54521 num = 1.4f;
54522 num4 = Math.Max(5f, num4 - num2 * 4f);
54523 num5 = Math.Min(1f, num5 + num2 * 0.03f);
54524 }
54525 if (type == 423)
54526 {
54527 num4 = 5f;
54528 }
54529 if (type == 373)
54530 {
54531 if (Main.player[owner].dead)
54532 {
54533 Main.player[owner].hornetMinion = false;
54534 }
54535 if (Main.player[owner].hornetMinion)
54536 {
54537 timeLeft = 2;
54538 }
54539 }
54540 if (type == 375)
54541 {
54542 if (Main.player[owner].dead)
54543 {
54544 Main.player[owner].impMinion = false;
54545 }
54546 if (Main.player[owner].impMinion)
54547 {
54548 timeLeft = 2;
54549 }
54550 }
54551 if (type == 407)
54552 {
54553 if (Main.player[owner].dead)
54554 {
54555 Main.player[owner].sharknadoMinion = false;
54556 }
54557 if (Main.player[owner].sharknadoMinion)
54558 {
54559 timeLeft = 2;
54560 }
54561 }
54562 if (type == 423)
54563 {
54564 if (Main.player[owner].dead)
54565 {
54566 Main.player[owner].UFOMinion = false;
54567 }
54568 if (Main.player[owner].UFOMinion)
54569 {
54570 timeLeft = 2;
54571 }
54572 }
54573 if (type == 613)
54574 {
54575 if (Main.player[owner].dead)
54576 {
54577 Main.player[owner].stardustMinion = false;
54578 }
54579 if (Main.player[owner].stardustMinion)
54580 {
54581 timeLeft = 2;
54582 }
54583 Lighting.AddLight(base.Center, 0.2f, 0.6f, 0.7f);
54584 if (localAI[1] > 0f)
54585 {
54586 localAI[1] -= 1f;
54587 }
54588 }
54589 if (type == 423)
54590 {
54591 if (ai[0] == 2f)
54592 {
54593 ai[1] -= 1f;
54594 tileCollide = false;
54595 if (ai[1] > 3f)
54596 {
54597 int num6 = Dust.NewDust(base.Center, 0, 0, 220 + Main.rand.Next(2), velocity.X, velocity.Y, 100);
54598 Main.dust[num6].scale = 0.5f + (float)Main.rand.NextDouble() * 0.3f;
54599 Main.dust[num6].velocity /= 2.5f;
54600 Main.dust[num6].noGravity = true;
54601 Main.dust[num6].noLight = true;
54602 Main.dust[num6].frame.Y = 80;
54603 }
54604 if (ai[1] != 0f)
54605 {
54606 return;
54607 }
54608 ai[1] = 30f;
54609 ai[0] = 0f;
54610 velocity /= 5f;
54611 velocity.Y = 0f;
54612 extraUpdates = 0;
54613 numUpdates = 0;
54614 netUpdate = true;
54615 extraUpdates = 0;
54616 numUpdates = 0;
54617 }
54618 if (extraUpdates > 1)
54619 {
54620 extraUpdates = 0;
54621 }
54622 if (numUpdates > 1)
54623 {
54624 numUpdates = 0;
54625 }
54626 }
54627 if (type == 613)
54628 {
54629 if (ai[0] == 2f)
54630 {
54631 ai[1] -= 1f;
54632 tileCollide = false;
54633 if (ai[1] > 3f)
54634 {
54635 if (numUpdates < 20)
54636 {
54637 for (int i = 0; i < 3; i++)
54638 {
54639 Dust obj = Main.dust[Dust.NewDust(position, width, height, 229)];
54640 obj.noGravity = true;
54641 obj.position = base.Center;
54642 obj.velocity *= 3f;
54643 obj.velocity += velocity * 3f;
54644 obj.fadeIn = 1f;
54645 }
54646 }
54647 float num7 = 2f - (float)numUpdates / 30f;
54648 if (scale > 0f)
54649 {
54650 float num8 = 2f;
54651 for (int j = 0; (float)j < num8; j++)
54652 {
54653 Dust obj2 = Main.dust[Dust.NewDust(position, width, height, 229)];
54654 obj2.noGravity = true;
54655 obj2.position = base.Center + Vector2.UnitY.RotatedBy((float)numUpdates * ((float)Math.PI / 30f) + (float)whoAmI * ((float)Math.PI / 4f) + (float)Math.PI / 2f) * (height / 2) - velocity * ((float)j / num8);
54656 obj2.velocity = velocity / 3f;
54657 obj2.fadeIn = num7 / 2f;
54658 obj2.scale = num7;
54659 }
54660 }
54661 }
54662 if (ai[1] != 0f)
54663 {
54664 return;
54665 }
54666 ai[1] = 30f;
54667 ai[0] = 0f;
54668 velocity /= 5f;
54669 velocity.Y = 0f;
54670 extraUpdates = 0;
54671 numUpdates = 0;
54672 netUpdate = true;
54673 float num9 = 15f;
54674 for (int k = 0; (float)k < num9; k++)
54675 {
54676 Dust dust = Main.dust[Dust.NewDust(position, width, height, 229)];
54677 dust.noGravity = true;
54678 dust.position = base.Center - velocity * 5f;
54679 dust.velocity *= 3f;
54680 dust.velocity += velocity * 3f;
54681 dust.fadeIn = 1f;
54682 if (Main.rand.Next(3) != 0)
54683 {
54684 dust.fadeIn = 2f;
54685 dust.scale = 2f;
54686 dust.velocity /= 8f;
54687 }
54688 }
54689 for (int l = 0; (float)l < num9; l++)
54690 {
54691 Dust dust2 = Main.dust[Dust.NewDust(position, width, height, 229)];
54692 dust2.noGravity = true;
54693 dust2.position = base.Center;
54694 dust2.velocity *= 3f;
54695 dust2.velocity += velocity * 3f;
54696 dust2.fadeIn = 1f;
54697 if (Main.rand.Next(3) != 0)
54698 {
54699 dust2.fadeIn = 2f;
54700 dust2.scale = 2f;
54701 dust2.velocity /= 8f;
54702 }
54703 }
54704 extraUpdates = 0;
54705 numUpdates = 0;
54706 }
54707 if (extraUpdates > 1)
54708 {
54709 extraUpdates = 0;
54710 }
54711 if (numUpdates > 1)
54712 {
54713 numUpdates = 0;
54714 }
54715 }
54716 if (type == 423 && localAI[0] > 0f)
54717 {
54718 localAI[0] -= 1f;
54719 }
54720 if (type == 613 && localAI[0] > 0f)
54721 {
54722 localAI[0] -= 1f;
54723 }
54724 float num10 = 0.05f;
54725 float num11 = width;
54726 if (type == 407)
54727 {
54728 num10 = 0.1f;
54729 num11 *= 2f;
54730 }
54731 for (int m = 0; m < 1000; m++)
54732 {
54733 if (m != whoAmI && Main.projectile[m].active && Main.projectile[m].owner == owner && Main.projectile[m].type == type && Math.Abs(position.X - Main.projectile[m].position.X) + Math.Abs(position.Y - Main.projectile[m].position.Y) < num11)
54734 {
54735 if (position.X < Main.projectile[m].position.X)
54736 {
54737 velocity.X -= num10;
54738 }
54739 else
54740 {
54741 velocity.X += num10;
54742 }
54743 if (position.Y < Main.projectile[m].position.Y)
54744 {
54745 velocity.Y -= num10;
54746 }
54747 else
54748 {
54749 velocity.Y += num10;
54750 }
54751 }
54752 }
54753 Vector2 vector = position;
54754 float num12 = 400f;
54755 if (type == 423)
54756 {
54757 num12 = 300f;
54758 }
54759 if (type == 613)
54760 {
54761 num12 = 300f;
54762 }
54763 num12 = 2000f;
54764 if (type == 963)
54765 {
54766 num12 = 700f;
54767 }
54768 bool flag = false;
54769 int num13 = -1;
54770 tileCollide = true;
54771 if (type == 963)
54772 {
54773 tileCollide = false;
54774 }
54775 if (type == 407)
54776 {
54777 tileCollide = false;
54778 if (Collision.SolidCollision(position, width, height))
54779 {
54780 alpha += 20;
54781 if (alpha > 150)
54782 {
54783 alpha = 150;
54784 }
54785 }
54786 else
54787 {
54788 alpha -= 50;
54789 if (alpha < 60)
54790 {
54791 alpha = 60;
54792 }
54793 }
54794 }
54795 if (type == 407 || type == 613 || type == 423)
54796 {
54797 Vector2 center = Main.player[owner].Center;
54798 Vector2 vector2 = new Vector2(0.5f);
54799 if (type == 423)
54800 {
54801 vector2.Y = 0f;
54802 }
54803 NPC ownerMinionAttackTargetNPC = OwnerMinionAttackTargetNPC;
54804 if (ownerMinionAttackTargetNPC != null && ownerMinionAttackTargetNPC.CanBeChasedBy(this))
54805 {
54806 Vector2 vector3 = ownerMinionAttackTargetNPC.position + ownerMinionAttackTargetNPC.Size * vector2;
54807 float num14 = num12 * 3f;
54809 if (num15 < num14 && !flag && Collision.CanHitLine(position, width, height, ownerMinionAttackTargetNPC.position, ownerMinionAttackTargetNPC.width, ownerMinionAttackTargetNPC.height))
54810 {
54811 num12 = num15;
54812 vector = vector3;
54813 flag = true;
54815 }
54816 }
54817 if (!flag)
54818 {
54819 for (int n = 0; n < 200; n++)
54820 {
54821 NPC nPC = Main.npc[n];
54822 if (nPC.CanBeChasedBy(this))
54823 {
54824 Vector2 vector4 = nPC.position + nPC.Size * vector2;
54826 if (!(num16 >= num12) && Collision.CanHitLine(position, width, height, nPC.position, nPC.width, nPC.height))
54827 {
54828 num12 = num16;
54829 vector = vector4;
54830 flag = true;
54831 num13 = n;
54832 }
54833 }
54834 }
54835 }
54836 }
54837 else
54838 {
54839 NPC ownerMinionAttackTargetNPC2 = OwnerMinionAttackTargetNPC;
54840 if (ownerMinionAttackTargetNPC2 != null && ownerMinionAttackTargetNPC2.CanBeChasedBy(this))
54841 {
54842 float num17 = Vector2.Distance(ownerMinionAttackTargetNPC2.Center, base.Center);
54843 float num18 = num12 * 3f;
54844 if (num17 < num18 && !flag)
54845 {
54846 bool flag2 = false;
54847 if ((type != 963) ? Collision.CanHitLine(position, width, height, ownerMinionAttackTargetNPC2.position, ownerMinionAttackTargetNPC2.width, ownerMinionAttackTargetNPC2.height) : Collision.CanHit(base.Center, 1, 1, ownerMinionAttackTargetNPC2.Center, 1, 1))
54848 {
54849 num12 = num17;
54851 flag = true;
54853 }
54854 }
54855 }
54856 if (!flag)
54857 {
54858 for (int num19 = 0; num19 < 200; num19++)
54859 {
54860 NPC nPC2 = Main.npc[num19];
54861 if (!nPC2.CanBeChasedBy(this))
54862 {
54863 continue;
54864 }
54865 float num20 = Vector2.Distance(nPC2.Center, base.Center);
54866 if (!(num20 >= num12))
54867 {
54868 bool flag3 = false;
54869 if ((type != 963) ? Collision.CanHitLine(position, width, height, nPC2.position, nPC2.width, nPC2.height) : Collision.CanHit(base.Center, 1, 1, nPC2.Center, 1, 1))
54870 {
54871 num12 = num20;
54872 vector = nPC2.Center;
54873 flag = true;
54874 num13 = num19;
54875 }
54876 }
54877 }
54878 }
54879 }
54880 int num21 = 500;
54881 if (type == 963)
54882 {
54883 num21 = 800;
54884 }
54885 if (flag)
54886 {
54887 num21 = 1000;
54888 }
54889 if (flag && type == 423)
54890 {
54891 num21 = 1200;
54892 }
54893 if (flag && type == 613)
54894 {
54895 num21 = 1350;
54896 }
54897 Player player = Main.player[owner];
54898 if (Vector2.Distance(player.Center, base.Center) > (float)num21)
54899 {
54900 ai[0] = 1f;
54901 netUpdate = true;
54902 }
54903 if (ai[0] == 1f)
54904 {
54905 tileCollide = false;
54906 }
54907 bool flag4 = false;
54908 if (type == 963)
54909 {
54910 flag4 = true;
54911 }
54912 if (flag4)
54913 {
54914 if (ai[0] <= 1f && localAI[1] <= 0f)
54915 {
54916 localAI[1] = -1f;
54917 }
54918 else
54919 {
54920 localAI[1] = Utils.Clamp(localAI[1] + 0.05f, 0f, 1f);
54921 if (localAI[1] == 1f)
54922 {
54923 localAI[1] = -1f;
54924 }
54925 }
54926 }
54927 if (type == 963 && velocity.Length() > 0.1f && Main.rand.Next(1500) == 0)
54928 {
54930 }
54931 bool flag5 = false;
54932 if (type == 423 || type == 407)
54933 {
54934 flag5 = true;
54935 }
54936 if (ai[0] >= 2f)
54937 {
54938 if (ai[0] == 2f && type == 963)
54939 {
54941 }
54942 ai[0] += 1f;
54943 if (flag4)
54944 {
54945 localAI[1] = ai[0] / num4;
54946 }
54947 if (!flag)
54948 {
54949 ai[0] += 1f;
54950 }
54951 if (ai[0] > num4)
54952 {
54953 ai[0] = 0f;
54954 netUpdate = true;
54955 if (flag && type == 963 && (vector - base.Center).Length() < 50f)
54956 {
54957 ai[0] = 2f;
54958 }
54959 }
54960 velocity *= num5;
54961 }
54962 else if (flag && (flag5 || ai[0] == 0f))
54963 {
54964 Vector2 v = vector - base.Center;
54965 float num22 = v.Length();
54966 v = v.SafeNormalize(Vector2.Zero);
54967 if (type == 423)
54968 {
54969 v = vector - Vector2.UnitY * 80f;
54970 int num23 = (int)v.Y / 16;
54971 if (num23 < 0)
54972 {
54973 num23 = 0;
54974 }
54975 Tile tile = Main.tile[(int)v.X / 16, num23];
54976 if (tile != null && tile.active() && Main.tileSolid[tile.type] && !Main.tileSolidTop[tile.type])
54977 {
54978 v += Vector2.UnitY * 16f;
54979 tile = Main.tile[(int)v.X / 16, (int)v.Y / 16];
54980 if (tile != null && tile.active() && Main.tileSolid[tile.type] && !Main.tileSolidTop[tile.type])
54981 {
54982 v += Vector2.UnitY * 16f;
54983 }
54984 }
54985 v -= base.Center;
54986 num22 = v.Length();
54987 v = v.SafeNormalize(Vector2.Zero);
54988 if (num22 > 300f && num22 <= 800f && localAI[0] == 0f)
54989 {
54990 ai[0] = 2f;
54991 ai[1] = (int)(num22 / 10f);
54992 extraUpdates = (int)ai[1];
54993 velocity = v * 10f;
54994 localAI[0] = 60f;
54995 return;
54996 }
54997 }
54998 if (type == 613)
54999 {
55000 v = vector;
55001 Vector2 vector5 = base.Center - v;
55002 if (vector5 == Vector2.Zero)
55003 {
55005 }
55006 vector5 = vector5.SafeNormalize(Vector2.Zero);
55007 v += vector5 * 60f;
55008 int num24 = (int)v.Y / 16;
55009 if (num24 < 0)
55010 {
55011 num24 = 0;
55012 }
55013 Tile tile2 = Main.tile[(int)v.X / 16, num24];
55014 if (tile2 != null && tile2.active() && Main.tileSolid[tile2.type] && !Main.tileSolidTop[tile2.type])
55015 {
55016 v += Vector2.UnitY * 16f;
55017 tile2 = Main.tile[(int)v.X / 16, (int)v.Y / 16];
55018 if (tile2 != null && tile2.active() && Main.tileSolid[tile2.type] && !Main.tileSolidTop[tile2.type])
55019 {
55020 v += Vector2.UnitY * 16f;
55021 }
55022 }
55023 v -= base.Center;
55024 num22 = v.Length();
55025 v = v.SafeNormalize(Vector2.Zero);
55026 if (num22 > 400f && num22 <= 800f && localAI[0] == 0f)
55027 {
55028 ai[0] = 2f;
55029 ai[1] = (int)(num22 / 10f);
55030 extraUpdates = (int)ai[1];
55031 velocity = v * 10f;
55032 localAI[0] = 60f;
55033 return;
55034 }
55035 }
55036 if (type == 407)
55037 {
55038 if (num22 > 400f)
55039 {
55040 float num25 = 3f;
55041 v *= num25;
55042 velocity = (velocity * 20f + v) / 21f;
55043 }
55044 else
55045 {
55046 velocity *= 0.96f;
55047 }
55048 }
55049 if (num22 > 200f)
55050 {
55051 float num26 = 6f + num2 * num;
55052 v *= num26;
55053 float num27 = num3 * 2f;
55054 velocity.X = (velocity.X * num27 + v.X) / (num27 + 1f);
55055 velocity.Y = (velocity.Y * num27 + v.Y) / (num27 + 1f);
55056 }
55057 else if (type == 963)
55058 {
55059 if (num22 < 50f)
55060 {
55061 velocity *= 0.5f;
55062 ai[0] = 2f;
55063 netUpdate = true;
55064 }
55065 else
55066 {
55067 float num28 = 4f + num2 * num;
55068 v *= num28;
55069 velocity = (velocity * num3 + v) / (num3 + 1f);
55070 }
55071 }
55072 else if (type == 423 || type == 613)
55073 {
55074 if (num22 > 70f && num22 < 130f)
55075 {
55076 float num29 = 7f;
55077 if (num22 < 100f)
55078 {
55079 num29 = -3f;
55080 }
55081 v *= num29;
55082 velocity = (velocity * 20f + v) / 21f;
55083 if (Math.Abs(v.X) > Math.Abs(v.Y))
55084 {
55085 velocity.X = (velocity.X * 10f + v.X) / 11f;
55086 }
55087 }
55088 else
55089 {
55090 velocity *= 0.97f;
55091 }
55092 }
55093 else if (type == 375)
55094 {
55095 if (num22 < 150f)
55096 {
55097 float num30 = 4f;
55098 v *= 0f - num30;
55099 velocity.X = (velocity.X * 40f + v.X) / 41f;
55100 velocity.Y = (velocity.Y * 40f + v.Y) / 41f;
55101 }
55102 else
55103 {
55104 velocity *= 0.97f;
55105 }
55106 }
55107 else if (velocity.Y > -1f)
55108 {
55109 velocity.Y -= 0.1f;
55110 }
55111 }
55112 else
55113 {
55114 if (type != 963 && !Collision.CanHitLine(base.Center, 1, 1, Main.player[owner].Center, 1, 1))
55115 {
55116 ai[0] = 1f;
55117 }
55118 float num31 = 6f;
55119 if (ai[0] == 1f)
55120 {
55121 num31 = 15f;
55122 }
55123 if (type == 407)
55124 {
55125 num31 = 9f;
55126 }
55127 if (type == 963)
55128 {
55129 num31 *= 0.8f;
55130 }
55131 Vector2 center2 = base.Center;
55132 Vector2 v2 = player.Center - center2 + new Vector2(0f, -60f);
55133 if (type == 407)
55134 {
55135 v2 += new Vector2(0f, 40f);
55136 }
55137 if (type == 963)
55138 {
55139 v2 += new Vector2(-40 * Main.player[owner].direction, 40f);
55140 }
55141 if (type == 375)
55142 {
55143 ai[1] = 80f;
55144 netUpdate = true;
55145 v2 = player.Center - center2;
55146 int num32 = 1;
55147 for (int num33 = 0; num33 < whoAmI; num33++)
55148 {
55149 if (Main.projectile[num33].active && Main.projectile[num33].owner == owner && Main.projectile[num33].type == type)
55150 {
55151 num32++;
55152 }
55153 }
55154 v2.X -= 10 * Main.player[owner].direction;
55155 v2.X -= num32 * 40 * Main.player[owner].direction;
55156 v2.Y -= 10f;
55157 }
55158 float num34 = v2.Length();
55159 if (num34 > 200f && num31 < 9f)
55160 {
55161 num31 = 9f;
55162 }
55163 if ((type == 423 || type == 407) && num34 > 300f && num31 < 12f)
55164 {
55165 num31 = 12f;
55166 }
55167 if (type == 375)
55168 {
55169 num31 = (int)((double)num31 * 0.75);
55170 }
55171 if (num34 < 100f && ai[0] == 1f && !Collision.SolidCollision(position, width, height))
55172 {
55173 ai[0] = 0f;
55174 netUpdate = true;
55175 }
55176 if (num34 > 2000f)
55177 {
55178 position.X = Main.player[owner].Center.X - (float)(width / 2);
55179 position.Y = Main.player[owner].Center.Y - (float)(width / 2);
55180 }
55181 if (type == 375 || type == 963)
55182 {
55183 if (num34 > 10f)
55184 {
55185 v2 = v2.SafeNormalize(Vector2.Zero);
55186 if (num34 < 50f)
55187 {
55188 num31 /= 2f;
55189 }
55190 v2 *= num31;
55191 velocity = (velocity * 20f + v2) / 21f;
55192 }
55193 else
55194 {
55195 direction = Main.player[owner].direction;
55196 velocity *= 0.9f;
55197 }
55198 }
55199 else if (type == 407)
55200 {
55201 if (Math.Abs(v2.X) > 40f || Math.Abs(v2.Y) > 10f)
55202 {
55203 v2 = v2.SafeNormalize(Vector2.Zero);
55204 v2 *= num31;
55205 v2 *= new Vector2(1.25f, 0.65f);
55206 velocity = (velocity * 20f + v2) / 21f;
55207 }
55208 else
55209 {
55210 if (velocity.X == 0f && velocity.Y == 0f)
55211 {
55212 velocity.X = -0.15f;
55213 velocity.Y = -0.05f;
55214 }
55215 velocity *= 1.01f;
55216 }
55217 }
55218 else if (num34 > 70f)
55219 {
55220 v2 = v2.SafeNormalize(Vector2.Zero);
55221 v2 *= num31;
55222 velocity = (velocity * 20f + v2) / 21f;
55223 }
55224 else
55225 {
55226 if (velocity.X == 0f && velocity.Y == 0f)
55227 {
55228 velocity.X = -0.15f;
55229 velocity.Y = -0.05f;
55230 }
55231 velocity *= 1.01f;
55232 }
55233 if (num34 > 250f && (type == 423 || type == 407))
55234 {
55235 float x = Main.player[owner].velocity.X;
55236 float y = Main.player[owner].velocity.Y;
55237 if ((velocity.X < 0f && x >= 0f) || (velocity.X >= 0f && x < 0f))
55238 {
55239 velocity.X *= 0.95f;
55240 }
55241 else
55242 {
55243 velocity.X += x * 0.125f;
55244 }
55245 if ((velocity.Y < 0f && y >= 0f) || (velocity.Y >= 0f && y < 0f))
55246 {
55247 velocity.Y *= 0.95f;
55248 }
55249 else
55250 {
55251 velocity.Y += y * 0.125f;
55252 }
55253 if (velocity.Length() > num31)
55254 {
55255 velocity = velocity.SafeNormalize(Vector2.Zero) * num31;
55256 }
55257 }
55258 }
55259 rotation = velocity.X * 0.05f;
55260 frameCounter++;
55261 if (type == 373)
55262 {
55263 if (frameCounter > 1)
55264 {
55265 frame++;
55266 frameCounter = 0;
55267 }
55268 if (frame > 2)
55269 {
55270 frame = 0;
55271 }
55272 }
55273 if (type == 963)
55274 {
55275 if (ai[0] >= 2f)
55276 {
55277 int num35 = 12;
55278 if (frame < 8)
55279 {
55280 frameCounter = 0;
55281 }
55282 frameCounter++;
55283 frame = frameCounter / num35;
55284 if (frame > 6)
55285 {
55286 frameCounter = 0;
55287 frame = 5;
55288 }
55289 switch (frame)
55290 {
55291 case 0:
55292 case 1:
55293 case 2:
55294 frame = 8 + frame;
55295 break;
55296 case 3:
55297 case 5:
55298 case 7:
55299 frame = 11;
55300 break;
55301 default:
55302 frame = 12;
55303 break;
55304 }
55305 if (Main.rand.Next(2) == 0)
55306 {
55307 float num36 = 1.1f + Main.rand.NextFloat() * 0.3f;
55308 float num37 = 1.4f + Main.rand.NextFloat() * 0.4f;
55309 Vector2 vector6 = Main.rand.NextVector2CircularEdge((float)width * num36, (0f - (float)height) * 0.25f * num36);
55310 float num38 = vector6.ToRotation() + (float)Math.PI / 2f;
55311 int num39 = Dust.NewDust(base.Bottom + vector6, 1, 1, 303, 0f, 0f, 50, Color.GhostWhite, num37);
55312 Main.dust[num39].velocity = vector6 * 0.0125f + new Vector2(1f, 0f).RotatedBy(num38, Vector2.Zero);
55313 Main.dust[num39].noGravity = true;
55314 }
55315 }
55316 else
55317 {
55318 if (frame > 7)
55319 {
55320 frame = 0;
55321 frameCounter = 0;
55322 }
55323 if (frameCounter > 6)
55324 {
55325 frameCounter = 0;
55326 frame++;
55327 if (frame > 7)
55328 {
55329 frame = 0;
55330 }
55331 }
55332 }
55333 }
55334 if (type == 375)
55335 {
55336 if (frameCounter >= 16)
55337 {
55338 frameCounter = 0;
55339 }
55340 frame = frameCounter / 4;
55341 if (ai[1] > 0f && ai[1] < 16f)
55342 {
55343 frame += 4;
55344 }
55345 if (Main.rand.Next(6) == 0)
55346 {
55347 int num40 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100, default(Color), 2f);
55348 Main.dust[num40].velocity *= 0.3f;
55349 Main.dust[num40].noGravity = true;
55350 Main.dust[num40].noLight = true;
55351 }
55352 }
55353 if (type == 407)
55354 {
55355 int num41 = 2;
55356 if (frameCounter >= 6 * num41)
55357 {
55358 frameCounter = 0;
55359 }
55360 frame = frameCounter / num41;
55361 if (Main.rand.Next(5) == 0)
55362 {
55363 int num42 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 217, 0f, 0f, 100, default(Color), 2f);
55364 Main.dust[num42].velocity *= 0.3f;
55365 Main.dust[num42].noGravity = true;
55366 Main.dust[num42].noLight = true;
55367 }
55368 }
55369 if (type == 423 || type == 613)
55370 {
55371 int num43 = 3;
55372 if (frameCounter >= 4 * num43)
55373 {
55374 frameCounter = 0;
55375 }
55376 frame = frameCounter / num43;
55377 }
55378 if (velocity.X > 0f)
55379 {
55380 spriteDirection = (direction = -1);
55381 }
55382 else if (velocity.X < 0f)
55383 {
55384 spriteDirection = (direction = 1);
55385 }
55386 if (type == 963)
55387 {
55388 spriteDirection = (direction *= -1);
55389 if (!flag && Math.Abs(velocity.X) < 0.1f)
55390 {
55391 spriteDirection = ((Main.player[owner].Center.X > base.Center.X) ? 1 : (-1));
55392 }
55393 }
55394 if (type == 373)
55395 {
55396 if (ai[1] > 0f)
55397 {
55398 ai[1] += Main.rand.Next(1, 4);
55399 }
55400 int num44 = 90;
55401 if (Main.player[owner].strongBees)
55402 {
55403 num44 = 70;
55404 }
55405 if (ai[1] > (float)num44)
55406 {
55407 ai[1] = 0f;
55408 netUpdate = true;
55409 }
55410 }
55411 else if (type == 375)
55412 {
55413 if (ai[1] > 0f)
55414 {
55415 ai[1] += 1f;
55416 if (Main.rand.Next(3) == 0)
55417 {
55418 ai[1] += 1f;
55419 }
55420 }
55421 if (ai[1] > 90f)
55422 {
55423 ai[1] = 0f;
55424 netUpdate = true;
55425 }
55426 }
55427 else if (type == 407)
55428 {
55429 if (ai[1] > 0f)
55430 {
55431 ai[1] += 1f;
55432 if (Main.rand.Next(3) != 0)
55433 {
55434 ai[1] += 1f;
55435 }
55436 }
55437 if (ai[1] > 50f)
55438 {
55439 ai[1] = 0f;
55440 netUpdate = true;
55441 }
55442 }
55443 else if (type == 423)
55444 {
55445 if (ai[1] > 0f)
55446 {
55447 ai[1] += 1f;
55448 if (Main.rand.Next(3) != 0)
55449 {
55450 ai[1] += 1f;
55451 }
55452 }
55453 if (ai[1] > 40f)
55454 {
55455 ai[1] = 0f;
55456 netUpdate = true;
55457 }
55458 }
55459 else if (type == 613)
55460 {
55461 if (ai[1] > 0f)
55462 {
55463 ai[1] += 1f;
55464 if (Main.rand.Next(3) != 0)
55465 {
55466 ai[1] += 1f;
55467 }
55468 }
55469 if (ai[1] > 60f)
55470 {
55471 ai[1] = 0f;
55472 netUpdate = true;
55473 }
55474 }
55475 if (!flag5 && ai[0] != 0f)
55476 {
55477 return;
55478 }
55479 float num45 = 0f;
55480 int num46 = 0;
55481 if (type == 373)
55482 {
55483 num45 = 10f;
55484 num46 = 374;
55485 }
55486 else if (type == 375)
55487 {
55488 num45 = 11f;
55489 num46 = 376;
55490 }
55491 else if (type == 407)
55492 {
55493 num45 = 20f;
55494 num46 = 408;
55495 }
55496 else if (type == 423)
55497 {
55498 num45 = 4f;
55499 num46 = 433;
55500 }
55501 else if (type == 613)
55502 {
55503 num45 = 14f;
55504 num46 = 614;
55505 }
55506 if (!flag)
55507 {
55508 return;
55509 }
55510 if (type == 375)
55511 {
55512 if ((vector - base.Center).X > 0f)
55513 {
55514 spriteDirection = (direction = -1);
55515 }
55516 else if ((vector - base.Center).X < 0f)
55517 {
55518 spriteDirection = (direction = 1);
55519 }
55520 }
55521 if (type == 407 && Collision.SolidCollision(position, width, height))
55522 {
55523 return;
55524 }
55525 if (type == 423)
55526 {
55527 if (Math.Abs((vector - base.Center).ToRotation() - (float)Math.PI / 2f) > (float)Math.PI / 4f)
55528 {
55529 velocity += (vector - base.Center - Vector2.UnitY * 80f).SafeNormalize(Vector2.Zero);
55530 }
55531 if (!((vector - base.Center).Length() > 400f) && ai[1] == 0f)
55532 {
55533 ai[1] += 1f;
55534 if (Main.myPlayer == owner)
55535 {
55536 Vector2 v3 = vector - base.Center;
55537 v3 = v3.SafeNormalize(Vector2.Zero);
55538 v3 *= num45;
55539 NewProjectile(GetProjectileSource_FromThis(), base.Center.X, base.Center.Y, v3.X, v3.Y, num46, damage, knockBack, Main.myPlayer);
55540 netUpdate = true;
55541 }
55542 }
55543 }
55544 else if (ai[1] == 0f && type == 613)
55545 {
55546 if ((vector - base.Center).Length() > 500f || ai[1] != 0f)
55547 {
55548 return;
55549 }
55550 ai[1] += 1f;
55551 if (Main.myPlayer == owner)
55552 {
55553 Vector2 v4 = vector - base.Center;
55554 v4 = v4.SafeNormalize(Vector2.Zero);
55555 v4 *= num45;
55556 int num47 = NewProjectile(GetProjectileSource_FromThis(), base.Center.X, base.Center.Y, v4.X, v4.Y, num46, damage, knockBack, Main.myPlayer, 0f, num13);
55557 Main.projectile[num47].timeLeft = 300;
55558 Main.projectile[num47].netUpdate = true;
55559 velocity -= v4 / 3f;
55560 netUpdate = true;
55561 }
55562 for (int num48 = 0; num48 < 5; num48++)
55563 {
55564 int num49 = width / 4;
55565 _ = ((float)Main.rand.NextDouble() * ((float)Math.PI * 2f)).ToRotationVector2() * Main.rand.Next(24, 41) / 8f;
55566 int num50 = Dust.NewDust(base.Center - Vector2.One * num49, num49 * 2, num49 * 2, 88);
55568 Vector2 vector7 = (dust3.position - base.Center).SafeNormalize(Vector2.Zero);
55569 dust3.position = base.Center + vector7 * num49 * scale - new Vector2(4f);
55570 if (num48 < 30)
55571 {
55572 dust3.velocity = vector7 * dust3.velocity.Length() * 2f;
55573 }
55574 else
55575 {
55576 dust3.velocity = 2f * vector7 * Main.rand.Next(45, 91) / 10f;
55577 }
55578 dust3.noGravity = true;
55579 dust3.scale = 0.7f + Main.rand.NextFloat();
55580 }
55581 }
55582 else if (ai[1] == 0f)
55583 {
55584 Vector2 v5 = vector - base.Center;
55585 ai[1] += 1f;
55586 if (Main.myPlayer == owner)
55587 {
55588 v5 = v5.SafeNormalize(Vector2.Zero);
55589 v5 *= num45;
55590 int num51 = NewProjectile(GetProjectileSource_FromThis(), base.Center.X, base.Center.Y, v5.X, v5.Y, num46, damage, knockBack, Main.myPlayer);
55591 Main.projectile[num51].timeLeft = 300;
55592 Main.projectile[num51].netUpdate = true;
55593 netUpdate = true;
55594 }
55595 }
55596 }
55597
55598 private void AI_075()
55599 {
55600 Player player = Main.player[owner];
55601 float num = (float)Math.PI / 2f;
55603 int num2 = 2;
55604 float num3 = 0f;
55605 if (type == 439)
55606 {
55607 ai[0] += 1f;
55608 int num4 = 0;
55609 if (ai[0] >= 40f)
55610 {
55611 num4++;
55612 }
55613 if (ai[0] >= 80f)
55614 {
55615 num4++;
55616 }
55617 if (ai[0] >= 120f)
55618 {
55619 num4++;
55620 }
55621 int num5 = 24;
55622 int num6 = 6;
55623 ai[1] += 1f;
55624 bool flag = false;
55625 if (ai[1] >= (float)(num5 - num6 * num4))
55626 {
55627 ai[1] = 0f;
55628 flag = true;
55629 }
55630 frameCounter += 1 + num4;
55631 if (frameCounter >= 4)
55632 {
55633 frameCounter = 0;
55634 frame++;
55635 if (frame >= 6)
55636 {
55637 frame = 0;
55638 }
55639 }
55640 if (soundDelay <= 0)
55641 {
55642 soundDelay = num5 - num6 * num4;
55643 if (ai[0] != 1f)
55644 {
55646 }
55647 }
55648 if (ai[1] == 1f && ai[0] != 1f)
55649 {
55650 Vector2 spinningpoint = Vector2.UnitX * 24f;
55651 spinningpoint = spinningpoint.RotatedBy(rotation - (float)Math.PI / 2f);
55652 Vector2 vector2 = base.Center + spinningpoint;
55653 for (int i = 0; i < 2; i++)
55654 {
55655 int num7 = Dust.NewDust(vector2 - Vector2.One * 8f, 16, 16, 135, velocity.X / 2f, velocity.Y / 2f, 100);
55656 Main.dust[num7].velocity *= 0.66f;
55657 Main.dust[num7].noGravity = true;
55658 Main.dust[num7].scale = 1.4f;
55659 }
55660 }
55661 if (flag && Main.myPlayer == owner)
55662 {
55663 if (player.channel && player.CheckMana(player.inventory[player.selectedItem].mana, pay: true) && !player.noItems && !player.CCed)
55664 {
55665 float num8 = player.inventory[player.selectedItem].shootSpeed * scale;
55667 Vector2 value = Main.screenPosition + new Vector2(Main.mouseX, Main.mouseY) - vector3;
55668 if (player.gravDir == -1f)
55669 {
55670 value.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - vector3.Y;
55671 }
55673 if (float.IsNaN(vector4.X) || float.IsNaN(vector4.Y))
55674 {
55676 }
55677 vector4 *= num8;
55678 if (vector4.X != velocity.X || vector4.Y != velocity.Y)
55679 {
55680 netUpdate = true;
55681 }
55682 velocity = vector4;
55683 int num9 = 440;
55684 float num10 = 14f;
55685 int num11 = 7;
55686 for (int j = 0; j < 2; j++)
55687 {
55688 vector3 = base.Center + new Vector2(Main.rand.Next(-num11, num11 + 1), Main.rand.Next(-num11, num11 + 1));
55690 spinningpoint2 = spinningpoint2.RotatedBy(Main.rand.NextDouble() * 0.19634954631328583 - 0.09817477315664291);
55691 if (float.IsNaN(spinningpoint2.X) || float.IsNaN(spinningpoint2.Y))
55692 {
55694 }
55695 NewProjectile(GetProjectileSource_FromThis(), vector3.X, vector3.Y, spinningpoint2.X, spinningpoint2.Y, num9, damage, knockBack, owner);
55696 }
55697 }
55698 else
55699 {
55700 Kill();
55701 }
55702 }
55703 }
55704 if (type == 445)
55705 {
55706 if (soundDelay <= 0)
55707 {
55709 soundDelay = 23;
55710 }
55711 localAI[0] += 1f;
55712 if (localAI[0] >= 60f)
55713 {
55714 localAI[0] = 0f;
55715 }
55716 if (Vector2.Distance(vector, base.Center) >= 5f)
55717 {
55718 float num12 = localAI[0] / 60f;
55719 if (num12 > 0.5f)
55720 {
55721 num12 = 1f - num12;
55722 }
55723 Vector3 value2 = new Vector3(0f, 1f, 0.7f);
55724 Vector3 value3 = new Vector3(0f, 0.7f, 1f);
55725 Vector3 vector5 = Vector3.Lerp(value2, value3, 1f - num12 * 2f) * 0.5f;
55726 if (Vector2.Distance(vector, base.Center) >= 30f)
55727 {
55728 Vector2 vector6 = base.Center - vector;
55729 vector6.Normalize();
55730 vector6 *= Vector2.Distance(vector, base.Center) - 30f;
55731 DelegateMethods.v3_1 = vector5 * 0.8f;
55733 }
55734 Lighting.AddLight((int)base.Center.X / 16, (int)base.Center.Y / 16, vector5.X, vector5.Y, vector5.Z);
55735 }
55736 if (Main.myPlayer == owner)
55737 {
55738 if (localAI[1] > 0f)
55739 {
55740 localAI[1] -= 1f;
55741 }
55742 if (!player.channel || player.noItems || player.CCed)
55743 {
55744 Kill();
55745 }
55746 else if (localAI[1] == 0f)
55747 {
55749 Vector2 value4 = Main.screenPosition + new Vector2(Main.mouseX, Main.mouseY) - vector7;
55750 if (player.gravDir == -1f)
55751 {
55752 value4.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - vector7.Y;
55753 }
55755 {
55756 value4 = new Vector2(Player.tileTargetX, Player.tileTargetY) * 16f + Vector2.One * 8f - vector7;
55757 localAI[1] = 2f;
55758 }
55759 value4 = Vector2.Lerp(value4, velocity, 0.7f);
55760 if (float.IsNaN(value4.X) || float.IsNaN(value4.Y))
55761 {
55762 value4 = -Vector2.UnitY;
55763 }
55764 float num13 = 30f;
55765 if (value4.Length() < num13)
55766 {
55768 }
55769 int tileBoost = player.inventory[player.selectedItem].tileBoost;
55770 int num14 = -Player.tileRangeX - tileBoost + 1;
55771 int num15 = Player.tileRangeX + tileBoost - 1;
55772 int num16 = -Player.tileRangeY - tileBoost;
55773 int num17 = Player.tileRangeY + tileBoost - 1;
55774 int num18 = 12;
55775 bool flag2 = false;
55776 if (value4.X < (float)(num14 * 16 - num18))
55777 {
55778 flag2 = true;
55779 }
55780 if (value4.Y < (float)(num16 * 16 - num18))
55781 {
55782 flag2 = true;
55783 }
55784 if (value4.X > (float)(num15 * 16 + num18))
55785 {
55786 flag2 = true;
55787 }
55788 if (value4.Y > (float)(num17 * 16 + num18))
55789 {
55790 flag2 = true;
55791 }
55792 if (flag2)
55793 {
55795 float num19 = -1f;
55796 if (vector8.X < 0f && ((float)(num14 * 16 - num18) / vector8.X < num19 || num19 == -1f))
55797 {
55798 num19 = (float)(num14 * 16 - num18) / vector8.X;
55799 }
55800 if (vector8.X > 0f && ((float)(num15 * 16 + num18) / vector8.X < num19 || num19 == -1f))
55801 {
55802 num19 = (float)(num15 * 16 + num18) / vector8.X;
55803 }
55804 if (vector8.Y < 0f && ((float)(num16 * 16 - num18) / vector8.Y < num19 || num19 == -1f))
55805 {
55806 num19 = (float)(num16 * 16 - num18) / vector8.Y;
55807 }
55808 if (vector8.Y > 0f && ((float)(num17 * 16 + num18) / vector8.Y < num19 || num19 == -1f))
55809 {
55810 num19 = (float)(num17 * 16 + num18) / vector8.Y;
55811 }
55812 value4 = vector8 * num19;
55813 }
55814 if (value4.X != velocity.X || value4.Y != velocity.Y)
55815 {
55816 netUpdate = true;
55817 }
55818 velocity = value4;
55819 }
55820 }
55821 }
55822 if (type == 460)
55823 {
55824 ai[0] += 1f;
55825 int num20 = 0;
55826 if (ai[0] >= 80f)
55827 {
55828 num20++;
55829 }
55830 if (ai[0] >= 180f)
55831 {
55832 num20++;
55833 }
55834 bool flag3 = false;
55835 _ = ai[0];
55836 if (ai[0] == 80f || ai[0] == 180f || (ai[0] > 180f && ai[0] % 20f == 0f))
55837 {
55838 flag3 = true;
55839 }
55840 bool flag4 = ai[0] >= 180f;
55841 int num21 = 5;
55842 if (!flag4)
55843 {
55844 ai[1] += 1f;
55845 }
55846 bool flag5 = false;
55847 if (ai[0] == 1f)
55848 {
55849 flag5 = true;
55850 }
55851 if (flag4 && ai[0] % 20f == 0f)
55852 {
55853 flag5 = true;
55854 }
55855 if ((!flag4 && ai[1] >= (float)num21) || (flag4 && ai[0] % 5f == 0f))
55856 {
55857 if (!flag4)
55858 {
55859 ai[1] = 0f;
55860 }
55861 flag5 = true;
55862 float num22 = player.inventory[player.selectedItem].shootSpeed * scale;
55864 Vector2 value5 = Main.screenPosition + new Vector2(Main.mouseX, Main.mouseY) - vector9;
55865 if (player.gravDir == -1f)
55866 {
55867 value5.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - vector9.Y;
55868 }
55870 if (float.IsNaN(vector10.X) || float.IsNaN(vector10.Y))
55871 {
55873 }
55874 vector10 *= num22;
55875 if (vector10.X != velocity.X || vector10.Y != velocity.Y)
55876 {
55877 netUpdate = true;
55878 }
55879 velocity = vector10;
55880 }
55881 if (soundDelay <= 0 && !flag4)
55882 {
55883 soundDelay = num21 - num20;
55884 soundDelay *= 2;
55885 if (ai[0] != 1f)
55886 {
55888 }
55889 }
55890 if (ai[0] > 10f && !flag4)
55891 {
55892 Vector2 spinningpoint3 = Vector2.UnitX * 18f;
55893 spinningpoint3 = spinningpoint3.RotatedBy(rotation - (float)Math.PI / 2f);
55894 Vector2 vector11 = base.Center + spinningpoint3;
55895 for (int k = 0; k < num20 + 1; k++)
55896 {
55897 int num23 = 226;
55898 float num24 = 0.4f;
55899 if (k % 2 == 1)
55900 {
55901 num23 = 226;
55902 num24 = 0.65f;
55903 }
55904 Vector2 vector12 = vector11 + ((float)Main.rand.NextDouble() * ((float)Math.PI * 2f)).ToRotationVector2() * (12f - (float)(num20 * 2));
55905 int num25 = Dust.NewDust(vector12 - Vector2.One * 8f, 16, 16, num23, velocity.X / 2f, velocity.Y / 2f);
55906 Main.dust[num25].velocity = Vector2.Normalize(vector11 - vector12) * 1.5f * (10f - (float)num20 * 2f) / 10f;
55907 Main.dust[num25].noGravity = true;
55908 Main.dust[num25].scale = num24;
55909 Main.dust[num25].customData = player;
55910 }
55911 }
55912 if (flag4)
55913 {
55914 Vector2 spinningpoint4 = Vector2.UnitX * 14f;
55915 spinningpoint4 = spinningpoint4.RotatedBy(rotation - (float)Math.PI / 2f);
55916 Vector2 vector13 = base.Center + spinningpoint4;
55917 for (int l = 0; l < 2; l++)
55918 {
55919 int num26 = 226;
55920 float num27 = 0.35f;
55921 if (l % 2 == 1)
55922 {
55923 num26 = 226;
55924 num27 = 0.45f;
55925 }
55926 float num28 = Main.rand.NextFloatDirection();
55927 Vector2 vector14 = vector13 + (rotation + num28 * ((float)Math.PI / 4f) * 0.8f - (float)Math.PI / 2f).ToRotationVector2() * 6f;
55928 int num29 = 24;
55929 int num30 = Dust.NewDust(vector14 - Vector2.One * (num29 / 2), num29, num29, num26, velocity.X / 2f, velocity.Y / 2f);
55930 Main.dust[num30].velocity = (vector14 - vector13).SafeNormalize(Vector2.Zero) * MathHelper.Lerp(1.5f, 9f, Utils.GetLerpValue(1f, 0f, Math.Abs(num28), clamped: true));
55931 Main.dust[num30].noGravity = true;
55932 Main.dust[num30].scale = num27;
55933 Main.dust[num30].customData = player;
55934 Main.dust[num30].fadeIn = 0.5f;
55935 }
55936 }
55937 if (flag5 && Main.myPlayer == owner)
55938 {
55939 bool flag6 = false;
55940 flag6 = !flag3 || player.CheckMana(player.inventory[player.selectedItem].mana, pay: true);
55941 if (player.channel && flag6 && !player.noItems && !player.CCed)
55942 {
55943 if (ai[0] == 180f)
55944 {
55945 Vector2 center = base.Center;
55946 Vector2 vector15 = Vector2.Normalize(velocity);
55947 if (float.IsNaN(vector15.X) || float.IsNaN(vector15.Y))
55948 {
55950 }
55951 int num31 = (int)((float)damage * 1.5f);
55952 int num32 = NewProjectile(GetProjectileSource_FromThis(), center.X, center.Y, vector15.X, vector15.Y, 461, num31, knockBack, owner, 0f, whoAmI);
55953 ai[1] = num32;
55954 netUpdate = true;
55955 }
55956 else if (flag4)
55957 {
55958 Projectile projectile = Main.projectile[(int)ai[1]];
55959 if (!projectile.active || projectile.type != 461)
55960 {
55961 Kill();
55962 return;
55963 }
55964 }
55965 else
55966 {
55967 bool flag7 = false;
55968 if (ai[0] == 1f)
55969 {
55970 flag7 = true;
55971 }
55972 if (ai[0] <= 50f && ai[0] % 10f == 0f)
55973 {
55974 flag7 = true;
55975 }
55976 if (ai[0] >= 80f && ai[0] < 180f && ai[0] % 30f == 0f)
55977 {
55978 flag7 = true;
55979 }
55980 if (flag7)
55981 {
55983 int num33 = 459;
55984 float num34 = 10f;
55985 vector16 = base.Center;
55986 Vector2 vector17 = Vector2.Normalize(velocity) * num34;
55987 if (float.IsNaN(vector17.X) || float.IsNaN(vector17.Y))
55988 {
55990 }
55991 float num35 = 0.7f + (float)num20 * 0.3f;
55992 int num36 = ((num35 < 1f) ? damage : ((int)((float)damage * 2.5f)));
55993 NewProjectile(GetProjectileSource_FromThis(), vector16.X, vector16.Y, vector17.X, vector17.Y, num33, num36, knockBack, owner, 0f, num35);
55994 }
55995 }
55996 }
55997 else
55998 {
55999 Kill();
56000 }
56001 }
56002 }
56003 if (type == 633)
56004 {
56005 float num37 = 30f;
56006 if (ai[0] > 90f)
56007 {
56008 num37 = 15f;
56009 }
56010 if (ai[0] > 120f)
56011 {
56012 num37 = 5f;
56013 }
56014 damage = (int)((float)player.inventory[player.selectedItem].damage * player.magicDamage);
56015 ai[0] += 1f;
56016 ai[1] += 1f;
56017 bool flag8 = false;
56018 if (ai[0] % num37 == 0f)
56019 {
56020 flag8 = true;
56021 }
56022 int num38 = 10;
56023 bool flag9 = false;
56024 if (ai[0] % num37 == 0f)
56025 {
56026 flag9 = true;
56027 }
56028 if (ai[1] >= 1f)
56029 {
56030 ai[1] = 0f;
56031 flag9 = true;
56032 if (Main.myPlayer == owner)
56033 {
56034 float num39 = player.inventory[player.selectedItem].shootSpeed * scale;
56036 Vector2 value6 = Main.screenPosition + new Vector2(Main.mouseX, Main.mouseY) - vector18;
56037 if (player.gravDir == -1f)
56038 {
56039 value6.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - vector18.Y;
56040 }
56042 if (float.IsNaN(value7.X) || float.IsNaN(value7.Y))
56043 {
56044 value7 = -Vector2.UnitY;
56045 }
56047 value7 *= num39;
56048 if (value7.X != velocity.X || value7.Y != velocity.Y)
56049 {
56050 netUpdate = true;
56051 }
56052 velocity = value7;
56053 }
56054 }
56055 frameCounter++;
56056 int num40 = ((!(ai[0] < 120f)) ? 1 : 4);
56057 if (frameCounter >= num40)
56058 {
56059 frameCounter = 0;
56060 if (++frame >= 5)
56061 {
56062 frame = 0;
56063 }
56064 }
56065 if (soundDelay <= 0)
56066 {
56067 soundDelay = num38;
56068 soundDelay *= 2;
56069 if (ai[0] != 1f)
56070 {
56072 }
56073 }
56074 if (flag9 && Main.myPlayer == owner)
56075 {
56076 bool flag10 = false;
56077 flag10 = !flag8 || player.CheckMana(player.inventory[player.selectedItem].mana, pay: true);
56078 if (player.channel && flag10 && !player.noItems && !player.CCed)
56079 {
56080 if (ai[0] == 1f)
56081 {
56082 Vector2 center2 = base.Center;
56083 Vector2 vector19 = Vector2.Normalize(velocity);
56084 if (float.IsNaN(vector19.X) || float.IsNaN(vector19.Y))
56085 {
56087 }
56088 int num41 = damage;
56089 for (int m = 0; m < 6; m++)
56090 {
56091 NewProjectile(GetProjectileSource_FromThis(), center2.X, center2.Y, vector19.X, vector19.Y, 632, num41, knockBack, owner, m, whoAmI);
56092 }
56093 netUpdate = true;
56094 }
56095 }
56096 else
56097 {
56098 Kill();
56099 }
56100 }
56101 }
56102 if (type == 595)
56103 {
56104 num = 0f;
56105 if (spriteDirection == -1)
56106 {
56107 num = (float)Math.PI;
56108 }
56109 if (++frame >= Main.projFrames[type])
56110 {
56111 frame = 0;
56112 }
56113 soundDelay--;
56114 if (soundDelay <= 0)
56115 {
56117 soundDelay = 12;
56118 }
56119 if (Main.myPlayer == owner)
56120 {
56121 if (player.channel && !player.noItems && !player.CCed)
56122 {
56123 float num42 = 1f;
56124 if (player.inventory[player.selectedItem].shoot == type)
56125 {
56126 num42 = player.inventory[player.selectedItem].shootSpeed * scale;
56127 }
56128 Vector2 vec = Main.MouseWorld - vector;
56129 vec.Normalize();
56130 if (vec.HasNaNs())
56131 {
56132 vec = Vector2.UnitX * player.direction;
56133 }
56134 vec *= num42;
56135 if (vec.X != velocity.X || vec.Y != velocity.Y)
56136 {
56137 netUpdate = true;
56138 }
56139 velocity = vec;
56140 }
56141 else
56142 {
56143 Kill();
56144 }
56145 }
56146 Vector2 vector20 = base.Center + velocity * 3f;
56147 Lighting.AddLight(vector20, 0.8f, 0.8f, 0.8f);
56148 if (Main.rand.Next(3) == 0)
56149 {
56150 int num43 = Dust.NewDust(vector20 - base.Size / 2f, width, height, 63, velocity.X, velocity.Y, 100, default(Color), 2f);
56151 Main.dust[num43].noGravity = true;
56152 Main.dust[num43].position -= velocity;
56153 }
56154 }
56155 if (type == 735)
56156 {
56157 num = 0f;
56158 if (spriteDirection == -1)
56159 {
56160 num = (float)Math.PI;
56161 }
56162 if (++frame >= Main.projFrames[type])
56163 {
56164 frame = 0;
56165 }
56166 soundDelay--;
56167 if (soundDelay <= 0)
56168 {
56170 soundDelay = 12;
56171 }
56172 if (Main.myPlayer == owner)
56173 {
56174 if (player.channel && !player.noItems && !player.CCed)
56175 {
56176 float num44 = 1f;
56177 if (player.inventory[player.selectedItem].shoot == type)
56178 {
56179 num44 = player.inventory[player.selectedItem].shootSpeed * scale;
56180 }
56181 Vector2 vec2 = Main.MouseWorld - vector;
56182 vec2.Normalize();
56183 if (vec2.HasNaNs())
56184 {
56185 vec2 = Vector2.UnitX * player.direction;
56186 }
56187 vec2 *= num44;
56188 if (vec2.X != velocity.X || vec2.Y != velocity.Y)
56189 {
56190 netUpdate = true;
56191 }
56192 velocity = vec2;
56193 }
56194 else
56195 {
56196 Kill();
56197 }
56198 }
56199 Vector2 vector21 = base.Center + velocity * 3f;
56200 Lighting.AddLight(vector21, 0.8f, 0.8f, 0.8f);
56201 if (Main.rand.Next(3) == 0)
56202 {
56203 int num45 = Dust.NewDust(vector21 - base.Size / 2f, width, height, 302, velocity.X, velocity.Y, 100, default(Color), 2f);
56204 Main.dust[num45].noGravity = true;
56205 Main.dust[num45].position -= velocity;
56206 }
56207 }
56208 if (type == 927)
56209 {
56210 num = 0f;
56211 scale = ai[1];
56212 ai[0] += 1f;
56213 if (ai[0] >= 8f)
56214 {
56215 ai[0] = 0f;
56216 }
56217 num2 = 9;
56218 num3 = Main.rand.NextFloatDirection() * ((float)Math.PI * 2f) * 0.05f;
56219 soundDelay--;
56220 if (soundDelay <= 0)
56221 {
56223 soundDelay = 6;
56224 }
56225 if (Main.myPlayer == owner)
56226 {
56227 if (player.channel && !player.noItems && !player.CCed)
56228 {
56229 float num46 = 1f;
56230 if (player.inventory[player.selectedItem].shoot == type)
56231 {
56232 num46 = player.inventory[player.selectedItem].shootSpeed;
56233 }
56234 Vector2 vec3 = Main.MouseWorld - vector;
56235 vec3.Normalize();
56236 if (vec3.HasNaNs())
56237 {
56238 vec3 = Vector2.UnitX * player.direction;
56239 }
56240 vec3 *= num46;
56241 if (vec3.X != velocity.X || vec3.Y != velocity.Y)
56242 {
56243 netUpdate = true;
56244 }
56245 velocity = vec3;
56246 }
56247 else
56248 {
56249 Kill();
56250 }
56251 }
56252 DelegateMethods.v3_1 = new Vector3(0.5f, 0.5f, 0.5f);
56253 Utils.PlotTileLine(base.Center - velocity, base.Center + velocity.SafeNormalize(Vector2.Zero) * 80f, 16f, DelegateMethods.CastLightOpen);
56254 }
56255 if (type == 600)
56256 {
56257 _ = ai[0];
56258 _ = 0f;
56259 ai[0] += 1f;
56260 if (Main.myPlayer == owner && ai[0] == 1f)
56261 {
56262 float num47 = player.inventory[player.selectedItem].shootSpeed * scale;
56264 Vector2 value8 = Main.screenPosition + new Vector2(Main.mouseX, Main.mouseY) - vector22;
56265 if (player.gravDir == -1f)
56266 {
56267 value8.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - vector22.Y;
56268 }
56270 if (float.IsNaN(vector23.X) || float.IsNaN(vector23.Y))
56271 {
56273 }
56274 vector23 *= num47;
56275 if (vector23.X != velocity.X || vector23.Y != velocity.Y)
56276 {
56277 netUpdate = true;
56278 }
56279 velocity = vector23;
56280 int num48 = 601;
56281 float num49 = 3f;
56282 vector22 = base.Center;
56283 Vector2 vector24 = Vector2.Normalize(velocity) * num49;
56284 if (float.IsNaN(vector24.X) || float.IsNaN(vector24.Y))
56285 {
56287 }
56288 NewProjectile(GetProjectileSource_FromThis(), vector22.X, vector22.Y, vector24.X, vector24.Y, num48, damage, knockBack, owner, ai[1]);
56289 }
56290 if (ai[0] >= 30f)
56291 {
56292 Kill();
56293 }
56294 }
56295 if (type == 611)
56296 {
56297 if (Main.netMode != 2 && localAI[0] == 0f)
56298 {
56300 }
56301 if (localAI[1] > 0f)
56302 {
56303 localAI[1] -= 1f;
56304 }
56305 alpha -= 42;
56306 if (alpha < 0)
56307 {
56308 alpha = 0;
56309 }
56310 if (localAI[0] == 0f)
56311 {
56312 localAI[0] = velocity.ToRotation();
56313 }
56314 float num50 = ((localAI[0].ToRotationVector2().X >= 0f) ? 1 : (-1));
56315 if (ai[1] <= 0f)
56316 {
56317 num50 *= -1f;
56318 }
56319 Vector2 spinningpoint5 = (num50 * (ai[0] / 30f * ((float)Math.PI * 2f) - (float)Math.PI / 2f)).ToRotationVector2();
56320 spinningpoint5.Y *= (float)Math.Sin(ai[1]);
56321 if (ai[1] <= 0f)
56322 {
56323 spinningpoint5.Y *= -1f;
56324 }
56325 spinningpoint5 = spinningpoint5.RotatedBy(localAI[0]);
56326 ai[0] += 1f;
56327 if (ai[0] < 30f)
56328 {
56329 velocity += 48f * spinningpoint5;
56330 }
56331 else
56332 {
56333 Kill();
56334 }
56335 }
56336 if (type == 615)
56337 {
56338 num = 0f;
56339 if (spriteDirection == -1)
56340 {
56341 num = (float)Math.PI;
56342 }
56343 ai[0] += 1f;
56344 int num51 = 0;
56345 if (ai[0] >= 40f)
56346 {
56347 num51++;
56348 }
56349 if (ai[0] >= 80f)
56350 {
56351 num51++;
56352 }
56353 if (ai[0] >= 120f)
56354 {
56355 num51++;
56356 }
56357 int num52 = 5;
56358 int num53 = 0;
56359 ai[1] -= 1f;
56360 bool flag11 = false;
56361 int num54 = -1;
56362 if (ai[1] <= 0f)
56363 {
56364 ai[1] = num52 - num53 * num51;
56365 flag11 = true;
56366 if ((int)ai[0] / (num52 - num53 * num51) % 7 == 0)
56367 {
56368 num54 = 0;
56369 }
56370 }
56371 frameCounter += 1 + num51;
56372 if (frameCounter >= 4)
56373 {
56374 frameCounter = 0;
56375 frame++;
56376 if (frame >= Main.projFrames[type])
56377 {
56378 frame = 0;
56379 }
56380 }
56381 if (soundDelay <= 0)
56382 {
56383 soundDelay = num52 - num53 * num51;
56384 if (ai[0] != 1f)
56385 {
56387 }
56388 }
56389 if (flag11 && Main.myPlayer == owner)
56390 {
56391 bool canShoot = player.channel && player.HasAmmo(player.inventory[player.selectedItem], canUse: true) && !player.noItems && !player.CCed;
56392 int projToShoot = 14;
56393 float speed = 14f;
56394 int Damage = player.GetWeaponDamage(player.inventory[player.selectedItem]);
56395 float KnockBack = player.inventory[player.selectedItem].knockBack;
56396 if (canShoot)
56397 {
56401 float num55 = player.inventory[player.selectedItem].shootSpeed * scale;
56403 Vector2 value9 = Main.screenPosition + new Vector2(Main.mouseX, Main.mouseY) - vector25;
56404 if (player.gravDir == -1f)
56405 {
56406 value9.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - vector25.Y;
56407 }
56409 if (float.IsNaN(spinningpoint6.X) || float.IsNaN(spinningpoint6.Y))
56410 {
56412 }
56414 spinningpoint6 = spinningpoint6.RotatedBy(Main.rand.NextDouble() * 0.13089969754219055 - 0.06544984877109528);
56415 if (spinningpoint6.X != velocity.X || spinningpoint6.Y != velocity.Y)
56416 {
56417 netUpdate = true;
56418 }
56419 velocity = spinningpoint6;
56420 for (int n = 0; n < 1; n++)
56421 {
56423 spinningpoint7 = spinningpoint7.RotatedBy(Main.rand.NextDouble() * 0.19634954631328583 - 0.09817477315664291);
56424 if (float.IsNaN(spinningpoint7.X) || float.IsNaN(spinningpoint7.Y))
56425 {
56427 }
56429 }
56430 if (num54 == 0)
56431 {
56432 projToShoot = 616;
56433 speed = 8f;
56434 for (int num56 = 0; num56 < 1; num56++)
56435 {
56437 spinningpoint8 = spinningpoint8.RotatedBy(Main.rand.NextDouble() * 0.39269909262657166 - 0.19634954631328583);
56438 if (float.IsNaN(spinningpoint8.X) || float.IsNaN(spinningpoint8.Y))
56439 {
56441 }
56443 }
56444 }
56445 }
56446 else
56447 {
56448 Kill();
56449 }
56450 }
56451 }
56452 if (type == 714)
56453 {
56454 num = 0f;
56455 if (spriteDirection == -1)
56456 {
56457 num = (float)Math.PI;
56458 }
56459 ai[0] += 1f;
56460 int num57 = 0;
56461 int num58 = 8;
56462 int num59 = 0;
56463 ai[1] -= 1f;
56464 bool flag12 = false;
56465 int num60 = -1;
56466 if (ai[1] <= 0f)
56467 {
56468 ai[1] = num58 - num59 * num57;
56469 flag12 = true;
56470 int num61 = (int)ai[0] / (num58 - num59 * num57);
56471 if (num61 % 7 == 0)
56472 {
56473 num60 = 0;
56474 }
56475 num60 = num61 % 7;
56476 }
56477 _ = rotation;
56478 Vector2 center3 = base.Center;
56479 _ = direction;
56480 Vector2 v = velocity;
56481 frameCounter += 1 + num57;
56482 if (frameCounter >= 4)
56483 {
56484 frameCounter = 0;
56485 frame++;
56486 if (frame >= Main.projFrames[type])
56487 {
56488 frame = 0;
56489 }
56490 }
56491 if (soundDelay <= 0 && Main.player[owner].controlUseItem)
56492 {
56493 soundDelay = num58 - num59 * num57;
56494 if (ai[0] != 1f)
56495 {
56497 }
56498 }
56499 if (flag12 && Main.myPlayer == owner)
56500 {
56501 bool canShoot2 = player.channel && player.HasAmmo(player.inventory[player.selectedItem], canUse: true) && !player.noItems && !player.CCed;
56502 int projToShoot2 = 134;
56503 float speed2 = 8f;
56504 int Damage2 = player.GetWeaponDamage(player.inventory[player.selectedItem]);
56505 float KnockBack2 = player.inventory[player.selectedItem].knockBack;
56506 if (num60 == 3)
56507 {
56508 speed2 += 1f;
56509 }
56510 if (canShoot2)
56511 {
56515 float num62 = player.inventory[player.selectedItem].shootSpeed * scale;
56517 Vector2 value10 = Main.screenPosition + new Vector2(Main.mouseX, Main.mouseY) - vector26;
56518 if (player.gravDir == -1f)
56519 {
56520 value10.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - vector26.Y;
56521 }
56523 if (float.IsNaN(spinningpoint9.X) || float.IsNaN(spinningpoint9.Y))
56524 {
56526 }
56528 spinningpoint9 = spinningpoint9.RotatedBy((Main.rand.NextDouble() * 0.13089969754219055 - 0.06544984877109528) * 0.5);
56529 if (spinningpoint9.X != velocity.X || spinningpoint9.Y != velocity.Y)
56530 {
56531 netUpdate = true;
56532 }
56533 velocity = spinningpoint9;
56534 for (int num63 = 0; num63 < 1; num63++)
56535 {
56537 spinningpoint10 = spinningpoint10.RotatedBy(Main.rand.NextDouble() * 0.19634954631328583 - 0.09817477315664291);
56538 if (float.IsNaN(spinningpoint10.X) || float.IsNaN(spinningpoint10.Y))
56539 {
56541 }
56543 if (num60 == 5)
56544 {
56545 for (float num64 = -1f; num64 <= 1f; num64 += 2f)
56546 {
56547 Vector2 vector27 = spinningpoint10.RotatedBy((float)Math.PI * 2f * num64 * 1f / 80f);
56548 if (float.IsNaN(spinningpoint10.X) || float.IsNaN(spinningpoint10.Y))
56549 {
56551 }
56553 }
56554 }
56555 if (num60 == 4)
56556 {
56558 }
56559 }
56560 }
56561 else
56562 {
56563 Kill();
56564 }
56565 }
56566 Vector2 vector28 = base.Center + velocity.ToRotation().ToRotationVector2() * 40f;
56567 Vector2 vector29 = center3 + v.ToRotation().ToRotationVector2() * 40f;
56568 Color color = Main.hslToRgb(ai[0] / 90f % 1f, 1f, 0.5f);
56569 color.A = 120;
56570 int num65 = 267;
56572 dust.color = color;
56573 dust.scale = 0.6f;
56574 dust.fadeIn = 0.9f;
56575 dust.noGravity = true;
56577 dust2.color = color;
56578 dust2.scale = 0.6f;
56579 dust2.fadeIn = 0.7f;
56580 dust2.noGravity = true;
56581 dust2.velocity = -velocity.RotatedBy(2.094395160675049) / 10f;
56583 dust3.color = color;
56584 dust3.scale = 0.6f;
56585 dust3.fadeIn = 0.7f;
56586 dust3.noGravity = true;
56587 dust3.velocity = -velocity.RotatedBy(-2.094395160675049) / 10f;
56588 if (vector28 != vector29)
56589 {
56590 float num66 = -1f;
56592 dust4.velocity = (vector28 - vector29).SafeNormalize(Vector2.Zero) * 2f;
56593 dust4.color = color;
56594 dust4.scale = 0.6f;
56595 dust4.fadeIn = 0.9f;
56596 dust4.velocity *= num66;
56597 dust4.noGravity = true;
56599 dust5.velocity = (vector28 - vector29).SafeNormalize(Vector2.Zero) * 2f;
56600 dust5.color = color;
56601 dust5.scale = 0.6f;
56602 dust5.fadeIn = 0.9f;
56603 dust5.velocity *= num66;
56604 dust5.noGravity = true;
56606 dust6.velocity = (vector28 - vector29).SafeNormalize(Vector2.Zero) * 2f;
56607 dust6.color = color;
56608 dust6.scale = 0.6f;
56609 dust6.fadeIn = 0.9f;
56610 dust6.velocity *= num66;
56611 dust6.noGravity = true;
56612 }
56613 }
56614 if (type == 630)
56615 {
56616 num = 0f;
56617 if (spriteDirection == -1)
56618 {
56619 num = (float)Math.PI;
56620 }
56621 ai[0] += 1f;
56622 int num67 = 0;
56623 if (ai[0] >= 40f)
56624 {
56625 num67++;
56626 }
56627 if (ai[0] >= 80f)
56628 {
56629 num67++;
56630 }
56631 if (ai[0] >= 120f)
56632 {
56633 num67++;
56634 }
56635 int num68 = 24;
56636 int num69 = 2;
56637 ai[1] -= 1f;
56638 bool flag13 = false;
56639 if (ai[1] <= 0f)
56640 {
56641 ai[1] = num68 - num69 * num67;
56642 flag13 = true;
56643 _ = (int)ai[0] / (num68 - num69 * num67);
56644 }
56645 bool canShoot3 = player.channel && player.HasAmmo(player.inventory[player.selectedItem], canUse: true) && !player.noItems && !player.CCed;
56646 if (localAI[0] > 0f)
56647 {
56648 localAI[0] -= 1f;
56649 }
56650 if (soundDelay <= 0 && canShoot3)
56651 {
56652 soundDelay = num68 - num69 * num67;
56653 if (ai[0] != 1f)
56654 {
56656 }
56657 localAI[0] = 12f;
56658 }
56659 player.phantasmTime = 2;
56660 if (flag13 && Main.myPlayer == owner)
56661 {
56662 int projToShoot3 = 14;
56663 float speed3 = 14f;
56664 int Damage3 = player.GetWeaponDamage(player.inventory[player.selectedItem]);
56665 float KnockBack3 = player.inventory[player.selectedItem].knockBack;
56666 if (canShoot3)
56667 {
56671 float num70 = player.inventory[player.selectedItem].shootSpeed * scale;
56673 Vector2 value11 = Main.screenPosition + new Vector2(Main.mouseX, Main.mouseY) - vector30;
56674 if (player.gravDir == -1f)
56675 {
56676 value11.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - vector30.Y;
56677 }
56679 if (float.IsNaN(vector31.X) || float.IsNaN(vector31.Y))
56680 {
56682 }
56683 vector31 *= num70;
56684 if (vector31.X != velocity.X || vector31.Y != velocity.Y)
56685 {
56686 netUpdate = true;
56687 }
56688 velocity = vector31 * 0.55f;
56689 for (int num71 = 0; num71 < 4; num71++)
56690 {
56691 Vector2 vector32 = Vector2.Normalize(velocity) * speed3 * (0.6f + Main.rand.NextFloat() * 0.8f);
56692 if (float.IsNaN(vector32.X) || float.IsNaN(vector32.Y))
56693 {
56695 }
56698 Main.projectile[num72].noDropItem = true;
56699 }
56700 }
56701 else
56702 {
56703 Kill();
56704 }
56705 }
56706 }
56707 if (type == 705)
56708 {
56709 num = 0f;
56710 if (spriteDirection == -1)
56711 {
56712 num = (float)Math.PI;
56713 }
56714 ai[0] += 1f;
56715 int itemAnimationMax = player.itemAnimationMax;
56716 ai[1] -= 1f;
56717 bool flag14 = false;
56718 if (ai[1] <= 0f)
56719 {
56720 ai[1] = itemAnimationMax;
56721 flag14 = true;
56722 }
56723 bool canShoot4 = player.channel && player.HasAmmo(player.inventory[player.selectedItem], canUse: true) && !player.noItems && !player.CCed;
56724 if (localAI[0] > 0f)
56725 {
56726 localAI[0] -= 1f;
56727 }
56728 if (soundDelay <= 0 && canShoot4)
56729 {
56730 soundDelay = itemAnimationMax;
56731 if (ai[0] != 1f)
56732 {
56734 }
56735 localAI[0] = 12f;
56736 }
56737 if (flag14 && Main.myPlayer == owner)
56738 {
56739 int projToShoot4 = 14;
56740 float speed4 = 12f;
56741 int Damage4 = player.GetWeaponDamage(player.inventory[player.selectedItem]);
56742 float KnockBack4 = player.inventory[player.selectedItem].knockBack;
56743 int num73 = 2;
56744 float num74 = 1.5f;
56745 if (canShoot4)
56746 {
56750 if (projToShoot4 == 1)
56751 {
56752 projToShoot4 = 2;
56753 }
56754 if (++player.phantomPhoneixCounter >= 3)
56755 {
56756 player.phantomPhoneixCounter = 0;
56757 num73 = 1;
56758 Damage4 *= 2;
56759 num74 = 0f;
56760 ai[1] *= 1.5f;
56761 projToShoot4 = 706;
56762 speed4 = 16f;
56763 }
56764 float num75 = player.inventory[player.selectedItem].shootSpeed * scale;
56766 Vector2 value12 = Main.screenPosition + new Vector2(Main.mouseX, Main.mouseY) - vector34;
56767 if (player.gravDir == -1f)
56768 {
56769 value12.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - vector34.Y;
56770 }
56772 if (float.IsNaN(vector35.X) || float.IsNaN(vector35.Y))
56773 {
56775 }
56776 vector35 *= num75;
56777 if (vector35.X != velocity.X || vector35.Y != velocity.Y)
56778 {
56779 netUpdate = true;
56780 }
56781 velocity = vector35 * 0.55f;
56782 for (int num76 = 0; num76 < num73; num76++)
56783 {
56784 Vector2 vector36 = Vector2.Normalize(velocity) * speed4;
56785 vector36 += Main.rand.NextVector2Square(0f - num74, num74);
56786 if (float.IsNaN(vector36.X) || float.IsNaN(vector36.Y))
56787 {
56789 }
56792 Main.projectile[num77].noDropItem = true;
56793 }
56794 }
56795 else
56796 {
56797 Kill();
56798 }
56799 }
56800 }
56801 position = player.RotatedRelativePoint(player.MountedCenter, reverseRotation: false, addGfxOffY: false) - base.Size / 2f;
56802 rotation = velocity.ToRotation() + num;
56803 spriteDirection = direction;
56804 timeLeft = 2;
56805 player.ChangeDir(direction);
56806 player.heldProj = whoAmI;
56807 player.SetDummyItemTime(num2);
56808 player.itemRotation = MathHelper.WrapAngle((float)Math.Atan2(velocity.Y * (float)direction, velocity.X * (float)direction) + num3);
56809 if (type == 460 || type == 611)
56810 {
56811 Vector2 vector38 = Main.OffsetsPlayerOnhand[player.bodyFrame.Y / 56] * 2f;
56812 if (player.direction != 1)
56813 {
56814 vector38.X = (float)player.bodyFrame.Width - vector38.X;
56815 }
56816 if (player.gravDir != 1f)
56817 {
56818 vector38.Y = (float)player.bodyFrame.Height - vector38.Y;
56819 }
56820 vector38 -= new Vector2(player.bodyFrame.Width - player.width, player.bodyFrame.Height - 42) / 2f;
56821 base.Center = player.RotatedRelativePoint(player.MountedCenter - new Vector2(20f, 42f) / 2f + vector38, reverseRotation: false, addGfxOffY: false) - velocity;
56822 }
56823 if (type == 615)
56824 {
56825 position.Y += player.gravDir * 2f;
56826 }
56827 if (type == 714)
56828 {
56829 position.Y += player.gravDir * 2f;
56830 }
56831 if (type == 611 && alpha == 0)
56832 {
56833 for (int num78 = 0; num78 < 2; num78++)
56834 {
56835 Dust obj = Main.dust[Dust.NewDust(position + velocity * 2f, width, height, 6, 0f, 0f, 100, Color.Transparent, 2f)];
56836 obj.noGravity = true;
56837 obj.velocity *= 2f;
56838 obj.velocity += localAI[0].ToRotationVector2();
56839 obj.fadeIn = 1.5f;
56840 }
56841 float num79 = 18f;
56842 for (int num80 = 0; (float)num80 < num79; num80++)
56843 {
56844 if (Main.rand.Next(4) == 0)
56845 {
56846 Vector2 vector39 = position + velocity + velocity * ((float)num80 / num79);
56847 Dust obj2 = Main.dust[Dust.NewDust(vector39, width, height, 6, 0f, 0f, 100, Color.Transparent)];
56848 obj2.noGravity = true;
56849 obj2.fadeIn = 0.5f;
56850 obj2.velocity += localAI[0].ToRotationVector2();
56851 obj2.noLight = true;
56852 }
56853 }
56854 }
56855 if (type == 927)
56856 {
56857 player.itemAnimation = num2 - (int)ai[0];
56858 }
56859 }
56860
56861 private void AI_099_1()
56862 {
56863 timeLeft = 6;
56864 bool flag = true;
56865 float num = 250f;
56866 float num2 = 0.1f;
56867 float num3 = 15f;
56868 float num4 = 12f;
56869 num *= 0.5f;
56870 num3 *= 0.8f;
56871 num4 *= 1.5f;
56872 if (owner == Main.myPlayer)
56873 {
56874 bool flag2 = false;
56875 for (int i = 0; i < 1000; i++)
56876 {
56877 if (Main.projectile[i].active && Main.projectile[i].owner == owner && Main.projectile[i].aiStyle == 99 && (Main.projectile[i].type < 556 || Main.projectile[i].type > 561))
56878 {
56879 flag2 = true;
56880 }
56881 }
56882 if (!flag2)
56883 {
56884 ai[0] = -1f;
56885 netUpdate = true;
56886 }
56887 }
56888 if (Main.player[owner].yoyoString)
56889 {
56890 num += num * 0.25f + 10f;
56891 }
56892 rotation += 0.5f;
56893 if (Main.player[owner].dead)
56894 {
56895 Kill();
56896 return;
56897 }
56898 if (!flag)
56899 {
56900 Main.player[owner].heldProj = whoAmI;
56901 Main.player[owner].SetDummyItemTime(2);
56902 if (position.X + (float)(width / 2) > Main.player[owner].position.X + (float)(Main.player[owner].width / 2))
56903 {
56904 Main.player[owner].ChangeDir(1);
56905 direction = 1;
56906 }
56907 else
56908 {
56909 Main.player[owner].ChangeDir(-1);
56910 direction = -1;
56911 }
56912 }
56913 if (ai[0] == 0f || ai[0] == 1f)
56914 {
56915 if (ai[0] == 1f)
56916 {
56917 num *= 0.75f;
56918 }
56919 num4 *= 0.5f;
56920 bool flag3 = false;
56921 Vector2 vector = Main.player[owner].Center - base.Center;
56922 if ((double)vector.Length() > (double)num * 0.9)
56923 {
56924 flag3 = true;
56925 }
56926 if (vector.Length() > num)
56927 {
56928 float num5 = vector.Length() - num;
56929 Vector2 vector2 = default(Vector2);
56930 vector2.X = vector.Y;
56931 vector2.Y = vector.X;
56932 vector.Normalize();
56933 vector *= num;
56934 position = Main.player[owner].Center - vector;
56935 position.X -= width / 2;
56936 position.Y -= height / 2;
56937 float num6 = velocity.Length();
56938 velocity.Normalize();
56939 if (num5 > num6 - 1f)
56940 {
56941 num5 = num6 - 1f;
56942 }
56943 velocity *= num6 - num5;
56944 num6 = velocity.Length();
56945 Vector2 vector3 = new Vector2(base.Center.X, base.Center.Y);
56946 Vector2 vector4 = new Vector2(Main.player[owner].Center.X, Main.player[owner].Center.Y);
56947 if (vector3.Y < vector4.Y)
56948 {
56949 vector2.Y = Math.Abs(vector2.Y);
56950 }
56951 else if (vector3.Y > vector4.Y)
56952 {
56953 vector2.Y = 0f - Math.Abs(vector2.Y);
56954 }
56955 if (vector3.X < vector4.X)
56956 {
56957 vector2.X = Math.Abs(vector2.X);
56958 }
56959 else if (vector3.X > vector4.X)
56960 {
56961 vector2.X = 0f - Math.Abs(vector2.X);
56962 }
56963 vector2.Normalize();
56964 vector2 *= velocity.Length();
56965 new Vector2(vector2.X, vector2.Y);
56966 if (Math.Abs(velocity.X) > Math.Abs(velocity.Y))
56967 {
56968 Vector2 vector5 = velocity;
56969 vector5.Y += vector2.Y;
56970 vector5.Normalize();
56971 vector5 *= velocity.Length();
56972 if ((double)Math.Abs(vector2.X) < 0.1 || (double)Math.Abs(vector2.Y) < 0.1)
56973 {
56974 velocity = vector5;
56975 }
56976 else
56977 {
56978 velocity = (vector5 + velocity * 2f) / 3f;
56979 }
56980 }
56981 else
56982 {
56983 Vector2 vector6 = velocity;
56984 vector6.X += vector2.X;
56985 vector6.Normalize();
56986 vector6 *= velocity.Length();
56987 if ((double)Math.Abs(vector2.X) < 0.2 || (double)Math.Abs(vector2.Y) < 0.2)
56988 {
56989 velocity = vector6;
56990 }
56991 else
56992 {
56993 velocity = (vector6 + velocity * 2f) / 3f;
56994 }
56995 }
56996 }
56997 if (Main.myPlayer == owner)
56998 {
56999 if (Main.player[owner].channel)
57000 {
57002 if (velocity.X != 0f || velocity.Y != 0f)
57003 {
57004 if (flag)
57005 {
57006 vector7 *= -1f;
57007 }
57008 if (flag3)
57009 {
57010 if (base.Center.X < Main.player[owner].Center.X && vector7.X < 0f)
57011 {
57012 vector7.X = 0f;
57013 }
57014 if (base.Center.X > Main.player[owner].Center.X && vector7.X > 0f)
57015 {
57016 vector7.X = 0f;
57017 }
57018 if (base.Center.Y < Main.player[owner].Center.Y && vector7.Y < 0f)
57019 {
57020 vector7.Y = 0f;
57021 }
57022 if (base.Center.Y > Main.player[owner].Center.Y && vector7.Y > 0f)
57023 {
57024 vector7.Y = 0f;
57025 }
57026 }
57027 velocity += vector7 * num2;
57028 netUpdate = true;
57029 }
57030 }
57031 else
57032 {
57033 ai[0] = -1f;
57034 netUpdate = true;
57035 }
57036 }
57037 if (flag || type == 562 || type == 547 || type == 555 || type == 564 || type == 552 || type == 563 || type == 549 || type == 550 || type == 554 || type == 553 || type == 603 || type == 999)
57038 {
57039 float num7 = 800f;
57040 Vector2 vector8 = default(Vector2);
57041 bool flag4 = false;
57042 if (type == 549)
57043 {
57044 num7 = 200f;
57045 }
57046 if (type == 554)
57047 {
57048 num7 = 400f;
57049 }
57050 if (type == 553)
57051 {
57052 num7 = 250f;
57053 }
57054 if (type == 603)
57055 {
57056 num7 = 320f;
57057 }
57058 for (int j = 0; j < 200; j++)
57059 {
57060 if (Main.npc[j].CanBeChasedBy(this))
57061 {
57062 float num8 = Main.npc[j].position.X + (float)(Main.npc[j].width / 2);
57063 float num9 = Main.npc[j].position.Y + (float)(Main.npc[j].height / 2);
57064 float num10 = Math.Abs(position.X + (float)(width / 2) - num8) + Math.Abs(position.Y + (float)(height / 2) - num9);
57065 if (num10 < num7 && (type != 563 || !(num10 < 200f)) && Collision.CanHit(position, width, height, Main.npc[j].position, Main.npc[j].width, Main.npc[j].height) && (double)(Main.npc[j].Center - Main.player[owner].Center).Length() < (double)num * 0.9)
57066 {
57067 num7 = num10;
57068 vector8.X = num8;
57069 vector8.Y = num9;
57070 flag4 = true;
57071 }
57072 }
57073 }
57074 if (flag4)
57075 {
57076 vector8 -= base.Center;
57077 vector8.Normalize();
57078 if (type == 563)
57079 {
57080 vector8 *= 4f;
57081 velocity = (velocity * 14f + vector8) / 15f;
57082 }
57083 else if (type == 553)
57084 {
57085 vector8 *= 5f;
57086 velocity = (velocity * 12f + vector8) / 13f;
57087 }
57088 else if (type == 603)
57089 {
57090 vector8 *= 16f;
57091 velocity = (velocity * 9f + vector8) / 10f;
57092 }
57093 else if (type == 554)
57094 {
57095 vector8 *= 8f;
57096 velocity = (velocity * 6f + vector8) / 7f;
57097 }
57098 else
57099 {
57100 vector8 *= 6f;
57101 velocity = (velocity * 7f + vector8) / 8f;
57102 }
57103 }
57104 }
57105 if (velocity.Length() > num3)
57106 {
57107 velocity.Normalize();
57108 velocity *= num3;
57109 }
57110 if (velocity.Length() < num4)
57111 {
57112 velocity.Normalize();
57113 velocity *= num4;
57114 }
57115 return;
57116 }
57117 tileCollide = false;
57118 Vector2 vector9 = Main.player[owner].Center - base.Center;
57119 float num11 = vector9.Length();
57120 if (num11 < 40f || vector9.HasNaNs() || num11 > 2000f)
57121 {
57122 Kill();
57123 return;
57124 }
57125 float num12 = num3 * 1.5f;
57126 if (type == 546)
57127 {
57128 num12 *= 1.5f;
57129 }
57130 if (type == 554)
57131 {
57132 num12 *= 1.25f;
57133 }
57134 if (type == 555)
57135 {
57136 num12 *= 1.35f;
57137 }
57138 if (type == 562)
57139 {
57140 num12 *= 1.25f;
57141 }
57142 float num13 = 12f;
57143 vector9.Normalize();
57144 vector9 *= num12;
57145 velocity = (velocity * (num13 - 1f) + vector9) / num13;
57146 }
57147
57148 private void AI_099_2()
57149 {
57150 bool flag = false;
57151 for (int i = 0; i < whoAmI; i++)
57152 {
57153 if (Main.projectile[i].active && Main.projectile[i].owner == owner && Main.projectile[i].type == type)
57154 {
57155 flag = true;
57156 }
57157 }
57158 if (owner == Main.myPlayer)
57159 {
57160 localAI[0] += 1f;
57161 if (flag)
57162 {
57163 localAI[0] += (float)Main.rand.Next(10, 31) * 0.1f;
57164 }
57165 float num = localAI[0] / 60f;
57166 num /= (1f + Main.player[owner].meleeSpeed) / 2f;
57168 if (num2 != -1f && num > num2)
57169 {
57170 ai[0] = -1f;
57171 }
57172 }
57173 if (type == 603 && owner == Main.myPlayer)
57174 {
57175 localAI[1] += 1f;
57176 if (localAI[1] >= 6f)
57177 {
57178 float num3 = 400f;
57179 Vector2 vector = velocity;
57180 Vector2 vector2 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101));
57181 vector2.Normalize();
57182 vector2 *= (float)Main.rand.Next(10, 41) * 0.1f;
57183 if (Main.rand.Next(3) == 0)
57184 {
57185 vector2 *= 2f;
57186 }
57187 vector *= 0.25f;
57188 vector += vector2;
57189 for (int j = 0; j < 200; j++)
57190 {
57191 if (Main.npc[j].CanBeChasedBy(this))
57192 {
57193 float num4 = Main.npc[j].position.X + (float)(Main.npc[j].width / 2);
57194 float num5 = Main.npc[j].position.Y + (float)(Main.npc[j].height / 2);
57195 float num6 = Math.Abs(position.X + (float)(width / 2) - num4) + Math.Abs(position.Y + (float)(height / 2) - num5);
57196 if (num6 < num3 && Collision.CanHit(position, width, height, Main.npc[j].position, Main.npc[j].width, Main.npc[j].height))
57197 {
57198 num3 = num6;
57199 vector.X = num4;
57200 vector.Y = num5;
57201 vector -= base.Center;
57202 vector.Normalize();
57203 vector *= 8f;
57204 }
57205 }
57206 }
57207 vector *= 0.8f;
57208 NewProjectile(GetProjectileSource_FromThis(), base.Center.X - vector.X, base.Center.Y - vector.Y, vector.X, vector.Y, 604, damage, knockBack, owner);
57209 localAI[1] = 0f;
57210 }
57211 }
57212 bool flag2 = false;
57213 if (type >= 556 && type <= 561)
57214 {
57215 flag2 = true;
57216 }
57217 if (Main.player[owner].dead)
57218 {
57219 Kill();
57220 return;
57221 }
57222 if (!flag2 && !flag)
57223 {
57224 Main.player[owner].heldProj = whoAmI;
57225 Main.player[owner].SetDummyItemTime(2);
57226 if (position.X + (float)(width / 2) > Main.player[owner].position.X + (float)(Main.player[owner].width / 2))
57227 {
57228 Main.player[owner].ChangeDir(1);
57229 direction = 1;
57230 }
57231 else
57232 {
57233 Main.player[owner].ChangeDir(-1);
57234 direction = -1;
57235 }
57236 }
57237 if (velocity.HasNaNs())
57238 {
57239 Kill();
57240 }
57241 timeLeft = 6;
57242 float num7 = 10f;
57243 float num8 = 10f;
57244 float num9 = 3f;
57245 float num10 = 200f;
57248 if (type == 545)
57249 {
57250 if (Main.rand.Next(6) == 0)
57251 {
57252 int num11 = Dust.NewDust(position, width, height, 6);
57253 Main.dust[num11].noGravity = true;
57254 }
57255 }
57256 else if (type == 553 && Main.rand.Next(2) == 0)
57257 {
57258 int num12 = Dust.NewDust(position, width, height, 6);
57259 Main.dust[num12].noGravity = true;
57260 Main.dust[num12].scale = 1.6f;
57261 }
57262 if (Main.player[owner].yoyoString)
57263 {
57264 num10 = num10 * 1.25f + 30f;
57265 }
57266 num10 /= (1f + Main.player[owner].meleeSpeed * 3f) / 4f;
57267 num8 /= (1f + Main.player[owner].meleeSpeed * 3f) / 4f;
57268 num7 = 14f - num8 / 2f;
57269 if (num7 < 1f)
57270 {
57271 num7 = 1f;
57272 }
57273 num9 = 5f + num8 / 2f;
57274 if (flag)
57275 {
57276 num9 += 20f;
57277 }
57278 if (ai[0] >= 0f)
57279 {
57280 if (velocity.Length() > num8)
57281 {
57282 velocity *= 0.98f;
57283 }
57284 bool flag3 = false;
57285 bool flag4 = false;
57286 Vector2 vector3 = Main.player[owner].Center - base.Center;
57287 if (vector3.Length() > num10)
57288 {
57289 flag3 = true;
57290 if ((double)vector3.Length() > (double)num10 * 1.3)
57291 {
57292 flag4 = true;
57293 }
57294 }
57295 if (owner == Main.myPlayer)
57296 {
57297 if (!Main.player[owner].channel || Main.player[owner].stoned || Main.player[owner].frozen)
57298 {
57299 ai[0] = -1f;
57300 ai[1] = 0f;
57301 netUpdate = true;
57302 }
57303 else
57304 {
57306 float x = vector4.X;
57307 float y = vector4.Y;
57308 Vector2 vector5 = new Vector2(x, y) - Main.player[owner].Center;
57309 if (vector5.Length() > num10)
57310 {
57311 vector5.Normalize();
57312 vector5 *= num10;
57313 vector5 = Main.player[owner].Center + vector5;
57314 x = vector5.X;
57315 y = vector5.Y;
57316 }
57317 if (ai[0] != x || ai[1] != y)
57318 {
57319 Vector2 vector6 = new Vector2(x, y) - Main.player[owner].Center;
57320 if (vector6.Length() > num10 - 1f)
57321 {
57322 vector6.Normalize();
57323 vector6 *= num10 - 1f;
57324 Vector2 vector7 = Main.player[owner].Center + vector6;
57325 x = vector7.X;
57326 y = vector7.Y;
57327 }
57328 ai[0] = x;
57329 ai[1] = y;
57330 netUpdate = true;
57331 }
57332 }
57333 }
57334 if (flag4 && owner == Main.myPlayer)
57335 {
57336 ai[0] = -1f;
57337 netUpdate = true;
57338 }
57339 if (ai[0] >= 0f)
57340 {
57341 if (flag3)
57342 {
57343 num7 /= 2f;
57344 num8 *= 2f;
57345 if (base.Center.X > Main.player[owner].Center.X && velocity.X > 0f)
57346 {
57347 velocity.X *= 0.5f;
57348 }
57349 if (base.Center.Y > Main.player[owner].Center.Y && velocity.Y > 0f)
57350 {
57351 velocity.Y *= 0.5f;
57352 }
57353 if (base.Center.X < Main.player[owner].Center.X && velocity.X < 0f)
57354 {
57355 velocity.X *= 0.5f;
57356 }
57357 if (base.Center.Y < Main.player[owner].Center.Y && velocity.Y < 0f)
57358 {
57359 velocity.Y *= 0.5f;
57360 }
57361 }
57362 Vector2 vector8 = new Vector2(ai[0], ai[1]) - base.Center;
57363 if (flag3)
57364 {
57365 num7 = 1f;
57366 }
57367 velocity.Length();
57368 float num13 = vector8.Length();
57369 if (num13 > num9)
57370 {
57371 vector8.Normalize();
57372 float num14 = Math.Min(num13 / 2f, num8);
57373 if (flag3)
57374 {
57375 num14 = Math.Min(num14, num8 / 2f);
57376 }
57377 vector8 *= num14;
57378 velocity = (velocity * (num7 - 1f) + vector8) / num7;
57379 }
57380 else if (flag)
57381 {
57382 if ((double)velocity.Length() < (double)num8 * 0.6)
57383 {
57384 vector8 = velocity;
57385 vector8.Normalize();
57386 vector8 *= num8 * 0.6f;
57387 velocity = (velocity * (num7 - 1f) + vector8) / num7;
57388 }
57389 }
57390 else
57391 {
57392 velocity *= 0.8f;
57393 }
57394 if (flag && !flag3 && (double)velocity.Length() < (double)num8 * 0.6)
57395 {
57396 velocity.Normalize();
57397 velocity *= num8 * 0.6f;
57398 }
57399 }
57400 }
57401 else
57402 {
57403 num7 = (int)((double)num7 * 0.8);
57404 num8 *= 1.5f;
57405 tileCollide = false;
57406 Vector2 vector9 = Main.player[owner].Center - base.Center;
57407 float num15 = vector9.Length();
57409 {
57410 Kill();
57411 }
57412 else
57413 {
57414 vector9.Normalize();
57415 vector9 *= num8;
57416 velocity = (velocity * (num7 - 1f) + vector9) / num7;
57417 }
57418 }
57419 rotation += 0.45f;
57420 }
57421
57423 {
57424 float num = 900f;
57425 float angleRatioMax = 1f;
57426 Vector2 vector = base.Center;
57427 int num2 = 664;
57428 int num3 = 12;
57429 float num4 = 12f;
57430 int num5 = 1;
57431 int num6 = 6;
57432 int num7 = 4;
57433 int num8 = 80;
57434 switch (type)
57435 {
57436 case 663:
57437 {
57438 Lighting.AddLight(base.Center, new Vector3(0.4f, 0.2f, 0.1f));
57439 Lighting.AddLight(base.Bottom + new Vector2(0f, -10f), new Vector3(0.4f, 0.2f, 0.1f));
57440 vector = base.Bottom + new Vector2(direction * 6, -40f);
57441 if ((localAI[0] += 1f) >= 300f)
57442 {
57443 localAI[0] = 0f;
57444 }
57445 Rectangle r3 = new Rectangle((int)position.X + width / 4, (int)position.Y + height - 16, width / 4 * 3, 6);
57446 if (direction == 1)
57447 {
57448 r3.X -= width / 4;
57449 }
57450 for (int m = 0; m < 1; m++)
57451 {
57452 if (Main.rand.Next(2) == 0)
57453 {
57454 Dust dust5 = Dust.NewDustDirect(r3.TopLeft() + new Vector2(-2f, -2f), r3.Width + 4, r3.Height + 4, 270, -direction * 2, -2f, 200, new Color(255, 255, 255, 0));
57455 dust5.fadeIn = 0.6f + Main.rand.NextFloat() * 0.6f;
57456 dust5.scale = 0.4f;
57457 dust5.noGravity = true;
57458 dust5.noLight = true;
57459 dust5.velocity = Vector2.Zero;
57460 dust5.velocity.X = (float)(-direction) * Main.rand.NextFloat() * dust5.fadeIn;
57461 }
57462 }
57463 r3 = new Rectangle((int)base.Center.X, (int)base.Bottom.Y, width / 4, 10);
57464 if (direction == -1)
57465 {
57466 r3.X -= r3.Width;
57467 }
57468 r3.X += direction * 4;
57469 r3.Y -= height - 10;
57470 for (int n = 0; n < 1; n++)
57471 {
57472 if (Main.rand.Next(5) == 0)
57473 {
57474 Dust dust6 = Dust.NewDustDirect(r3.TopLeft(), r3.Width, r3.Height, 6);
57475 dust6.fadeIn = 1f;
57476 dust6.scale = 1f;
57477 dust6.noGravity = true;
57478 dust6.noLight = true;
57479 dust6.velocity *= 2f;
57480 }
57481 }
57482 break;
57483 }
57484 case 665:
57485 {
57486 Lighting.AddLight(base.Center, new Vector3(0.4f, 0.2f, 0.1f) * 1.2f);
57487 Lighting.AddLight(base.Bottom + new Vector2(0f, -10f), new Vector3(0.4f, 0.2f, 0.1f) * 1.2f);
57488 num8 = 70;
57489 num4 += 3f;
57490 num6 = 8;
57491 num2 = 666;
57492 vector = base.Bottom + new Vector2(direction * 6, -44f);
57493 if ((localAI[0] += 1f) >= 300f)
57494 {
57495 localAI[0] = 0f;
57496 }
57497 Rectangle r2 = new Rectangle((int)position.X + width / 4, (int)position.Y + height - 16, width / 4 * 2, 6);
57498 if (direction == 1)
57499 {
57500 r2.X -= width / 4;
57501 }
57502 for (int k = 0; k < 1; k++)
57503 {
57504 if (Main.rand.Next(2) == 0)
57505 {
57506 Dust dust3 = Dust.NewDustDirect(r2.TopLeft() + new Vector2(-2f, -2f), r2.Width + 4, r2.Height + 4, 270, -direction * 2, -2f, 200, new Color(255, 255, 255, 0));
57507 dust3.fadeIn = 0.6f + Main.rand.NextFloat() * 0.6f;
57508 dust3.scale = 0.4f;
57509 dust3.noGravity = true;
57510 dust3.noLight = true;
57511 dust3.velocity = Vector2.Zero;
57512 dust3.velocity.X = (float)(-direction) * Main.rand.NextFloat() * dust3.fadeIn;
57513 }
57514 }
57515 r2 = new Rectangle((int)base.Center.X, (int)base.Bottom.Y, width / 4, 10);
57516 if (direction == -1)
57517 {
57518 r2.X -= r2.Width;
57519 }
57520 r2.X += direction * 4;
57521 r2.Y -= height - 10;
57522 for (int l = 0; l < 2; l++)
57523 {
57524 if (Main.rand.Next(5) == 0)
57525 {
57526 Dust dust4 = Dust.NewDustDirect(r2.TopLeft(), r2.Width, r2.Height, 6);
57527 dust4.fadeIn = 1f;
57528 dust4.scale = 1f;
57529 dust4.noGravity = true;
57530 dust4.noLight = true;
57531 dust4.velocity *= 2f;
57532 }
57533 }
57534 break;
57535 }
57536 case 667:
57537 {
57538 Lighting.AddLight(base.Center, new Vector3(0.4f, 0.2f, 0.1f) * 1.5f);
57539 Lighting.AddLight(base.Bottom + new Vector2(0f, -10f), new Vector3(0.4f, 0.2f, 0.1f) * 1.5f);
57540 num8 = 60;
57541 num4 += 6f;
57542 num6 = 8;
57543 num2 = 668;
57544 vector = base.Bottom + new Vector2(direction * 6, -46f);
57545 if ((localAI[0] += 1f) >= 300f)
57546 {
57547 localAI[0] = 0f;
57548 }
57549 Rectangle r = new Rectangle((int)position.X + width / 4, (int)position.Y + height - 16, width / 4 * 2, 6);
57550 if (direction == 1)
57551 {
57552 r.X -= width / 4;
57553 }
57554 for (int i = 0; i < 1; i++)
57555 {
57556 if (Main.rand.Next(2) == 0)
57557 {
57558 Dust dust = Dust.NewDustDirect(r.TopLeft() + new Vector2(-2f, -2f), r.Width + 4, r.Height + 4, 270, -direction * 2, -2f, 200, new Color(255, 255, 255, 0));
57559 dust.fadeIn = 0.6f + Main.rand.NextFloat() * 0.6f;
57560 dust.scale = 0.4f;
57561 dust.noGravity = true;
57562 dust.noLight = true;
57563 dust.velocity = Vector2.Zero;
57564 dust.velocity.X = (float)(-direction) * Main.rand.NextFloat() * dust.fadeIn;
57565 }
57566 }
57567 r = new Rectangle((int)base.Center.X, (int)base.Bottom.Y, width / 4, 10);
57568 if (direction == -1)
57569 {
57570 r.X -= r.Width;
57571 }
57572 r.X += direction * 4;
57573 r.Y -= height - 10;
57574 for (int j = 0; j < 3; j++)
57575 {
57576 if (Main.rand.Next(5) == 0)
57577 {
57578 Dust dust2 = Dust.NewDustDirect(r.TopLeft(), r.Width, r.Height, 6);
57579 dust2.fadeIn = 1.1f;
57580 dust2.scale = 1f;
57581 dust2.noGravity = true;
57582 dust2.noLight = true;
57583 dust2.velocity *= 2.4f;
57584 }
57585 }
57586 break;
57587 }
57588 }
57589 if (Main.player[owner].setApprenticeT2)
57590 {
57591 angleRatioMax = 0.1f;
57592 num *= 1.5f;
57593 num4 *= 1.4f;
57594 }
57595 if (ai[0] == 0f)
57596 {
57597 direction = (spriteDirection = Main.player[owner].direction);
57598 ai[0] = 1f;
57599 ai[1] = 0f;
57600 netUpdate = true;
57601 }
57602 if (ai[0] == 1f)
57603 {
57604 frame = 0;
57605 bool flag = false;
57606 if (ai[1] > 0f)
57607 {
57608 ai[1] -= 1f;
57609 }
57610 else
57611 {
57612 flag = true;
57613 }
57614 if (flag && owner == Main.myPlayer)
57615 {
57616 int num9 = AI_130_FlameBurstTower_FindTarget(num, angleRatioMax, vector);
57617 if (num9 != -1)
57618 {
57619 direction = Math.Sign(DirectionTo(Main.npc[num9].Center).X);
57620 ai[0] = 2f;
57621 ai[1] = 0f;
57622 netUpdate = true;
57623 }
57624 }
57625 }
57626 else if (ai[0] == 2f)
57627 {
57628 frame = num5 + (int)(ai[1] / (float)num7);
57629 if (ai[1] == (float)num3)
57630 {
57631 Vector2 vector2 = new Vector2(direction, 0f);
57632 int num10 = AI_130_FlameBurstTower_FindTarget(num, angleRatioMax, vector, canChangeDirection: false);
57633 if (num10 != -1)
57634 {
57635 vector2 = (Main.npc[num10].Center - vector).SafeNormalize(Vector2.UnitX * direction);
57636 }
57638 if (owner == Main.myPlayer)
57639 {
57640 NewProjectile(GetProjectileSource_FromThis(), vector, vector3, num2, damage, knockBack, owner);
57641 }
57642 }
57643 if ((ai[1] += 1f) >= (float)(num6 * num7))
57644 {
57645 ai[0] = 1f;
57646 ai[1] = num8;
57647 }
57648 }
57649 spriteDirection = direction;
57650 tileCollide = true;
57651 velocity.Y += 0.2f;
57652 }
57653
57655 {
57656 int num = -1;
57657 NPC ownerMinionAttackTargetNPC = OwnerMinionAttackTargetNPC;
57658 if (ownerMinionAttackTargetNPC != null && ownerMinionAttackTargetNPC.CanBeChasedBy(this))
57659 {
57660 for (int i = 0; i < 1; i++)
57661 {
57662 if (!ownerMinionAttackTargetNPC.CanBeChasedBy(this))
57663 {
57664 continue;
57665 }
57667 if (!(num2 > shot_range))
57668 {
57669 Vector2 vector = (ownerMinionAttackTargetNPC.Center - shootingSpot).SafeNormalize(Vector2.UnitY);
57670 if (!(Math.Abs(vector.X) < Math.Abs(vector.Y) * angleRatioMax) && (canChangeDirection || !((float)direction * vector.X < 0f)) && (num == -1 || num2 < Vector2.Distance(shootingSpot, Main.npc[num].Center)) && Collision.CanHitLine(shootingSpot, 0, 0, ownerMinionAttackTargetNPC.Center, 0, 0))
57671 {
57672 num = ownerMinionAttackTargetNPC.whoAmI;
57673 }
57674 }
57675 }
57676 if (num != -1)
57677 {
57678 return num;
57679 }
57680 }
57681 for (int j = 0; j < 200; j++)
57682 {
57683 NPC nPC = Main.npc[j];
57684 if (!nPC.CanBeChasedBy(this))
57685 {
57686 continue;
57687 }
57688 float num3 = Vector2.Distance(shootingSpot, nPC.Center);
57689 if (!(num3 > shot_range))
57690 {
57691 Vector2 vector2 = (nPC.Center - shootingSpot).SafeNormalize(Vector2.UnitY);
57692 if (!(Math.Abs(vector2.X) < Math.Abs(vector2.Y) * angleRatioMax) && (canChangeDirection || !((float)direction * vector2.X < 0f)) && (num == -1 || num3 < Vector2.Distance(shootingSpot, Main.npc[num].Center)) && Collision.CanHitLine(shootingSpot, 0, 0, nPC.Center, 0, 0))
57693 {
57694 num = j;
57695 }
57696 }
57697 }
57698 return num;
57699 }
57700
57702 {
57703 int num = -1;
57704 NPC ownerMinionAttackTargetNPC = OwnerMinionAttackTargetNPC;
57705 if (ownerMinionAttackTargetNPC != null && ownerMinionAttackTargetNPC.CanBeChasedBy(this))
57706 {
57707 for (int i = 0; i < 1; i++)
57708 {
57709 if (!ownerMinionAttackTargetNPC.CanBeChasedBy(this))
57710 {
57711 continue;
57712 }
57714 if (!(num2 > shot_range))
57715 {
57716 Vector2 vector = (ownerMinionAttackTargetNPC.Center - shootingSpot).SafeNormalize(Vector2.UnitY);
57717 if ((!(Math.Abs(vector.X) < Math.Abs(vector.Y) * deadBottomAngle) || !(vector.Y > 0f)) && (num == -1 || num2 < Vector2.Distance(shootingSpot, Main.npc[num].Center)) && Collision.CanHitLine(shootingSpot, 0, 0, ownerMinionAttackTargetNPC.Center, 0, 0))
57718 {
57719 num = ownerMinionAttackTargetNPC.whoAmI;
57720 }
57721 }
57722 }
57723 if (num != -1)
57724 {
57725 return num;
57726 }
57727 }
57728 for (int j = 0; j < 200; j++)
57729 {
57730 NPC nPC = Main.npc[j];
57731 if (!nPC.CanBeChasedBy(this))
57732 {
57733 continue;
57734 }
57735 float num3 = Vector2.Distance(shootingSpot, nPC.Center);
57736 if (!(num3 > shot_range))
57737 {
57738 Vector2 vector2 = (nPC.Center - shootingSpot).SafeNormalize(Vector2.UnitY);
57739 if ((!(Math.Abs(vector2.X) < Math.Abs(vector2.Y) * deadBottomAngle) || !(vector2.Y > 0f)) && (num == -1 || num3 < Vector2.Distance(shootingSpot, Main.npc[num].Center)) && Collision.CanHitLine(shootingSpot, 0, 0, nPC.Center, 0, 0))
57740 {
57741 num = j;
57742 }
57743 }
57744 }
57745 return num;
57746 }
57747
57749 {
57750 //IL_0051: Unknown result type (might be due to invalid IL or missing references)
57751 if (type != 664 && type != 666 && type != 668)
57752 {
57753 return;
57754 }
57755 if (localAI[0] == 0f)
57756 {
57757 localAI[0] = 1f;
57759 }
57760 if (alpha > 0)
57761 {
57762 alpha -= 25;
57763 if (alpha < 0)
57764 {
57765 alpha = 0;
57766 }
57767 }
57768 int num = 1;
57769 if (type == 666)
57770 {
57771 num = 2;
57772 }
57773 if (type == 668)
57774 {
57775 num = 3;
57776 }
57777 for (int i = 0; i < num; i++)
57778 {
57779 if (Main.rand.Next(2) != 0)
57780 {
57781 Dust dust = Dust.NewDustDirect(position, width, height, 6, velocity.X * 0.2f, velocity.Y * 0.2f, 100, default(Color), 2f);
57782 dust.noGravity = true;
57783 dust.velocity *= 0.3f;
57784 if (Main.rand.Next(1) == 0)
57785 {
57786 dust.velocity.Y += (float)Math.Sign(dust.velocity.Y) * 1.2f;
57787 dust.fadeIn += 0.5f;
57788 }
57789 }
57790 }
57791 rotation = velocity.ToRotation() + (float)Math.PI / 2f;
57792 }
57793
57794 private void AI_134_Ballista()
57795 {
57796 //IL_02dd: Unknown result type (might be due to invalid IL or missing references)
57797 float shot_range = 900f;
57798 float deadBottomAngle = 0.75f;
57799 Vector2 center = base.Center;
57800 int num = 680;
57801 int num2 = 12;
57802 float num3 = 16f;
57803 int num4 = 1;
57804 int num5 = 5;
57805 int num6 = 5;
57806 if (Main.player[owner].setSquireT2)
57807 {
57808 num3 = 21f;
57809 }
57810 int ballistraShotDelay = GetBallistraShotDelay(Main.player[owner]);
57811 num2 = num6;
57812 int num7 = type;
57813 if (num7 == 677)
57814 {
57815 center.Y -= 4f;
57816 }
57817 if (ai[0] == 0f)
57818 {
57819 direction = (spriteDirection = Main.player[owner].direction);
57820 ai[0] = 1f;
57821 ai[1] = 0f;
57822 netUpdate = true;
57823 if (direction == -1)
57824 {
57825 rotation = (float)Math.PI;
57826 }
57827 }
57828 if (ai[0] == 1f)
57829 {
57830 frame = 0;
57831 bool flag = false;
57832 if (Main.player[owner].ballistaPanic && ai[1] > 60f)
57833 {
57834 ai[1] = 60f;
57835 }
57836 if (Main.player[owner].ballistaPanic && Main.player[owner].setSquireT3 && ai[1] > 30f)
57837 {
57838 ai[1] = 30f;
57839 }
57840 if (ai[1] > 0f)
57841 {
57842 ai[1] -= 1f;
57843 }
57844 else
57845 {
57846 flag = true;
57847 }
57848 int num8 = AI_134_Ballista_FindTarget(shot_range, deadBottomAngle, center);
57849 if (num8 != -1)
57850 {
57851 Vector2 vector = (vector = (Main.npc[num8].Center - center).SafeNormalize(Vector2.UnitY));
57852 rotation = rotation.AngleLerp(vector.ToRotation(), 0.08f);
57853 if (rotation > (float)Math.PI / 2f || rotation < -(float)Math.PI / 2f)
57854 {
57855 direction = -1;
57856 }
57857 else
57858 {
57859 direction = 1;
57860 }
57861 if (flag && owner == Main.myPlayer)
57862 {
57863 direction = Math.Sign(vector.X);
57864 ai[0] = 2f;
57865 ai[1] = 0f;
57866 netUpdate = true;
57867 }
57868 }
57869 else
57870 {
57871 float targetAngle = 0f;
57872 if (direction == -1)
57873 {
57874 targetAngle = (float)Math.PI;
57875 }
57876 rotation = rotation.AngleLerp(targetAngle, 0.05f);
57877 }
57878 }
57879 else if (ai[0] == 2f)
57880 {
57881 frame = num4 + (int)(ai[1] / (float)num6);
57882 if (ai[1] == (float)num2)
57883 {
57885 Vector2 vector2 = new Vector2(direction, 0f);
57886 int num9 = AI_134_Ballista_FindTarget(shot_range, deadBottomAngle, center);
57887 if (num9 != -1)
57888 {
57889 vector2 = (Main.npc[num9].Center - center).SafeNormalize(Vector2.UnitX * direction);
57890 }
57891 rotation = vector2.ToRotation();
57892 if (rotation > (float)Math.PI / 2f || rotation < -(float)Math.PI / 2f)
57893 {
57894 direction = -1;
57895 }
57896 else
57897 {
57898 direction = 1;
57899 }
57901 if (owner == Main.myPlayer)
57902 {
57903 NewProjectile(GetProjectileSource_FromThis(), center, vector3, num, damage, knockBack, owner);
57904 }
57905 }
57906 if ((ai[1] += 1f) >= (float)(num5 * num6))
57907 {
57908 ai[0] = 1f;
57909 ai[1] = ballistraShotDelay;
57910 }
57911 }
57912 spriteDirection = direction;
57913 tileCollide = true;
57914 velocity.Y += 0.2f;
57915 }
57916
57917 public static int GetBallistraShotDelay(Player player)
57918 {
57919 int result = 160;
57920 if (player.setSquireT3)
57921 {
57922 result = 100;
57923 }
57924 if (player.ballistaPanic)
57925 {
57926 result = 60;
57927 }
57928 if (player.ballistaPanic && player.setSquireT3)
57929 {
57930 result = 30;
57931 }
57932 return result;
57933 }
57934
57935 private void AI_135_OgreStomp()
57936 {
57937 float num = 40f;
57938 if (type == 922)
57939 {
57940 num = 30f;
57941 }
57942 ai[0] += 1f;
57943 if (ai[0] > 9f)
57944 {
57945 Kill();
57946 return;
57947 }
57948 velocity = Vector2.Zero;
57949 position = base.Center;
57950 base.Size = new Vector2(16f, 16f) * MathHelper.Lerp(5f, num, Utils.GetLerpValue(0f, 9f, ai[0]));
57951 base.Center = position;
57952 Point point = base.TopLeft.ToTileCoordinates();
57953 Point point2 = base.BottomRight.ToTileCoordinates();
57954 int num2 = point.X / 2 + point2.X / 2;
57955 int num3 = width / 2;
57956 if ((int)ai[0] % 3 != 0)
57957 {
57958 return;
57959 }
57960 int num4 = (int)ai[0] / 3;
57961 for (int i = point.X; i <= point2.X; i++)
57962 {
57963 for (int j = point.Y; j <= point2.Y; j++)
57964 {
57965 if (Vector2.Distance(base.Center, new Vector2(i * 16, j * 16)) > (float)num3)
57966 {
57967 continue;
57968 }
57971 {
57972 continue;
57973 }
57975 if (tileSafely2.active() && Main.tileSolid[tileSafely2.type] && !Main.tileSolidTop[tileSafely2.type])
57976 {
57977 continue;
57978 }
57980 for (int k = 0; k < num5; k++)
57981 {
57983 obj.velocity.Y -= 3f + (float)num4 * 1.5f;
57984 obj.velocity.Y *= Main.rand.NextFloat();
57985 obj.velocity.Y *= 0.75f;
57986 obj.scale += (float)num4 * 0.03f;
57987 }
57988 if (num4 >= 2)
57989 {
57990 if (type == 922)
57991 {
57993 newColor.A = 150;
57994 for (int l = 0; l < num5 - 1; l++)
57995 {
57996 int num6 = Dust.NewDust(position, 12, 12, 4, 0f, 0f, 50, newColor, 1.5f);
57997 Main.dust[num6].velocity.Y -= 0.1f + (float)num4 * 0.5f;
57998 Main.dust[num6].velocity.Y *= Main.rand.NextFloat();
57999 Main.dust[num6].velocity.X *= Main.rand.NextFloatDirection() * 3f;
58000 Main.dust[num6].position = new Vector2(i * 16 + Main.rand.Next(16), j * 16 + Main.rand.Next(16));
58001 if (Main.rand.Next(3) != 0)
58002 {
58003 Main.dust[num6].velocity *= 0.5f;
58004 Main.dust[num6].noGravity = true;
58005 }
58006 }
58007 }
58008 else
58009 {
58010 for (int m = 0; m < num5 - 1; m++)
58011 {
58013 obj2.velocity.Y -= 1f + (float)num4;
58014 obj2.velocity.Y *= Main.rand.NextFloat();
58015 obj2.velocity.Y *= 0.75f;
58016 }
58017 }
58018 }
58019 if (num5 <= 0 || Main.rand.Next(3) == 0)
58020 {
58021 continue;
58022 }
58023 float num7 = (float)Math.Abs(num2 - i) / (num / 2f);
58024 if (type == 922)
58025 {
58027 newColor2.A = 150;
58028 for (int n = 0; n < 3; n++)
58029 {
58030 int num8 = Dust.NewDust(position, width, height, 31, 0f, 0f, 50, newColor2, 2f - (float)num4 * 0.15f + num7 * 0.5f);
58031 Main.dust[num8].velocity.Y -= 0.1f + (float)num4 * 0.5f + num7 * (float)num4 * 1f;
58032 Main.dust[num8].velocity.Y *= Main.rand.NextFloat();
58033 Main.dust[num8].velocity.X *= Main.rand.NextFloatDirection() * 3f;
58034 Main.dust[num8].position = new Vector2(i * 16 + 20, j * 16 + 20);
58035 if (Main.rand.Next(3) != 0)
58036 {
58037 Main.dust[num8].velocity *= 0.5f;
58038 Main.dust[num8].noGravity = true;
58039 }
58040 }
58041 }
58042 else
58043 {
58044 Gore gore = Gore.NewGoreDirect(position, Vector2.Zero, 61 + Main.rand.Next(3), 1f - (float)num4 * 0.15f + num7 * 0.5f);
58045 gore.velocity.Y -= 0.1f + (float)num4 * 0.5f + num7 * (float)num4 * 1f;
58046 gore.velocity.Y *= Main.rand.NextFloat();
58047 gore.position = new Vector2(i * 16 + 20, j * 16 + 20);
58048 }
58049 }
58050 }
58051 }
58052
58053 private void AI_136_BetsyBreath()
58054 {
58055 if (ai[1] < 0f || ai[1] > 200f)
58056 {
58057 Kill();
58058 return;
58059 }
58060 NPC nPC = Main.npc[(int)ai[1]];
58061 float num = -8f;
58062 Vector2 center = nPC.Center + new Vector2((110f + num) * (float)nPC.spriteDirection, 30f).RotatedBy(nPC.rotation);
58063 base.Center = center;
58064 rotation = nPC.DirectionTo(base.Center).ToRotation();
58065 DelegateMethods.v3_1 = new Vector3(1.2f, 1f, 0.3f);
58066 float num2 = ai[0] / 40f;
58067 if (num2 > 1f)
58068 {
58069 num2 = 1f;
58070 }
58071 float num3 = (ai[0] - 38f) / 40f;
58072 if (num3 < 0f)
58073 {
58074 num3 = 0f;
58075 }
58076 Utils.PlotTileLine(base.Center + rotation.ToRotationVector2() * 400f * num3, base.Center + rotation.ToRotationVector2() * 400f * num2, 16f, DelegateMethods.CastLight);
58077 Utils.PlotTileLine(base.Center + rotation.ToRotationVector2().RotatedBy(0.19634954631328583) * 400f * num3, base.Center + rotation.ToRotationVector2().RotatedBy(0.19634954631328583) * 400f * num2, 16f, DelegateMethods.CastLight);
58078 Utils.PlotTileLine(base.Center + rotation.ToRotationVector2().RotatedBy(-0.19634954631328583) * 400f * num3, base.Center + rotation.ToRotationVector2().RotatedBy(-0.19634954631328583) * 400f * num2, 16f, DelegateMethods.CastLight);
58079 if (num3 == 0f && num2 > 0.1f)
58080 {
58081 for (int i = 0; i < 3; i++)
58082 {
58083 Dust dust = Dust.NewDustDirect(position, width, height, 6);
58084 dust.fadeIn = 1.5f;
58085 dust.velocity = rotation.ToRotationVector2().RotatedBy(Main.rand.NextFloatDirection() * ((float)Math.PI / 12f)) * (0.5f + Main.rand.NextFloat() * 2.5f) * 15f;
58086 dust.velocity += nPC.velocity * 2f;
58087 dust.noLight = true;
58088 dust.noGravity = true;
58089 dust.alpha = 200;
58090 }
58091 }
58092 if (Main.rand.Next(5) == 0 && ai[0] >= 15f)
58093 {
58094 Gore gore = Gore.NewGoreDirect(base.Center + rotation.ToRotationVector2() * 300f - Utils.RandomVector2(Main.rand, -20f, 20f), Vector2.Zero, 61 + Main.rand.Next(3), 0.5f);
58095 gore.velocity *= 0.3f;
58096 gore.velocity += rotation.ToRotationVector2() * 4f;
58097 }
58098 for (int j = 0; j < 1; j++)
58099 {
58100 Dust dust2 = Dust.NewDustDirect(position, width, height, 31);
58101 dust2.fadeIn = 1.5f;
58102 dust2.scale = 0.4f;
58103 dust2.velocity = rotation.ToRotationVector2().RotatedBy(Main.rand.NextFloatDirection() * ((float)Math.PI / 12f)) * (0.5f + Main.rand.NextFloat() * 2.5f) * 15f;
58104 dust2.velocity += nPC.velocity * 2f;
58105 dust2.velocity *= 0.3f;
58106 dust2.noLight = true;
58107 dust2.noGravity = true;
58108 float num4 = Main.rand.NextFloat();
58109 dust2.position = Vector2.Lerp(base.Center + rotation.ToRotationVector2() * 400f * num3, base.Center + rotation.ToRotationVector2() * 400f * num2, num4);
58110 dust2.position += rotation.ToRotationVector2().RotatedBy(1.5707963705062866) * (20f + 100f * (num4 - 0.5f));
58111 }
58112 frameCounter++;
58113 ai[0] += 1f;
58114 if (ai[0] >= 78f)
58115 {
58116 Kill();
58117 }
58118 }
58119
58121 {
58122 //IL_00fc: Unknown result type (might be due to invalid IL or missing references)
58123 int num = 10;
58124 int num2 = 999;
58125 int num3 = 30;
58126 int num4 = 40;
58127 int num5 = 4;
58128 knockBack = 0f;
58129 if (Main.player[owner].setMonkT2)
58130 {
58131 num3 -= 5;
58132 }
58133 if (Main.player[owner].setMonkT3)
58134 {
58135 num = 14;
58136 num5 = 8;
58137 }
58138 ai[0] += 1f;
58139 if (ai[0] >= (float)num3)
58140 {
58141 ai[0] = 0f;
58142 }
58143 if (ai[0] == 0f)
58144 {
58145 bool flag = false;
58146 for (int i = 0; i < 200; i++)
58147 {
58148 NPC nPC = Main.npc[i];
58149 if (nPC.CanBeChasedBy(this) && nPC.Hitbox.Distance(base.Center) < (float)(width / 2) && Colliding(base.Hitbox, nPC.Hitbox))
58150 {
58151 flag = true;
58152 break;
58153 }
58154 }
58155 if (flag)
58156 {
58158 }
58159 }
58160 if (localAI[0] == 0f)
58161 {
58162 localAI[0] = 1f;
58163 velocity = Vector2.Zero;
58164 Point origin = base.Center.ToTileCoordinates();
58165 bool flag2 = true;
58166 if (!WorldUtils.Find(origin, Searches.Chain(new Searches.Down(500), _cachedConditions_notNull, _cachedConditions_solid), out var result))
58167 {
58168 flag2 = false;
58169 position.Y += 16f;
58170 return;
58171 }
58172 if (!WorldUtils.Find(new Point(result.X, result.Y - 1), Searches.Chain(new Searches.Up(num), _cachedConditions_notNull, _cachedConditions_solid), out var result2))
58173 {
58174 result2 = new Point(origin.X, origin.Y - num - 1);
58175 }
58176 int num6 = 0;
58177 if (flag2 && Main.tile[result.X, result.Y] != null && Main.tile[result.X, result.Y].blockType() == 1)
58178 {
58179 num6 += 8;
58180 }
58181 Vector2 center = result.ToWorldCoordinates(8f, num6);
58182 Vector2 vector = result2.ToWorldCoordinates(8f, 0f);
58183 base.Size = new Vector2(1f, center.Y - vector.Y);
58184 if (height > num * 16)
58185 {
58186 height = num * 16;
58187 }
58188 if (height < num5 * 16)
58189 {
58190 height = num5 * 16;
58191 }
58192 height *= 2;
58193 width = (int)((float)height * 1f);
58194 if (width > num2)
58195 {
58196 width = num2;
58197 }
58198 base.Center = center;
58199 }
58200 if (++frameCounter >= 8)
58201 {
58202 frameCounter = 0;
58203 if (++frame >= Main.projFrames[type])
58204 {
58205 frame = 0;
58206 }
58207 }
58208 DelegateMethods.v3_1 = new Vector3(0.2f, 0.7f, 1f);
58209 Utils.PlotTileLine(base.Center + Vector2.UnitX * -40f, base.Center + Vector2.UnitX * 40f, 80f, DelegateMethods.CastLightOpen);
58210 Vector2 vector2 = new Vector2(base.Top.X, position.Y + (float)num4);
58211 for (int j = 0; j < 4; j++)
58212 {
58213 if (Main.rand.Next(6) != 0)
58214 {
58215 continue;
58216 }
58217 Vector2 vector3 = Main.rand.NextVector2Unit();
58218 if (!(Math.Abs(vector3.X) < 0.12f))
58219 {
58220 Vector2 targetPosition = base.Center + vector3 * new Vector2((height - num4) / 2);
58221 if (!WorldGen.SolidTile((int)targetPosition.X / 16, (int)targetPosition.Y / 16) && AI_137_CanHit(targetPosition))
58222 {
58223 Dust dust = Dust.NewDustDirect(targetPosition, 0, 0, 226, 0f, 0f, 100);
58224 dust.position = targetPosition;
58225 dust.velocity = (vector2 - dust.position).SafeNormalize(Vector2.Zero);
58226 dust.scale = 0.7f;
58227 dust.fadeIn = 1f;
58228 dust.noGravity = true;
58229 dust.noLight = true;
58230 }
58231 }
58232 }
58233 for (int k = 0; k < 0; k++)
58234 {
58235 if (Main.rand.Next(10) != 0)
58236 {
58237 continue;
58238 }
58239 Vector2 vector4 = Main.rand.NextVector2Unit();
58240 if (!(Math.Abs(vector4.X) < 0.12f))
58241 {
58242 Vector2 targetPosition2 = base.Center + vector4 * new Vector2((height - num4) / 2) * Main.rand.NextFloat();
58243 if (!WorldGen.SolidTile((int)targetPosition2.X / 16, (int)targetPosition2.Y / 16) && AI_137_CanHit(targetPosition2))
58244 {
58245 Dust dust2 = Dust.NewDustDirect(targetPosition2, 0, 0, 226, 0f, 0f, 100);
58246 dust2.velocity *= 0.6f;
58247 dust2.velocity += Vector2.UnitY * -2f;
58248 dust2.noGravity = true;
58249 dust2.noLight = true;
58250 }
58251 }
58252 }
58253 for (int l = 0; l < 4; l++)
58254 {
58255 if (Main.rand.Next(10) == 0)
58256 {
58257 Dust dust3 = Dust.NewDustDirect(vector2 - new Vector2(8f, 0f), 16, height / 2 - 40, 226, 0f, 0f, 100);
58258 dust3.velocity *= 0.6f;
58259 dust3.velocity += Vector2.UnitY * -2f;
58260 dust3.scale = 0.7f;
58261 dust3.noGravity = true;
58262 dust3.noLight = true;
58263 }
58264 }
58265 tileCollide = true;
58266 velocity.Y += 0.2f;
58267 }
58268
58270 {
58271 //IL_0173: Unknown result type (might be due to invalid IL or missing references)
58272 spriteDirection = (direction = 1);
58273 int num = 694;
58274 int num2 = 48;
58275 int explosiveTrapCooldown = GetExplosiveTrapCooldown(Main.player[owner]);
58276 switch (type)
58277 {
58278 case 692:
58279 num = 695;
58280 break;
58281 case 693:
58282 num = 696;
58283 break;
58284 }
58285 Lighting.AddLight(base.Center, 0.6f, 0.5f, 0.3f);
58286 if (++frameCounter >= 12)
58287 {
58288 frameCounter = 0;
58289 if (++frame >= Main.projFrames[type])
58290 {
58291 frame = 0;
58292 }
58293 }
58294 if (localAI[0] > 0f)
58295 {
58296 localAI[0] -= 1f;
58297 }
58298 if (localAI[0] <= 0f && owner == Main.myPlayer)
58299 {
58300 localAI[0] = 3f;
58301 bool flag = false;
58302 Rectangle rectangle = Utils.CenteredRectangle(base.Center + new Vector2(0f, -num2), new Vector2(num2 * 3));
58303 for (int i = 0; i < 200; i++)
58304 {
58305 NPC nPC = Main.npc[i];
58306 if (nPC.CanBeChasedBy(this) && rectangle.Intersects(nPC.Hitbox))
58307 {
58308 flag = true;
58309 break;
58310 }
58311 }
58312 if (flag)
58313 {
58315 localAI[0] = explosiveTrapCooldown;
58316 NewProjectile(GetProjectileSource_FromThis(), base.Center + new Vector2(0f, -num2), Vector2.Zero, num, damage, knockBack, owner);
58317 }
58318 }
58319 tileCollide = true;
58320 velocity.Y += 0.2f;
58321 }
58322
58323 public static int GetExplosiveTrapCooldown(Player player)
58324 {
58325 int result = 90;
58326 if (player.setHuntressT2)
58327 {
58328 result = 60;
58329 }
58330 if (player.setHuntressT3)
58331 {
58332 result = 30;
58333 }
58334 return result;
58335 }
58336
58338 {
58339 int num = Main.projFrames[type];
58340 int num2 = 3;
58341 alpha -= 25;
58342 if (alpha < 0)
58343 {
58344 alpha = 0;
58345 }
58346 if (localAI[0] == 0f)
58347 {
58348 localAI[0] = 1f;
58349 }
58350 if (++frameCounter >= num2)
58351 {
58352 frameCounter = 0;
58353 if (++frame >= num)
58354 {
58355 Kill();
58356 return;
58357 }
58358 }
58359 DelegateMethods.v3_1 = new Vector3(1.3f, 0.9f, 0.2f);
58361 }
58362
58363 private void AI_140_MonkStaffT1()
58364 {
58365 //IL_0505: Unknown result type (might be due to invalid IL or missing references)
58366 //IL_0518: Unknown result type (might be due to invalid IL or missing references)
58367 float num = 50f;
58368 float num2 = 2f;
58369 float num3 = 20f;
58370 Player player = Main.player[owner];
58371 float num4 = -(float)Math.PI / 4f;
58374 if (player.dead)
58375 {
58376 Kill();
58377 return;
58378 }
58379 if (type == 697)
58380 {
58381 int num5 = damage * 3;
58382 int num6 = Math.Sign(velocity.X);
58383 velocity = new Vector2(num6, 0f);
58384 if (ai[0] == 0f)
58385 {
58386 rotation = new Vector2(num6, 0f - player.gravDir).ToRotation() + num4 + (float)Math.PI;
58387 if (velocity.X < 0f)
58388 {
58389 rotation -= (float)Math.PI / 2f;
58390 }
58391 }
58392 alpha -= 128;
58393 if (alpha < 0)
58394 {
58395 alpha = 0;
58396 }
58397 float num7 = ai[0] / num;
58398 float num8 = 1f;
58399 ai[0] += num8;
58400 rotation += (float)Math.PI * 2f * num2 / num * (float)num6;
58401 bool flag = ai[0] == (float)(int)(num / 2f);
58402 if (ai[0] >= num || (flag && !player.controlUseItem))
58403 {
58404 Kill();
58405 player.reuseDelay = 10;
58406 }
58407 else if (flag)
58408 {
58410 int num9 = ((player.DirectionTo(mouseWorld).X > 0f) ? 1 : (-1));
58411 if ((float)num9 != velocity.X)
58412 {
58413 player.ChangeDir(num9);
58414 velocity = new Vector2(num9, 0f);
58415 netUpdate = true;
58416 rotation -= (float)Math.PI;
58417 }
58418 }
58419 float num10 = rotation - (float)Math.PI / 4f * (float)num6;
58420 vector2 = (num10 + ((num6 == -1) ? ((float)Math.PI) : 0f)).ToRotationVector2() * (ai[0] / num) * num3;
58421 Vector2 vector3 = base.Center + (num10 + ((num6 == -1) ? ((float)Math.PI) : 0f)).ToRotationVector2() * 30f;
58422 if (Main.rand.Next(2) == 0)
58423 {
58424 Dust dust = Dust.NewDustDirect(vector3 - new Vector2(5f), 10, 10, 31, player.velocity.X, player.velocity.Y, 150);
58425 dust.velocity = DirectionTo(dust.position) * 0.1f + dust.velocity * 0.1f;
58426 }
58427 if (num7 >= 0.75f)
58428 {
58429 Dust dust2 = Dust.NewDustDirect(vector3 - new Vector2(5f), 10, 10, 55, player.velocity.X, player.velocity.Y, 50);
58430 dust2.velocity = DirectionTo(dust2.position) * 0.1f + dust2.velocity * 0.1f;
58431 dust2.noGravity = true;
58432 dust2.color = new Color(20, 255, 100, 160);
58433 }
58434 if (ai[0] >= num - 8f && ai[0] < num - 2f)
58435 {
58436 for (int i = 0; i < 5; i++)
58437 {
58438 Dust dust3 = Dust.NewDustDirect(vector3 - new Vector2(5f), 10, 10, 55, player.velocity.X, player.velocity.Y, 50);
58439 dust3.velocity *= 1.2f;
58440 dust3.noGravity = true;
58441 dust3.scale += 0.1f;
58442 dust3.color = new Color(20, 255, 100, 160);
58443 }
58444 }
58445 if (ai[0] == num - 3f && owner == Main.myPlayer)
58446 {
58447 if (localAI[1] == 1f || WorldUtils.Find(vector3.ToTileCoordinates(), Searches.Chain(new Searches.Down(4), _cachedConditions_notNull, _cachedConditions_solid), out var _))
58448 {
58449 NewProjectile(GetProjectileSource_FromThis(), vector3 + new Vector2(num6 * 20, -60f), Vector2.Zero, 698, num5, 0f, owner);
58451 }
58452 else
58453 {
58455 }
58456 }
58457 }
58458 if (type == 707)
58459 {
58460 Lighting.AddLight(player.Center, 0.75f, 0.9f, 1.15f);
58461 int num11 = Math.Sign(velocity.X);
58462 velocity = new Vector2(num11, 0f);
58463 if (ai[0] == 0f)
58464 {
58465 rotation = new Vector2(num11, 0f - player.gravDir).ToRotation() + num4 + (float)Math.PI;
58466 if (velocity.X < 0f)
58467 {
58468 rotation -= (float)Math.PI / 2f;
58469 }
58470 }
58471 alpha -= 128;
58472 if (alpha < 0)
58473 {
58474 alpha = 0;
58475 }
58476 _ = ai[0] / num;
58477 float num12 = 1f;
58478 ai[0] += num12;
58479 rotation += (float)Math.PI * 2f * num2 / num * (float)num11;
58480 bool flag2 = ai[0] == (float)(int)(num / 2f);
58481 if (ai[0] >= num || (flag2 && !player.controlUseItem))
58482 {
58483 Kill();
58484 player.reuseDelay = 2;
58485 }
58486 else if (flag2)
58487 {
58489 int num13 = ((player.DirectionTo(mouseWorld2).X > 0f) ? 1 : (-1));
58490 if ((float)num13 != velocity.X)
58491 {
58492 player.ChangeDir(num13);
58493 velocity = new Vector2(num13, 0f);
58494 netUpdate = true;
58495 rotation -= (float)Math.PI;
58496 }
58497 }
58498 if ((ai[0] == num12 || (ai[0] == (float)(int)(num / 2f) && active)) && owner == Main.myPlayer)
58499 {
58501 _ = player.DirectionTo(mouseWorld3) * 0f;
58502 }
58503 float num14 = rotation - (float)Math.PI / 4f * (float)num11;
58504 vector2 = (num14 + ((num11 == -1) ? ((float)Math.PI) : 0f)).ToRotationVector2() * (ai[0] / num) * num3;
58505 Vector2 vector4 = base.Center + (num14 + ((num11 == -1) ? ((float)Math.PI) : 0f)).ToRotationVector2() * 30f;
58506 Vector2 vector5 = num14.ToRotationVector2();
58507 Vector2 vector6 = vector5.RotatedBy((float)Math.PI / 2f * (float)spriteDirection);
58508 if (Main.rand.Next(2) == 0)
58509 {
58510 Dust dust4 = Dust.NewDustDirect(vector4 - new Vector2(5f), 10, 10, 31, player.velocity.X, player.velocity.Y, 150);
58511 dust4.velocity = DirectionTo(dust4.position) * 0.1f + dust4.velocity * 0.1f;
58512 }
58513 for (int j = 0; j < 4; j++)
58514 {
58515 float num15 = 1f;
58516 float num16 = 1f;
58517 switch (j)
58518 {
58519 case 1:
58520 num16 = -1f;
58521 break;
58522 case 2:
58523 num16 = 1.25f;
58524 num15 = 0.5f;
58525 break;
58526 case 3:
58527 num16 = -1.25f;
58528 num15 = 0.5f;
58529 break;
58530 }
58531 if (Main.rand.Next(6) != 0)
58532 {
58533 Dust dust5 = Dust.NewDustDirect(position, 0, 0, 226, 0f, 0f, 100);
58534 dust5.position = base.Center + vector5 * (60f + Main.rand.NextFloat() * 20f) * num16;
58535 dust5.velocity = vector6 * (4f + 4f * Main.rand.NextFloat()) * num16 * num15;
58536 dust5.noGravity = true;
58537 dust5.noLight = true;
58538 dust5.scale = 0.5f;
58539 dust5.customData = this;
58540 if (Main.rand.Next(4) == 0)
58541 {
58542 dust5.noGravity = false;
58543 }
58544 }
58545 }
58546 }
58547 position = vector - base.Size / 2f;
58548 position += vector2;
58549 spriteDirection = direction;
58550 timeLeft = 2;
58551 player.ChangeDir(direction);
58552 player.heldProj = whoAmI;
58553 player.SetDummyItemTime(2);
58554 player.itemRotation = MathHelper.WrapAngle(rotation);
58555 }
58556
58558 {
58559 Point scanAreaStart = base.TopLeft.ToTileCoordinates();
58560 Point scanAreaEnd = base.BottomRight.ToTileCoordinates();
58561 _ = scanAreaStart.X / 2;
58562 _ = scanAreaEnd.X / 2;
58563 int explosionRange = width;
58564 ai[0] += 1f;
58565 if (ai[0] > 20f)
58566 {
58567 Kill();
58568 }
58569 else if (ai[0] == 1f)
58570 {
58571 CreateImpactExplosion(6, base.Bottom, ref scanAreaStart, ref scanAreaEnd, explosionRange, out var causedShockwaves);
58572 CreateImpactExplosion2_SleepyOctopod(base.Bottom, causedShockwaves);
58573 }
58574 }
58575
58577 {
58578 causedShockwaves = false;
58579 int num = 4;
58580 for (int i = scanAreaStart.X; i <= scanAreaEnd.X; i++)
58581 {
58582 for (int j = scanAreaStart.Y; j <= scanAreaEnd.Y; j++)
58583 {
58584 if (Vector2.Distance(explosionOrigin, new Vector2(i * 16, j * 16)) > (float)explosionRange)
58585 {
58586 continue;
58587 }
58590 {
58591 continue;
58592 }
58594 if (tileSafely2.active() && Main.tileSolid[tileSafely2.type] && !Main.tileSolidTop[tileSafely2.type])
58595 {
58596 continue;
58597 }
58599 for (int k = 0; k < num2; k++)
58600 {
58602 obj.velocity.Y -= 3f + (float)num * 1.5f;
58603 obj.velocity.Y *= Main.rand.NextFloat();
58604 obj.scale += (float)num * 0.03f;
58605 }
58606 if (num >= 2)
58607 {
58608 for (int l = 0; l < num2 - 1; l++)
58609 {
58611 obj2.velocity.Y -= 1f + (float)num;
58612 obj2.velocity.Y *= Main.rand.NextFloat();
58613 }
58614 }
58615 if (num2 > 0)
58616 {
58617 causedShockwaves = true;
58618 }
58619 }
58620 }
58621 }
58622
58624 {
58625 Vector2 spinningpoint = new Vector2(7f, 0f);
58626 Vector2 vector = new Vector2(1f, 0.7f);
58627 Color color = new Color(20, 255, 100, 200);
58628 for (float num = 0f; num < 25f; num += 1f)
58629 {
58630 Vector2 vector2 = spinningpoint.RotatedBy(num * ((float)Math.PI * 2f) / 25f) * vector;
58631 Dust dust = Dust.NewDustDirect(position, width, height, 55);
58632 dust.alpha = 0;
58633 if (!causedShockwaves)
58634 {
58635 dust.alpha = 50;
58636 }
58637 dust.color = color;
58638 dust.position = explosionOrigin + vector2;
58639 dust.velocity.Y -= 3f;
58640 dust.velocity.X *= 0.5f;
58641 dust.fadeIn = 0.5f + Main.rand.NextFloat() * 0.5f;
58642 dust.noLight = true;
58643 }
58644 if (!causedShockwaves)
58645 {
58646 for (float num2 = 0f; num2 < 25f; num2 += 1f)
58647 {
58648 Vector2 vector3 = spinningpoint.RotatedBy(num2 * ((float)Math.PI * 2f) / 25f) * vector;
58649 Dust dust2 = Dust.NewDustDirect(position, width, height, 55);
58650 dust2.alpha = 100;
58651 dust2.color = color;
58652 dust2.position = explosionOrigin + vector3;
58653 dust2.velocity.Y -= 5f;
58654 dust2.velocity.X *= 0.8f;
58655 dust2.fadeIn = 0.5f + Main.rand.NextFloat() * 0.5f;
58656 dust2.noLight = true;
58657 }
58658 }
58659 }
58660
58662 {
58663 Vector2 spinningpoint = new Vector2(7f, 0f);
58664 Vector2 vector = new Vector2(1f, 0.7f);
58665 Color color = Color.White * 0.5f;
58667 for (float num = 0f; num < 8f; num += 1f)
58668 {
58669 Vector2 vector3 = spinningpoint.RotatedBy(num * ((float)Math.PI * 2f) / 8f) * vector;
58670 Dust dust = Dust.NewDustDirect(position, width, height, 31);
58671 dust.alpha = 0;
58672 if (!causedShockwaves)
58673 {
58674 dust.alpha = 50;
58675 }
58676 dust.color = color;
58677 dust.position = explosionOrigin + vector3;
58678 dust.velocity.Y -= 0.8f;
58679 dust.velocity.X *= 0.8f;
58680 dust.fadeIn = 0.3f + Main.rand.NextFloat() * 0.4f;
58681 dust.scale = 0.4f;
58682 dust.noLight = true;
58683 dust.velocity += vector2 * 2f;
58684 }
58685 if (!causedShockwaves)
58686 {
58687 for (float num2 = 0f; num2 < 8f; num2 += 1f)
58688 {
58689 Vector2 vector4 = spinningpoint.RotatedBy(num2 * ((float)Math.PI * 2f) / 8f) * vector;
58690 Dust dust2 = Dust.NewDustDirect(position, width, height, 31);
58691 dust2.alpha = 100;
58692 dust2.color = color;
58693 dust2.position = explosionOrigin + vector4;
58694 dust2.velocity.Y -= 1f;
58695 dust2.velocity.X *= 0.4f;
58696 dust2.fadeIn = 0.3f + Main.rand.NextFloat() * 0.4f;
58697 dust2.scale = 0.4f;
58698 dust2.noLight = true;
58699 dust2.velocity += vector2 * 1.5f;
58700 }
58701 }
58702 }
58703
58705 {
58706 Player player = Main.player[owner];
58708 direction = player.direction;
58709 player.heldProj = whoAmI;
58710 base.Center = vector;
58711 if (player.dead)
58712 {
58713 Kill();
58714 return;
58715 }
58716 if (!player.frozen)
58717 {
58718 if (type == 699)
58719 {
58720 spriteDirection = (direction = player.direction);
58722 alpha -= 127;
58723 if (alpha < 0)
58724 {
58725 alpha = 0;
58726 }
58727 if (localAI[0] > 0f)
58728 {
58729 localAI[0] -= 1f;
58730 }
58731 float num = (float)player.itemAnimation / (float)player.itemAnimationMax;
58732 float num2 = 1f - num;
58733 float num3 = velocity.ToRotation();
58734 float num4 = velocity.Length();
58735 float num5 = 22f;
58736 Vector2 spinningpoint = new Vector2(1f, 0f).RotatedBy((float)Math.PI + num2 * ((float)Math.PI * 2f)) * new Vector2(num4, ai[0]);
58737 position += spinningpoint.RotatedBy(num3) + new Vector2(num4 + num5, 0f).RotatedBy(num3);
58738 Vector2 target = vector2 + spinningpoint.RotatedBy(num3) + new Vector2(num4 + num5 + 40f, 0f).RotatedBy(num3);
58739 rotation = vector2.AngleTo(target) + (float)Math.PI / 4f * (float)player.direction;
58740 if (spriteDirection == -1)
58741 {
58742 rotation += (float)Math.PI;
58743 }
58744 vector2.DirectionTo(base.Center);
58745 Vector2 vector3 = vector2.DirectionTo(target);
58746 Vector2 vector4 = velocity.SafeNormalize(Vector2.UnitY);
58747 float num6 = 2f;
58748 for (int i = 0; (float)i < num6; i++)
58749 {
58750 Dust dust = Dust.NewDustDirect(base.Center, 14, 14, 228, 0f, 0f, 110);
58751 dust.velocity = vector2.DirectionTo(dust.position) * 2f;
58752 dust.position = base.Center + vector4.RotatedBy(num2 * ((float)Math.PI * 2f) * 2f + (float)i / num6 * ((float)Math.PI * 2f)) * 10f;
58753 dust.scale = 1f + 0.6f * Main.rand.NextFloat();
58754 dust.velocity += vector4 * 3f;
58755 dust.noGravity = true;
58756 }
58757 for (int j = 0; j < 1; j++)
58758 {
58759 if (Main.rand.Next(3) == 0)
58760 {
58761 Dust dust2 = Dust.NewDustDirect(base.Center, 20, 20, 228, 0f, 0f, 110);
58762 dust2.velocity = vector2.DirectionTo(dust2.position) * 2f;
58763 dust2.position = base.Center + vector3 * -110f;
58764 dust2.scale = 0.45f + 0.4f * Main.rand.NextFloat();
58765 dust2.fadeIn = 0.7f + 0.4f * Main.rand.NextFloat();
58766 dust2.noGravity = true;
58767 dust2.noLight = true;
58768 }
58769 }
58770 }
58771 else if (type == 708)
58772 {
58773 Lighting.AddLight(player.Center, 0.75f, 0.9f, 1.15f);
58774 spriteDirection = (direction = player.direction);
58775 alpha -= 127;
58776 if (alpha < 0)
58777 {
58778 alpha = 0;
58779 }
58780 float num7 = (float)player.itemAnimation / (float)player.itemAnimationMax;
58781 float num8 = 1f - num7;
58782 float num9 = velocity.ToRotation();
58783 float num10 = velocity.Length();
58784 float num11 = 22f;
58785 Vector2 spinningpoint2 = new Vector2(1f, 0f).RotatedBy((float)Math.PI + num8 * ((float)Math.PI * 2f)) * new Vector2(num10, ai[0]);
58786 position += spinningpoint2.RotatedBy(num9) + new Vector2(num10 + num11, 0f).RotatedBy(num9);
58787 Vector2 vector5 = vector + spinningpoint2.RotatedBy(num9) + new Vector2(num10 + num11 + 40f, 0f).RotatedBy(num9);
58788 rotation = (vector5 - vector).SafeNormalize(Vector2.UnitX).ToRotation() + (float)Math.PI / 4f * (float)player.direction;
58789 if (spriteDirection == -1)
58790 {
58791 rotation += (float)Math.PI;
58792 }
58793 (base.Center - vector).SafeNormalize(Vector2.Zero);
58794 (vector5 - vector).SafeNormalize(Vector2.Zero);
58795 Vector2 vector6 = velocity.SafeNormalize(Vector2.UnitY);
58796 if ((player.itemAnimation == 2 || player.itemAnimation == 6 || player.itemAnimation == 10) && owner == Main.myPlayer)
58797 {
58798 Vector2 vector7 = vector6 + Main.rand.NextVector2Square(-0.2f, 0.2f);
58799 vector7 *= 12f;
58800 switch (player.itemAnimation)
58801 {
58802 case 2:
58803 vector7 = vector6.RotatedBy(0.3839724659919739);
58804 break;
58805 case 6:
58806 vector7 = vector6.RotatedBy(-0.3839724659919739);
58807 break;
58808 case 10:
58809 vector7 = vector6.RotatedBy(0.0);
58810 break;
58811 }
58812 vector7 *= 10f + (float)Main.rand.Next(4);
58813 NewProjectile(GetProjectileSource_FromThis(), base.Center, vector7, 709, damage, 0f, owner);
58814 }
58815 for (int k = 0; k < 3; k += 2)
58816 {
58817 float num12 = 1f;
58818 float num13 = 1f;
58819 switch (k)
58820 {
58821 case 1:
58822 num13 = -1f;
58823 break;
58824 case 2:
58825 num13 = 1.25f;
58826 num12 = 0.5f;
58827 break;
58828 case 3:
58829 num13 = -1.25f;
58830 num12 = 0.5f;
58831 break;
58832 }
58833 if (Main.rand.Next(6) != 0)
58834 {
58835 num13 *= 1.2f;
58836 Dust dust3 = Dust.NewDustDirect(position, width, height, 226, 0f, 0f, 100);
58837 dust3.velocity = vector6 * (4f + 4f * Main.rand.NextFloat()) * num13 * num12;
58838 dust3.noGravity = true;
58839 dust3.noLight = true;
58840 dust3.scale = 0.75f;
58841 dust3.fadeIn = 0.8f;
58842 dust3.customData = this;
58843 if (Main.rand.Next(3) == 0)
58844 {
58845 dust3.noGravity = false;
58846 dust3.fadeIn = 0f;
58847 }
58848 }
58849 }
58850 }
58851 }
58852 if (player.whoAmI == Main.myPlayer && player.itemAnimation <= 2)
58853 {
58854 Kill();
58855 player.reuseDelay = 2;
58856 }
58857 }
58858
58860 {
58861 //IL_0037: Unknown result type (might be due to invalid IL or missing references)
58862 //IL_0021: Unknown result type (might be due to invalid IL or missing references)
58863 //IL_0026: Unknown result type (might be due to invalid IL or missing references)
58864 //IL_004c: Unknown result type (might be due to invalid IL or missing references)
58865 //IL_0051: Unknown result type (might be due to invalid IL or missing references)
58866 SlotId val;
58867 if (ai[0] == 0f)
58868 {
58869 float[] array = localAI;
58871 array[1] = ((SlotId)(ref val)).ToFloat();
58872 }
58874 if (activeSound == null)
58875 {
58876 float[] array2 = localAI;
58877 val = SlotId.Invalid;
58878 array2[1] = ((SlotId)(ref val)).ToFloat();
58879 }
58880 else
58881 {
58882 activeSound.Position = base.Center;
58883 }
58884 ai[0] += 1f;
58885 if (ai[0] > 50f)
58886 {
58887 alpha += 25;
58888 if (alpha > 255)
58889 {
58890 alpha = 255;
58891 }
58892 }
58893 else
58894 {
58895 alpha -= 25;
58896 if (alpha < 100)
58897 {
58898 alpha = 100;
58899 }
58900 }
58901 velocity *= 0.98f;
58902 if (++frameCounter >= 5)
58903 {
58904 frameCounter = 0;
58905 if (++frame >= 4)
58906 {
58907 frame = 0;
58908 }
58909 }
58910 if (ai[0] >= 60f)
58911 {
58912 Kill();
58913 }
58914 direction = (spriteDirection = ((velocity.X > 0f) ? 1 : (-1)));
58915 rotation = velocity.ToRotation();
58916 if (spriteDirection == -1)
58917 {
58918 rotation += (float)Math.PI;
58919 }
58920 if (ai[0] >= 10f && ai[0] < 34f)
58921 {
58922 Vector2 vector = velocity.SafeNormalize(Vector2.UnitY);
58923 float num = ai[0] / 60f;
58924 float num2 = 2f;
58925 for (int i = 0; (float)i < num2; i++)
58926 {
58927 Dust dust = Dust.NewDustDirect(base.Center, 14, 14, 228, 0f, 0f, 110);
58928 dust.velocity = vector * 2f;
58929 dust.position = base.Center + vector.RotatedBy(num * ((float)Math.PI * 2f) * 2f + (float)i / num2 * ((float)Math.PI * 2f)) * 7f;
58930 dust.scale = 1f + 0.6f * Main.rand.NextFloat();
58931 dust.velocity += vector * 3f;
58932 dust.noGravity = true;
58933 }
58934 }
58935 }
58936
58937 private void AI_144_DD2Pet()
58938 {
58939 Player player = Main.player[owner];
58940 float num = 4f;
58941 int num2 = 6;
58942 int num3 = 4;
58943 int num4 = Main.projFrames[type];
58944 int num5 = 0;
58945 float num6 = 0.08f;
58946 bool flag = false;
58947 float num7 = 0.1f;
58948 Vector2 vector = new Vector2(player.direction * 30, -20f);
58949 if (player.dead)
58950 {
58951 Kill();
58952 return;
58953 }
58954 bool flag2 = true;
58955 switch (type)
58956 {
58957 case 702:
58958 {
58959 if (player.petFlagDD2Ghost)
58960 {
58961 timeLeft = 2;
58962 }
58963 vector.Y += (float)Math.Cos(localAI[0] * ((float)Math.PI / 60f)) * 2f;
58964 num3 = 4;
58965 num2 = 10;
58966 flag2 = false;
58967 num = 6f;
58968 Vector2 vector3 = new Vector2((spriteDirection == -1) ? (-6) : (-2), -26f).RotatedBy(rotation);
58969 if (Main.rand.Next(24) == 0)
58970 {
58971 Dust dust2 = Dust.NewDustDirect(base.Center + vector3, 4, 4, 135, 0f, 0f, 100);
58972 if (Main.rand.Next(3) != 0)
58973 {
58974 dust2.noGravity = true;
58975 dust2.velocity.Y -= 3f;
58976 dust2.noLight = true;
58977 }
58978 else if (Main.rand.Next(2) != 0)
58979 {
58980 dust2.noLight = true;
58981 }
58982 dust2.velocity *= 0.5f;
58983 dust2.velocity.Y -= 0.9f;
58984 dust2.scale += 0.1f + Main.rand.NextFloat() * 0.6f;
58985 }
58986 DelegateMethods.v3_1 = new Vector3(0.3f, 0.5f, 1f);
58987 Utils.PlotTileLine(base.Center, base.Center + velocity * 6f, 20f, DelegateMethods.CastLightOpen);
58989 Utils.PlotTileLine(player.Center, player.Center + player.velocity * 6f, 40f, DelegateMethods.CastLightOpen);
58991 break;
58992 }
58993 case 703:
58994 if (player.petFlagDD2Gato)
58995 {
58996 timeLeft = 2;
58997 }
58998 vector.Y += (float)Math.Cos(localAI[0] * ((float)Math.PI / 30f)) * 2f;
58999 num2 = 4;
59000 num3 = 2;
59001 num = 3f;
59002 num4 = 4;
59003 break;
59004 case 701:
59005 if (player.petFlagDD2Dragon)
59006 {
59007 timeLeft = 2;
59008 }
59009 break;
59010 case 764:
59011 {
59012 num7 = 0.025f;
59013 num6 = 0.04f;
59014 flag = true;
59015 localAI[0] += 1f;
59016 if (localAI[0] > 120f)
59017 {
59018 localAI[0] = 0f;
59019 }
59020 localAI[1] += velocity.X * 0.01f;
59021 localAI[1] += 1f / 120f;
59022 if (localAI[1] < (float)Math.PI * -2f)
59023 {
59024 localAI[1] += (float)Math.PI * 2f;
59025 }
59026 if (localAI[1] > (float)Math.PI * 2f)
59027 {
59028 localAI[1] -= (float)Math.PI * 2f;
59029 }
59030 if (velocity.Length() < 4f)
59031 {
59032 localAI[1] *= 0.9f;
59033 if (velocity.Length() > 0.1f && Main.rand.Next(30) == 0)
59034 {
59035 Dust dust = Dust.NewDustDirect(position - velocity, width, height, 292, velocity.X * 0.5f, velocity.Y * 0.5f, 150);
59036 dust.velocity *= 0.3f;
59037 dust.noLightEmittence = true;
59038 }
59039 }
59040 else
59041 {
59043 base.Hitbox.Intersects(Utils.CenteredRectangle(Main.screenPosition + vector2 / 2f, vector2 + new Vector2(400f)));
59044 if (Main.rand.Next(15) == 0)
59045 {
59046 Dust.NewDustDirect(position - velocity, width, height, 292, velocity.X * 0.5f, velocity.Y * 0.5f, 150, default(Color), 0.9f).noLightEmittence = true;
59047 }
59048 }
59049 float num8 = localAI[0] / 120f * 2f;
59050 if (num8 > 1f)
59051 {
59052 num8 = 2f - num8;
59053 }
59054 Opacity = MathHelper.Lerp(0.4f, 0.75f, num8);
59055 vector.Y += (float)Math.Cos(localAI[0] / 120f * ((float)Math.PI * 2f)) * 2f;
59056 if (player.petFlagUpbeatStar)
59057 {
59058 timeLeft = 2;
59059 }
59060 break;
59061 }
59062 }
59063 if (flag2 && (player.suspiciouslookingTentacle || player.petFlagDD2Ghost))
59064 {
59065 vector.X += -player.direction * 64;
59066 }
59067 direction = (spriteDirection = player.direction);
59068 Vector2 vector4 = player.MountedCenter + vector;
59069 float num9 = Vector2.Distance(base.Center, vector4);
59070 if (num9 > 1000f)
59071 {
59072 base.Center = player.Center + vector;
59073 }
59074 Vector2 vector5 = vector4 - base.Center;
59075 if (num9 < num)
59076 {
59077 velocity *= 0.25f;
59078 }
59079 if (vector5 != Vector2.Zero)
59080 {
59081 if (vector5.Length() < num * 0.5f)
59082 {
59083 velocity = vector5;
59084 }
59085 else
59086 {
59087 velocity = vector5 * num7;
59088 }
59089 }
59090 if (velocity.Length() > 6f)
59091 {
59092 float num10 = velocity.X * num6 + velocity.Y * (float)spriteDirection * 0.02f;
59093 if (Math.Abs(rotation - num10) >= (float)Math.PI)
59094 {
59095 if (num10 < rotation)
59096 {
59097 rotation -= (float)Math.PI * 2f;
59098 }
59099 else
59100 {
59101 rotation += (float)Math.PI * 2f;
59102 }
59103 }
59104 float num11 = 12f;
59105 rotation = (rotation * (num11 - 1f) + num10) / num11;
59106 if (++frameCounter >= num3)
59107 {
59108 frameCounter = 0;
59109 if (++frame >= num4)
59110 {
59111 frame = num5;
59112 }
59113 }
59114 }
59115 else
59116 {
59117 if (rotation > (float)Math.PI)
59118 {
59119 rotation -= (float)Math.PI * 2f;
59120 }
59121 if (rotation > -0.005f && rotation < 0.005f)
59122 {
59123 rotation = 0f;
59124 }
59125 else
59126 {
59127 rotation *= 0.96f;
59128 }
59129 if (++frameCounter >= num2)
59130 {
59131 frameCounter = 0;
59132 if (++frame >= num4)
59133 {
59134 frame = num5;
59135 }
59136 }
59137 }
59138 if (!flag)
59139 {
59140 localAI[0] += 1f;
59141 if (localAI[0] > 120f)
59142 {
59143 localAI[0] = 0f;
59144 }
59145 }
59146 }
59147
59149 {
59150 //IL_003e: Unknown result type (might be due to invalid IL or missing references)
59151 //IL_0027: Unknown result type (might be due to invalid IL or missing references)
59152 //IL_002c: Unknown result type (might be due to invalid IL or missing references)
59153 //IL_008d: Unknown result type (might be due to invalid IL or missing references)
59154 //IL_0092: Unknown result type (might be due to invalid IL or missing references)
59155 float num = 300f;
59156 SlotId val;
59157 if (soundDelay == 0)
59158 {
59159 soundDelay = -1;
59160 float[] array = localAI;
59162 array[1] = ((SlotId)(ref val)).ToFloat();
59163 }
59165 if (activeSound != null)
59166 {
59167 activeSound.Position = base.Center;
59168 activeSound.Volume = 1f - Math.Max(ai[0] - (num - 15f), 0f) / 15f;
59169 }
59170 else
59171 {
59172 float[] array2 = localAI;
59173 val = SlotId.Invalid;
59174 array2[1] = ((SlotId)(ref val)).ToFloat();
59175 }
59176 if (localAI[0] >= 16f && ai[0] < num - 15f)
59177 {
59178 ai[0] = num - 15f;
59179 }
59180 ai[0] += 1f;
59181 if (ai[0] >= num)
59182 {
59183 Kill();
59184 }
59185 Vector2 top = base.Top;
59186 Vector2 bottom = base.Bottom;
59187 Vector2 vector = Vector2.Lerp(top, bottom, 0.5f);
59188 Vector2 vector2 = new Vector2(0f, bottom.Y - top.Y);
59189 vector2.X = vector2.Y * 0.2f;
59190 int num2 = 16;
59191 int num3 = 160;
59192 for (int i = 0; i < 1; i++)
59193 {
59194 Vector2 vector3 = new Vector2(base.Center.X - (float)(num2 / 2), position.Y + (float)height - (float)num3);
59196 {
59197 if (velocity.Y > 0f)
59198 {
59199 velocity.Y = 0f;
59200 }
59201 if (velocity.Y > -4f)
59202 {
59203 velocity.Y -= 2f;
59204 }
59205 else
59206 {
59207 velocity.Y -= 4f;
59208 localAI[0] += 2f;
59209 }
59210 if (velocity.Y < -16f)
59211 {
59212 velocity.Y = -16f;
59213 }
59214 continue;
59215 }
59216 localAI[0] -= 1f;
59217 if (localAI[0] < 0f)
59218 {
59219 localAI[0] = 0f;
59220 }
59221 if (velocity.Y < 0f)
59222 {
59223 velocity.Y = 0f;
59224 }
59225 if (velocity.Y < 4f)
59226 {
59227 velocity.Y += 2f;
59228 }
59229 else
59230 {
59231 velocity.Y += 4f;
59232 }
59233 if (velocity.Y > 16f)
59234 {
59235 velocity.Y = 16f;
59236 }
59237 }
59238 if (ai[0] < num - 30f)
59239 {
59240 for (int j = 0; j < 1; j++)
59241 {
59242 float value = -1f;
59243 float value2 = 0.9f;
59244 float amount = Main.rand.NextFloat();
59245 Vector2 vector4 = new Vector2(MathHelper.Lerp(0.1f, 1f, Main.rand.NextFloat()), MathHelper.Lerp(value, value2, amount));
59246 vector4.X *= MathHelper.Lerp(2.2f, 0.6f, amount);
59247 vector4.X *= -1f;
59248 Vector2 vector5 = new Vector2(6f, 10f);
59250 Dust dust = Main.dust[Dust.NewDust(vector6, 0, 0, 274)];
59251 dust.position = vector6;
59252 dust.fadeIn = 1.3f;
59253 dust.scale = 0.87f;
59254 dust.alpha = 211;
59255 if (vector4.X > -1.2f)
59256 {
59257 dust.velocity.X = 1f + Main.rand.NextFloat();
59258 }
59259 dust.noGravity = true;
59260 dust.velocity.Y = Main.rand.NextFloat() * -0.5f - 1.3f;
59261 dust.velocity.X += velocity.X * 2.1f;
59262 dust.noLight = true;
59263 }
59264 }
59265 Vector2 vector7 = base.Bottom + new Vector2(-25f, -25f);
59266 for (int k = 0; k < 4; k++)
59267 {
59268 Dust dust2 = Dust.NewDustDirect(vector7, 50, 25, 31, velocity.X, -2f, 100);
59269 dust2.fadeIn = 1.1f;
59270 dust2.noGravity = true;
59271 }
59272 for (int l = 0; l < 1; l++)
59273 {
59274 if (Main.rand.Next(5) == 0)
59275 {
59276 Gore gore = Gore.NewGoreDirect(base.TopLeft + Main.rand.NextVector2Square(0f, 1f) * base.Size, new Vector2(velocity.X * 1.5f, (0f - Main.rand.NextFloat()) * 16f), Utils.SelectRandom<int>(Main.rand, 1007, 1008, 1008));
59277 gore.timeLeft = 60;
59278 gore.alpha = 50;
59279 gore.velocity.X += velocity.X;
59280 }
59281 }
59282 for (int m = 0; m < 1; m++)
59283 {
59284 if (Main.rand.Next(7) == 0)
59285 {
59286 Gore gore2 = Gore.NewGoreDirect(base.TopLeft + Main.rand.NextVector2Square(0f, 1f) * base.Size, new Vector2(velocity.X * 1.5f, (0f - Main.rand.NextFloat()) * 16f), Utils.SelectRandom<int>(Main.rand, 1007, 1008, 1008));
59287 gore2.timeLeft = 0;
59288 gore2.alpha = 80;
59289 }
59290 }
59291 for (int n = 0; n < 1; n++)
59292 {
59293 if (Main.rand.Next(7) == 0)
59294 {
59295 Gore gore3 = Gore.NewGoreDirect(base.TopLeft + Main.rand.NextVector2Square(0f, 1f) * base.Size, new Vector2(velocity.X * 1.5f, (0f - Main.rand.NextFloat()) * 16f), Utils.SelectRandom<int>(Main.rand, 1007, 1008, 1008));
59296 gore3.timeLeft = 0;
59297 gore3.alpha = 80;
59298 }
59299 }
59300 }
59301
59303 {
59304 if (WorldGen.SolidTile((int)targetPosition.X / 16, (int)targetPosition.Y / 16))
59305 {
59306 return false;
59307 }
59308 Vector2 vector = base.Top + Vector2.UnitY * 20f;
59309 bool flag = Collision.CanHitLine(vector, 0, 0, targetPosition, 0, 0);
59310 if (!flag)
59311 {
59313 Vector2 spinningpoint = v.SafeNormalize(Vector2.UnitY);
59315 Vector2 vector3 = vector2 + spinningpoint.RotatedBy(1.5707963705062866) * v.Length() * 0.2f;
59316 if (Collision.CanHitLine(vector, 0, 0, vector3, 0, 0) && Collision.CanHitLine(vector3, 0, 0, targetPosition, 0, 0))
59317 {
59318 flag = true;
59319 }
59320 if (!flag)
59321 {
59322 Vector2 vector4 = vector2 + spinningpoint.RotatedBy(-1.5707963705062866) * v.Length() * 0.2f;
59323 if (Collision.CanHitLine(vector, 0, 0, vector4, 0, 0) && Collision.CanHitLine(vector4, 0, 0, targetPosition, 0, 0))
59324 {
59325 flag = true;
59326 }
59327 }
59328 }
59329 return flag;
59330 }
59331
59333 {
59334 Player player = Main.player[owner];
59335 Vector2 vector = DirectionTo(player.Center);
59336 Point result = new Point((!(vector.X > 0f)) ? 1 : (-1), (!(vector.Y > 0f)) ? 1 : (-1));
59337 if (Math.Abs(vector.X) > Math.Abs(vector.Y) * 2f)
59338 {
59339 result.Y = 0;
59340 }
59341 else if (Math.Abs(vector.Y) > Math.Abs(vector.X) * 2f)
59342 {
59343 result.X = 0;
59344 }
59345 return result;
59346 }
59347
59349 {
59350 return Main.hslToRgb(ai[1], 1f, 0.5f);
59351 }
59352
59354 {
59355 Tile tile = Main.tile[pt.X, pt.Y];
59356 if (tile != null && tile.active() && tile.halfBrick())
59357 {
59358 int num = pt.Y - 1;
59359 if (num >= 0)
59360 {
59361 tile = Main.tile[pt.X, num];
59362 if (!WorldGen.SolidOrSlopedTile(tile))
59363 {
59364 pt.Y--;
59365 }
59366 }
59367 }
59368 DelegateMethods.v2_1 = pt.ToVector2();
59369 DelegateMethods.f_1 = size;
59370 Utils.PlotTileArea(pt.X, pt.Y, plot);
59371 }
59372
59373 public bool IsAttachedTo(NPC npc)
59374 {
59375 if (aiStyle == 113 && ai[0] == 1f && ai[1] == (float)npc.whoAmI)
59376 {
59377 return true;
59378 }
59379 return false;
59380 }
59381
59382 private void BoulderExplosion()
59383 {
59384 int num = Main.rand.Next(2, 5);
59385 for (int i = 0; i < num; i++)
59386 {
59387 float num2 = 8f;
59388 Vector2 vector = new Vector2(Main.rand.NextFloat() - 0.5f, (0f - Main.rand.NextFloat()) / 2f);
59389 vector.Normalize();
59390 vector *= num2;
59391 int num3 = (int)((double)damage * 0.75);
59392 int num4 = NewProjectile(GetProjectileSource_FromThis(), base.Center.X, base.Center.Y, vector.X, vector.Y, 1005, num3, 0f, Main.myPlayer);
59393 Main.projectile[num4].timeLeft = 300;
59394 }
59395 }
59396
59397 private void SpawnWebs()
59398 {
59399 int num = 6;
59400 int num2 = (int)(base.Center.X / 16f);
59401 int num3 = (int)(base.Center.Y / 16f);
59402 int num4 = num2 - num;
59403 int num5 = num2 + num;
59404 int num6 = num3 - num;
59405 int num7 = num3 + num;
59406 if (num4 < 1)
59407 {
59408 num4 = 1;
59409 }
59410 if (num5 > Main.maxTilesX - 1)
59411 {
59412 num5 = Main.maxTilesX - 1;
59413 }
59414 if (num6 < 1)
59415 {
59416 num6 = 1;
59417 }
59418 if (num7 > Main.maxTilesY - 1)
59419 {
59420 num7 = Main.maxTilesY - 1;
59421 }
59422 for (int i = num4; i < num5; i++)
59423 {
59424 for (int j = num6; j < num7; j++)
59425 {
59426 if (!Main.tile[i, j].active() && Main.rand.Next(5) != 0 && Math.Abs(i - num2) * Math.Abs(i - num2) + Math.Abs(j - num3) * Math.Abs(j - num3) < num * num)
59427 {
59428 WorldGen.PlaceTile(i, j, 51);
59429 if (Main.tile[i, j].active() && Main.netMode == 2)
59430 {
59431 NetMessage.SendTileSquare(-1, i, j);
59432 }
59433 }
59434 }
59435 }
59436 }
59437
59438 public void Kill()
59439 {
59440 //IL_011e: Unknown result type (might be due to invalid IL or missing references)
59441 //IL_2d70: Unknown result type (might be due to invalid IL or missing references)
59442 //IL_2d90: Unknown result type (might be due to invalid IL or missing references)
59443 //IL_2dad: Unknown result type (might be due to invalid IL or missing references)
59444 //IL_d1f4: Unknown result type (might be due to invalid IL or missing references)
59445 //IL_d1f9: Unknown result type (might be due to invalid IL or missing references)
59446 //IL_159ed: Unknown result type (might be due to invalid IL or missing references)
59447 if (!active)
59448 {
59449 return;
59450 }
59451 Main.projectileIdentity[owner, identity] = -1;
59452 int num = timeLeft;
59453 timeLeft = 0;
59454 bool flag = true;
59456 {
59457 flag = false;
59458 }
59459 if (owner == Main.myPlayer && flag)
59460 {
59461 Main.player[owner].TryCancelChannel(this);
59462 }
59463 if (Main.getGoodWorld && aiStyle == 16)
59464 {
59465 TryGettingHitByOtherPlayersExplosives();
59466 }
59467 if (Main.netMode != 1 && Main.getGoodWorld)
59468 {
59469 if (type == 472)
59470 {
59471 SpawnWebs();
59472 }
59473 if (type == 99)
59474 {
59475 BoulderExplosion();
59476 }
59477 }
59478 if (type == 1020)
59479 {
59480 if (position.Y - (float)height <= (float)(16 * Main.offScreenRange) && owner == Main.myPlayer)
59481 {
59482 Main.Achievements.GetCondition("TO_INFINITY_AND_BEYOND", "Do").Complete();
59483 }
59484 SoundEngine.GetActiveSound(SlotId.FromFloat(localAI[2]))?.Stop();
59487 for (int i = 0; i < 15; i++)
59488 {
59489 Dust dust = Dust.NewDustDirect(position, width, height, 31, 0f, 0f, 100, transparent, 0.8f);
59490 dust.fadeIn = 0f;
59491 Dust dust2 = dust;
59492 dust2.velocity *= 0.5f;
59493 }
59494 for (int j = 0; j < 5; j++)
59495 {
59496 Dust dust3 = Dust.NewDustDirect(position, width, height, 228, 0f, 0f, 100, transparent, 2.5f);
59497 dust3.noGravity = true;
59498 Dust dust2 = dust3;
59499 dust2.velocity *= 2.5f;
59500 dust3 = Dust.NewDustDirect(position, width, height, 228, 0f, 0f, 100, transparent, 1.1f);
59501 dust2 = dust3;
59502 dust2.velocity *= 2f;
59503 dust3.noGravity = true;
59504 }
59505 for (int k = 0; k < 3; k++)
59506 {
59507 Dust dust4 = Dust.NewDustDirect(position, width, height, 226, 0f, 0f, 100, transparent, 1.1f);
59508 Dust dust2 = dust4;
59509 dust2.velocity *= 2f;
59510 dust4.noGravity = true;
59511 }
59512 for (int l = -1; l <= 1; l += 2)
59513 {
59514 for (int m = -1; m <= 1; m += 2)
59515 {
59516 if (Main.rand.Next(5) == 0)
59517 {
59518 Gore gore = Gore.NewGoreDirect(position, Vector2.Zero, Main.rand.Next(61, 64));
59519 Gore gore2 = gore;
59520 gore2.velocity *= 0.2f;
59521 gore2 = gore;
59522 gore2.scale *= 0.65f;
59523 gore2 = gore;
59524 gore2.velocity += new Vector2(l, m) * 0.5f;
59525 }
59526 }
59527 }
59528 }
59529 else if (type == 949)
59530 {
59532 int num2 = (int)ai[0];
59533 float num3 = 20f;
59534 for (float num4 = 0f; num4 < num3; num4++)
59535 {
59536 Vector2 vector = position;
59537 int num5 = Dust.NewDust(vector, 4, 4, num2, 0f, 0f, 100);
59538 if (Main.rand.Next(3) != 0)
59539 {
59540 Main.dust[num5].noGravity = true;
59541 }
59542 Dust dust2 = Main.dust[num5];
59543 dust2.velocity *= 0.8f;
59544 if (num2 == 66)
59545 {
59546 Main.dust[num5].color = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB);
59547 Main.dust[num5].noGravity = true;
59548 }
59549 }
59550 }
59551 else if (type == 985)
59552 {
59553 if (localAI[1] != 1f)
59554 {
59555 Color value = new Color(64, 220, 96);
59556 Color value2 = new Color(15, 84, 125);
59557 for (int n = 0; n < 20; n++)
59558 {
59559 float num6 = Main.rand.NextFloatDirection();
59560 float num7 = 1f - Math.Abs(num6);
59561 float f = rotation + num6 * ((float)Math.PI / 2f) * 0.9f;
59562 Vector2 vector2 = base.Center + f.ToRotationVector2() * Utils.Remap(Main.rand.NextFloat(), 0f, 1f, 60f, 85f) * scale;
59563 float num8 = Main.rand.NextFloat();
59564 vector2 -= rotation.ToRotationVector2() * num8 * 70f * scale;
59566 value3 = Color.Lerp(value3, Color.White, 0.5f);
59567 Color.Lerp(value3, Color.White, Main.rand.NextFloat() * 0.3f);
59568 Dust dust5 = Dust.NewDustPerfect(vector2, 107, velocity.RotatedBy(num6 * ((float)Math.PI / 4f)) * 0.2f * Main.rand.NextFloat(), 100, default(Color), 1.4f * num7);
59569 Dust dust2 = dust5;
59570 dust2.position -= dust5.velocity * Main.rand.NextFloat() * 3f;
59571 dust2 = dust5;
59572 dust2.scale *= 1f - num8;
59573 }
59574 for (int num9 = 0; num9 < 10; num9++)
59575 {
59576 float num10 = Main.rand.NextFloatDirection();
59577 float num11 = 1f - Math.Abs(num10);
59578 float f2 = rotation + num10 * ((float)Math.PI / 2f) * 0.9f;
59579 Vector2 vector3 = base.Center + f2.ToRotationVector2() * Utils.Remap(Main.rand.NextFloat(), 0f, 1f, 70f, 85f) * scale;
59580 float num12 = Main.rand.NextFloat() * 0.25f;
59581 vector3 -= rotation.ToRotationVector2() * (0.2f + num12) * 70f * scale;
59582 Color value4 = Color.Lerp(value2, value, 0.66f);
59583 value4 = Color.Lerp(value4, Color.White, 0.33f);
59584 Color.Lerp(value4, Color.White, Main.rand.NextFloat() * 0.3f);
59585 Dust dust6 = Dust.NewDustPerfect(vector3, 107, velocity.RotatedBy(num10 * ((float)Math.PI / 4f)) * 0.2f * Main.rand.NextFloat(), 100, default(Color), 1.4f * num11);
59586 Dust dust2 = dust6;
59587 dust2.position -= dust6.velocity * Main.rand.NextFloat() * 3f;
59588 dust2 = dust6;
59589 dust2.scale *= 1f - num12;
59590 }
59591 for (int num13 = 0; num13 < 10; num13++)
59592 {
59593 float num14 = Main.rand.NextFloatDirection();
59594 float num15 = 1f - Math.Abs(num14);
59595 float f3 = rotation + num14 * ((float)Math.PI / 2f) * 0.9f;
59596 Vector2 vector4 = base.Center + f3.ToRotationVector2() * Utils.Remap(Main.rand.NextFloat(), 0f, 1f, 60f, 75f) * scale;
59597 float num16 = Main.rand.NextFloat() * 0.25f;
59598 vector4 -= rotation.ToRotationVector2() * (0.5f + num16) * 70f * scale;
59599 Color value5 = Color.Lerp(value2, value, 0.33f);
59600 value5 = Color.Lerp(value5, Color.White, 0.16f);
59601 Color.Lerp(value5, Color.White, Main.rand.NextFloat() * 0.3f);
59602 Dust dust7 = Dust.NewDustPerfect(vector4, 107, velocity.RotatedBy(num14 * ((float)Math.PI / 4f)) * 0.2f * Main.rand.NextFloat(), 100, default(Color), 1.4f * num15);
59603 Dust dust2 = dust7;
59604 dust2.position -= dust7.velocity * Main.rand.NextFloat() * 3f;
59605 dust2 = dust7;
59606 dust2.scale *= 1f - num16;
59607 }
59608 }
59609 }
59610 else if (type == 756)
59611 {
59612 for (float num17 = 0f; num17 < 1f; num17 += 0.025f)
59613 {
59614 Dust dust8 = Dust.NewDustPerfect(base.Center + Main.rand.NextVector2Circular(16f, 16f) * scale + velocity.SafeNormalize(Vector2.UnitY) * num17 * 200f * scale, 5, Main.rand.NextVector2Circular(3f, 3f));
59615 dust8.velocity.Y += -0.3f;
59616 Dust dust2 = dust8;
59617 dust2.velocity += velocity * 0.2f;
59618 dust8.scale = 1f;
59619 dust8.alpha = 100;
59620 }
59621 }
59622 else if (type == 961)
59623 {
59624 for (float num18 = 0f; num18 < 1f; num18 += 0.25f)
59625 {
59626 Dust dust9 = Dust.NewDustPerfect(base.Center + Main.rand.NextVector2Circular(16f, 16f) * scale + velocity.SafeNormalize(Vector2.UnitY) * num18 * 200f * scale, 16, Main.rand.NextVector2Circular(3f, 3f));
59627 dust9.velocity.Y += -0.3f;
59628 Dust dust2 = dust9;
59629 dust2.velocity += velocity * 0.2f;
59630 dust9.scale = 1f;
59631 dust9.alpha = 100;
59632 }
59633 }
59634 else if (type == 962)
59635 {
59636 for (int num19 = 0; num19 < 20; num19++)
59637 {
59638 Dust dust10 = Dust.NewDustPerfect(base.Center + Main.rand.NextVector2Circular(16f, 16f) * scale, 16, Main.rand.NextVector2Circular(2f, 2f));
59639 Dust dust2 = dust10;
59640 dust2.velocity += velocity * 0.1f;
59641 dust10.scale = 1f;
59642 dust10.alpha = 100;
59643 }
59644 }
59645 else if (type == 932)
59646 {
59647 Color fairyQueenWeaponsColor = GetFairyQueenWeaponsColor();
59649 Vector2 target = base.Center;
59650 Main.rand.NextFloat();
59651 int num20 = 10;
59652 for (int num21 = 0; num21 < num20; num21++)
59653 {
59654 Vector2 vector5 = position - velocity * num21;
59655 int num22 = Main.rand.Next(1, 3);
59656 float num23 = MathHelper.Lerp(0.3f, 1f, Utils.GetLerpValue(num20, 0f, num21, clamped: true));
59657 if ((float)num21 >= (float)oldPos.Length * 0.3f)
59658 {
59659 num22--;
59660 }
59661 if ((float)num21 >= (float)oldPos.Length * 0.75f)
59662 {
59663 num22 -= 2;
59664 }
59665 vector5.DirectionTo(target).SafeNormalize(Vector2.Zero);
59666 target = vector5;
59667 for (float num24 = 0f; num24 < (float)num22; num24++)
59668 {
59669 int num25 = Dust.NewDust(vector5, width, height, 267, 0f, 0f, 0, fairyQueenWeaponsColor);
59671 dust2.velocity *= Main.rand.NextFloat() * 0.8f;
59672 Main.dust[num25].noGravity = true;
59673 Main.dust[num25].scale = 0.9f + Main.rand.NextFloat() * 1.2f;
59674 Main.dust[num25].fadeIn = Main.rand.NextFloat() * 1.2f * num23;
59675 dust2 = Main.dust[num25];
59676 dust2.scale *= num23;
59677 if (num25 != 6000)
59678 {
59680 dust2 = dust11;
59681 dust2.scale /= 2f;
59682 dust2 = dust11;
59683 dust2.fadeIn *= 0.85f;
59684 dust11.color = new Color(255, 255, 255, 255);
59685 }
59686 }
59687 }
59688 }
59689 else if (type == 931)
59690 {
59691 Color fairyQueenWeaponsColor2 = GetFairyQueenWeaponsColor();
59693 Vector2 target2 = base.Center;
59694 Main.rand.NextFloat();
59695 for (int num26 = 0; num26 < oldPos.Length; num26++)
59696 {
59697 Vector2 vector6 = oldPos[num26];
59698 if (vector6 == Vector2.Zero)
59699 {
59700 break;
59701 }
59702 int num27 = Main.rand.Next(1, 3);
59703 float num28 = MathHelper.Lerp(0.3f, 1f, Utils.GetLerpValue(oldPos.Length, 0f, num26, clamped: true));
59704 if ((float)num26 >= (float)oldPos.Length * 0.3f)
59705 {
59706 num27--;
59707 }
59708 if ((float)num26 >= (float)oldPos.Length * 0.75f)
59709 {
59710 num27 -= 2;
59711 }
59712 vector6.DirectionTo(target2).SafeNormalize(Vector2.Zero);
59713 target2 = vector6;
59714 for (float num29 = 0f; num29 < (float)num27; num29++)
59715 {
59716 int num30 = Dust.NewDust(vector6, width, height, 267, 0f, 0f, 0, fairyQueenWeaponsColor2);
59718 dust2.velocity *= Main.rand.NextFloat() * 0.8f;
59719 Main.dust[num30].noGravity = true;
59720 Main.dust[num30].scale = 0.9f + Main.rand.NextFloat() * 1.2f;
59721 Main.dust[num30].fadeIn = Main.rand.NextFloat() * 1.2f * num28;
59722 dust2 = Main.dust[num30];
59723 dust2.scale *= num28;
59724 if (num30 != 6000)
59725 {
59727 dust2 = dust12;
59728 dust2.scale /= 2f;
59729 dust2 = dust12;
59730 dust2.fadeIn *= 0.85f;
59731 dust12.color = new Color(255, 255, 255, 255);
59732 }
59733 }
59734 }
59735 }
59736 else if (type == 79)
59737 {
59738 int newWidth = width;
59739 int newHeight = height;
59740 Resize(128, 128);
59741 maxPenetrate = -1;
59742 penetrate = -1;
59743 Damage();
59744 Resize(newWidth, newHeight);
59746 Vector2 target3 = base.Center;
59747 float num31 = Main.rand.NextFloat();
59748 for (int num32 = 0; num32 < oldPos.Length; num32++)
59749 {
59750 Vector2 vector7 = oldPos[num32];
59751 if (vector7 == Vector2.Zero)
59752 {
59753 break;
59754 }
59755 Color newColor = Main.hslToRgb((num31 + Utils.GetLerpValue(oldPos.Length, 0f, num32, clamped: true)) % 1f, 1f, 0.65f);
59756 int num33 = Main.rand.Next(1, 4);
59757 float lerpValue = Utils.GetLerpValue(oldPos.Length, 0f, num32, clamped: true);
59758 float num34 = MathHelper.Lerp(0.3f, 1f, lerpValue);
59759 if ((float)num32 >= (float)oldPos.Length * 0.3f)
59760 {
59761 num33--;
59762 }
59763 if ((float)num32 >= (float)oldPos.Length * 0.65f)
59764 {
59765 num33 -= 2;
59766 }
59767 if ((float)num32 >= (float)oldPos.Length * 0.85f)
59768 {
59769 num33 -= 3;
59770 }
59771 Vector2 vector8 = vector7.DirectionTo(target3).SafeNormalize(Vector2.Zero);
59772 target3 = vector7;
59773 Vector2 vector9 = base.Size / 2f;
59774 for (float num35 = 0f; num35 < (float)num33; num35++)
59775 {
59776 int num36 = Dust.NewDust(vector7, width, height, 267, 0f, 0f, 0, newColor);
59778 dust2.velocity *= Main.rand.NextFloat() * 0.8f;
59779 Main.dust[num36].noGravity = true;
59780 Main.dust[num36].scale = 0.9f + Main.rand.NextFloat() * 1.2f;
59781 Main.dust[num36].fadeIn = Main.rand.NextFloat() * 1.2f * num34;
59782 dust2 = Main.dust[num36];
59783 dust2.velocity += vector8 * 6f;
59784 dust2 = Main.dust[num36];
59785 dust2.scale *= num34;
59786 Main.dust[num36].position = Vector2.Lerp(vector7 + vector9, Main.dust[num36].position, lerpValue);
59787 if (num36 != 6000)
59788 {
59790 dust2 = dust13;
59791 dust2.scale /= 2f;
59792 dust2 = dust13;
59793 dust2.fadeIn *= 0.85f;
59794 dust13.color = new Color(255, 255, 255, 255);
59795 }
59796 }
59797 }
59798 for (float num37 = 0f; num37 < 0.5f; num37 += 0.25f)
59799 {
59801 {
59802 PositionInWorld = base.Center,
59803 MovementVector = Vector2.UnitX.RotatedBy(num37 * ((float)Math.PI * 2f)) * 16f
59804 }, owner);
59805 }
59806 for (int num38 = 0; num38 < 14; num38++)
59807 {
59808 int num39 = Dust.NewDust(position, width, height, 66, 0f, 0f, 100, Main.hslToRgb(Main.rand.NextFloat(), 1f, 0.5f), 1.7f);
59809 Main.dust[num39].noGravity = true;
59811 dust2.velocity *= 3f;
59812 }
59813 }
59814 else if (type == 16)
59815 {
59816 int newWidth2 = width;
59817 int newHeight2 = height;
59818 Resize(128, 128);
59819 maxPenetrate = -1;
59820 penetrate = -1;
59821 Damage();
59822 Resize(newWidth2, newHeight2);
59824 Vector2 target4 = base.Center;
59825 for (int num40 = 0; num40 < oldPos.Length; num40++)
59826 {
59827 Vector2 vector10 = oldPos[num40];
59828 if (vector10 == Vector2.Zero)
59829 {
59830 break;
59831 }
59832 Color newColor2 = Main.hslToRgb(4f / 9f + Main.rand.NextFloat() * (2f / 9f), 1f, 0.65f);
59833 int num41 = Main.rand.Next(1, 4);
59834 float num42 = MathHelper.Lerp(0.3f, 1f, Utils.GetLerpValue(oldPos.Length, 0f, num40, clamped: true));
59835 if ((float)num40 >= (float)oldPos.Length * 0.3f)
59836 {
59837 num41--;
59838 }
59839 if ((float)num40 >= (float)oldPos.Length * 0.75f)
59840 {
59841 num41 -= 2;
59842 }
59843 Vector2 vector11 = vector10.DirectionTo(target4).SafeNormalize(Vector2.Zero);
59844 target4 = vector10;
59845 for (float num43 = 0f; num43 < (float)num41; num43++)
59846 {
59847 if (Main.rand.Next(3) == 0)
59848 {
59849 int num44 = Dust.NewDust(vector10, width, height, 267, 0f, 0f, 0, newColor2);
59851 dust2.velocity *= Main.rand.NextFloat() * 0.8f;
59852 Main.dust[num44].noGravity = true;
59853 Main.dust[num44].scale = Main.rand.NextFloat() * 0.8f;
59854 Main.dust[num44].fadeIn = Main.rand.NextFloat() * 1.2f * num42;
59855 dust2 = Main.dust[num44];
59856 dust2.velocity += vector11 * 6f;
59857 dust2 = Main.dust[num44];
59858 dust2.scale *= num42;
59859 if (num44 != 6000)
59860 {
59862 dust2 = dust14;
59863 dust2.scale /= 2f;
59864 dust2 = dust14;
59865 dust2.fadeIn /= 2f;
59866 dust14.color = new Color(255, 255, 255, 255);
59867 }
59868 }
59869 else
59870 {
59871 Dust dust15 = Dust.NewDustDirect(vector10, width, height, 15, (0f - velocity.X) * 0.2f, (0f - velocity.Y) * 0.2f, 100);
59872 Main.rand.Next(2);
59873 dust15.noGravity = true;
59874 Dust dust2 = dust15;
59875 dust2.velocity *= 2f;
59876 dust2 = dust15;
59877 dust2.velocity += vector11 * 9f;
59878 dust2 = dust15;
59879 dust2.scale *= num42;
59880 dust15.fadeIn = (0.6f + Main.rand.NextFloat() * 0.4f) * num42;
59881 dust15.noLightEmittence = (dust15.noLight = true);
59882 }
59883 }
59884 }
59885 for (int num45 = 0; num45 < 20; num45++)
59886 {
59887 Dust dust16 = Dust.NewDustDirect(position, width, height, 15);
59888 dust16.noGravity = true;
59889 dust16.velocity = Main.rand.NextVector2Circular(1f, 1f) * 1.5f;
59890 dust16.scale = 1.2f + Main.rand.NextFloat() * 0.5f;
59891 dust16.noLightEmittence = (dust16.noLight = true);
59892 Dust dust2 = dust16;
59893 dust2.velocity += velocity * 0.01f;
59894 dust2 = dust16;
59895 dust2.position += dust16.velocity * Main.rand.Next(1, 16);
59896 dust16 = Dust.NewDustDirect(position, width, height, 15, 0f, 0f, 100);
59897 dust2 = dust16;
59898 dust2.velocity *= 1.2f;
59899 dust16.noLightEmittence = (dust16.noLight = true);
59900 dust2 = dust16;
59901 dust2.velocity += velocity * 0.01f;
59902 dust2 = dust16;
59903 dust2.scale *= 0.8f + Main.rand.NextFloat() * 0.2f;
59904 dust2 = dust16;
59905 dust2.position += dust16.velocity * Main.rand.Next(1, 16);
59906 }
59907 }
59908 else if (type == 34)
59909 {
59910 int newWidth3 = width;
59911 int newHeight3 = height;
59912 Resize(96, 96);
59913 maxPenetrate = -1;
59914 penetrate = -1;
59915 Damage();
59916 Resize(newWidth3, newHeight3);
59918 Vector2 target5 = base.Center;
59919 for (int num46 = 0; num46 < oldPos.Length; num46++)
59920 {
59921 Vector2 vector12 = oldPos[num46];
59922 if (vector12 == Vector2.Zero)
59923 {
59924 break;
59925 }
59926 Color newColor3 = Main.hslToRgb(Main.rand.NextFloat() * (1f / 9f), 1f, 0.5f);
59927 int num47 = Main.rand.Next(1, 5);
59928 float num48 = MathHelper.Lerp(0.3f, 1f, Utils.GetLerpValue(oldPos.Length, 0f, num46, clamped: true));
59929 if ((float)num46 >= (float)oldPos.Length * 0.3f)
59930 {
59931 num47--;
59932 }
59933 if ((float)num46 >= (float)oldPos.Length * 0.75f)
59934 {
59935 num47 -= 2;
59936 }
59937 Vector2 vector13 = vector12.DirectionTo(target5).SafeNormalize(Vector2.Zero);
59938 target5 = vector12;
59939 for (float num49 = 0f; num49 < (float)num47; num49++)
59940 {
59941 if (Main.rand.Next(3) == 0)
59942 {
59943 int num50 = Dust.NewDust(vector12, width, height, 267, 0f, 0f, 0, newColor3);
59945 dust2.velocity *= Main.rand.NextFloat() * 0.8f;
59946 Main.dust[num50].noGravity = true;
59947 Main.dust[num50].scale = Main.rand.NextFloat() * 1f;
59948 Main.dust[num50].fadeIn = Main.rand.NextFloat() * 2f;
59949 dust2 = Main.dust[num50];
59950 dust2.velocity += vector13 * 8f;
59951 dust2 = Main.dust[num50];
59952 dust2.scale *= num48;
59953 if (num50 != 6000)
59954 {
59956 dust2 = dust17;
59957 dust2.scale /= 2f;
59958 dust2 = dust17;
59959 dust2.fadeIn /= 2f;
59960 dust17.color = new Color(255, 255, 255, 255);
59961 }
59962 }
59963 else
59964 {
59965 Dust dust18 = Dust.NewDustDirect(vector12, width, height, 6, (0f - velocity.X) * 0.2f, (0f - velocity.Y) * 0.2f, 100);
59966 Dust dust2;
59967 if (Main.rand.Next(2) == 0)
59968 {
59969 dust18.noGravity = true;
59970 dust2 = dust18;
59971 dust2.scale *= 2.5f;
59972 }
59973 dust2 = dust18;
59974 dust2.velocity *= 2f;
59975 dust2 = dust18;
59976 dust2.velocity += vector13 * 6f;
59977 dust2 = dust18;
59978 dust2.scale *= num48;
59979 dust18.noLightEmittence = (dust18.noLight = true);
59980 }
59981 }
59982 }
59983 for (int num51 = 0; num51 < 20; num51++)
59984 {
59985 Dust dust19 = Dust.NewDustDirect(position, width, height, 6, (0f - velocity.X) * 0.2f, (0f - velocity.Y) * 0.2f, 100);
59986 dust19.noGravity = true;
59987 dust19.velocity = Main.rand.NextVector2Circular(1f, 1f) * 6f;
59988 dust19.scale = 1.6f;
59989 dust19.fadeIn = 1.3f + Main.rand.NextFloat() * 1f;
59990 dust19.noLightEmittence = (dust19.noLight = true);
59991 Dust dust2 = dust19;
59992 dust2.velocity += velocity * 0.1f;
59993 dust19 = Dust.NewDustDirect(position, width, height, 6, (0f - velocity.X) * 0.2f, (0f - velocity.Y) * 0.2f, 100);
59994 dust2 = dust19;
59995 dust2.velocity *= 2f;
59996 dust19.noLightEmittence = (dust19.noLight = true);
59997 dust2 = dust19;
59998 dust2.velocity += velocity * 0.1f;
59999 }
60000 }
60001 if (type == 873)
60002 {
60003 int num52 = 20;
60004 float num53 = (float)Math.PI * 2f / (float)num52;
60005 float num54 = velocity.ToRotation();
60006 Color value6 = AI_171_GetColor();
60007 for (int num55 = 0; num55 < num52; num55++)
60008 {
60009 Dust dust20 = Dust.NewDustPerfect(base.Center, 267);
60010 dust20.fadeIn = 1f;
60011 dust20.noGravity = true;
60012 dust20.alpha = 100;
60013 dust20.color = Color.Lerp(value6, Color.White, Main.rand.NextFloat() * 0.4f);
60014 if (num55 % 4 == 0)
60015 {
60016 dust20.velocity = num54.ToRotationVector2() * 3.2f;
60017 dust20.scale = 2.3f;
60018 }
60019 else if (num55 % 2 == 0)
60020 {
60021 dust20.velocity = num54.ToRotationVector2() * 1.8f;
60022 dust20.scale = 1.9f;
60023 }
60024 else
60025 {
60026 dust20.velocity = num54.ToRotationVector2();
60027 dust20.scale = 1.6f;
60028 }
60029 num54 += num53;
60030 Dust dust2 = dust20;
60031 dust2.velocity += velocity * Main.rand.NextFloat() * 0.5f;
60032 }
60033 }
60034 _ = type;
60035 _ = 857;
60036 if (type == 1012)
60037 {
60038 SoundEngine.PlaySound(0, (int)position.X, (int)position.Y);
60039 for (int num56 = 0; num56 < 40; num56++)
60040 {
60041 Vector2 vector14 = Vector2.UnitY.RotatedBy((float)num56 * ((float)Math.PI * 2f)) * (2f + Main.rand.NextFloat() * 0.5f);
60042 vector14 += velocity * Main.rand.NextFloat();
60044 if (Main.rand.Next(3) == 0)
60045 {
60046 Dust dust21 = Dust.NewDustDirect(newColor: Main.rand.Next(3) switch
60047 {
60048 0 => new Color(226, 116, 56),
60049 1 => new Color(243, 175, 93),
60050 2 => new Color(254, 210, 146),
60051 _ => new Color(176, 64, 36),
60052 }, Position: position + Main.rand.NextVector2Circular(18f, 18f) * scale, Width: 2, Height: 2, Type: 284, SpeedX: vector14.X, SpeedY: vector14.Y, Alpha: 0, Scale: Main.rand.NextFloat() * 1f + 1f);
60053 Dust dust2 = dust21;
60054 dust2.position -= velocity;
60055 dust21.fadeIn = 1f;
60056 }
60057 else
60058 {
60059 vector14 *= 0.3f;
60060 Dust dust22 = Dust.NewDustDirect(position + Main.rand.NextVector2Circular(18f, 18f) * scale, 2, 2, 138, vector14.X, vector14.Y, 0, default(Color), Main.rand.NextFloat() * 0.3f + 0.6f);
60061 Dust dust2 = dust22;
60062 dust2.position -= velocity;
60063 }
60064 }
60065 }
60066 if (type == 920)
60067 {
60068 for (int num57 = 0; num57 < 6; num57++)
60069 {
60070 Vector2 vector15 = Vector2.UnitY.RotatedBy((float)num57 * ((float)Math.PI * 2f) + Main.rand.NextFloat() * ((float)Math.PI * 2f) * 0.5f) * (2f + Main.rand.NextFloat() * 0.5f);
60071 int num58 = Dust.NewDust(position + base.Size * Main.rand.NextVector2Square(0f, 1f), 4, 4, 4, vector15.X, vector15.Y, 80, new Color(78, 136, 255, 150), 1.5f);
60072 Main.dust[num58].noGravity = true;
60073 }
60074 }
60075 if (type == 921)
60076 {
60077 for (int num59 = 0; num59 < 12; num59++)
60078 {
60079 Vector2 vector16 = Vector2.UnitY.RotatedBy((float)num59 * ((float)Math.PI * 2f) + Main.rand.NextFloat() * ((float)Math.PI * 2f) * 0.5f) * (3f + Main.rand.NextFloat() * 0.5f);
60080 int num60 = Dust.NewDust(position + base.Size * Main.rand.NextVector2Square(0f, 1f), 6, 6, 243, vector16.X, vector16.Y, 80, default(Color), 1.5f);
60081 Main.dust[num60].noGravity = true;
60082 }
60083 }
60084 if (type == 926)
60085 {
60086 for (int num61 = 0; num61 < 22; num61++)
60087 {
60088 Vector2 vector17 = Vector2.UnitY.RotatedBy((float)num61 * ((float)Math.PI * 2f) + Main.rand.NextFloat() * ((float)Math.PI * 2f) * 0.5f) * (3f + Main.rand.NextFloat() * 0.5f);
60089 int num62 = Dust.NewDust(position - new Vector2(8f, 8f), width + 16, height + 16, 31, vector17.X, vector17.Y, 40, NPC.AI_121_QueenSlime_GetDustColor(), 1.5f);
60090 Main.dust[num62].noGravity = true;
60091 }
60092 }
60093 if (type == 937)
60094 {
60095 for (int num63 = 0; num63 < 12; num63++)
60096 {
60097 Vector2 vector18 = Vector2.UnitY.RotatedBy((float)num63 * ((float)Math.PI * 2f) + Main.rand.NextFloat() * ((float)Math.PI * 2f) * 0.5f) * (3f + Main.rand.NextFloat() * 0.5f);
60098 int num64 = Dust.NewDust(position - new Vector2(8f, 8f), width + 16, height + 16, 31, vector18.X, vector18.Y, 40, NPC.AI_121_QueenSlime_GetDustColor(), 1.5f);
60099 Main.dust[num64].noGravity = true;
60100 }
60101 }
60102 if (type == 818)
60103 {
60104 for (float num65 = 0f; num65 < 1f; num65 += 0.34f)
60105 {
60106 Dust.NewDustPerfect(position + base.Size * Main.rand.NextVector2Square(0f, 1f), 278, Vector2.UnitY.RotatedBy(num65 * ((float)Math.PI * 2f) + Main.rand.NextFloat() * ((float)Math.PI * 2f) * 0.5f) * (2f + Main.rand.NextFloat() * 0.5f), 150, Color.Lerp(Color.White, Color.Gold, Main.rand.NextFloat()), 0.4f).noGravity = true;
60107 }
60108 for (float num66 = 0f; num66 < 1f; num66 += 0.34f)
60109 {
60110 Dust.NewDustPerfect(position + base.Size * Main.rand.NextVector2Square(0f, 1f), 278, Vector2.UnitY.RotatedBy(num66 * ((float)Math.PI * 2f) + Main.rand.NextFloat() * ((float)Math.PI * 2f) * 0.5f) * (1f + Main.rand.NextFloat() * 0.5f), 150, Color.Lerp(Color.White, Main.OurFavoriteColor, Main.rand.NextFloat()), 0.7f).noGravity = true;
60111 }
60112 }
60113 if (type == 856)
60114 {
60115 for (int num67 = 0; num67 < 6; num67++)
60116 {
60117 Dust.NewDust(position, width, height, 58, 0f, 0f, 150, default(Color), 0.8f);
60118 }
60119 for (float num68 = 0f; num68 < 1f; num68 += 0.34f)
60120 {
60121 Dust.NewDustPerfect(base.Center, 278, Vector2.UnitY.RotatedBy(num68 * ((float)Math.PI * 2f) + Main.rand.NextFloat() * ((float)Math.PI * 2f) * 0.5f) * (4f + Main.rand.NextFloat() * 2f), 150, Color.Lerp(Color.White, Color.HotPink, Main.rand.NextFloat() * 0.5f + 0.5f)).noGravity = true;
60122 }
60123 for (float num69 = 0f; num69 < 1f; num69 += 0.34f)
60124 {
60125 Dust.NewDustPerfect(base.Center, 278, Vector2.UnitY.RotatedBy(num69 * ((float)Math.PI * 2f) + Main.rand.NextFloat() * ((float)Math.PI * 2f) * 0.5f) * (2f + Main.rand.NextFloat() * 1f), 150, Color.Lerp(Color.White, Color.Orange, Main.rand.NextFloat() * 0.5f + 0.5f)).noGravity = true;
60126 }
60128 if (base.Hitbox.Intersects(Utils.CenteredRectangle(Main.screenPosition + vector19 / 2f, vector19 + new Vector2(400f))))
60129 {
60130 for (int num70 = 0; num70 < 1; num70++)
60131 {
60132 Gore.NewGore(position, Main.rand.NextVector2CircularEdge(0.5f, 0.5f) * 3f, Utils.SelectRandom<int>(Main.rand, 16));
60133 }
60134 }
60136 {
60137 PositionInWorld = base.Center
60138 }, owner);
60139 position = base.Center;
60140 width = (height = 128);
60141 base.Center = position;
60142 maxPenetrate = -1;
60143 penetrate = -1;
60144 Damage();
60145 }
60146 if (type == 818)
60147 {
60148 Damage();
60149 }
60150 if (type == 686)
60151 {
60153 }
60154 else if (type == 711)
60155 {
60157 }
60158 else if (type == 704)
60159 {
60161 if (activeSound != null)
60162 {
60163 activeSound.Volume = 0f;
60164 activeSound.Stop();
60165 }
60166 }
60167 if (type == 710)
60168 {
60169 ai[1] = -1f;
60170 position = base.Center;
60171 width = (height = 40);
60172 base.Center = position;
60173 Damage();
60175 for (int num71 = 0; num71 < 2; num71++)
60176 {
60177 int num72 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 100, default(Color), 1.5f);
60178 Main.dust[num72].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * width / 2f;
60179 }
60180 for (int num73 = 0; num73 < 10; num73++)
60181 {
60182 int num74 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 0, default(Color), 2.5f);
60183 Main.dust[num74].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * width / 2f;
60184 Main.dust[num74].noGravity = true;
60186 dust2.velocity *= 2f;
60187 }
60188 for (int num75 = 0; num75 < 5; num75++)
60189 {
60190 int num76 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 0, default(Color), 1.5f);
60191 Main.dust[num76].position = base.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy(velocity.ToRotation()) * width / 2f;
60192 Main.dust[num76].noGravity = true;
60194 dust2.velocity *= 2f;
60195 }
60196 }
60197 else if (type == 711)
60198 {
60199 Rectangle hitbox = base.Hitbox;
60200 for (int num77 = 0; num77 < oldPos.Length / 2; num77 += 2)
60201 {
60202 hitbox.X = (int)oldPos[num77].X;
60203 hitbox.Y = (int)oldPos[num77].Y;
60204 for (int num78 = 0; num78 < 2; num78++)
60205 {
60206 int num79 = Utils.SelectRandom<int>(Main.rand, 6, 55, 158);
60207 int num80 = Dust.NewDust(hitbox.TopLeft(), width, height, num79, direction, -2.5f);
60208 Main.dust[num80].alpha = 200;
60210 dust2.velocity *= 2.4f;
60211 dust2 = Main.dust[num80];
60212 dust2.scale += Main.rand.NextFloat();
60213 dust2 = Main.dust[num80];
60214 dust2.scale -= 0.5f;
60215 if (Main.dust[num80].type == 55)
60216 {
60217 Main.dust[num80].color = Color.Lerp(new Color(128, 0, 180, 128), Color.Gold, Main.rand.NextFloat());
60218 }
60219 Main.dust[num80].noLight = true;
60220 }
60221 }
60222 for (int num81 = 10; num81 < oldPos.Length; num81 += 2)
60223 {
60224 hitbox.X = (int)oldPos[num81].X;
60225 hitbox.Y = (int)oldPos[num81].Y;
60226 for (int num82 = 0; num82 < 2; num82++)
60227 {
60228 if (Main.rand.Next(3) != 0)
60229 {
60230 int num83 = Utils.SelectRandom<int>(Main.rand, 55);
60231 int num84 = Dust.NewDust(hitbox.TopLeft(), width, height, num83, direction, -2.5f);
60232 Main.dust[num84].alpha = 120;
60234 dust2.velocity *= 2.4f;
60235 dust2 = Main.dust[num84];
60236 dust2.scale += Main.rand.NextFloat() * 0.7f;
60237 dust2 = Main.dust[num84];
60238 dust2.scale -= 0.5f;
60239 if (Main.dust[num84].type == 55)
60240 {
60241 Main.dust[num84].color = Color.Lerp(Color.Purple, Color.Black, Main.rand.NextFloat());
60242 }
60243 Main.dust[num84].noLight = true;
60244 }
60245 }
60246 }
60247 for (int num85 = 5; num85 < oldPos.Length; num85++)
60248 {
60249 hitbox.X = (int)oldPos[num85].X;
60250 hitbox.Y = (int)oldPos[num85].Y;
60251 for (int num86 = 0; num86 < 1; num86++)
60252 {
60253 if (Main.rand.Next(3) != 0)
60254 {
60255 int num87 = Utils.SelectRandom<int>(Main.rand, 55);
60256 int num88 = Dust.NewDust(hitbox.TopLeft(), width, height, num87, direction, -2.5f);
60257 Main.dust[num88].alpha = 80;
60259 dust2.velocity *= 0.3f;
60260 dust2 = Main.dust[num88];
60261 dust2.velocity += velocity * 0.5f;
60262 dust2 = Main.dust[num88];
60263 dust2.scale += Main.rand.NextFloat() * 0.7f;
60264 dust2 = Main.dust[num88];
60265 dust2.scale -= 0.5f;
60266 if (Main.dust[num88].type == 55)
60267 {
60268 Main.dust[num88].color = Color.Lerp(Color.Purple, Color.Black, Main.rand.NextFloat());
60269 }
60270 Main.dust[num88].noLight = true;
60271 }
60272 }
60273 }
60274 for (int num89 = 0; num89 < 20; num89++)
60275 {
60276 if (Main.rand.Next(3) != 0)
60277 {
60278 int num90 = 228;
60279 Dust dust23 = Main.dust[Dust.NewDust(position, width, height, num90)];
60280 dust23.noGravity = true;
60281 dust23.scale = 1.25f + Main.rand.NextFloat();
60282 dust23.fadeIn = 1.5f;
60283 Dust dust2 = dust23;
60284 dust2.velocity *= 6f;
60285 dust23.noLight = true;
60286 }
60287 }
60288 for (int num91 = 0; num91 < 20; num91++)
60289 {
60290 if (Main.rand.Next(3) != 0)
60291 {
60292 int num92 = 55;
60293 Dust dust24 = Main.dust[Dust.NewDust(position, width, height, num92)];
60294 dust24.noGravity = true;
60295 dust24.scale = 1.25f + Main.rand.NextFloat();
60296 dust24.fadeIn = 1.5f;
60297 Dust dust2 = dust24;
60298 dust2.velocity *= 6f;
60299 dust24.noLight = true;
60300 dust24.color = new Color(0, 0, 220, 128);
60301 }
60302 }
60303 if (owner == Main.myPlayer)
60304 {
60305 position = base.Center;
60306 base.Size = new Vector2(140f);
60307 base.Center = position;
60308 penetrate = -1;
60309 usesLocalNPCImmunity = true;
60310 localNPCHitCooldown = -1;
60311 Damage();
60312 }
60313 }
60314 else if (type == 662 || type == 685)
60315 {
60316 SoundEngine.PlaySound(0, (int)position.X, (int)position.Y);
60317 Vector2 vector20 = oldVelocity.SafeNormalize(Vector2.Zero);
60318 Vector2 vector21 = position + vector20 * 16f;
60319 for (int num93 = 0; num93 < 16; num93++)
60320 {
60321 if (Main.rand.Next(2) == 0)
60322 {
60323 vector21 -= vector20 * 8f;
60324 continue;
60325 }
60326 Dust dust25 = Dust.NewDustDirect(vector21, width, height, 11);
60327 dust25.position = (dust25.position + base.Center) / 2f;
60328 Dust dust2 = dust25;
60329 dust2.velocity += oldVelocity * 0.4f;
60330 dust2 = dust25;
60331 dust2.velocity *= 0.5f;
60332 dust25.noGravity = true;
60333 vector21 -= vector20 * 8f;
60334 }
60335 }
60336 if (type == 680)
60337 {
60338 SoundEngine.PlaySound(0, (int)position.X, (int)position.Y);
60339 Vector2 vector22 = oldVelocity.SafeNormalize(Vector2.Zero);
60340 Vector2 vector23 = position + vector22 * 16f;
60341 for (int num94 = 0; num94 < 16; num94++)
60342 {
60343 if (Main.rand.Next(2) == 0)
60344 {
60345 vector23 -= vector22 * 8f;
60346 continue;
60347 }
60348 Dust dust26 = Dust.NewDustDirect(vector23, width, height, 11);
60349 dust26.position = (dust26.position + base.Center) / 2f;
60350 Dust dust2 = dust26;
60351 dust2.velocity += oldVelocity * 0.4f;
60352 dust2 = dust26;
60353 dust2.velocity *= 0.5f;
60354 dust26.noGravity = true;
60355 vector23 -= vector22 * 8f;
60356 }
60357 Dust.NewDustDirect(position, width, height, 11, 0f, 0f, 0, Color.Red, 1.6f).noGravity = true;
60358 }
60359 if (type == 664 || type == 666 || type == 668 || type == 706)
60360 {
60361 int num95 = 4;
60362 int num96 = 20;
60363 int num97 = 10;
60364 int num98 = 20;
60365 int num99 = 20;
60366 int num100 = 4;
60367 float num101 = 1.5f;
60368 int num102 = 6;
60369 int num103 = 6;
60370 if (Main.player[owner].setApprenticeT3)
60371 {
60372 num95 += 4;
60373 num99 += 10;
60374 num96 += 20;
60375 num98 += 30;
60376 num97 /= 2;
60377 num100 += 4;
60378 num101 += 0.5f;
60379 num102 += 7;
60380 num103 = 270;
60381 }
60382 position = base.Center;
60383 width = (height = 16 * num102);
60384 base.Center = position;
60385 Damage();
60387 for (int num104 = 0; num104 < num95; num104++)
60388 {
60389 int num105 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 100, default(Color), 1.5f);
60390 Main.dust[num105].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * width / 2f;
60391 }
60392 for (int num106 = 0; num106 < num96; num106++)
60393 {
60394 Dust dust27 = Dust.NewDustDirect(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 200, default(Color), 2.5f);
60395 dust27.position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * width / 10f;
60396 Dust dust2 = dust27;
60397 dust2.velocity *= 16f;
60398 if (dust27.velocity.Y > -2f)
60399 {
60400 dust27.velocity.Y *= -0.4f;
60401 }
60402 dust27.noLight = true;
60403 dust27.noGravity = true;
60404 }
60405 for (int num107 = 0; num107 < num98; num107++)
60406 {
60407 Dust dust28 = Dust.NewDustDirect(new Vector2(position.X, position.Y), width, height, num103, 0f, 0f, 100, default(Color), 1.5f);
60408 dust28.position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * width / 2f;
60409 Dust dust2 = dust28;
60410 dust2.velocity *= 2f;
60411 dust28.noGravity = true;
60412 dust28.fadeIn = num101;
60413 }
60414 for (int num108 = 0; num108 < num97; num108++)
60415 {
60416 int num109 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 0, default(Color), 2.7f);
60417 Main.dust[num109].position = base.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy(velocity.ToRotation()) * width / 2f;
60418 Main.dust[num109].noGravity = true;
60420 dust2.velocity *= 3f;
60421 }
60422 for (int num110 = 0; num110 < num99; num110++)
60423 {
60424 int num111 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 0, default(Color), 1.5f);
60425 Main.dust[num111].position = base.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy(velocity.ToRotation()) * width / 2f;
60426 Main.dust[num111].noGravity = true;
60428 dust2.velocity *= 3f;
60429 }
60430 for (int num112 = 0; num112 < num100; num112++)
60431 {
60432 int num113 = 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));
60433 Main.gore[num113].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * width / 2f;
60435 gore2.position -= Vector2.One * 16f;
60436 if (Main.rand.Next(2) == 0)
60437 {
60438 Main.gore[num113].position.Y -= 30f;
60439 }
60440 gore2 = Main.gore[num113];
60441 gore2.velocity *= 0.3f;
60442 Main.gore[num113].velocity.X += (float)Main.rand.Next(-10, 11) * 0.05f;
60443 Main.gore[num113].velocity.Y += (float)Main.rand.Next(-10, 11) * 0.05f;
60444 }
60445 }
60446 else if (type == 681)
60447 {
60448 position.X += width / 2;
60449 position.Y += height / 2;
60451 width = 22;
60452 height = 22;
60453 position.X -= width / 2;
60454 position.Y -= height / 2;
60455 for (int num114 = 0; num114 < 10; num114++)
60456 {
60457 int num115 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 100, default(Color), 1.5f);
60459 dust2.velocity *= 1.4f;
60460 num115 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100, default(Color), 1.5f);
60461 dust2 = Main.dust[num115];
60462 dust2.velocity *= 1.4f;
60463 Main.dust[num115].noGravity = true;
60464 Main.dust[num115].fadeIn = 2f;
60465 }
60466 for (int num116 = 0; num116 < 10; num116++)
60467 {
60468 int num117 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100, default(Color), 2.5f);
60469 Main.dust[num117].noGravity = true;
60471 dust2.velocity *= 5f;
60472 num117 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100, default(Color), 1.5f);
60473 dust2 = Main.dust[num117];
60474 dust2.velocity *= 3f;
60475 }
60476 int num118 = Gore.NewGore(new Vector2(position.X, position.Y), default(Vector2), Main.rand.Next(61, 64));
60478 gore2.velocity *= 0.4f;
60479 Main.gore[num118].velocity.X += 1f;
60480 Main.gore[num118].velocity.Y += 1f;
60481 num118 = Gore.NewGore(new Vector2(position.X, position.Y), default(Vector2), Main.rand.Next(61, 64));
60482 gore2 = Main.gore[num118];
60483 gore2.velocity *= 0.4f;
60484 Main.gore[num118].velocity.X -= 1f;
60485 Main.gore[num118].velocity.Y += 1f;
60486 num118 = Gore.NewGore(new Vector2(position.X, position.Y), default(Vector2), Main.rand.Next(61, 64));
60487 gore2 = Main.gore[num118];
60488 gore2.velocity *= 0.4f;
60489 Main.gore[num118].velocity.X += 1f;
60490 Main.gore[num118].velocity.Y -= 1f;
60491 num118 = Gore.NewGore(new Vector2(position.X, position.Y), default(Vector2), Main.rand.Next(61, 64));
60492 gore2 = Main.gore[num118];
60493 gore2.velocity *= 0.4f;
60494 Main.gore[num118].velocity.X -= 1f;
60495 Main.gore[num118].velocity.Y -= 1f;
60496 position.X += width / 2;
60497 position.Y += height / 2;
60498 width = 80;
60499 height = 80;
60500 position.X -= width / 2;
60501 position.Y -= height / 2;
60502 Damage();
60503 }
60504 if (type == 669)
60505 {
60506 SoundEngine.PlaySound(13, (int)position.X, (int)position.Y);
60507 Vector2 vector24 = new Vector2(20f, 20f);
60508 for (int num119 = 0; num119 < 10; num119++)
60509 {
60510 Dust dust29 = Dust.NewDustDirect(base.Center - vector24 / 2f, (int)vector24.X, (int)vector24.Y, 4, 0f, 0f, 100, new Color(255, 255, 255, 110), 1.1f);
60511 Dust dust2 = dust29;
60512 dust2.velocity *= 1.4f;
60513 }
60514 for (int num120 = 0; num120 < 40; num120++)
60515 {
60516 Dust dust30 = Dust.NewDustDirect(base.Center - vector24 / 2f, (int)vector24.X, (int)vector24.Y, 4, 0f, 0f, 50, new Color(245, 200, 30, 155), 1.2f);
60517 dust30.noGravity = true;
60518 Dust dust2 = dust30;
60519 dust2.velocity *= 4f;
60520 dust30 = Dust.NewDustDirect(base.Center - vector24 / 2f, (int)vector24.X, (int)vector24.Y, 4, 0f, 0f, 50, new Color(245, 200, 30, 155), 0.8f);
60521 dust2 = dust30;
60522 dust2.velocity *= 2f;
60523 }
60524 }
60525 if (Main.myPlayer == owner && bobber)
60526 {
60528 if (ai[1] > 0f && ai[1] < (float)ItemID.Count)
60529 {
60530 AI_061_FishingBobber_GiveItemToPlayer(Main.player[owner], (int)ai[1]);
60531 }
60532 ai[1] = 0f;
60533 }
60534 if (type == 634 || type == 635)
60535 {
60536 int num121 = Utils.SelectRandom<int>(Main.rand, 242, 73, 72, 71, 255);
60537 int num122 = 255;
60538 int num123 = 255;
60539 int num124 = 50;
60540 float num125 = 1.7f;
60541 float num126 = 0.8f;
60542 float num127 = 2f;
60543 Vector2 vector25 = (rotation - (float)Math.PI / 2f).ToRotationVector2();
60544 Vector2 vector26 = vector25 * velocity.Length() * MaxUpdates;
60545 if (type == 635)
60546 {
60547 num122 = 88;
60548 num123 = 88;
60549 num121 = Utils.SelectRandom<int>(Main.rand, 242, 59, 88);
60550 num125 = 3.7f;
60551 num126 = 1.5f;
60552 num127 = 2.2f;
60553 vector26 *= 0.5f;
60554 }
60556 position = base.Center;
60557 width = (height = num124);
60558 base.Center = position;
60559 maxPenetrate = -1;
60560 penetrate = -1;
60561 Damage();
60562 for (int num128 = 0; num128 < 40; num128++)
60563 {
60564 num121 = Utils.SelectRandom<int>(Main.rand, 242, 73, 72, 71, 255);
60565 if (type == 635)
60566 {
60567 num121 = Utils.SelectRandom<int>(Main.rand, 242, 59, 88);
60568 }
60569 int num129 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, num121, 0f, 0f, 200, default(Color), num125);
60570 Main.dust[num129].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * width / 2f;
60571 Main.dust[num129].noGravity = true;
60573 dust2.velocity *= 3f;
60574 dust2 = Main.dust[num129];
60575 dust2.velocity += vector26 * Main.rand.NextFloat();
60576 num129 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, num122, 0f, 0f, 100, default(Color), num126);
60577 Main.dust[num129].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * width / 2f;
60578 dust2 = Main.dust[num129];
60579 dust2.velocity *= 2f;
60580 Main.dust[num129].noGravity = true;
60581 Main.dust[num129].fadeIn = 1f;
60582 Main.dust[num129].color = Color.Crimson * 0.5f;
60583 dust2 = Main.dust[num129];
60584 dust2.velocity += vector26 * Main.rand.NextFloat();
60585 }
60586 for (int num130 = 0; num130 < 20; num130++)
60587 {
60588 int num131 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, num123, 0f, 0f, 0, default(Color), num127);
60589 Main.dust[num131].position = base.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy(velocity.ToRotation()) * width / 3f;
60590 Main.dust[num131].noGravity = true;
60592 dust2.velocity *= 0.5f;
60593 dust2 = Main.dust[num131];
60594 dust2.velocity += vector26 * (0.6f + 0.6f * Main.rand.NextFloat());
60595 }
60596 }
60597 else if (type == 651)
60598 {
60599 if (localAI[0] == 1f && owner == Main.myPlayer)
60600 {
60601 Player master = Main.player[owner];
60602 Point ps = new Vector2(ai[0], ai[1]).ToPoint();
60603 Point pe = base.Center.ToTileCoordinates();
60604 if (Main.netMode == 1)
60605 {
60606 NetMessage.SendData(109, -1, -1, null, ps.X, ps.Y, pe.X, pe.Y, (int)WiresUI.Settings.ToolMode);
60607 }
60608 else
60609 {
60610 Wiring.MassWireOperation(ps, pe, master);
60611 }
60612 }
60613 }
60614 else if (type == 641)
60615 {
60616 if (owner == Main.myPlayer)
60617 {
60618 for (int num132 = 0; num132 < 1000; num132++)
60619 {
60620 if (Main.projectile[num132].active && Main.projectile[num132].owner == owner && Main.projectile[num132].type == 642)
60621 {
60622 Main.projectile[num132].Kill();
60623 }
60624 }
60625 }
60626 }
60627 else if (type == 643)
60628 {
60629 if (owner == Main.myPlayer)
60630 {
60631 for (int num133 = 0; num133 < 1000; num133++)
60632 {
60633 if (Main.projectile[num133].active && Main.projectile[num133].owner == owner && Main.projectile[num133].type == 644)
60634 {
60635 Main.projectile[num133].Kill();
60636 }
60637 }
60638 }
60639 }
60640 else if (type == 645)
60641 {
60642 bool flag2 = WorldGen.SolidTile(Framing.GetTileSafely((int)position.X / 16, (int)position.Y / 16));
60643 for (int num134 = 0; num134 < 4; num134++)
60644 {
60645 Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 100, default(Color), 1.5f);
60646 }
60647 for (int num135 = 0; num135 < 4; num135++)
60648 {
60649 int num136 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 229, 0f, 0f, 0, default(Color), 2.5f);
60650 Main.dust[num136].noGravity = true;
60652 dust2.velocity *= 3f;
60653 if (flag2)
60654 {
60655 Main.dust[num136].noLight = true;
60656 }
60657 num136 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 229, 0f, 0f, 100, default(Color), 1.5f);
60658 dust2 = Main.dust[num136];
60659 dust2.velocity *= 2f;
60660 Main.dust[num136].noGravity = true;
60661 if (flag2)
60662 {
60663 Main.dust[num136].noLight = true;
60664 }
60665 }
60666 for (int num137 = 0; num137 < 1; num137++)
60667 {
60668 int num138 = 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));
60670 gore2.velocity *= 0.3f;
60671 Main.gore[num138].velocity.X += (float)Main.rand.Next(-10, 11) * 0.05f;
60672 Main.gore[num138].velocity.Y += (float)Main.rand.Next(-10, 11) * 0.05f;
60673 }
60674 }
60675 else if (type == 636)
60676 {
60677 Rectangle hitbox2 = base.Hitbox;
60678 for (int num139 = 0; num139 < 6; num139 += 3)
60679 {
60680 hitbox2.X = (int)oldPos[num139].X;
60681 hitbox2.Y = (int)oldPos[num139].Y;
60682 for (int num140 = 0; num140 < 5; num140++)
60683 {
60684 int num141 = Utils.SelectRandom<int>(Main.rand, 6, 259, 158);
60685 int num142 = Dust.NewDust(hitbox2.TopLeft(), width, height, num141, 2.5f * (float)direction, -2.5f);
60686 Main.dust[num142].alpha = 200;
60688 dust2.velocity *= 2.4f;
60689 dust2 = Main.dust[num142];
60690 dust2.scale += Main.rand.NextFloat();
60691 }
60692 }
60693 if (Main.myPlayer == owner)
60694 {
60695 NewProjectile(GetProjectileSource_FromThis(), base.Center.X, base.Center.Y, 0f, 0f, 953, damage, 10f, owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f);
60696 }
60697 }
60698 else if (type == 614)
60699 {
60700 for (int num143 = 0; num143 < 10; num143++)
60701 {
60702 Dust dust31 = Main.dust[Dust.NewDust(position, width, height, 229)];
60703 dust31.noGravity = true;
60704 Dust dust2 = dust31;
60705 dust2.velocity *= 3f;
60706 }
60707 }
60708 if (type == 644)
60709 {
60710 DoRainbowCrystalStaffExplosion();
60711 if (Main.myPlayer == owner)
60712 {
60713 friendly = true;
60714 int num144 = width;
60715 int num145 = height;
60716 int num146 = penetrate;
60717 position = base.Center;
60718 width = (height = 60);
60719 base.Center = position;
60720 penetrate = -1;
60721 maxPenetrate = -1;
60722 Damage();
60723 penetrate = num146;
60724 position = base.Center;
60725 width = num144;
60726 height = num145;
60727 base.Center = position;
60728 }
60729 }
60730 if (type == 608)
60731 {
60732 maxPenetrate = -1;
60733 penetrate = -1;
60734 Damage();
60736 for (int num147 = 0; num147 < 4; num147++)
60737 {
60738 int num148 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 100, default(Color), 1.5f);
60739 Main.dust[num148].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * width / 2f;
60740 }
60741 for (int num149 = 0; num149 < 30; num149++)
60742 {
60743 int num150 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 200, default(Color), 3.7f);
60744 Main.dust[num150].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * width / 2f;
60745 Main.dust[num150].noGravity = true;
60747 dust2.velocity *= 3f;
60748 Main.dust[num150].shader = GameShaders.Armor.GetSecondaryShader(Main.player[owner].ArmorSetDye(), Main.player[owner]);
60749 num150 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100, default(Color), 1.5f);
60750 Main.dust[num150].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * width / 2f;
60751 dust2 = Main.dust[num150];
60752 dust2.velocity *= 2f;
60753 Main.dust[num150].noGravity = true;
60754 Main.dust[num150].fadeIn = 2.5f;
60755 Main.dust[num150].shader = GameShaders.Armor.GetSecondaryShader(Main.player[owner].ArmorSetDye(), Main.player[owner]);
60756 }
60757 for (int num151 = 0; num151 < 10; num151++)
60758 {
60759 int num152 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 0, default(Color), 2.7f);
60760 Main.dust[num152].position = base.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy(velocity.ToRotation()) * width / 2f;
60761 Main.dust[num152].noGravity = true;
60763 dust2.velocity *= 3f;
60764 Main.dust[num152].shader = GameShaders.Armor.GetSecondaryShader(Main.player[owner].ArmorSetDye(), Main.player[owner]);
60765 }
60766 for (int num153 = 0; num153 < 10; num153++)
60767 {
60768 int num154 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 0, default(Color), 1.5f);
60769 Main.dust[num154].position = base.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy(velocity.ToRotation()) * width / 2f;
60770 Main.dust[num154].noGravity = true;
60772 dust2.velocity *= 3f;
60773 }
60774 for (int num155 = 0; num155 < 2; num155++)
60775 {
60776 int num156 = 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));
60777 Main.gore[num156].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * width / 2f;
60779 gore2.velocity *= 0.3f;
60780 Main.gore[num156].velocity.X += (float)Main.rand.Next(-10, 11) * 0.05f;
60781 Main.gore[num156].velocity.Y += (float)Main.rand.Next(-10, 11) * 0.05f;
60782 }
60783 }
60784 else if (type == 661)
60785 {
60786 position = base.Center;
60787 width = (height = 160);
60788 base.Center = position;
60789 maxPenetrate = -1;
60790 penetrate = -1;
60791 Damage();
60793 Vector2 vector27 = base.Center + Vector2.One * -20f;
60794 int num157 = 40;
60795 int num158 = num157;
60796 for (int num159 = 0; num159 < 4; num159++)
60797 {
60798 int num160 = Dust.NewDust(vector27, num157, num158, 240, 0f, 0f, 100, default(Color), 1.5f);
60799 Main.dust[num160].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * num157 / 2f;
60800 }
60801 for (int num161 = 0; num161 < 20; num161++)
60802 {
60803 int num162 = Dust.NewDust(vector27, num157, num158, 62, 0f, 0f, 200, default(Color), 3.7f);
60804 Main.dust[num162].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * num157 / 2f;
60805 Main.dust[num162].noGravity = true;
60806 Main.dust[num162].noLight = true;
60808 dust2.velocity *= 3f;
60809 dust2 = Main.dust[num162];
60810 dust2.velocity += DirectionTo(Main.dust[num162].position) * (2f + Main.rand.NextFloat() * 4f);
60811 num162 = Dust.NewDust(vector27, num157, num158, 62, 0f, 0f, 100, default(Color), 1.5f);
60812 Main.dust[num162].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * num157 / 2f;
60813 dust2 = Main.dust[num162];
60814 dust2.velocity *= 2f;
60815 Main.dust[num162].noGravity = true;
60816 Main.dust[num162].fadeIn = 1f;
60817 Main.dust[num162].color = Color.Crimson * 0.5f;
60818 Main.dust[num162].noLight = true;
60819 dust2 = Main.dust[num162];
60820 dust2.velocity += DirectionTo(Main.dust[num162].position) * 8f;
60821 }
60822 for (int num163 = 0; num163 < 20; num163++)
60823 {
60824 int num164 = Dust.NewDust(vector27, num157, num158, 62, 0f, 0f, 0, default(Color), 2.7f);
60825 Main.dust[num164].position = base.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy(velocity.ToRotation()) * num157 / 2f;
60826 Main.dust[num164].noGravity = true;
60827 Main.dust[num164].noLight = true;
60829 dust2.velocity *= 3f;
60830 dust2 = Main.dust[num164];
60831 dust2.velocity += DirectionTo(Main.dust[num164].position) * 2f;
60832 }
60833 for (int num165 = 0; num165 < 70; num165++)
60834 {
60835 int num166 = Dust.NewDust(vector27, num157, num158, 240, 0f, 0f, 0, default(Color), 1.5f);
60836 Main.dust[num166].position = base.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy(velocity.ToRotation()) * num157 / 2f;
60837 Main.dust[num166].noGravity = true;
60839 dust2.velocity *= 3f;
60840 dust2 = Main.dust[num166];
60841 dust2.velocity += DirectionTo(Main.dust[num166].position) * 3f;
60842 }
60843 }
60844 else if (type == 617)
60845 {
60846 position = base.Center;
60847 width = (height = 176);
60848 base.Center = position;
60849 maxPenetrate = -1;
60850 penetrate = -1;
60851 Damage();
60853 for (int num167 = 0; num167 < 4; num167++)
60854 {
60855 int num168 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 240, 0f, 0f, 100, default(Color), 1.5f);
60856 Main.dust[num168].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * width / 2f;
60857 }
60858 for (int num169 = 0; num169 < 30; num169++)
60859 {
60860 int num170 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 62, 0f, 0f, 200, default(Color), 3.7f);
60861 Main.dust[num170].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * width / 2f;
60862 Main.dust[num170].noGravity = true;
60864 dust2.velocity *= 3f;
60865 num170 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 90, 0f, 0f, 100, default(Color), 1.5f);
60866 Main.dust[num170].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * width / 2f;
60867 dust2 = Main.dust[num170];
60868 dust2.velocity *= 2f;
60869 Main.dust[num170].noGravity = true;
60870 Main.dust[num170].fadeIn = 1f;
60871 Main.dust[num170].color = Color.Crimson * 0.5f;
60872 }
60873 for (int num171 = 0; num171 < 10; num171++)
60874 {
60875 int num172 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 62, 0f, 0f, 0, default(Color), 2.7f);
60876 Main.dust[num172].position = base.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy(velocity.ToRotation()) * width / 2f;
60877 Main.dust[num172].noGravity = true;
60879 dust2.velocity *= 3f;
60880 }
60881 for (int num173 = 0; num173 < 10; num173++)
60882 {
60883 int num174 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 240, 0f, 0f, 0, default(Color), 1.5f);
60884 Main.dust[num174].position = base.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy(velocity.ToRotation()) * width / 2f;
60885 Main.dust[num174].noGravity = true;
60887 dust2.velocity *= 3f;
60888 }
60889 for (int num175 = 0; num175 < 2; num175++)
60890 {
60891 int num176 = 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));
60892 Main.gore[num176].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * width / 2f;
60894 gore2.velocity *= 0.3f;
60895 Main.gore[num176].velocity.X += (float)Main.rand.Next(-10, 11) * 0.05f;
60896 Main.gore[num176].velocity.Y += (float)Main.rand.Next(-10, 11) * 0.05f;
60897 }
60898 if (Main.myPlayer == owner)
60899 {
60900 for (int num177 = 0; num177 < 1000; num177++)
60901 {
60902 if (Main.projectile[num177].active && Main.projectile[num177].type == 618 && Main.projectile[num177].ai[1] == (float)whoAmI)
60903 {
60904 Main.projectile[num177].Kill();
60905 }
60906 }
60907 int num178 = Main.rand.Next(5, 9);
60908 int num179 = Main.rand.Next(5, 9);
60909 int num180 = Utils.SelectRandom<int>(Main.rand, 86, 90);
60910 int num181 = ((num180 == 86) ? 90 : 86);
60911 for (int num182 = 0; num182 < num178; num182++)
60912 {
60913 Vector2 vector28 = base.Center + Utils.RandomVector2(Main.rand, -30f, 30f);
60914 Vector2 vector29 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101));
60915 while (vector29.X == 0f && vector29.Y == 0f)
60916 {
60917 vector29 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101));
60918 }
60919 vector29.Normalize();
60920 if (vector29.Y > 0.2f)
60921 {
60922 vector29.Y *= -1f;
60923 }
60924 vector29 *= (float)Main.rand.Next(70, 101) * 0.1f;
60925 NewProjectile(GetProjectileSource_FromThis(), vector28.X, vector28.Y, vector29.X, vector29.Y, 620, (int)((double)damage * 0.65), knockBack * 0.8f, owner, num180);
60926 }
60927 for (int num183 = 0; num183 < num179; num183++)
60928 {
60929 Vector2 vector30 = base.Center + Utils.RandomVector2(Main.rand, -30f, 30f);
60930 Vector2 vector31 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101));
60931 while (vector31.X == 0f && vector31.Y == 0f)
60932 {
60933 vector31 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101));
60934 }
60935 vector31.Normalize();
60936 if (vector31.Y > 0.4f)
60937 {
60938 vector31.Y *= -1f;
60939 }
60940 vector31 *= (float)Main.rand.Next(40, 81) * 0.1f;
60941 NewProjectile(GetProjectileSource_FromThis(), vector30.X, vector30.Y, vector31.X, vector31.Y, 620, (int)((double)damage * 0.65), knockBack * 0.8f, owner, num181);
60942 }
60943 }
60944 }
60945 else if (type == 658)
60946 {
60947 for (int num184 = 0; num184 < 10; num184++)
60948 {
60949 int num185 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 269, velocity.X * 0.1f, velocity.Y * 0.1f, 0, default(Color), 0.5f);
60950 Dust dust2;
60951 if (Main.rand.Next(3) == 0)
60952 {
60953 Main.dust[num185].fadeIn = 0.75f + (float)Main.rand.Next(-10, 11) * 0.01f;
60954 Main.dust[num185].scale = 0.25f + (float)Main.rand.Next(-10, 11) * 0.005f;
60955 dust2 = Main.dust[num185];
60956 dust2.type++;
60957 }
60958 else
60959 {
60960 Main.dust[num185].scale = 1f + (float)Main.rand.Next(-10, 11) * 0.01f;
60961 }
60962 Main.dust[num185].noGravity = true;
60963 dust2 = Main.dust[num185];
60964 dust2.velocity *= 1.25f;
60965 dust2 = Main.dust[num185];
60966 dust2.velocity -= oldVelocity / 10f;
60967 }
60968 }
60969 else if (type == 620 || type == 618)
60970 {
60971 if (type == 618)
60972 {
60973 ai[0] = 86f;
60974 }
60975 for (int num186 = 0; num186 < 10; num186++)
60976 {
60977 int num187 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, (int)ai[0], velocity.X * 0.1f, velocity.Y * 0.1f, 0, default(Color), 0.5f);
60978 Dust dust2;
60979 if (Main.rand.Next(3) == 0)
60980 {
60981 Main.dust[num187].fadeIn = 0.75f + (float)Main.rand.Next(-10, 11) * 0.01f;
60982 Main.dust[num187].scale = 0.25f + (float)Main.rand.Next(-10, 11) * 0.005f;
60983 dust2 = Main.dust[num187];
60984 dust2.type++;
60985 }
60986 else
60987 {
60988 Main.dust[num187].scale = 1f + (float)Main.rand.Next(-10, 11) * 0.01f;
60989 }
60990 Main.dust[num187].noGravity = true;
60991 dust2 = Main.dust[num187];
60992 dust2.velocity *= 1.25f;
60993 dust2 = Main.dust[num187];
60994 dust2.velocity -= oldVelocity / 10f;
60995 }
60996 }
60997 else if (type == 619)
60998 {
61000 for (int num188 = 0; num188 < 20; num188++)
61001 {
61002 int num189 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, (int)ai[0], velocity.X * 0.1f, velocity.Y * 0.1f, 0, default(Color), 0.5f);
61003 Dust dust2;
61004 if (Main.rand.Next(3) == 0)
61005 {
61006 Main.dust[num189].fadeIn = 1.1f + (float)Main.rand.Next(-10, 11) * 0.01f;
61007 Main.dust[num189].scale = 0.35f + (float)Main.rand.Next(-10, 11) * 0.01f;
61008 dust2 = Main.dust[num189];
61009 dust2.type++;
61010 }
61011 else
61012 {
61013 Main.dust[num189].scale = 1.2f + (float)Main.rand.Next(-10, 11) * 0.01f;
61014 }
61015 Main.dust[num189].noGravity = true;
61016 dust2 = Main.dust[num189];
61017 dust2.velocity *= 2.5f;
61018 dust2 = Main.dust[num189];
61019 dust2.velocity -= oldVelocity / 10f;
61020 }
61021 if (Main.myPlayer == owner)
61022 {
61023 int num190 = Main.rand.Next(3, 6);
61024 for (int num191 = 0; num191 < num190; num191++)
61025 {
61026 Vector2 vector32 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101));
61027 while (vector32.X == 0f && vector32.Y == 0f)
61028 {
61029 vector32 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101));
61030 }
61031 vector32.Normalize();
61032 vector32 *= (float)Main.rand.Next(70, 101) * 0.1f;
61033 NewProjectile(GetProjectileSource_FromThis(), oldPosition.X + (float)(width / 2), oldPosition.Y + (float)(height / 2), vector32.X, vector32.Y, 620, (int)((double)damage * 0.8), knockBack * 0.8f, owner, ai[0]);
61034 }
61035 }
61036 }
61037 if (type == 601)
61038 {
61039 Color portalColor = PortalHelper.GetPortalColor(owner, (int)ai[0]);
61040 Color color = portalColor;
61041 color.A = byte.MaxValue;
61042 for (int num192 = 0; num192 < 6; num192++)
61043 {
61044 Vector2 vector33 = Vector2.UnitY.RotatedByRandom(6.2831854820251465) * (3f * Main.rand.NextFloat());
61045 Dust dust32 = Main.dust[Dust.NewDust(base.Center, 0, 0, 263)];
61046 dust32.position = base.Center;
61047 dust32.velocity = vector33 + velocity / 5f;
61048 dust32.color = color;
61049 dust32.scale = 2f;
61050 dust32.noLight = true;
61051 dust32.noGravity = true;
61052 }
61053 }
61054 if (type == 596)
61055 {
61056 position = base.Center;
61057 width = (height = 60);
61058 base.Center = position;
61059 int num193 = 30;
61060 if (Main.expertMode)
61061 {
61062 num193 = 22;
61063 }
61064 damage = num193;
61065 Damage();
61067 for (int num194 = 0; num194 < 4; num194++)
61068 {
61069 int num195 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 100, default(Color), 1.5f);
61070 Main.dust[num195].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * width / 2f;
61071 }
61072 for (int num196 = 0; num196 < 20; num196++)
61073 {
61074 int num197 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 27, 0f, 0f, 0, default(Color), 2.5f);
61075 Main.dust[num197].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * width / 2f;
61076 Main.dust[num197].noGravity = true;
61078 dust2.velocity *= 2f;
61079 }
61080 for (int num198 = 0; num198 < 10; num198++)
61081 {
61082 int num199 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 0, default(Color), 1.5f);
61083 Main.dust[num199].position = base.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy(velocity.ToRotation()) * width / 2f;
61084 Main.dust[num199].noGravity = true;
61086 dust2.velocity *= 2f;
61087 }
61088 }
61089 if (type == 659)
61090 {
61091 if (ai[0] >= 0f)
61092 {
61093 int num200 = 80;
61094 position = base.Center;
61095 width = (height = num200);
61096 base.Center = position;
61097 Damage();
61099 int num201 = 15;
61100 int num202 = num201 + 15;
61101 for (int num203 = 0; num203 < num202; num203++)
61102 {
61103 int num204 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 27, 0f, 0f, 0, default(Color), 2f + Main.rand.NextFloat() * 0.5f);
61104 Main.dust[num204].noGravity = true;
61105 if (num203 < num201)
61106 {
61107 float num205 = (float)(num203 + 1) / (float)num201 * ((float)Math.PI * 2f);
61108 Main.dust[num204].fadeIn = 1.5f + Main.rand.NextFloat() * 0.5f;
61109 Main.dust[num204].position = base.Center;
61110 Main.dust[num204].velocity = Vector2.UnitY.RotatedBy(num205) * (5f + Main.rand.NextFloat() * 1.5f);
61111 }
61112 else
61113 {
61114 Main.dust[num204].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * Main.rand.NextFloat() * width / 3f;
61115 Main.dust[num204].fadeIn = 0.5f + Main.rand.NextFloat() * 0.5f;
61117 dust2.velocity *= 2f;
61118 }
61119 }
61120 for (int num206 = 0; num206 < 10; num206++)
61121 {
61122 int num207 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 0, default(Color), 1.5f);
61123 Main.dust[num207].position = base.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy(velocity.ToRotation()) * width / 3f;
61124 Main.dust[num207].fadeIn = 0.5f + Main.rand.NextFloat() * 0.5f;
61125 Main.dust[num207].noGravity = true;
61127 dust2.velocity *= 1.5f;
61128 }
61129 }
61130 }
61131 else if (type >= 625 && type <= 628)
61132 {
61133 for (int num208 = 0; num208 < 6; num208++)
61134 {
61135 int num209 = Dust.NewDust(position, width, height, 135, 0f, 0f, 100, default(Color), 2f);
61136 Main.dust[num209].noGravity = true;
61137 Main.dust[num209].noLight = true;
61138 }
61139 }
61140 if (type == 631)
61141 {
61142 int num210 = Main.rand.Next(5, 10);
61143 for (int num211 = 0; num211 < num210; num211++)
61144 {
61145 int num212 = Dust.NewDust(base.Center, 0, 0, 229, 0f, 0f, 100);
61147 dust2.velocity *= 1.6f;
61148 Main.dust[num212].velocity.Y -= 1f;
61149 dust2 = Main.dust[num212];
61150 dust2.position -= Vector2.One * 4f;
61151 Main.dust[num212].position = Vector2.Lerp(Main.dust[num212].position, base.Center, 0.5f);
61152 Main.dust[num212].noGravity = true;
61153 }
61154 }
61155 if (type == 539)
61156 {
61157 position = base.Center;
61158 width = (height = 80);
61159 base.Center = position;
61160 Damage();
61161 SoundEngine.PlaySound(4, (int)position.X, (int)position.Y, 7);
61162 for (int num213 = 0; num213 < 4; num213++)
61163 {
61164 int num214 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 100, default(Color), 1.5f);
61165 Main.dust[num214].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * width / 2f;
61166 }
61167 for (int num215 = 0; num215 < 20; num215++)
61168 {
61169 int num216 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 176, 0f, 0f, 200, default(Color), 3.7f);
61170 Main.dust[num216].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * width / 2f;
61171 Main.dust[num216].noGravity = true;
61173 dust2.velocity *= 3f;
61174 }
61175 for (int num217 = 0; num217 < 20; num217++)
61176 {
61177 int num218 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 180, 0f, 0f, 0, default(Color), 2.7f);
61178 Main.dust[num218].position = base.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy(velocity.ToRotation()) * width / 2f;
61179 Main.dust[num218].noGravity = true;
61181 dust2.velocity *= 3f;
61182 }
61183 for (int num219 = 0; num219 < 10; num219++)
61184 {
61185 int num220 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 0, default(Color), 1.5f);
61186 Main.dust[num220].position = base.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy(velocity.ToRotation()) * width / 2f;
61187 Main.dust[num220].noGravity = true;
61189 dust2.velocity *= 3f;
61190 }
61191 }
61192 else if (type == 585)
61193 {
61194 SoundEngine.PlaySound(0, (int)position.X, (int)position.Y, 27);
61195 for (int num221 = 0; num221 < 20; num221++)
61196 {
61197 int num222 = Dust.NewDust(position, width, height, 26, 0f, 0f, 100);
61198 Main.dust[num222].noGravity = true;
61200 dust2.velocity *= 1.2f;
61201 Main.dust[num222].scale = 1.3f;
61202 dust2 = Main.dust[num222];
61203 dust2.velocity -= oldVelocity * 0.3f;
61204 num222 = Dust.NewDust(new Vector2(position.X + 4f, position.Y + 4f), width - 8, height - 8, 27, 0f, 0f, 100, default(Color), 2f);
61205 Main.dust[num222].noGravity = true;
61206 dust2 = Main.dust[num222];
61207 dust2.velocity *= 3f;
61208 }
61209 }
61210 else if (type == 590)
61211 {
61212 SoundEngine.PlaySound(0, (int)position.X, (int)position.Y, 27);
61213 int num223 = 165;
61214 if (ai[2] == 1f)
61215 {
61216 num223 = 31;
61217 }
61218 for (int num224 = 0; num224 < 10; num224++)
61219 {
61220 int num225 = Dust.NewDust(position, width, height, num223, 0f, 0f, 50, default(Color), 1.5f);
61222 dust2.velocity *= 2f;
61223 Main.dust[num225].noGravity = true;
61224 }
61225 float num226 = 0.6f + Main.rand.NextFloat() * 0.4f;
61226 int num227 = 375;
61227 if (ai[2] == 1f)
61228 {
61229 num227 = 61;
61230 }
61231 int num228 = Gore.NewGore(position, Vector2.Zero, num227, num226);
61233 gore2.velocity *= 0.3f;
61234 num228 = Gore.NewGore(position, Vector2.Zero, num227 + 1, num226);
61235 gore2 = Main.gore[num228];
61236 gore2.velocity *= 0.3f;
61237 num228 = Gore.NewGore(position, Vector2.Zero, num227 + 2, num226);
61238 gore2 = Main.gore[num228];
61239 gore2.velocity *= 0.3f;
61240 }
61241 else if (type == 587)
61242 {
61243 Color newColor5 = Main.hslToRgb(ai[1], 1f, 0.5f);
61244 newColor5.A = 200;
61245 SoundEngine.PlaySound(0, (int)position.X, (int)position.Y);
61246 for (int num229 = 0; num229 < 10; num229++)
61247 {
61248 int num230 = Dust.NewDust(position, width, height, 76, 0f, 0f, 0, newColor5);
61249 Main.dust[num230].noGravity = true;
61251 dust2.velocity *= 1.2f;
61252 Main.dust[num230].scale = 0.9f;
61253 dust2 = Main.dust[num230];
61254 dust2.velocity -= oldVelocity * 0.3f;
61255 num230 = Dust.NewDust(new Vector2(position.X + 4f, position.Y + 4f), width - 8, height - 8, 76, 0f, 0f, 0, newColor5, 1.1f);
61256 Main.dust[num230].noGravity = true;
61257 dust2 = Main.dust[num230];
61258 dust2.velocity *= 2f;
61259 }
61260 }
61261 else if (type == 572)
61262 {
61263 for (int num231 = 0; num231 < 15; num231++)
61264 {
61265 int num232 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 40, velocity.X * 0.1f, velocity.Y * 0.1f, 100);
61267 dust2.velocity *= 3f;
61268 Main.dust[num232].noGravity = true;
61269 Main.dust[num232].scale = 1.25f;
61270 Main.dust[num232].position = (base.Center + position) / 2f;
61271 }
61272 }
61273 else if (type == 581)
61274 {
61275 for (int num233 = 0; num233 < 30; num233++)
61276 {
61277 int num234 = Utils.SelectRandom<int>(Main.rand, 229, 229, 161);
61278 Dust dust33 = Main.dust[Dust.NewDust(position, width, height, num234)];
61279 dust33.noGravity = true;
61280 dust33.scale = 1.25f + Main.rand.NextFloat();
61281 dust33.fadeIn = 0.25f;
61282 Dust dust2 = dust33;
61283 dust2.velocity *= 2f;
61284 dust33.noLight = true;
61285 }
61286 }
61287 else if (type == 671)
61288 {
61289 for (int num235 = 0; num235 < 30; num235++)
61290 {
61291 int num236 = Utils.SelectRandom<int>(Main.rand, 27, 27, 62);
61292 Dust dust34 = Main.dust[Dust.NewDust(position, width, height, num236)];
61293 dust34.noGravity = true;
61294 dust34.scale = 1.25f + Main.rand.NextFloat();
61295 dust34.fadeIn = 0.25f;
61296 Dust dust2 = dust34;
61297 dust2.velocity *= 2f;
61298 dust34.noLight = true;
61299 }
61300 }
61301 else if (type == 811 || type == 814)
61302 {
61303 for (int num237 = 0; num237 < 30; num237++)
61304 {
61305 Dust dust35 = Main.dust[Dust.NewDust(position, width, height, 5)];
61306 dust35.scale = 1.25f + Main.rand.NextFloat();
61307 Dust dust2 = dust35;
61308 dust2.velocity *= 2f;
61309 }
61310 }
61311 else if (type == 819)
61312 {
61313 SoundEngine.PlaySound(0, (int)position.X, (int)position.Y);
61314 for (int num238 = 0; num238 < 20; num238++)
61315 {
61316 Dust dust36 = Main.dust[Dust.NewDust(position, width, height, 5)];
61317 dust36.scale = 1f + Main.rand.NextFloat() * 0.5f;
61318 Dust dust2 = dust36;
61319 dust2.velocity *= 1.5f;
61320 }
61321 }
61322 else if (type == 675)
61323 {
61324 for (int num239 = 0; num239 < 40; num239++)
61325 {
61326 int num240 = Utils.SelectRandom<int>(Main.rand, 27, 242, 73, 72, 71, 255, 255, 255);
61327 Dust dust37 = Main.dust[Dust.NewDust(position, width, height, num240)];
61328 dust37.noGravity = true;
61329 dust37.scale = 1.25f + Main.rand.NextFloat();
61330 dust37.fadeIn = 0.25f;
61331 Dust dust2 = dust37;
61332 dust2.velocity *= 3f;
61333 dust37.noLight = true;
61334 }
61335 }
61336 else if (type == 676)
61337 {
61338 for (int num241 = 0; num241 < 120; num241++)
61339 {
61340 int num242 = Utils.SelectRandom<int>(Main.rand, 4, 256);
61341 Dust dust38 = Main.dust[Dust.NewDust(position, width, height, num242, 0f, 0f, 100)];
61342 dust38.scale = 0.8f + Main.rand.NextFloat() * 0.6f;
61343 dust38.fadeIn = 0.5f;
61344 Dust dust2 = dust38;
61345 dust2.velocity *= 4.5f;
61346 dust38.noLight = true;
61347 if (dust38.velocity.Y > 0f)
61348 {
61349 dust2 = dust38;
61350 dust2.velocity *= -0.5f;
61351 }
61352 if (dust38.type == 4)
61353 {
61354 dust38.color = new Color(80, 170, 40, 120);
61355 }
61356 }
61357 for (int num243 = 0; num243 < 10; num243++)
61358 {
61359 Gore.NewGoreDirect(base.Center, new Vector2(MathHelper.Lerp(-5f, 5f, Main.rand.NextFloat()), (0f - Main.rand.NextFloat()) * 5f), 1024);
61360 }
61361 for (int num244 = 0; num244 < 10; num244++)
61362 {
61363 Gore.NewGoreDirect(base.Center, new Vector2(MathHelper.Lerp(-5f, 5f, Main.rand.NextFloat()), (0f - Main.rand.NextFloat()) * 5f), 1025);
61364 }
61365 for (int num245 = 0; num245 < 10; num245++)
61366 {
61367 Gore.NewGoreDirect(base.Center, new Vector2(MathHelper.Lerp(-5f, 5f, Main.rand.NextFloat()), (0f - Main.rand.NextFloat()) * 5f), 1026);
61368 }
61369 for (int num246 = 0; num246 < 20; num246++)
61370 {
61371 Gore.NewGoreDirect(base.Center, new Vector2(MathHelper.Lerp(-0.5f, 0.5f, Main.rand.NextFloat()), (0f - Main.rand.NextFloat()) * 2f), 1026);
61372 }
61373 if (Main.netMode != 2)
61374 {
61375 Player player = Main.player[Main.myPlayer];
61376 if (!player.dead && player.active && (player.Center - base.Center).Length() < 300f && !player.creativeGodMode)
61377 {
61378 player.AddBuff(197, 900, quiet: false);
61379 }
61380 }
61381 }
61382 else if (type == 686)
61383 {
61384 Rectangle hitbox3 = base.Hitbox;
61385 for (int num247 = 0; num247 < oldPos.Length / 2; num247 += 2)
61386 {
61387 hitbox3.X = (int)oldPos[num247].X;
61388 hitbox3.Y = (int)oldPos[num247].Y;
61389 for (int num248 = 0; num248 < 3; num248++)
61390 {
61391 int num249 = Utils.SelectRandom<int>(Main.rand, 6, 55, 158);
61392 int num250 = Dust.NewDust(hitbox3.TopLeft(), width, height, num249, direction, -2.5f);
61393 Main.dust[num250].alpha = 200;
61395 dust2.velocity *= 2.4f;
61396 dust2 = Main.dust[num250];
61397 dust2.scale += Main.rand.NextFloat();
61398 dust2 = Main.dust[num250];
61399 dust2.scale -= 0.5f;
61400 if (Main.dust[num250].type == 55)
61401 {
61402 Main.dust[num250].color = Color.Lerp(Color.Red, Color.Gold, Main.rand.NextFloat());
61403 }
61404 Main.dust[num250].noLight = true;
61405 }
61406 }
61407 for (int num251 = 10; num251 < oldPos.Length; num251 += 2)
61408 {
61409 hitbox3.X = (int)oldPos[num251].X;
61410 hitbox3.Y = (int)oldPos[num251].Y;
61411 for (int num252 = 0; num252 < 2; num252++)
61412 {
61413 int num253 = Utils.SelectRandom<int>(Main.rand, 55);
61414 int num254 = Dust.NewDust(hitbox3.TopLeft(), width, height, num253, direction, -2.5f);
61415 Main.dust[num254].alpha = 120;
61417 dust2.velocity *= 2.4f;
61418 dust2 = Main.dust[num254];
61419 dust2.scale += Main.rand.NextFloat() * 0.7f;
61420 dust2 = Main.dust[num254];
61421 dust2.scale -= 0.5f;
61422 if (Main.dust[num254].type == 55)
61423 {
61424 Main.dust[num254].color = Color.Lerp(Color.Purple, Color.Black, Main.rand.NextFloat());
61425 }
61426 Main.dust[num254].noLight = true;
61427 }
61428 }
61429 for (int num255 = 5; num255 < oldPos.Length; num255++)
61430 {
61431 hitbox3.X = (int)oldPos[num255].X;
61432 hitbox3.Y = (int)oldPos[num255].Y;
61433 for (int num256 = 0; num256 < 1; num256++)
61434 {
61435 int num257 = Utils.SelectRandom<int>(Main.rand, 55);
61436 int num258 = Dust.NewDust(hitbox3.TopLeft(), width, height, num257, direction, -2.5f);
61437 Main.dust[num258].alpha = 80;
61439 dust2.velocity *= 0.3f;
61440 dust2 = Main.dust[num258];
61441 dust2.velocity += velocity * 0.5f;
61442 dust2 = Main.dust[num258];
61443 dust2.scale += Main.rand.NextFloat() * 0.7f;
61444 dust2 = Main.dust[num258];
61445 dust2.scale -= 0.5f;
61446 if (Main.dust[num258].type == 55)
61447 {
61448 Main.dust[num258].color = Color.Lerp(Color.Purple, Color.Black, Main.rand.NextFloat());
61449 }
61450 Main.dust[num258].noLight = true;
61451 }
61452 }
61453 for (int num259 = 0; num259 < 30; num259++)
61454 {
61455 int num260 = 228;
61456 Dust dust39 = Main.dust[Dust.NewDust(position, width, height, num260)];
61457 dust39.noGravity = true;
61458 dust39.scale = 1.25f + Main.rand.NextFloat();
61459 dust39.fadeIn = 1.5f;
61460 Dust dust2 = dust39;
61461 dust2.velocity *= 6f;
61462 dust39.noLight = true;
61463 }
61464 }
61465 if (type == 405)
61466 {
61468 _ = base.Center;
61469 for (int num261 = 0; num261 < 20; num261++)
61470 {
61471 int num262 = 10;
61472 int num263 = Dust.NewDust(base.Center - Vector2.One * num262, num262 * 2, num262 * 2, 212);
61474 Vector2 vector34 = Vector2.Normalize(dust40.position - base.Center);
61475 dust40.position = base.Center + vector34 * num262 * scale;
61476 if (num261 < 30)
61477 {
61478 dust40.velocity = vector34 * dust40.velocity.Length();
61479 }
61480 else
61481 {
61482 dust40.velocity = vector34 * Main.rand.Next(45, 91) / 10f;
61483 }
61484 dust40.color = Main.hslToRgb((float)(0.4000000059604645 + Main.rand.NextDouble() * 0.20000000298023224), 0.9f, 0.5f);
61485 dust40.color = Color.Lerp(dust40.color, Color.White, 0.3f);
61486 dust40.noGravity = true;
61487 dust40.scale = 0.7f;
61488 }
61489 }
61490 if (type == 501)
61491 {
61492 SoundEngine.PlaySound(13, (int)position.X, (int)position.Y);
61493 int num264 = 20;
61494 position.X -= num264;
61495 position.Y -= num264;
61496 width += num264 * 2;
61497 height += num264 * 2;
61498 num264 += 20;
61499 for (int num265 = 0; num265 < 20; num265++)
61500 {
61501 int num266 = Dust.NewDust(position, width, height, 188, 0f, 0f, 100, default(Color), 1.5f);
61503 dust2.velocity *= 0.5f;
61504 }
61505 for (int num267 = 0; num267 < 5; num267++)
61506 {
61507 int num268 = Gore.NewGore(new Vector2(position.X + (float)Main.rand.Next(width), position.Y + (float)Main.rand.Next(height)), default(Vector2), Main.rand.Next(435, 438));
61509 gore2.velocity *= 0.5f;
61510 switch (num267)
61511 {
61512 case 0:
61513 Main.gore[num268].velocity.X += 1f;
61514 Main.gore[num268].velocity.Y += 1f;
61515 break;
61516 case 1:
61517 Main.gore[num268].velocity.X -= 1f;
61518 Main.gore[num268].velocity.Y += 1f;
61519 break;
61520 case 2:
61521 Main.gore[num268].velocity.X += 1f;
61522 Main.gore[num268].velocity.Y -= 1f;
61523 break;
61524 default:
61525 Main.gore[num268].velocity.X -= 1f;
61526 Main.gore[num268].velocity.Y -= 1f;
61527 break;
61528 }
61529 gore2 = Main.gore[num268];
61530 gore2.velocity *= 0.5f;
61531 }
61532 position.X -= num264;
61533 position.Y -= num264;
61534 width += num264 * 2;
61535 height += num264 * 2;
61536 Damage();
61537 }
61538 if (type == 410)
61539 {
61541 _ = base.Center;
61542 for (int num269 = 0; num269 < 10; num269++)
61543 {
61544 int num270 = (int)(10f * ai[1]);
61545 int num271 = Dust.NewDust(base.Center - Vector2.One * num270, num270 * 2, num270 * 2, 212);
61547 Vector2 vector35 = Vector2.Normalize(dust41.position - base.Center);
61548 dust41.position = base.Center + vector35 * num270 * scale;
61549 if (num269 < 30)
61550 {
61551 dust41.velocity = vector35 * dust41.velocity.Length();
61552 }
61553 else
61554 {
61555 dust41.velocity = vector35 * Main.rand.Next(45, 91) / 10f;
61556 }
61557 dust41.color = Main.hslToRgb((float)(0.4000000059604645 + Main.rand.NextDouble() * 0.20000000298023224), 0.9f, 0.5f);
61558 dust41.color = Color.Lerp(dust41.color, Color.White, 0.3f);
61559 dust41.noGravity = true;
61560 dust41.scale = 0.7f;
61561 }
61562 }
61563 if (type == 629 && Main.netMode != 1)
61564 {
61565 switch (Main.npc[(int)ai[0]].type)
61566 {
61567 case 517:
61569 {
61570 Main.npc[(int)ai[0]].ai[3] = 1f;
61571 }
61572 NPC.ShieldStrengthTowerSolar = (int)MathHelper.Clamp(NPC.ShieldStrengthTowerSolar - 1, 0f, NPC.ShieldStrengthTowerMax);
61573 break;
61574 case 422:
61576 {
61577 Main.npc[(int)ai[0]].ai[3] = 1f;
61578 }
61579 NPC.ShieldStrengthTowerVortex = (int)MathHelper.Clamp(NPC.ShieldStrengthTowerVortex - 1, 0f, NPC.ShieldStrengthTowerMax);
61580 break;
61581 case 507:
61583 {
61584 Main.npc[(int)ai[0]].ai[3] = 1f;
61585 }
61586 NPC.ShieldStrengthTowerNebula = (int)MathHelper.Clamp(NPC.ShieldStrengthTowerNebula - 1, 0f, NPC.ShieldStrengthTowerMax);
61587 break;
61588 case 493:
61590 {
61591 Main.npc[(int)ai[0]].ai[3] = 1f;
61592 }
61593 NPC.ShieldStrengthTowerStardust = (int)MathHelper.Clamp(NPC.ShieldStrengthTowerStardust - 1, 0f, NPC.ShieldStrengthTowerMax);
61594 break;
61595 }
61596 Main.npc[(int)ai[0]].netUpdate = true;
61597 NetMessage.SendData(101);
61598 }
61599 if (aiStyle == 105 && owner == Main.myPlayer && ai[1] == 0f)
61600 {
61601 Vector2 vector36 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101));
61602 vector36.Normalize();
61603 vector36 *= 0.3f;
61604 NewProjectile(GetProjectileSource_FromThis(), base.Center.X, base.Center.Y, vector36.X, vector36.Y, Main.rand.Next(569, 572), damage, 0f, owner);
61605 }
61606 if (type == 452)
61607 {
61608 SoundEngine.PlaySound(29, (int)position.X, (int)position.Y, 103);
61609 position = base.Center;
61610 width = (height = 144);
61611 position.X -= width / 2;
61612 position.Y -= height / 2;
61613 for (int num272 = 0; num272 < 4; num272++)
61614 {
61615 Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 100, default(Color), 1.5f);
61616 }
61617 for (int num273 = 0; num273 < 40; num273++)
61618 {
61619 int num274 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 229, 0f, 0f, 0, default(Color), 2.5f);
61620 Main.dust[num274].noGravity = true;
61622 dust2.velocity *= 3f;
61623 num274 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 229, 0f, 0f, 100, default(Color), 1.5f);
61624 dust2 = Main.dust[num274];
61625 dust2.velocity *= 2f;
61626 Main.dust[num274].noGravity = true;
61627 }
61628 for (int num275 = 0; num275 < 1; num275++)
61629 {
61630 int num276 = 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));
61632 gore2.velocity *= 0.3f;
61633 Main.gore[num276].velocity.X += (float)Main.rand.Next(-10, 11) * 0.05f;
61634 Main.gore[num276].velocity.Y += (float)Main.rand.Next(-10, 11) * 0.05f;
61635 }
61636 Damage();
61637 }
61638 if (type == 454)
61639 {
61640 SoundEngine.PlaySound(4, (int)position.X, (int)position.Y, 6);
61641 position = base.Center;
61642 width = (height = 208);
61643 position.X -= width / 2;
61644 position.Y -= height / 2;
61645 for (int num277 = 0; num277 < 7; num277++)
61646 {
61647 int num278 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 100, default(Color), 1.5f);
61648 Main.dust[num278].position = new Vector2(width / 2, 0f).RotatedBy(6.2831854820251465 * Main.rand.NextDouble()) * (float)Main.rand.NextDouble() + base.Center;
61649 }
61650 for (int num279 = 0; num279 < 60; num279++)
61651 {
61652 int num280 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 229, 0f, 0f, 0, default(Color), 2.5f);
61653 Main.dust[num280].position = new Vector2(width / 2, 0f).RotatedBy(6.2831854820251465 * Main.rand.NextDouble()) * (float)Main.rand.NextDouble() + base.Center;
61654 Main.dust[num280].noGravity = true;
61656 dust2.velocity *= 1f;
61657 num280 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 229, 0f, 0f, 100, default(Color), 1.5f);
61658 Main.dust[num280].position = new Vector2(width / 2, 0f).RotatedBy(6.2831854820251465 * Main.rand.NextDouble()) * (float)Main.rand.NextDouble() + base.Center;
61659 dust2 = Main.dust[num280];
61660 dust2.velocity *= 1f;
61661 Main.dust[num280].noGravity = true;
61662 }
61663 for (int num281 = 0; num281 < 3; num281++)
61664 {
61665 int num282 = 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));
61667 gore2.velocity *= 0.3f;
61668 Main.gore[num282].velocity.X += (float)Main.rand.Next(-10, 11) * 0.05f;
61669 Main.gore[num282].velocity.Y += (float)Main.rand.Next(-10, 11) * 0.05f;
61670 }
61671 Damage();
61672 }
61673 if (type == 467)
61674 {
61675 position = base.Center;
61676 width = (height = 176);
61677 base.Center = position;
61678 Damage();
61680 for (int num283 = 0; num283 < 4; num283++)
61681 {
61682 int num284 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 100, default(Color), 1.5f);
61683 Main.dust[num284].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * width / 2f;
61684 }
61685 for (int num285 = 0; num285 < 30; num285++)
61686 {
61687 int num286 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 200, default(Color), 3.7f);
61688 Main.dust[num286].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * width / 2f;
61689 Main.dust[num286].noGravity = true;
61691 dust2.velocity *= 3f;
61692 num286 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100, default(Color), 1.5f);
61693 Main.dust[num286].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * width / 2f;
61694 dust2 = Main.dust[num286];
61695 dust2.velocity *= 2f;
61696 Main.dust[num286].noGravity = true;
61697 Main.dust[num286].fadeIn = 2.5f;
61698 }
61699 for (int num287 = 0; num287 < 10; num287++)
61700 {
61701 int num288 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 0, default(Color), 2.7f);
61702 Main.dust[num288].position = base.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy(velocity.ToRotation()) * width / 2f;
61703 Main.dust[num288].noGravity = true;
61705 dust2.velocity *= 3f;
61706 }
61707 for (int num289 = 0; num289 < 10; num289++)
61708 {
61709 int num290 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 0, default(Color), 1.5f);
61710 Main.dust[num290].position = base.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy(velocity.ToRotation()) * width / 2f;
61711 Main.dust[num290].noGravity = true;
61713 dust2.velocity *= 3f;
61714 }
61715 for (int num291 = 0; num291 < 2; num291++)
61716 {
61717 int num292 = 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));
61718 Main.gore[num292].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * width / 2f;
61720 gore2.velocity *= 0.3f;
61721 Main.gore[num292].velocity.X += (float)Main.rand.Next(-10, 11) * 0.05f;
61722 Main.gore[num292].velocity.Y += (float)Main.rand.Next(-10, 11) * 0.05f;
61723 }
61724 }
61725 if (type == 468)
61726 {
61727 position = base.Center;
61728 width = (height = 176);
61729 base.Center = position;
61730 Damage();
61732 for (int num293 = 0; num293 < 4; num293++)
61733 {
61734 int num294 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 100, default(Color), 1.5f);
61735 Main.dust[num294].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * width / 2f;
61736 }
61737 for (int num295 = 0; num295 < 20; num295++)
61738 {
61739 int num296 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 27, 0f, 0f, 200, default(Color), 3.7f);
61740 Main.dust[num296].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * width / 2f;
61741 Main.dust[num296].noGravity = true;
61743 dust2.velocity *= 3f;
61744 num296 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 27, 0f, 0f, 100, default(Color), 1.5f);
61745 Main.dust[num296].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * width / 2f;
61746 dust2 = Main.dust[num296];
61747 dust2.velocity *= 2f;
61748 Main.dust[num296].noGravity = true;
61749 Main.dust[num296].fadeIn = 2.5f;
61750 }
61751 for (int num297 = 0; num297 < 10; num297++)
61752 {
61753 int num298 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 27, 0f, 0f, 0, default(Color), 2.7f);
61754 Main.dust[num298].position = base.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy(velocity.ToRotation()) * width / 2f;
61755 Main.dust[num298].noGravity = true;
61757 dust2.velocity *= 3f;
61758 }
61759 for (int num299 = 0; num299 < 10; num299++)
61760 {
61761 int num300 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 0, default(Color), 1.5f);
61762 Main.dust[num300].position = base.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy(velocity.ToRotation()) * width / 2f;
61763 Main.dust[num300].noGravity = true;
61765 dust2.velocity *= 3f;
61766 }
61767 for (int num301 = 0; num301 < 2; num301++)
61768 {
61769 int num302 = 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));
61770 Main.gore[num302].position = base.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * width / 2f;
61772 gore2.velocity *= 0.3f;
61773 Main.gore[num302].velocity.X += (float)Main.rand.Next(-10, 11) * 0.05f;
61774 Main.gore[num302].velocity.Y += (float)Main.rand.Next(-10, 11) * 0.05f;
61775 }
61776 }
61777 if (type == 485)
61778 {
61779 for (int num303 = 0; num303 < 15; num303++)
61780 {
61781 int num304 = Dust.NewDust(position, width, height, 6);
61782 Main.dust[num304].noGravity = true;
61784 dust2.velocity -= oldVelocity * Main.rand.Next(20, 60) * 0.01f;
61785 }
61786 }
61787 else if (type == 484)
61788 {
61789 for (int num305 = 0; num305 < 5; num305++)
61790 {
61791 int num306 = Dust.NewDust(position, width, height, 78);
61792 Main.dust[num306].noGravity = true;
61794 dust2.velocity -= oldVelocity / 5f;
61795 Main.dust[num306].scale = 0.85f;
61796 }
61797 }
61798 else if (type == 483)
61799 {
61801 if (owner == Main.myPlayer)
61802 {
61803 int num307 = Main.rand.Next(4, 8);
61804 int[] array = new int[num307];
61805 int num308 = 0;
61806 for (int num309 = 0; num309 < 200; num309++)
61807 {
61808 if (!Main.npc[num309].CanBeChasedBy(this, ignoreDontTakeDamage: true))
61809 {
61810 continue;
61811 }
61812 float num310 = Distance(Main.npc[num309].Center);
61813 if (!(num310 > 2000f) && Collision.CanHitLine(position, width, height, Main.npc[num309].position, Main.npc[num309].width, Main.npc[num309].height))
61814 {
61815 array[num308] = num309;
61816 num308++;
61817 if (num308 == num307)
61818 {
61819 break;
61820 }
61821 }
61822 }
61823 if (num308 > 1)
61824 {
61825 for (int num311 = 0; num311 < 100; num311++)
61826 {
61827 int num312 = Main.rand.Next(num308);
61828 int num313;
61829 for (num313 = num312; num313 == num312; num313 = Main.rand.Next(num308))
61830 {
61831 }
61832 int num314 = array[num312];
61834 array[num313] = num314;
61835 }
61836 }
61837 Vector2 vector37 = new Vector2(-1f, -1f);
61838 for (int num315 = 0; num315 < num308; num315++)
61839 {
61840 Vector2 vector38 = Main.npc[array[num315]].Center - base.Center;
61841 vector38.Normalize();
61842 vector37 += vector38;
61843 }
61844 vector37.Normalize();
61845 for (int num316 = 0; num316 < num307; num316++)
61846 {
61847 float num317 = Main.rand.Next(8, 15);
61848 Vector2 vector39 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101));
61849 vector39.Normalize();
61850 if (num308 > 0)
61851 {
61852 vector39 += vector37;
61853 vector39.Normalize();
61854 }
61855 vector39 *= num317;
61856 if (num308 > 0)
61857 {
61858 num308--;
61859 vector39 = Main.npc[array[num308]].Center - base.Center;
61860 vector39.Normalize();
61861 vector39 *= num317;
61862 }
61863 NewProjectile(GetProjectileSource_FromThis(), base.Center.X, base.Center.Y, vector39.X, vector39.Y, 484, (int)((double)damage * 0.7), knockBack * 0.7f, owner);
61864 }
61865 }
61866 for (int num318 = 0; num318 < 20; num318++)
61867 {
61868 int num319 = Dust.NewDust(position, width, height, 78);
61869 Main.dust[num319].noGravity = true;
61871 dust2.velocity *= 4f;
61872 }
61873 for (int num320 = 0; num320 < 7; num320++)
61874 {
61875 int num321 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 100, default(Color), 1.5f);
61877 dust2.velocity *= 0.9f;
61878 Main.dust[num321].scale = 0.9f;
61879 }
61880 for (int num322 = 0; num322 < 3; num322++)
61881 {
61882 int num323 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100, default(Color), 2.5f);
61883 Main.dust[num323].noGravity = true;
61885 dust2.velocity *= 3f;
61886 num323 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100, default(Color), 1.5f);
61887 dust2 = Main.dust[num323];
61888 dust2.velocity *= 2f;
61889 }
61890 int num324 = Gore.NewGore(new Vector2(position.X, position.Y), default(Vector2), Main.rand.Next(61, 64));
61892 gore2.velocity *= 0.3f;
61893 Main.gore[num324].velocity.X += Main.rand.Next(-1, 2);
61894 Main.gore[num324].velocity.Y += Main.rand.Next(-1, 2);
61895 if (owner == Main.myPlayer)
61896 {
61897 int num325 = 100;
61898 position.X -= num325 / 2;
61899 position.Y -= num325 / 2;
61900 width += num325;
61901 height++;
61902 penetrate = -1;
61903 Damage();
61904 }
61905 }
61906 if (type == 523)
61907 {
61909 for (int num326 = 0; num326 < 25; num326++)
61910 {
61911 int num327 = Dust.NewDust(position, width, height, 256);
61912 Main.dust[num327].noGravity = true;
61913 Main.dust[num327].position = (Main.dust[num327].position + position) / 2f;
61914 Main.dust[num327].velocity = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101));
61915 Main.dust[num327].velocity.Normalize();
61917 dust2.velocity *= (float)Main.rand.Next(1, 30) * 0.1f;
61918 Main.dust[num327].alpha = alpha;
61919 }
61920 }
61921 else if (type == 522)
61922 {
61924 for (int num328 = 0; num328 < 10; num328++)
61925 {
61926 int num329 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 254, velocity.X * 0.1f, velocity.Y * 0.1f, 0, default(Color), 0.5f);
61927 Dust dust2;
61928 if (Main.rand.Next(3) == 0)
61929 {
61930 Main.dust[num329].fadeIn = 0.75f + (float)Main.rand.Next(-10, 11) * 0.01f;
61931 Main.dust[num329].scale = 0.25f + (float)Main.rand.Next(-10, 11) * 0.005f;
61932 dust2 = Main.dust[num329];
61933 dust2.type++;
61934 }
61935 else
61936 {
61937 Main.dust[num329].scale = 1f + (float)Main.rand.Next(-10, 11) * 0.01f;
61938 }
61939 Main.dust[num329].noGravity = true;
61940 dust2 = Main.dust[num329];
61941 dust2.velocity *= 1.25f;
61942 dust2 = Main.dust[num329];
61943 dust2.velocity -= oldVelocity / 10f;
61944 }
61945 }
61946 else if (type == 521)
61947 {
61949 for (int num330 = 0; num330 < 20; num330++)
61950 {
61951 int num331 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 254, velocity.X * 0.1f, velocity.Y * 0.1f, 0, default(Color), 0.5f);
61952 Dust dust2;
61953 if (Main.rand.Next(3) == 0)
61954 {
61955 Main.dust[num331].fadeIn = 1.1f + (float)Main.rand.Next(-10, 11) * 0.01f;
61956 Main.dust[num331].scale = 0.35f + (float)Main.rand.Next(-10, 11) * 0.01f;
61957 dust2 = Main.dust[num331];
61958 dust2.type++;
61959 }
61960 else
61961 {
61962 Main.dust[num331].scale = 1.2f + (float)Main.rand.Next(-10, 11) * 0.01f;
61963 }
61964 Main.dust[num331].noGravity = true;
61965 dust2 = Main.dust[num331];
61966 dust2.velocity *= 2.5f;
61967 dust2 = Main.dust[num331];
61968 dust2.velocity -= oldVelocity / 10f;
61969 }
61970 if (Main.myPlayer == owner)
61971 {
61972 int num332 = Main.rand.Next(3, 6);
61973 for (int num333 = 0; num333 < num332; num333++)
61974 {
61975 Vector2 vector40 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101));
61976 while (vector40.X == 0f && vector40.Y == 0f)
61977 {
61978 vector40 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101));
61979 }
61980 vector40.Normalize();
61981 vector40 *= (float)Main.rand.Next(70, 101) * 0.1f;
61982 NewProjectile(GetProjectileSource_FromThis(), oldPosition.X + (float)(width / 2), oldPosition.Y + (float)(height / 2), vector40.X, vector40.Y, 522, (int)((double)damage * 0.8), knockBack * 0.8f, owner);
61983 }
61984 }
61985 }
61986 if (type == 520)
61987 {
61989 for (int num334 = 0; num334 < 10; num334++)
61990 {
61991 int num335 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 252, velocity.X * 0.1f, velocity.Y * 0.1f, 0, default(Color), 0.75f);
61992 Main.dust[num335].noGravity = true;
61994 dust2.velocity -= oldVelocity / 3f;
61995 }
61996 }
61997 if (type == 459 || type == 709)
61998 {
61999 int num336 = 3;
62000 int num337 = 10;
62001 int num338 = 0;
62002 if (scale >= 1f)
62003 {
62004 position = base.Center;
62005 width = (height = 144);
62006 base.Center = position;
62007 num336 = 7;
62008 num337 = 30;
62009 num338 = 2;
62010 Damage();
62011 }
62012 for (int num339 = 0; num339 < num336; num339++)
62013 {
62014 int num340 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 100, default(Color), 1.5f);
62015 Main.dust[num340].position = new Vector2(width / 2, 0f).RotatedBy(6.2831854820251465 * Main.rand.NextDouble()) * (float)Main.rand.NextDouble() + base.Center;
62016 }
62017 for (int num341 = 0; num341 < num337; num341++)
62018 {
62019 int num342 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 226, 0f, 0f, 0, default(Color), 1.5f);
62020 Main.dust[num342].position = new Vector2(width / 2, 0f).RotatedBy(6.2831854820251465 * Main.rand.NextDouble()) * (float)Main.rand.NextDouble() + base.Center;
62021 Main.dust[num342].noGravity = true;
62023 dust2.velocity *= 1f;
62024 }
62025 for (int num343 = 0; num343 < num338; num343++)
62026 {
62027 int num344 = 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));
62029 gore2.velocity *= 0.3f;
62030 Main.gore[num344].velocity.X += (float)Main.rand.Next(-10, 11) * 0.05f;
62031 Main.gore[num344].velocity.Y += (float)Main.rand.Next(-10, 11) * 0.05f;
62032 }
62033 if (type == 709 && Main.myPlayer == owner)
62034 {
62035 Rectangle value7 = new Rectangle((int)base.Center.X - 40, (int)base.Center.Y - 40, 80, 80);
62036 for (int num345 = 0; num345 < 1000; num345++)
62037 {
62038 if (num345 != whoAmI && Main.projectile[num345].active && Main.projectile[num345].owner == owner && Main.projectile[num345].type == 443 && Main.projectile[num345].getRect().Intersects(value7))
62039 {
62040 Main.projectile[num345].ai[1] = 1f;
62041 Main.projectile[num345].velocity = (base.Center - Main.projectile[num345].Center) / 5f;
62042 Main.projectile[num345].netUpdate = true;
62043 }
62044 }
62045 int num346 = NewProjectile(GetProjectileSource_FromThis(), base.Center.X, base.Center.Y, 0f, 0f, 443, damage, 0f, owner);
62046 Main.projectile[num346].timeLeft = 30 * Main.rand.Next(2, 6);
62047 float[] array2 = Main.projectile[num346].localAI;
62049 array2[0] = ((SlotId)(ref val)).ToFloat();
62050 }
62051 }
62052 if (owner != Main.myPlayer && type == 453 && Main.player[owner].mount.AbilityActive)
62053 {
62054 Main.player[owner].mount.UseAbility(Main.player[owner], position, toggleOn: false);
62055 }
62056 if (type == 441)
62057 {
62058 Main.player[owner].mount.StopAbilityCharge();
62059 }
62060 if (type == 444)
62061 {
62063 int num347 = Main.rand.Next(5, 9);
62064 for (int num348 = 0; num348 < num347; num348++)
62065 {
62066 int num349 = Dust.NewDust(base.Center, 0, 0, 171, 0f, 0f, 100, default(Color), 1.4f);
62068 dust2.velocity *= 0.8f;
62069 Main.dust[num349].position = Vector2.Lerp(Main.dust[num349].position, base.Center, 0.5f);
62070 Main.dust[num349].noGravity = true;
62071 }
62072 if (owner == Main.myPlayer)
62073 {
62074 Vector2 vector41 = Main.screenPosition + new Vector2(Main.mouseX, Main.mouseY);
62075 if (Main.player[owner].gravDir == -1f)
62076 {
62077 vector41.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y;
62078 }
62080 vector42 *= localAI[1];
62081 NewProjectile(GetProjectileSource_FromThis(), base.Center.X, base.Center.Y, vector42.X, vector42.Y, (int)localAI[0], damage, knockBack, owner);
62082 }
62083 }
62084 if (type == 472)
62085 {
62086 for (int num350 = 0; num350 < 20; num350++)
62087 {
62088 int num351 = Dust.NewDust(position, width, height, 30);
62089 Main.dust[num351].noGravity = true;
62091 dust2.velocity *= 0.45f;
62092 dust2 = Main.dust[num351];
62093 dust2.velocity += velocity * 0.9f;
62094 }
62095 }
62096 if (type == 639 || type == 640)
62097 {
62098 int num352 = Main.rand.Next(5, 10);
62099 for (int num353 = 0; num353 < num352; num353++)
62100 {
62101 int num354 = Dust.NewDust(base.Center, 0, 0, 220, 0f, 0f, 100, default(Color), 0.5f);
62103 dust2.velocity *= 1.6f;
62104 Main.dust[num354].velocity.Y -= 1f;
62105 Main.dust[num354].position = Vector2.Lerp(Main.dust[num354].position, base.Center, 0.5f);
62106 Main.dust[num354].noGravity = true;
62107 }
62108 if (owner == Main.myPlayer && type == 639)
62109 {
62110 int num355 = num + 1;
62111 int nextSlot = GetNextSlot();
62113 {
62114 num355++;
62115 }
62116 Vector2 vector43 = new Vector2(ai[0], ai[1]);
62117 NewProjectile(GetProjectileSource_FromThis(), localAI[0], localAI[1], vector43.X, vector43.Y, 640, damage, knockBack, owner, 0f, num355);
62118 }
62119 }
62120 if (type == 684)
62121 {
62122 int num356 = Main.rand.Next(15, 25);
62123 for (int num357 = 0; num357 < num356; num357++)
62124 {
62125 int num358 = Dust.NewDust(base.Center, 0, 0, 60, 0f, 0f, 100, new Color(255, 255, 255, 0), 1.3f);
62127 dust2.velocity *= 8f * (0.3f + 0.7f * Main.rand.NextFloat());
62128 Main.dust[num358].fadeIn = 1.3f + Main.rand.NextFloat() * 0.2f;
62129 Main.dust[num358].noLight = true;
62130 Main.dust[num358].noGravity = true;
62131 dust2 = Main.dust[num358];
62132 dust2.position += Main.dust[num358].velocity * 4f;
62133 }
62134 }
62135 if (type == 435)
62136 {
62137 int num359 = Main.rand.Next(5, 10);
62138 for (int num360 = 0; num360 < num359; num360++)
62139 {
62140 int num361 = Dust.NewDust(base.Center, 0, 0, 226, 0f, 0f, 100, default(Color), 0.5f);
62142 dust2.velocity *= 1.6f;
62143 Main.dust[num361].velocity.Y -= 1f;
62144 Main.dust[num361].position = Vector2.Lerp(Main.dust[num361].position, base.Center, 0.5f);
62145 Main.dust[num361].noGravity = true;
62146 }
62147 }
62148 if (type == 732)
62149 {
62150 int num362 = Main.rand.Next(5, 10);
62151 for (int num363 = 0; num363 < num362; num363++)
62152 {
62153 int num364 = Dust.NewDust(base.Center, 0, 0, 226, 0f, 0f, 100, default(Color), 0.5f);
62155 dust2.velocity *= 1.6f;
62156 Main.dust[num364].velocity.Y -= 1f;
62157 Main.dust[num364].velocity = Main.dust[num364].velocity * 0.5f + velocity * ((float)num363 / (float)num362) * 0.7f;
62158 Main.dust[num364].position = Vector2.Lerp(Main.dust[num364].position, base.Center, 0.5f);
62159 Main.dust[num364].noGravity = true;
62160 }
62161 }
62162 if (type == 682)
62163 {
62164 int num365 = 22;
62165 for (int num366 = 0; num366 < num365; num366++)
62166 {
62167 int num367 = Dust.NewDust(base.Center, 0, 0, 272, 0f, 0f, 0, default(Color), 0.5f);
62169 dust2.velocity *= 1.6f;
62170 Main.dust[num367].velocity.Y -= 1f;
62171 Main.dust[num367].position = Vector2.Lerp(Main.dust[num367].position, base.Center, 0.5f);
62172 }
62173 }
62174 if (type == 436)
62175 {
62176 int num368 = Main.rand.Next(5, 10);
62177 for (int num369 = 0; num369 < num368; num369++)
62178 {
62179 int num370 = Dust.NewDust(base.Center, 0, 0, 220, 0f, 0f, 100, default(Color), 0.5f);
62181 dust2.velocity *= 1.6f;
62182 Main.dust[num370].velocity.Y -= 1f;
62183 Main.dust[num370].position = Vector2.Lerp(Main.dust[num370].position, base.Center, 0.5f);
62184 Main.dust[num370].noGravity = true;
62185 }
62186 }
62187 if (type == 462)
62188 {
62189 int num371 = Main.rand.Next(5, 10);
62190 for (int num372 = 0; num372 < num371; num372++)
62191 {
62192 int num373 = Dust.NewDust(base.Center, 0, 0, 229, 0f, 0f, 100, default(Color), 0.5f);
62194 dust2.velocity *= 1.6f;
62195 Main.dust[num373].velocity.Y -= 1f;
62196 dust2 = Main.dust[num373];
62197 dust2.position -= Vector2.One * 4f;
62198 Main.dust[num373].position = Vector2.Lerp(Main.dust[num373].position, base.Center, 0.5f);
62199 Main.dust[num373].noGravity = true;
62200 }
62201 }
62202 if (type == 442)
62203 {
62205 int num374 = Main.rand.Next(3, 7);
62206 for (int num375 = 0; num375 < num374; num375++)
62207 {
62208 int num376 = Dust.NewDust(position, width, height, 135, 0f, 0f, 100, default(Color), 2.1f);
62210 dust2.velocity *= 2f;
62211 Main.dust[num376].noGravity = true;
62212 }
62213 if (Main.myPlayer == owner)
62214 {
62215 Rectangle value8 = new Rectangle((int)base.Center.X - 40, (int)base.Center.Y - 40, 80, 80);
62216 for (int num377 = 0; num377 < 1000; num377++)
62217 {
62218 if (num377 != whoAmI && Main.projectile[num377].active && Main.projectile[num377].owner == owner && Main.projectile[num377].type == 443 && Main.projectile[num377].getRect().Intersects(value8))
62219 {
62220 Main.projectile[num377].ai[1] = 1f;
62221 Main.projectile[num377].velocity = (base.Center - Main.projectile[num377].Center) / 5f;
62222 Main.projectile[num377].netUpdate = true;
62223 }
62224 }
62225 NewProjectile(GetProjectileSource_FromThis(), base.Center.X, base.Center.Y, 0f, 0f, 443, damage, 0f, owner);
62226 }
62227 }
62228 if (type == 440)
62229 {
62230 int num378 = Main.rand.Next(3, 7);
62231 for (int num379 = 0; num379 < num378; num379++)
62232 {
62233 int num380 = Dust.NewDust(base.Center - velocity / 2f, 0, 0, 135, 0f, 0f, 100, default(Color), 2.1f);
62235 dust2.velocity *= 2f;
62236 Main.dust[num380].noGravity = true;
62237 }
62238 }
62239 if (type == 606)
62240 {
62241 int num381 = Main.rand.Next(3, 7);
62242 for (int num382 = 0; num382 < num381; num382++)
62243 {
62244 int num383 = Dust.NewDust(base.Center - velocity / 2f, 0, 0, 182, 0f, 0f, 100, default(Color), 1.6f);
62246 dust2.velocity *= 1.5f;
62247 Main.dust[num383].noGravity = true;
62248 }
62249 }
62250 if (type == 449)
62251 {
62252 int num384 = Main.rand.Next(3, 7);
62253 for (int num385 = 0; num385 < num384; num385++)
62254 {
62255 int num386 = Dust.NewDust(base.Center - velocity / 2f, 0, 0, 228, 0f, 0f, 100, default(Color), 2.1f);
62257 dust2.velocity *= 2f;
62258 Main.dust[num386].noGravity = true;
62259 }
62260 }
62261 if (type == 495)
62262 {
62263 for (int num387 = 0; num387 < 15; num387++)
62264 {
62265 int num388 = Dust.NewDust(base.Center, 10, 10, 27);
62266 Main.dust[num388].noGravity = true;
62268 dust2.velocity -= oldVelocity * 0.3f;
62269 }
62270 }
62271 if (type == 497)
62272 {
62273 for (int num389 = 0; num389 < 15; num389++)
62274 {
62275 int num390 = Dust.NewDust(base.Center, 10, 10, 27);
62276 Main.dust[num390].noGravity = true;
62278 dust2.velocity *= 2f;
62279 dust2 = Main.dust[num390];
62280 dust2.velocity -= oldVelocity * 0.3f;
62281 dust2 = Main.dust[num390];
62282 dust2.scale += (float)Main.rand.Next(150) * 0.001f;
62283 }
62284 }
62285 if (type == 448)
62286 {
62288 position = base.Center;
62289 width = (height = 112);
62290 position.X -= width / 2;
62291 position.Y -= height / 2;
62292 for (int num391 = 0; num391 < 4; num391++)
62293 {
62294 Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 100, default(Color), 1.5f);
62295 }
62296 for (int num392 = 0; num392 < 40; num392++)
62297 {
62298 int num393 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 228, 0f, 0f, 0, default(Color), 2.5f);
62299 Main.dust[num393].noGravity = true;
62301 dust2.velocity *= 3f;
62302 num393 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 228, 0f, 0f, 100, default(Color), 1.5f);
62303 dust2 = Main.dust[num393];
62304 dust2.velocity *= 2f;
62305 Main.dust[num393].noGravity = true;
62306 }
62307 for (int num394 = 0; num394 < 1; num394++)
62308 {
62309 int num395 = 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));
62311 gore2.velocity *= 0.3f;
62312 Main.gore[num395].velocity.X += (float)Main.rand.Next(-10, 11) * 0.05f;
62313 Main.gore[num395].velocity.Y += (float)Main.rand.Next(-10, 11) * 0.05f;
62314 }
62315 Damage();
62316 }
62317 else if (type == 715 || type == 716 || type == 717 || type == 718)
62318 {
62320 position = base.Center;
62321 width = (height = 128);
62322 if (type == 717 || type == 718)
62323 {
62324 width = (height = 240);
62325 }
62326 position.X -= width / 2;
62327 position.Y -= height / 2;
62328 Damage();
62329 AI_147_Explosion();
62330 }
62331 if (type == 616)
62332 {
62334 position = base.Center;
62335 width = (height = 80);
62336 position.X -= width / 2;
62337 position.Y -= height / 2;
62338 for (int num396 = 0; num396 < 4; num396++)
62339 {
62340 Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 100, default(Color), 1.5f);
62341 }
62342 for (int num397 = 0; num397 < 40; num397++)
62343 {
62344 int num398 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 229, 0f, 0f, 200, default(Color), 2.5f);
62345 Main.dust[num398].noGravity = true;
62347 dust2.velocity *= 2f;
62348 num398 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 229, 0f, 0f, 200, default(Color), 1.5f);
62349 dust2 = Main.dust[num398];
62350 dust2.velocity *= 1.2f;
62351 Main.dust[num398].noGravity = true;
62352 }
62353 for (int num399 = 0; num399 < 1; num399++)
62354 {
62355 int num400 = 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));
62357 gore2.velocity *= 0.3f;
62358 Main.gore[num400].velocity.X += (float)Main.rand.Next(-10, 11) * 0.05f;
62359 Main.gore[num400].velocity.Y += (float)Main.rand.Next(-10, 11) * 0.05f;
62360 }
62361 Damage();
62362 }
62363 if (type == 502)
62364 {
62365 Vector2 vector44 = new Vector2(width, height) / 2f;
62366 for (int num401 = 0; num401 < oldPos.Length; num401++)
62367 {
62368 if (!(oldPos[num401] == Vector2.Zero))
62369 {
62370 int num402 = Dust.NewDust(oldPos[num401] + vector44, 0, 0, 66, 0f, 0f, 150, Color.Transparent, 0.7f);
62371 Main.dust[num402].color = Main.hslToRgb(Main.rand.NextFloat(), 1f, 0.5f);
62372 Main.dust[num402].noGravity = true;
62373 }
62374 }
62375 }
62376 if (type == 510)
62377 {
62379 Gore.NewGore(base.Center, -oldVelocity * 0.2f, 704);
62380 Gore.NewGore(base.Center, -oldVelocity * 0.2f, 705);
62381 if (owner == Main.myPlayer)
62382 {
62383 int num403 = Main.rand.Next(20, 31);
62384 for (int num404 = 0; num404 < num403; num404++)
62385 {
62386 Vector2 vector45 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101));
62387 vector45.Normalize();
62388 vector45 *= (float)Main.rand.Next(10, 201) * 0.01f;
62389 NewProjectile(GetProjectileSource_FromThis(), base.Center.X, base.Center.Y, vector45.X, vector45.Y, 511 + Main.rand.Next(3), damage, 1f, owner);
62390 }
62391 }
62392 }
62393 if (type == 868 || type == 869 || type == 996)
62394 {
62396 for (int num405 = 0; num405 < 15; num405++)
62397 {
62398 Dust.NewDust(position, width, height, 13, 0f, -2f, 0, default(Color), 1.5f);
62399 }
62400 if (Main.netMode != 1)
62401 {
62402 switch (type)
62403 {
62404 case 868:
62405 WorldGen.TreeTops.RandomizeTreeStyleBasedOnWorldPosition(Main.rand, base.Center);
62406 break;
62407 case 869:
62409 break;
62410 case 996:
62412 break;
62413 }
62415 }
62416 }
62417 else if (type == 836)
62418 {
62419 for (int num406 = 0; num406 < 3; num406++)
62420 {
62421 int num407 = Dust.NewDust(position, width, height, 31, 0f, 0f, 50, Color.White, 0.8f);
62423 dust2.velocity *= 0.5f;
62424 Main.dust[num407].noGravity = true;
62425 }
62426 }
62427 if (type == 408)
62428 {
62429 for (int num408 = 0; num408 < 15; num408++)
62430 {
62431 int num409 = Dust.NewDust(base.Center - Vector2.One * 10f, 50, 50, 5, 0f, -2f);
62433 dust2.velocity /= 2f;
62434 }
62435 int num410 = 0;
62436 int num411 = 10;
62437 num410 = Gore.NewGore(base.Center, velocity * 0.8f, 584);
62439 gore2.timeLeft /= num411;
62440 num410 = Gore.NewGore(base.Center, velocity * 0.9f, 585);
62441 gore2 = Main.gore[num410];
62442 gore2.timeLeft /= num411;
62443 num410 = Gore.NewGore(base.Center, velocity * 1f, 586);
62444 gore2 = Main.gore[num410];
62445 gore2.timeLeft /= num411;
62446 }
62447 if (type == 385)
62448 {
62449 SoundEngine.PlaySound(4, (int)base.Center.X, (int)base.Center.Y, 19);
62450 int num412 = 36;
62451 for (int num413 = 0; num413 < num412; num413++)
62452 {
62453 Vector2 spinningpoint = Vector2.Normalize(velocity) * new Vector2((float)width / 2f, height) * 0.75f;
62454 spinningpoint = spinningpoint.RotatedBy((float)(num413 - (num412 / 2 - 1)) * ((float)Math.PI * 2f) / (float)num412) + base.Center;
62456 int num414 = Dust.NewDust(spinningpoint + vector46, 0, 0, 172, vector46.X * 2f, vector46.Y * 2f, 100, default(Color), 1.4f);
62457 Main.dust[num414].noGravity = true;
62458 Main.dust[num414].noLight = true;
62459 Main.dust[num414].velocity = vector46;
62460 }
62461 if (owner == Main.myPlayer)
62462 {
62463 if (ai[1] < 1f)
62464 {
62465 int num415 = (Main.expertMode ? 25 : 40);
62466 int num416 = NewProjectile(GetProjectileSource_FromThis(), base.Center.X - (float)(direction * 30), base.Center.Y - 4f, (float)(-direction) * 0.01f, 0f, 384, num415, 4f, owner, 16f, 15f);
62467 Main.projectile[num416].netUpdate = true;
62468 }
62469 else
62470 {
62471 int num417 = (int)(base.Center.Y / 16f);
62472 int num418 = (int)(base.Center.X / 16f);
62473 int num419 = 100;
62474 if (num418 < 10)
62475 {
62476 num418 = 10;
62477 }
62478 if (num418 > Main.maxTilesX - 10)
62479 {
62480 num418 = Main.maxTilesX - 10;
62481 }
62482 if (num417 < 10)
62483 {
62484 num417 = 10;
62485 }
62486 if (num417 > Main.maxTilesY - num419 - 10)
62487 {
62488 num417 = Main.maxTilesY - num419 - 10;
62489 }
62490 int num420 = num417 + num419;
62491 int num421 = num417 + 15;
62492 for (int num422 = num417; num422 < num420; num422++)
62493 {
62494 Tile tile = Main.tile[num418, num422];
62495 if (tile.active() && (Main.tileSolid[tile.type] || tile.liquid != 0))
62496 {
62497 num421 = num422;
62498 break;
62499 }
62500 }
62501 num417 = num421;
62502 int num423 = (Main.expertMode ? 50 : 80);
62503 int num424 = NewProjectile(GetProjectileSource_FromThis(), num418 * 16 + 8, num417 * 16 - 24, 0f, 0f, 386, num423, 4f, Main.myPlayer, 16f, 24f);
62504 Main.projectile[num424].netUpdate = true;
62505 }
62506 }
62507 }
62508 else if (type >= 424 && type <= 426)
62509 {
62511 position.X += width / 2;
62512 position.Y += height / 2;
62513 width = (int)(128f * scale);
62514 height = (int)(128f * scale);
62515 position.X -= width / 2;
62516 position.Y -= height / 2;
62517 for (int num425 = 0; num425 < 8; num425++)
62518 {
62519 Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 100, default(Color), 1.5f);
62520 }
62521 for (int num426 = 0; num426 < 32; num426++)
62522 {
62523 int num427 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100, default(Color), 2.5f);
62524 Main.dust[num427].noGravity = true;
62526 dust2.velocity *= 3f;
62527 num427 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100, default(Color), 1.5f);
62528 dust2 = Main.dust[num427];
62529 dust2.velocity *= 2f;
62530 Main.dust[num427].noGravity = true;
62531 }
62532 for (int num428 = 0; num428 < 2; num428++)
62533 {
62534 int num429 = 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));
62536 gore2.velocity *= 0.3f;
62537 Main.gore[num429].velocity.X += (float)Main.rand.Next(-10, 11) * 0.05f;
62538 Main.gore[num429].velocity.Y += (float)Main.rand.Next(-10, 11) * 0.05f;
62539 }
62540 if (owner == Main.myPlayer)
62541 {
62542 localAI[1] = -1f;
62543 maxPenetrate = 0;
62544 Damage();
62545 }
62546 for (int num430 = 0; num430 < 5; num430++)
62547 {
62548 int num431 = Utils.SelectRandom<int>(Main.rand, 6, 259, 158);
62549 int num432 = Dust.NewDust(position, width, height, num431, 2.5f * (float)direction, -2.5f);
62550 Main.dust[num432].alpha = 200;
62552 dust2.velocity *= 2.4f;
62553 dust2 = Main.dust[num432];
62554 dust2.scale += Main.rand.NextFloat();
62555 }
62556 }
62557 if (type == 399)
62558 {
62559 SoundEngine.PlaySound(13, (int)position.X, (int)position.Y);
62560 Vector2 vector47 = new Vector2(20f, 20f);
62561 for (int num433 = 0; num433 < 5; num433++)
62562 {
62563 Dust.NewDust(base.Center - vector47 / 2f, (int)vector47.X, (int)vector47.Y, 12, 0f, 0f, 0, Color.Red);
62564 }
62565 for (int num434 = 0; num434 < 10; num434++)
62566 {
62567 int num435 = Dust.NewDust(base.Center - vector47 / 2f, (int)vector47.X, (int)vector47.Y, 31, 0f, 0f, 100, default(Color), 1.5f);
62569 dust2.velocity *= 1.4f;
62570 }
62571 for (int num436 = 0; num436 < 20; num436++)
62572 {
62573 int num437 = Dust.NewDust(base.Center - vector47 / 2f, (int)vector47.X, (int)vector47.Y, 6, 0f, 0f, 100, default(Color), 2.5f);
62574 Main.dust[num437].noGravity = true;
62576 dust2.velocity *= 5f;
62577 num437 = Dust.NewDust(base.Center - vector47 / 2f, (int)vector47.X, (int)vector47.Y, 6, 0f, 0f, 100, default(Color), 1.5f);
62578 dust2 = Main.dust[num437];
62579 dust2.velocity *= 3f;
62580 }
62581 if (Main.myPlayer == owner)
62582 {
62583 for (int num438 = 0; num438 < 6; num438++)
62584 {
62585 float num439 = (0f - velocity.X) * (float)Main.rand.Next(20, 50) * 0.01f + (float)Main.rand.Next(-20, 21) * 0.4f;
62586 float num440 = (0f - Math.Abs(velocity.Y)) * (float)Main.rand.Next(30, 50) * 0.01f + (float)Main.rand.Next(-20, 5) * 0.4f;
62587 NewProjectile(GetProjectileSource_FromThis(), base.Center.X + num439, base.Center.Y + num440, num439, num440, 400 + Main.rand.Next(3), (int)((double)damage * 0.5), 0f, owner);
62588 }
62589 }
62590 }
62591 if (type == 384 || type == 386)
62592 {
62593 for (int num441 = 0; num441 < 20; num441++)
62594 {
62595 int num442 = Dust.NewDust(position, width, height, 212, direction * 2, 0f, 100, default(Color), 1.4f);
62597 dust42.color = Color.CornflowerBlue;
62598 dust42.color = Color.Lerp(dust42.color, Color.White, 0.3f);
62599 dust42.noGravity = true;
62600 }
62601 }
62602 if (type == 507 || type == 508)
62603 {
62604 SoundEngine.PlaySound(0, (int)position.X, (int)position.Y);
62605 Vector2 vector48 = position;
62606 Vector2 vector49 = oldVelocity;
62607 vector49.Normalize();
62608 vector48 += vector49 * 16f;
62609 for (int num443 = 0; num443 < 20; num443++)
62610 {
62611 int num444 = Dust.NewDust(vector48, width, height, 81);
62612 Main.dust[num444].position = (Main.dust[num444].position + base.Center) / 2f;
62614 dust2.velocity += oldVelocity * 0.4f;
62615 dust2 = Main.dust[num444];
62616 dust2.velocity *= 0.5f;
62617 Main.dust[num444].noGravity = true;
62618 vector48 -= vector49 * 8f;
62619 }
62620 }
62621 if (type == 598)
62622 {
62623 SoundEngine.PlaySound(0, (int)position.X, (int)position.Y);
62624 Vector2 vector50 = position;
62625 Vector2 vector51 = (rotation - (float)Math.PI / 2f).ToRotationVector2();
62626 vector50 += vector51 * 16f;
62627 for (int num445 = 0; num445 < 20; num445++)
62628 {
62629 int num446 = Dust.NewDust(vector50, width, height, 81);
62630 Main.dust[num446].position = (Main.dust[num446].position + base.Center) / 2f;
62632 dust2.velocity += vector51 * 2f;
62633 dust2 = Main.dust[num446];
62634 dust2.velocity *= 0.5f;
62635 Main.dust[num446].noGravity = true;
62636 vector50 -= vector51 * 8f;
62637 }
62638 }
62639 if (type == 971)
62640 {
62641 Vector2 vector52 = position;
62642 Vector2 vector53 = (rotation - (float)Math.PI / 2f).ToRotationVector2();
62643 vector52 += vector53 * 8f;
62644 for (int num447 = 0; num447 < 6; num447++)
62645 {
62646 int num448 = Dust.NewDust(vector52, width, height, 4);
62647 Main.dust[num448].color = new Color(10, 10, 10, 150);
62648 Main.dust[num448].position = (Main.dust[num448].position + base.Center) / 2f;
62650 dust2.velocity += vector53;
62651 dust2 = Main.dust[num448];
62652 dust2.velocity *= 0.5f;
62653 Main.dust[num448].noGravity = true;
62654 vector52 -= vector53 * 4f;
62655 }
62656 }
62657 if (type == 1 || type == 81 || type == 98 || type == 980)
62658 {
62659 SoundEngine.PlaySound(0, (int)position.X, (int)position.Y);
62660 for (int num449 = 0; num449 < 10; num449++)
62661 {
62662 Dust.NewDust(new Vector2(position.X, position.Y), width, height, 7);
62663 }
62664 }
62665 if (type == 336 || type == 345)
62666 {
62667 for (int num450 = 0; num450 < 6; num450++)
62668 {
62669 int num451 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 196);
62670 Main.dust[num451].noGravity = true;
62671 Main.dust[num451].scale = scale;
62672 }
62673 }
62674 if (type == 358)
62675 {
62676 velocity = oldVelocity * 0.2f;
62677 for (int num452 = 0; num452 < 100; num452++)
62678 {
62679 int num453 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 211, 0f, 0f, 75, default(Color), 1.2f);
62680 Dust dust2;
62681 if (Main.rand.Next(2) == 0)
62682 {
62683 dust2 = Main.dust[num453];
62684 dust2.alpha += 25;
62685 }
62686 if (Main.rand.Next(2) == 0)
62687 {
62688 dust2 = Main.dust[num453];
62689 dust2.alpha += 25;
62690 }
62691 if (Main.rand.Next(2) == 0)
62692 {
62693 dust2 = Main.dust[num453];
62694 dust2.alpha += 25;
62695 }
62696 if (Main.rand.Next(2) == 0)
62697 {
62698 Main.dust[num453].scale = 0.6f;
62699 }
62700 else
62701 {
62702 Main.dust[num453].noGravity = true;
62703 }
62704 dust2 = Main.dust[num453];
62705 dust2.velocity *= 0.3f;
62706 dust2 = Main.dust[num453];
62707 dust2.velocity += velocity;
62708 dust2 = Main.dust[num453];
62709 dust2.velocity *= 1f + (float)Main.rand.Next(-100, 101) * 0.01f;
62710 Main.dust[num453].velocity.X += (float)Main.rand.Next(-50, 51) * 0.015f;
62711 Main.dust[num453].velocity.Y += (float)Main.rand.Next(-50, 51) * 0.015f;
62712 Main.dust[num453].position = base.Center;
62713 }
62714 }
62715 if (type == 406)
62716 {
62717 int num454 = 175;
62718 Color newColor6 = new Color(0, 80, 255, 100);
62719 velocity = oldVelocity * 0.2f;
62720 for (int num455 = 0; num455 < 40; num455++)
62721 {
62722 int num456 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 4, 0f, 0f, num454, newColor6, 1.6f);
62723 Dust dust2;
62724 if (Main.rand.Next(2) == 0)
62725 {
62726 dust2 = Main.dust[num456];
62727 dust2.alpha += 25;
62728 }
62729 if (Main.rand.Next(2) == 0)
62730 {
62731 dust2 = Main.dust[num456];
62732 dust2.alpha += 25;
62733 }
62734 if (Main.rand.Next(2) == 0)
62735 {
62736 dust2 = Main.dust[num456];
62737 dust2.alpha += 25;
62738 }
62739 if (Main.rand.Next(2) == 0)
62740 {
62741 Main.dust[num456].scale = 0.6f;
62742 }
62743 else
62744 {
62745 Main.dust[num456].noGravity = true;
62746 }
62747 dust2 = Main.dust[num456];
62748 dust2.velocity *= 0.3f;
62749 dust2 = Main.dust[num456];
62750 dust2.velocity += velocity;
62751 dust2 = Main.dust[num456];
62752 dust2.velocity *= 1f + (float)Main.rand.Next(-100, 101) * 0.01f;
62753 Main.dust[num456].velocity.X += (float)Main.rand.Next(-50, 51) * 0.015f;
62754 Main.dust[num456].velocity.Y += (float)Main.rand.Next(-50, 51) * 0.015f;
62755 Main.dust[num456].position = base.Center;
62756 }
62757 }
62758 if (type == 344)
62759 {
62760 for (int num457 = 0; num457 < 8; num457++)
62761 {
62762 int num458 = Dust.NewDust(position, width, height, 197, 0f, 0f, 50);
62763 Main.dust[num458].noGravity = true;
62764 Main.dust[num458].velocity.X *= 0.75f;
62765 Main.dust[num458].velocity.Y *= 0.75f;
62767 dust2.velocity -= velocity * 0.025f;
62768 }
62769 }
62770 else if (type == 343)
62771 {
62773 for (int num459 = 4; num459 < 31; num459++)
62774 {
62775 float num460 = oldVelocity.X * (30f / (float)num459);
62776 float num461 = oldVelocity.Y * (30f / (float)num459);
62777 int num462 = Dust.NewDust(new Vector2(oldPosition.X - num460, oldPosition.Y - num461), 8, 8, 197, oldVelocity.X, oldVelocity.Y, 100, default(Color), 1.2f);
62778 Main.dust[num462].noGravity = true;
62780 dust2.velocity *= 0.5f;
62781 }
62782 }
62783 else if (type == 349)
62784 {
62786 for (int num463 = 0; num463 < 3; num463++)
62787 {
62788 int num464 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 76);
62789 Main.dust[num464].noGravity = true;
62790 Main.dust[num464].noLight = true;
62791 Main.dust[num464].scale = 0.7f;
62792 }
62793 }
62794 if (type == 323)
62795 {
62796 SoundEngine.PlaySound(0, (int)position.X, (int)position.Y);
62797 for (int num465 = 0; num465 < 20; num465++)
62798 {
62799 int num466 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 7);
62800 if (Main.rand.Next(2) == 0)
62801 {
62802 Main.dust[num466].noGravity = true;
62803 Main.dust[num466].scale = 1.3f;
62805 dust2.velocity *= 1.5f;
62806 dust2 = Main.dust[num466];
62807 dust2.velocity -= oldVelocity * 0.5f;
62808 dust2 = Main.dust[num466];
62809 dust2.velocity *= 1.5f;
62810 }
62811 else
62812 {
62814 dust2.velocity *= 0.75f;
62815 dust2 = Main.dust[num466];
62816 dust2.velocity -= oldVelocity * 0.25f;
62817 Main.dust[num466].scale = 0.8f;
62818 }
62819 }
62820 }
62821 if (type == 589)
62822 {
62825 if (ai[1] == 1f)
62826 {
62828 }
62829 if (ai[1] == 2f)
62830 {
62832 }
62833 if (ai[1] == 3f)
62834 {
62836 }
62837 if (ai[1] == 4f)
62838 {
62840 }
62841 newColor7.A = 100;
62842 for (int num467 = 0; num467 < 30; num467++)
62843 {
62844 int num468 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 11, 0f, 0f, 0, newColor7);
62846 dust2.velocity *= 1f + Main.rand.NextFloat() * 1f;
62847 if (num467 < 10)
62848 {
62849 Main.dust[num468].noGravity = true;
62850 dust2 = Main.dust[num468];
62851 dust2.velocity *= 0.5f;
62852 }
62853 }
62854 }
62855 if (type == 346)
62856 {
62858 for (int num469 = 0; num469 < 20; num469++)
62859 {
62860 int num470 = 10;
62861 if (ai[1] == 1f)
62862 {
62863 num470 = 4;
62864 }
62865 int num471 = Dust.NewDust(position, width, height, num470);
62866 Main.dust[num471].noGravity = true;
62867 }
62868 }
62869 if (type == 335)
62870 {
62872 for (int num472 = 0; num472 < 20; num472++)
62873 {
62874 int num473 = 90 - (int)ai[1];
62875 int num474 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, num473);
62876 Main.dust[num474].noLight = true;
62877 Main.dust[num474].scale = 0.8f;
62878 }
62879 }
62880 if (type == 318)
62881 {
62882 SoundEngine.PlaySound(0, (int)position.X, (int)position.Y);
62883 for (int num475 = 0; num475 < 10; num475++)
62884 {
62885 int num476 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 30);
62886 if (Main.rand.Next(2) == 0)
62887 {
62888 Main.dust[num476].noGravity = true;
62889 }
62890 }
62891 }
62892 if (type == 378)
62893 {
62894 for (int num477 = 0; num477 < 10; num477++)
62895 {
62896 int num478 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 30);
62897 if (Main.rand.Next(2) == 0)
62898 {
62899 Main.dust[num478].noGravity = true;
62900 }
62901 }
62902 }
62903 else if (type == 311)
62904 {
62905 for (int num479 = 0; num479 < 5; num479++)
62906 {
62907 int num480 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 189);
62908 Main.dust[num480].scale = 0.85f;
62909 Main.dust[num480].noGravity = true;
62911 dust2.velocity += velocity * 0.5f;
62912 }
62913 }
62914 else if (type == 316)
62915 {
62916 for (int num481 = 0; num481 < 5; num481++)
62917 {
62918 int num482 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 195);
62919 Main.dust[num482].scale = 0.85f;
62920 Main.dust[num482].noGravity = true;
62922 dust2.velocity += velocity * 0.5f;
62923 }
62924 }
62925 else if (type == 184 || type == 195)
62926 {
62927 SoundEngine.PlaySound(0, (int)position.X, (int)position.Y);
62928 for (int num483 = 0; num483 < 5; num483++)
62929 {
62930 Dust.NewDust(new Vector2(position.X, position.Y), width, height, 7);
62931 }
62932 }
62933 else if (type == 275 || type == 276)
62934 {
62935 SoundEngine.PlaySound(0, (int)position.X, (int)position.Y);
62936 for (int num484 = 0; num484 < 5; num484++)
62937 {
62938 Dust.NewDust(new Vector2(position.X, position.Y), width, height, 7);
62939 }
62940 }
62941 else if (type == 291)
62942 {
62943 if (owner == Main.myPlayer)
62944 {
62945 NewProjectile(GetProjectileSource_FromThis(), base.Center.X, base.Center.Y, 0f, 0f, 292, damage, knockBack, owner);
62946 }
62947 }
62948 else if (type == 295)
62949 {
62950 if (owner == Main.myPlayer)
62951 {
62952 NewProjectile(GetProjectileSource_FromThis(), base.Center.X, base.Center.Y, 0f, 0f, 296, (int)((double)damage * 0.75), knockBack, owner);
62953 }
62954 }
62955 else if (type == 270 || type == 837)
62956 {
62957 SoundEngine.PlaySound(0, (int)position.X, (int)position.Y, 27);
62958 if (type == 270)
62959 {
62960 for (int num485 = 0; num485 < 20; num485++)
62961 {
62962 int num486 = Dust.NewDust(position, width, height, 26, 0f, 0f, 100);
62963 Main.dust[num486].noGravity = true;
62965 dust2.velocity *= 1.2f;
62966 Main.dust[num486].scale = 1.3f;
62967 dust2 = Main.dust[num486];
62968 dust2.velocity -= oldVelocity * 0.3f;
62969 num486 = Dust.NewDust(new Vector2(position.X + 4f, position.Y + 4f), width - 8, height - 8, 5, 0f, 0f, 100, default(Color), 1.5f);
62970 Main.dust[num486].noGravity = true;
62971 dust2 = Main.dust[num486];
62972 dust2.velocity *= 3f;
62973 }
62974 }
62975 else
62976 {
62977 for (int num487 = 0; num487 < 20; num487++)
62978 {
62979 int num488 = Dust.NewDust(position, width, height, 26, 0f, 0f, 100);
62980 Main.dust[num488].noGravity = true;
62982 dust2.velocity *= 1.2f;
62983 Main.dust[num488].scale = 1.3f;
62984 dust2 = Main.dust[num488];
62985 dust2.velocity -= oldVelocity * 0.3f;
62986 num488 = Dust.NewDust(new Vector2(position.X + 4f, position.Y + 4f), width - 8, height - 8, 6, 0f, 0f, 100, default(Color), 2f);
62987 Main.dust[num488].noGravity = true;
62988 dust2 = Main.dust[num488];
62989 dust2.velocity *= 3f;
62990 }
62991 }
62992 }
62993 else if (type == 265)
62994 {
62995 for (int num489 = 0; num489 < 15; num489++)
62996 {
62997 int num490 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 163, 0f, 0f, 100, default(Color), 1.2f);
62998 Main.dust[num490].noGravity = true;
63000 dust2.velocity *= 1.2f;
63001 dust2 = Main.dust[num490];
63002 dust2.velocity -= oldVelocity * 0.3f;
63003 }
63004 }
63005 else if (type == 355)
63006 {
63007 for (int num491 = 0; num491 < 15; num491++)
63008 {
63009 int num492 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 205, 0f, 0f, 100, default(Color), 1.2f);
63010 Main.dust[num492].noGravity = true;
63012 dust2.velocity *= 1.2f;
63013 dust2 = Main.dust[num492];
63014 dust2.velocity -= oldVelocity * 0.3f;
63015 }
63016 }
63017 else if (type == 304)
63018 {
63019 for (int num493 = 0; num493 < 3; num493++)
63020 {
63021 int num494 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 182, 0f, 0f, 100, default(Color), 0.8f);
63022 Main.dust[num494].noGravity = true;
63024 dust2.velocity *= 1.2f;
63025 dust2 = Main.dust[num494];
63026 dust2.velocity -= oldVelocity * 0.3f;
63027 }
63028 }
63029 else if (type == 263)
63030 {
63032 for (int num495 = 0; num495 < 15; num495++)
63033 {
63034 int num496 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 92, velocity.X, velocity.Y, Main.rand.Next(0, 101), default(Color), 1f + (float)Main.rand.Next(40) * 0.01f);
63035 Main.dust[num496].noGravity = true;
63037 dust2.velocity *= 2f;
63038 }
63039 }
63040 else if (type == 261)
63041 {
63042 SoundEngine.PlaySound(0, (int)position.X, (int)position.Y);
63043 for (int num497 = 0; num497 < 15; num497++)
63044 {
63045 Dust dust43 = Dust.NewDustDirect(new Vector2(position.X, position.Y), width, height, 148);
63046 Dust dust2 = dust43;
63047 dust2.velocity *= 2f;
63048 dust43.velocity.Y -= 0.4f;
63049 }
63050 for (int num498 = 0; num498 < 3; num498++)
63051 {
63052 Dust dust44 = Dust.NewDustDirect(new Vector2(position.X, position.Y), width, height, 228);
63053 Dust dust2 = dust44;
63054 dust2.velocity *= 2f;
63055 dust44.noLight = true;
63056 dust2 = dust44;
63057 dust2.scale *= 0.8f;
63058 dust44.velocity.Y -= 0.3f;
63059 }
63060 }
63061 else if (type == 928)
63062 {
63063 SoundEngine.PlaySound(0, (int)position.X, (int)position.Y);
63064 for (int num499 = 0; num499 < 25; num499++)
63065 {
63066 Dust.NewDust(new Vector2(position.X, position.Y), width, height, 5, velocity.X, velocity.Y, 0, Color.White, 1.3f);
63067 }
63068 }
63069 else if (type == 229)
63070 {
63071 for (int num500 = 0; num500 < 25; num500++)
63072 {
63073 int num501 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 157);
63074 Main.dust[num501].noGravity = true;
63076 dust2.velocity *= 1.5f;
63077 Main.dust[num501].scale = 1.5f;
63078 }
63079 }
63080 else if (type == 239)
63081 {
63082 if (velocity.Y > 0f)
63083 {
63084 int num502 = Dust.NewDust(new Vector2(position.X, position.Y + (float)height - 2f), 2, 2, 154);
63085 Main.dust[num502].position.X -= 2f;
63086 Main.dust[num502].alpha = 38;
63088 dust2.velocity *= 0.1f;
63089 dust2 = Main.dust[num502];
63090 dust2.velocity += -oldVelocity * 0.25f;
63091 Main.dust[num502].scale = 0.95f;
63092 }
63093 }
63094 else if (type == 245)
63095 {
63096 if (velocity.Y > 0f)
63097 {
63098 int num503 = Dust.NewDust(new Vector2(position.X, position.Y + (float)height - 2f), 2, 2, 114);
63099 Main.dust[num503].noGravity = true;
63100 Main.dust[num503].position.X -= 2f;
63101 Main.dust[num503].alpha = 38;
63103 dust2.velocity *= 0.1f;
63104 dust2 = Main.dust[num503];
63105 dust2.velocity += -oldVelocity * 0.25f;
63106 Main.dust[num503].scale = 0.95f;
63107 }
63108 }
63109 else if (type == 264)
63110 {
63111 if (velocity.Y > 0f)
63112 {
63113 int num504 = Dust.NewDust(new Vector2(position.X, position.Y + (float)height - 2f), 2, 2, 54);
63114 Main.dust[num504].noGravity = true;
63115 Main.dust[num504].position.X -= 2f;
63116 Main.dust[num504].alpha = 38;
63118 dust2.velocity *= 0.1f;
63119 dust2 = Main.dust[num504];
63120 dust2.velocity += -oldVelocity * 0.25f;
63121 Main.dust[num504].scale = 0.95f;
63122 }
63123 }
63124 else if (type == 206 || type == 225)
63125 {
63126 SoundEngine.PlaySound(6, (int)position.X, (int)position.Y);
63127 for (int num505 = 0; num505 < 5; num505++)
63128 {
63129 Dust.NewDust(new Vector2(position.X, position.Y), width, height, 40);
63130 }
63131 }
63132 else if (type == 227)
63133 {
63134 SoundEngine.PlaySound(6, (int)position.X, (int)position.Y);
63135 for (int num506 = 0; num506 < 15; num506++)
63136 {
63137 int num507 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 157);
63138 Main.dust[num507].noGravity = true;
63140 dust2.velocity += oldVelocity * Main.rand.NextFloat();
63141 Main.dust[num507].scale = 1.5f;
63142 }
63143 }
63144 else if (type == 237 && owner == Main.myPlayer)
63145 {
63146 NewProjectile(GetProjectileSource_FromThis(), base.Center.X, base.Center.Y, 0f, 0f, 238, damage, knockBack, owner);
63147 }
63148 else if (type == 243 && owner == Main.myPlayer)
63149 {
63150 NewProjectile(GetProjectileSource_FromThis(), base.Center.X, base.Center.Y, 0f, 0f, 244, damage, knockBack, owner);
63151 }
63152 else if (type == 120)
63153 {
63154 SoundEngine.PlaySound(0, (int)position.X, (int)position.Y);
63155 for (int num508 = 0; num508 < 10; num508++)
63156 {
63157 int num509 = Dust.NewDust(new Vector2(position.X - velocity.X, position.Y - velocity.Y), width, height, 67, velocity.X, velocity.Y, 100);
63158 if (num508 < 5)
63159 {
63160 Main.dust[num509].noGravity = true;
63161 }
63163 dust2.velocity *= 0.2f;
63164 }
63165 }
63166 else if (type == 181 || type == 189 || type == 566)
63167 {
63168 for (int num510 = 0; num510 < 6; num510++)
63169 {
63170 int num511 = Dust.NewDust(position, width, height, 150, velocity.X, velocity.Y, 50);
63171 Main.dust[num511].noGravity = true;
63172 Main.dust[num511].scale = 1f;
63173 }
63174 }
63175 else if (type == 178)
63176 {
63177 for (int num512 = 0; num512 < 85; num512++)
63178 {
63179 int num513 = Main.rand.Next(139, 143);
63180 int num514 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, num513, velocity.X, velocity.Y, 0, default(Color), 1.2f);
63181 Main.dust[num514].velocity.X += (float)Main.rand.Next(-50, 51) * 0.01f;
63182 Main.dust[num514].velocity.Y += (float)Main.rand.Next(-50, 51) * 0.01f;
63183 Main.dust[num514].velocity.X *= 1f + (float)Main.rand.Next(-50, 51) * 0.01f;
63184 Main.dust[num514].velocity.Y *= 1f + (float)Main.rand.Next(-50, 51) * 0.01f;
63185 Main.dust[num514].velocity.X += (float)Main.rand.Next(-50, 51) * 0.05f;
63186 Main.dust[num514].velocity.Y += (float)Main.rand.Next(-50, 51) * 0.05f;
63188 dust2.scale *= 1f + (float)Main.rand.Next(-30, 31) * 0.01f;
63189 }
63190 for (int num515 = 0; num515 < 40; num515++)
63191 {
63192 int num516 = Main.rand.Next(276, 283);
63193 int num517 = Gore.NewGore(position, velocity, num516);
63194 Main.gore[num517].velocity.X += (float)Main.rand.Next(-50, 51) * 0.01f;
63195 Main.gore[num517].velocity.Y += (float)Main.rand.Next(-50, 51) * 0.01f;
63196 Main.gore[num517].velocity.X *= 1f + (float)Main.rand.Next(-50, 51) * 0.01f;
63197 Main.gore[num517].velocity.Y *= 1f + (float)Main.rand.Next(-50, 51) * 0.01f;
63199 gore2.scale *= 1f + (float)Main.rand.Next(-20, 21) * 0.01f;
63200 Main.gore[num517].velocity.X += (float)Main.rand.Next(-50, 51) * 0.05f;
63201 Main.gore[num517].velocity.Y += (float)Main.rand.Next(-50, 51) * 0.05f;
63202 }
63203 }
63204 else if (type == 289)
63205 {
63206 for (int num518 = 0; num518 < 30; num518++)
63207 {
63208 int num519 = Main.rand.Next(139, 143);
63209 int num520 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, num519, velocity.X, velocity.Y, 0, default(Color), 1.2f);
63210 Main.dust[num520].velocity.X += (float)Main.rand.Next(-50, 51) * 0.01f;
63211 Main.dust[num520].velocity.Y += (float)Main.rand.Next(-50, 51) * 0.01f;
63212 Main.dust[num520].velocity.X *= 1f + (float)Main.rand.Next(-50, 51) * 0.01f;
63213 Main.dust[num520].velocity.Y *= 1f + (float)Main.rand.Next(-50, 51) * 0.01f;
63214 Main.dust[num520].velocity.X += (float)Main.rand.Next(-50, 51) * 0.05f;
63215 Main.dust[num520].velocity.Y += (float)Main.rand.Next(-50, 51) * 0.05f;
63217 dust2.scale *= 1f + (float)Main.rand.Next(-30, 31) * 0.01f;
63218 }
63219 for (int num521 = 0; num521 < 15; num521++)
63220 {
63221 int num522 = Main.rand.Next(276, 283);
63222 int num523 = Gore.NewGore(position, velocity, num522);
63223 Main.gore[num523].velocity.X += (float)Main.rand.Next(-50, 51) * 0.01f;
63224 Main.gore[num523].velocity.Y += (float)Main.rand.Next(-50, 51) * 0.01f;
63225 Main.gore[num523].velocity.X *= 1f + (float)Main.rand.Next(-50, 51) * 0.01f;
63226 Main.gore[num523].velocity.Y *= 1f + (float)Main.rand.Next(-50, 51) * 0.01f;
63228 gore2.scale *= 1f + (float)Main.rand.Next(-20, 21) * 0.01f;
63229 Main.gore[num523].velocity.X += (float)Main.rand.Next(-50, 51) * 0.05f;
63230 Main.gore[num523].velocity.Y += (float)Main.rand.Next(-50, 51) * 0.05f;
63231 }
63232 }
63233 else if (type == 475 || type == 505 || type == 506)
63234 {
63235 if (ai[1] == 0f)
63236 {
63237 SoundEngine.PlaySound(0, (int)position.X, (int)position.Y);
63238 }
63239 if (ai[1] < 10f)
63240 {
63241 Vector2 vector54 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
63242 float num524 = 0f - velocity.X;
63243 float num525 = 0f - velocity.Y;
63244 float num526 = 1f;
63245 if (ai[0] <= 17f)
63246 {
63247 num526 = ai[0] / 17f;
63248 }
63249 int num527 = (int)(30f * num526);
63250 float num528 = 1f;
63251 if (ai[0] <= 30f)
63252 {
63253 num528 = ai[0] / 30f;
63254 }
63255 float num529 = 0.4f * num528;
63256 float num530 = num529;
63257 num525 += num530;
63258 for (int num531 = 0; num531 < num527; num531++)
63259 {
63260 float num532 = (float)Math.Sqrt(num524 * num524 + num525 * num525);
63261 float num533 = 5.6f;
63262 if (Math.Abs(num524) + Math.Abs(num525) < 1f)
63263 {
63264 num533 *= Math.Abs(num524) + Math.Abs(num525) / 1f;
63265 }
63266 num532 = num533 / num532;
63267 num524 *= num532;
63268 num525 *= num532;
63270 int num534 = 3;
63271 if (type == 506)
63272 {
63273 num534 = 30;
63274 }
63275 if (type == 505)
63276 {
63277 num534 = 239;
63278 }
63279 if ((float)num531 > ai[1])
63280 {
63281 for (int num535 = 0; num535 < 4; num535++)
63282 {
63283 int num536 = Dust.NewDust(vector54, width, height, num534);
63284 Main.dust[num536].noGravity = true;
63286 dust2.velocity *= 0.3f;
63287 }
63288 }
63289 vector54.X += num524;
63290 vector54.Y += num525;
63291 num524 = 0f - velocity.X;
63292 num525 = 0f - velocity.Y;
63293 num530 += num529;
63294 num525 += num530;
63295 }
63296 }
63297 }
63298 else if (type == 171)
63299 {
63300 if (ai[1] == 0f)
63301 {
63302 SoundEngine.PlaySound(0, (int)position.X, (int)position.Y);
63303 }
63304 if (ai[1] < 10f)
63305 {
63306 Vector2 vector55 = new Vector2(position.X + (float)width * 0.5f, position.Y + (float)height * 0.5f);
63307 float num537 = 0f - velocity.X;
63308 float num538 = 0f - velocity.Y;
63309 float num539 = 1f;
63310 if (ai[0] <= 17f)
63311 {
63312 num539 = ai[0] / 17f;
63313 }
63314 int num540 = (int)(30f * num539);
63315 float num541 = 1f;
63316 if (ai[0] <= 30f)
63317 {
63318 num541 = ai[0] / 30f;
63319 }
63320 float num542 = 0.4f * num541;
63321 float num543 = num542;
63322 num538 += num543;
63323 for (int num544 = 0; num544 < num540; num544++)
63324 {
63325 float num545 = (float)Math.Sqrt(num537 * num537 + num538 * num538);
63326 float num546 = 5.6f;
63327 if (Math.Abs(num537) + Math.Abs(num538) < 1f)
63328 {
63329 num546 *= Math.Abs(num537) + Math.Abs(num538) / 1f;
63330 }
63331 num545 = num546 / num545;
63332 num537 *= num545;
63333 num538 *= num545;
63335 if ((float)num544 > ai[1])
63336 {
63337 for (int num547 = 0; num547 < 4; num547++)
63338 {
63339 int num548 = Dust.NewDust(vector55, width, height, 129);
63340 Main.dust[num548].noGravity = true;
63342 dust2.velocity *= 0.3f;
63343 }
63344 }
63345 vector55.X += num537;
63346 vector55.Y += num538;
63347 num537 = 0f - velocity.X;
63348 num538 = 0f - velocity.Y;
63349 num543 += num542;
63350 num538 += num543;
63351 }
63352 }
63353 }
63354 else if (type == 117)
63355 {
63356 SoundEngine.PlaySound(0, (int)position.X, (int)position.Y);
63357 for (int num549 = 0; num549 < 10; num549++)
63358 {
63359 Dust.NewDust(new Vector2(position.X, position.Y), width, height, 26);
63360 }
63361 }
63362 else if (type == 166)
63363 {
63365 for (int num550 = 0; num550 < 10; num550++)
63366 {
63367 int num551 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 76);
63368 Main.dust[num551].noGravity = true;
63370 dust2.velocity -= oldVelocity * 0.25f;
63371 }
63372 }
63373 else if (type == 158)
63374 {
63375 SoundEngine.PlaySound(0, (int)position.X, (int)position.Y);
63376 for (int num552 = 0; num552 < 10; num552++)
63377 {
63378 int num553 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 9);
63379 Main.dust[num553].noGravity = true;
63381 dust2.velocity -= velocity * 0.5f;
63382 }
63383 }
63384 else if (type == 159)
63385 {
63386 SoundEngine.PlaySound(0, (int)position.X, (int)position.Y);
63387 for (int num554 = 0; num554 < 10; num554++)
63388 {
63389 int num555 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 11);
63390 Main.dust[num555].noGravity = true;
63392 dust2.velocity -= velocity * 0.5f;
63393 }
63394 }
63395 else if (type == 160)
63396 {
63397 SoundEngine.PlaySound(0, (int)position.X, (int)position.Y);
63398 for (int num556 = 0; num556 < 10; num556++)
63399 {
63400 int num557 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 19);
63401 Main.dust[num557].noGravity = true;
63403 dust2.velocity -= velocity * 0.5f;
63404 }
63405 }
63406 else if (type == 161)
63407 {
63408 SoundEngine.PlaySound(0, (int)position.X, (int)position.Y);
63409 for (int num558 = 0; num558 < 10; num558++)
63410 {
63411 int num559 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 11);
63412 Main.dust[num559].noGravity = true;
63414 dust2.velocity -= velocity * 0.5f;
63415 }
63416 }
63417 else if (type >= 191 && type <= 194)
63418 {
63419 int num560 = Gore.NewGore(new Vector2(position.X - (float)(width / 2), position.Y - (float)(height / 2)), new Vector2(0f, 0f), Main.rand.Next(61, 64), scale);
63421 gore2.velocity *= 0.1f;
63422 }
63423 else if (!Main.projPet[type])
63424 {
63425 if (type == 93)
63426 {
63427 SoundEngine.PlaySound(0, (int)position.X, (int)position.Y);
63428 for (int num561 = 0; num561 < 10; num561++)
63429 {
63430 int num562 = Dust.NewDust(position, width, height, 57, 0f, 0f, 100);
63431 Main.dust[num562].noGravity = true;
63432 Main.dust[num562].fadeIn = 1f;
63433 Main.dust[num562].velocity.X *= 2f;
63434 Main.dust[num562].velocity.Y *= 2f;
63435 Main.dust[num562].velocity.Y -= Main.rand.NextFloat() * 1.5f;
63436 }
63437 }
63438 else if (type == 99 || type == 1013 || type == 727 || type == 1014 || type == 1021)
63439 {
63440 short num563 = 1;
63441 num563 = type switch
63442 {
63443 1013 => 243,
63444 727 => 40,
63445 1014 => 12,
63446 1021 => 323,
63447 _ => 1,
63448 };
63449 SoundEngine.PlaySound(0, (int)position.X, (int)position.Y);
63450 for (int num564 = 0; num564 < 30; num564++)
63451 {
63452 int num565 = Dust.NewDust(position, width, height, num563);
63453 if (Main.rand.Next(2) == 0)
63454 {
63456 dust2.scale *= 1.4f;
63457 }
63458 velocity *= 1.9f;
63459 }
63460 if (type == 1014 && owner == Main.myPlayer)
63461 {
63462 int number = Item.NewItem(new EntitySource_Loot(this), position, base.Size, 29);
63463 if (Main.netMode == 1)
63464 {
63465 NetMessage.SendData(21, -1, -1, null, number, 1f);
63466 }
63467 }
63468 }
63469 else if (type == 1005)
63470 {
63471 SoundEngine.PlaySound(0, (int)position.X, (int)position.Y);
63472 for (int num566 = 0; num566 < 10; num566++)
63473 {
63474 int num567 = Dust.NewDust(position, width, height, 1);
63475 if (Main.rand.Next(2) == 0)
63476 {
63478 dust2.scale *= 1.1f;
63479 }
63480 velocity *= 1.6f;
63481 }
63482 }
63483 else if (type == 772)
63484 {
63485 SoundEngine.PlaySound(0, (int)position.X, (int)position.Y);
63486 for (int num568 = 0; num568 < 6; num568++)
63487 {
63488 Dust.NewDust(position, width, height, 1);
63489 velocity *= 1.9f;
63490 }
63491 for (int num569 = 0; num569 < 20; num569++)
63492 {
63493 Dust dust45 = Dust.NewDustDirect(position, width, height, Main.rand.NextFromList<int>(86, 87, 88, 89, 90), 0f, 0f, 0, default(Color), 0.7f);
63494 dust45.noGravity = true;
63495 Dust dust2 = dust45;
63496 dust2.velocity *= 2.9f;
63497 dust45.velocity.Y *= 0.8f;
63498 dust45.fadeIn = 1.1f;
63499 }
63500 for (int num570 = 0; num570 < 7; num570++)
63501 {
63502 Dust dust46 = Dust.NewDustDirect(position, width, height, Main.rand.NextFromList<int>(86, 87, 88, 89, 90), 0f, 0f, 0, default(Color), 0.7f);
63503 dust46.noGravity = true;
63504 Dust dust2 = dust46;
63505 dust2.velocity *= 2.9f;
63506 dust46.velocity.Y *= 0.8f;
63507 dust46.fadeIn = 1.1f;
63508 dust46.noLight = true;
63509 }
63510 if (owner == Main.myPlayer)
63511 {
63512 DropGeodeGems();
63513 }
63514 }
63515 else if (type == 763)
63516 {
63517 for (int num571 = 0; num571 < 4; num571++)
63518 {
63519 int num572 = Dust.NewDust(position, width, height, 40);
63520 if (Main.rand.Next(2) == 0)
63521 {
63523 dust2.scale *= 0.8f;
63524 }
63525 Main.dust[num572].noGravity = true;
63526 velocity *= 1.9f;
63527 }
63528 }
63529 else if (type == 655)
63530 {
63531 SoundEngine.PlaySound(4, (int)position.X, (int)position.Y);
63532 for (int num573 = 0; num573 < 30; num573++)
63533 {
63534 int num574 = Dust.NewDust(position, width, height, 147);
63535 if (Main.rand.Next(2) == 0)
63536 {
63538 dust2.scale *= 1.4f;
63539 }
63540 velocity *= 1.9f;
63541 }
63542 if (Main.netMode != 1 && !wet)
63543 {
63544 int num575 = 2;
63545 if (Main.rand.Next(3) == 0)
63546 {
63547 num575++;
63548 }
63549 if (Main.rand.Next(3) == 0)
63550 {
63551 num575++;
63552 }
63553 if (Main.rand.Next(3) == 0)
63554 {
63555 num575++;
63556 }
63559 {
63560 int num577 = Main.rand.Next(210, 212);
63561 int num578 = NPC.NewNPC(GetNPCSource_FromThis(), (int)base.Center.X, (int)base.Center.Y, num577, 1);
63562 Main.npc[num578].velocity.X = (float)Main.rand.Next(-200, 201) * 0.002f;
63563 Main.npc[num578].velocity.Y = (float)Main.rand.Next(-200, 201) * 0.002f;
63564 Main.npc[num578].netUpdate = true;
63565 }
63566 }
63567 }
63568 else if (type == 728)
63569 {
63571 for (int num579 = 0; num579 < 7; num579++)
63572 {
63573 Dust.NewDust(position, width, height, 58, velocity.X * 0.1f, velocity.Y * 0.1f, 150, default(Color), 0.8f);
63574 }
63575 for (float num580 = 0f; num580 < 1f; num580 += 0.125f)
63576 {
63577 Dust.NewDustPerfect(base.Center, 278, Vector2.UnitY.RotatedBy(num580 * ((float)Math.PI * 2f) + Main.rand.NextFloat() * 0.5f) * (4f + Main.rand.NextFloat() * 4f), 150, Color.CornflowerBlue).noGravity = true;
63578 }
63579 for (float num581 = 0f; num581 < 1f; num581 += 0.25f)
63580 {
63581 Dust.NewDustPerfect(base.Center, 278, Vector2.UnitY.RotatedBy(num581 * ((float)Math.PI * 2f) + Main.rand.NextFloat() * 0.5f) * (2f + Main.rand.NextFloat() * 3f), 150, Color.Gold).noGravity = true;
63582 }
63584 if (base.Hitbox.Intersects(Utils.CenteredRectangle(Main.screenPosition + vector56 / 2f, vector56 + new Vector2(400f))))
63585 {
63586 for (int num582 = 0; num582 < 7; num582++)
63587 {
63588 Gore.NewGore(position, Main.rand.NextVector2CircularEdge(0.5f, 0.5f) * velocity.Length(), Utils.SelectRandom<int>(Main.rand, 16, 17, 17, 17, 17, 17, 17, 17));
63589 }
63590 }
63591 }
63592 else if (type == 729)
63593 {
63595 for (int num583 = 0; num583 < 10; num583++)
63596 {
63597 Dust dust47 = Dust.NewDustDirect(position, width, height, 279, velocity.X * 0.1f, velocity.Y * 0.1f, 150, default(Color), 1.2f);
63598 dust47.noGravity = true;
63599 dust47.velocity.X *= 2f;
63600 }
63601 }
63602 else if (type == 723 || type == 724 || type == 725 || type == 726 || type == 907)
63603 {
63604 if (type == 723)
63605 {
63607 for (int num584 = 0; num584 < 10; num584++)
63608 {
63609 Dust dust48 = Dust.NewDustDirect(position, width, height, 88, velocity.X * 0.1f, velocity.Y * 0.1f, 150, default(Color), 1.2f);
63610 dust48.noGravity = true;
63611 dust48.velocity.X *= 2f;
63612 }
63613 for (int num585 = 0; num585 < 3; num585++)
63614 {
63615 Gore gore3 = Gore.NewGoreDirect(position, new Vector2(velocity.X * 0.05f, velocity.Y * 0.05f), Utils.SelectRandom<int>(Main.rand, 16, 17, 17));
63616 Gore gore2 = gore3;
63617 gore2.velocity *= 2f;
63618 }
63619 if (owner == Main.myPlayer && Main.player[owner].starCloakCooldown == 0)
63620 {
63621 Main.player[owner].starCloakCooldown = 60;
63622 int number2 = Item.NewItem(GetItemSource_DropAsItem(), (int)position.X, (int)position.Y, width, height, 4143);
63623 if (Main.netMode == 1)
63624 {
63625 NetMessage.SendData(21, -1, -1, null, number2, 1f);
63626 }
63627 }
63628 }
63629 else
63630 {
63631 if (type == 907)
63632 {
63634 }
63635 else
63636 {
63638 }
63639 for (int num586 = 0; num586 < 10; num586++)
63640 {
63641 Dust dust49 = Main.dust[Dust.NewDust(position, width, height, 58, velocity.X * 0.1f, velocity.Y * 0.1f, 150, default(Color), 1.2f)];
63642 if (type == 907)
63643 {
63644 Dust dust2 = dust49;
63645 dust2.velocity *= 0.75f;
63646 }
63647 }
63648 for (int num587 = 0; num587 < 3; num587++)
63649 {
63650 Gore gore4 = Main.gore[Gore.NewGore(position, new Vector2(velocity.X * 0.05f, velocity.Y * 0.05f), Main.rand.Next(16, 18))];
63651 if (type == 907)
63652 {
63653 Gore gore2 = gore4;
63654 gore2.velocity *= 0.5f;
63655 }
63656 }
63657 }
63658 }
63659 else if (type == 91 || type == 92)
63660 {
63662 for (int num588 = 0; num588 < 10; num588++)
63663 {
63664 Dust.NewDust(position, width, height, 58, velocity.X * 0.1f, velocity.Y * 0.1f, 150, default(Color), 1.2f);
63665 }
63666 for (int num589 = 0; num589 < 3; num589++)
63667 {
63668 Gore.NewGore(position, new Vector2(velocity.X * 0.05f, velocity.Y * 0.05f), Main.rand.Next(16, 18));
63669 }
63670 if ((type == 91 || (type == 92 && ai[0] > 0f)) && owner == Main.myPlayer)
63671 {
63672 float x = position.X + (float)Main.rand.Next(-400, 400);
63673 float y = position.Y - (float)Main.rand.Next(600, 900);
63674 Vector2 vector57 = new Vector2(x, y);
63675 float num590 = position.X + (float)(width / 2) - vector57.X;
63676 float num591 = position.Y + (float)(height / 2) - vector57.Y;
63677 int num592 = 22;
63678 float num593 = (float)Math.Sqrt(num590 * num590 + num591 * num591);
63679 num593 = (float)num592 / num593;
63680 num590 *= num593;
63681 num591 *= num593;
63682 int num594 = damage;
63683 if (type == 91)
63684 {
63685 num594 /= 3;
63686 }
63687 int num595 = NewProjectile(GetProjectileSource_FromThis(), x, y, num590, num591, 92, num594, knockBack, owner);
63688 if (type == 91)
63689 {
63690 Main.projectile[num595].ai[1] = position.Y;
63691 Main.projectile[num595].ai[0] = 1f;
63692 }
63693 else
63694 {
63695 Main.projectile[num595].ai[1] = position.Y;
63696 }
63697 }
63698 }
63699 else if (type == 89)
63700 {
63701 SoundEngine.PlaySound(0, (int)position.X, (int)position.Y);
63702 for (int num596 = 0; num596 < 5; num596++)
63703 {
63704 int num597 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 68);
63705 Main.dust[num597].noGravity = true;
63707 dust2.velocity *= 1.5f;
63708 dust2 = Main.dust[num597];
63709 dust2.scale *= 0.9f;
63710 }
63711 if (type == 89 && owner == Main.myPlayer)
63712 {
63713 for (int num598 = 0; num598 < 2; num598++)
63714 {
63715 float num599 = (0f - velocity.X) * (float)Main.rand.Next(40, 70) * 0.01f + (float)Main.rand.Next(-20, 21) * 0.4f;
63716 float num600 = (0f - velocity.Y) * (float)Main.rand.Next(40, 70) * 0.01f + (float)Main.rand.Next(-20, 21) * 0.4f;
63717 NewProjectile(GetProjectileSource_FromThis(), position.X + num599, position.Y + num600, num599, num600, 90, (int)((double)damage * 0.5), 0f, owner);
63718 }
63719 }
63720 }
63721 else if (type == 967)
63722 {
63724 for (int num601 = 0; num601 < 20; num601++)
63725 {
63726 int num602 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 219, velocity.X, velocity.Y, 0, default(Color), 0.5f + (float)Main.rand.Next(-20, 40) * 0.01f);
63727 Main.dust[num602].noGravity = true;
63728 Main.dust[num602].velocity = Main.rand.NextVector2Circular(6f, 6f);
63729 }
63730 }
63731 else if (type == 969)
63732 {
63734 if (activeSound2 != null)
63735 {
63736 activeSound2.Volume = 0f;
63737 activeSound2.Stop();
63738 }
63739 }
63740 else if (type == 177)
63741 {
63742 for (int num603 = 0; num603 < 20; num603++)
63743 {
63744 int num604 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 137, 0f, 0f, Main.rand.Next(0, 101), default(Color), 1f + (float)Main.rand.Next(-20, 40) * 0.01f);
63746 dust2.velocity -= oldVelocity * 0.2f;
63747 if (Main.rand.Next(3) == 0)
63748 {
63749 dust2 = Main.dust[num604];
63750 dust2.scale *= 0.8f;
63751 dust2 = Main.dust[num604];
63752 dust2.velocity *= 0.5f;
63753 }
63754 else
63755 {
63756 Main.dust[num604].noGravity = true;
63757 }
63758 }
63759 }
63760 else if (type == 119 || type == 118 || type == 128 || type == 359)
63761 {
63762 int num605 = 10;
63763 if (type == 119 || type == 359)
63764 {
63765 num605 = 20;
63766 }
63768 for (int num606 = 0; num606 < num605; num606++)
63769 {
63770 int num607 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 92);
63771 if (Main.rand.Next(3) != 0)
63772 {
63774 dust2.velocity *= 2f;
63775 Main.dust[num607].noGravity = true;
63776 dust2 = Main.dust[num607];
63777 dust2.scale *= 1.75f;
63778 }
63779 else
63780 {
63782 dust2.scale *= 0.5f;
63783 }
63784 }
63785 }
63786 else if (type == 309)
63787 {
63788 int num608 = 10;
63790 for (int num609 = 0; num609 < num608; num609++)
63791 {
63792 int num610 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 185);
63793 if (Main.rand.Next(2) == 0)
63794 {
63796 dust2.velocity *= 2f;
63797 Main.dust[num610].noGravity = true;
63798 dust2 = Main.dust[num610];
63799 dust2.scale *= 1.75f;
63800 }
63801 }
63802 }
63803 else if (type == 308)
63804 {
63805 int num611 = 80;
63807 for (int num612 = 0; num612 < num611; num612++)
63808 {
63809 int num613 = Dust.NewDust(new Vector2(position.X, position.Y + 16f), width, height - 16, 185);
63811 dust2.velocity *= 2f;
63812 Main.dust[num613].noGravity = true;
63813 dust2 = Main.dust[num613];
63814 dust2.scale *= 1.15f;
63815 }
63816 }
63817 else if (aiStyle == 29 && type <= 126)
63818 {
63819 SoundEngine.PlaySound(0, (int)position.X, (int)position.Y);
63820 int num614 = type - 121 + 86;
63821 for (int num615 = 0; num615 < 15; num615++)
63822 {
63823 int num616 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, num614, oldVelocity.X, oldVelocity.Y, 50, default(Color), 1.2f);
63824 Main.dust[num616].noGravity = true;
63826 dust2.scale *= 1.25f;
63827 dust2 = Main.dust[num616];
63828 dust2.velocity *= 0.5f;
63829 }
63830 }
63831 else if (type == 597)
63832 {
63833 SoundEngine.PlaySound(0, (int)position.X, (int)position.Y);
63834 for (int num617 = 0; num617 < 15; num617++)
63835 {
63836 int num618 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 262, oldVelocity.X, oldVelocity.Y, 50, default(Color), 1.2f);
63837 Main.dust[num618].noGravity = true;
63839 dust2.scale *= 1.25f;
63840 dust2 = Main.dust[num618];
63841 dust2.velocity *= 0.5f;
63842 }
63843 }
63844 else if (type == 731)
63845 {
63846 SoundEngine.PlaySound(0, (int)position.X, (int)position.Y);
63847 for (int num619 = 0; num619 < 15; num619++)
63848 {
63849 Dust dust50 = Dust.NewDustDirect(position, width, height, 226, oldVelocity.X * 0.5f, oldVelocity.Y * 0.5f, 50, default(Color), 0.5f);
63850 if (Main.rand.Next(3) != 0)
63851 {
63852 dust50.noGravity = true;
63853 Dust dust2 = dust50;
63854 dust2.scale *= 1.5f;
63855 dust2 = dust50;
63856 dust2.velocity *= 0.5f;
63857 }
63858 }
63859 }
63860 else if (type == 337)
63861 {
63863 for (int num620 = 0; num620 < 10; num620++)
63864 {
63865 int num621 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 197);
63866 Main.dust[num621].noGravity = true;
63867 }
63868 }
63869 else if (type == 379 || type == 377)
63870 {
63871 for (int num622 = 0; num622 < 5; num622++)
63872 {
63873 int num623 = Dust.NewDust(position, width, height, 171, 0f, 0f, 100);
63874 Main.dust[num623].scale = (float)Main.rand.Next(1, 10) * 0.1f;
63875 Main.dust[num623].noGravity = true;
63876 Main.dust[num623].fadeIn = 1.5f;
63878 dust2.velocity *= 0.75f;
63879 }
63880 }
63881 else if (type == 80)
63882 {
63883 if (ai[0] >= 0f)
63884 {
63886 for (int num624 = 0; num624 < 10; num624++)
63887 {
63888 Dust.NewDust(new Vector2(position.X, position.Y), width, height, 67);
63889 }
63890 }
63891 int num625 = (int)position.X / 16;
63892 int num626 = (int)position.Y / 16;
63893 if (Main.tile[num625, num626] == null)
63894 {
63895 Main.tile[num625, num626] = new Tile();
63896 }
63897 if (Main.tile[num625, num626].type == 127 && Main.tile[num625, num626].active())
63898 {
63900 }
63901 }
63902 else if (type == 76 || type == 77 || type == 78)
63903 {
63904 for (int num627 = 0; num627 < 5; num627++)
63905 {
63906 int num628 = Dust.NewDust(position, width, height, 27, 0f, 0f, 80, default(Color), 1.5f);
63907 Main.dust[num628].noGravity = true;
63908 }
63909 }
63910 else if (type == 55 || type == 719)
63911 {
63912 for (int num629 = 0; num629 < 5; num629++)
63913 {
63914 int num630 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 18, 0f, 0f, 0, default(Color), 1.5f);
63915 Main.dust[num630].noGravity = true;
63916 }
63917 }
63918 else if (type == 51 || type == 267)
63919 {
63920 SoundEngine.PlaySound(0, (int)position.X, (int)position.Y);
63921 for (int num631 = 0; num631 < 5; num631++)
63922 {
63923 Dust.NewDust(new Vector2(position.X, position.Y), width, height, 0, 0f, 0f, 0, default(Color), 0.7f);
63924 }
63925 }
63926 else if (type == 478)
63927 {
63928 if (owner == Main.myPlayer)
63929 {
63930 NewProjectile(GetProjectileSource_FromThis(), base.Center.X, base.Center.Y, 0f, 0f, 480, (int)((double)damage * 0.8), knockBack * 0.5f, owner);
63931 }
63932 }
63933 else if (type == 477 || type == 479)
63934 {
63935 for (int num632 = 0; num632 < 5; num632++)
63936 {
63937 }
63938 Collision.HitTiles(position, velocity, width, height);
63939 }
63940 else if (type == 2 || type == 82)
63941 {
63942 SoundEngine.PlaySound(0, (int)position.X, (int)position.Y);
63943 for (int num633 = 0; num633 < 10; num633++)
63944 {
63945 Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100);
63946 }
63947 }
63948 else if (type == 474)
63949 {
63950 SoundEngine.PlaySound(0, (int)position.X, (int)position.Y);
63951 for (int num634 = 0; num634 < 20; num634++)
63952 {
63953 Dust.NewDust(new Vector2(position.X, position.Y), width, height, 26, 0f, 0f, 0, default(Color), 0.9f);
63954 }
63955 }
63956 else if (type == 172)
63957 {
63958 SoundEngine.PlaySound(0, (int)position.X, (int)position.Y);
63959 for (int num635 = 0; num635 < 20; num635++)
63960 {
63961 Dust.NewDust(new Vector2(position.X, position.Y), width, height, 135, 0f, 0f, 100);
63962 }
63963 }
63964 else if (type == 103)
63965 {
63966 SoundEngine.PlaySound(0, (int)position.X, (int)position.Y);
63967 for (int num636 = 0; num636 < 20; num636++)
63968 {
63969 int num637 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 75, 0f, 0f, 100);
63970 if (Main.rand.Next(2) == 0)
63971 {
63973 dust2.scale *= 2.5f;
63974 Main.dust[num637].noGravity = true;
63975 dust2 = Main.dust[num637];
63976 dust2.velocity *= 5f;
63977 }
63978 }
63979 }
63980 else if (type == 278)
63981 {
63982 SoundEngine.PlaySound(0, (int)position.X, (int)position.Y);
63983 for (int num638 = 0; num638 < 20; num638++)
63984 {
63985 int num639 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 169, 0f, 0f, 100);
63986 if (Main.rand.Next(2) == 0)
63987 {
63989 dust2.scale *= 1.5f;
63990 Main.dust[num639].noGravity = true;
63991 dust2 = Main.dust[num639];
63992 dust2.velocity *= 5f;
63993 }
63994 }
63995 }
63996 else if (type == 3 || type == 48 || type == 54 || type == 599 || type == 909)
63997 {
63998 SoundEngine.PlaySound(0, (int)position.X, (int)position.Y);
63999 for (int num640 = 0; num640 < 10; num640++)
64000 {
64001 Dust.NewDust(new Vector2(position.X, position.Y), width, height, 1, velocity.X * 0.1f, velocity.Y * 0.1f, 0, default(Color), 0.75f);
64002 }
64003 }
64004 else if (type == 330)
64005 {
64006 SoundEngine.PlaySound(0, (int)position.X, (int)position.Y);
64007 for (int num641 = 0; num641 < 10; num641++)
64008 {
64009 Dust.NewDust(new Vector2(position.X, position.Y), width, height, 0, velocity.X * 0.4f, velocity.Y * 0.4f, 0, default(Color), 0.75f);
64010 }
64011 }
64012 else if (type == 4)
64013 {
64014 SoundEngine.PlaySound(0, (int)position.X, (int)position.Y);
64015 for (int num642 = 0; num642 < 10; num642++)
64016 {
64017 Dust.NewDust(new Vector2(position.X, position.Y), width, height, 14, 0f, 0f, 150, default(Color), 1.1f);
64018 }
64019 }
64020 else if (type == 5)
64021 {
64023 for (int num643 = 0; num643 < 60; num643++)
64024 {
64025 int num644 = Main.rand.Next(3);
64026 Dust.NewDust(position, width, height, num644 switch
64027 {
64028 0 => 15,
64029 1 => 57,
64030 _ => 58,
64031 }, velocity.X * 0.5f, velocity.Y * 0.5f, 150, default(Color), 1.5f);
64032 }
64033 }
64034 else if (type == 9 || type == 12 || type == 503 || type == 955)
64035 {
64037 if (type == 12 || type == 955)
64038 {
64040 if (Main.tenthAnniversaryWorld && (type == 12 || type == 955))
64041 {
64043 newColor8.A /= 2;
64044 }
64045 for (int num645 = 0; num645 < 7; num645++)
64046 {
64047 Dust.NewDust(position, width, height, 58, velocity.X * 0.1f, velocity.Y * 0.1f, 150, default(Color), 0.8f);
64048 }
64049 for (float num646 = 0f; num646 < 1f; num646 += 0.125f)
64050 {
64051 Dust.NewDustPerfect(base.Center, 278, Vector2.UnitY.RotatedBy(num646 * ((float)Math.PI * 2f) + Main.rand.NextFloat() * 0.5f) * (4f + Main.rand.NextFloat() * 4f), 150, newColor8).noGravity = true;
64052 }
64053 for (float num647 = 0f; num647 < 1f; num647 += 0.25f)
64054 {
64055 Dust.NewDustPerfect(base.Center, 278, Vector2.UnitY.RotatedBy(num647 * ((float)Math.PI * 2f) + Main.rand.NextFloat() * 0.5f) * (2f + Main.rand.NextFloat() * 3f), 150, Color.Gold).noGravity = true;
64056 }
64058 if (base.Hitbox.Intersects(Utils.CenteredRectangle(Main.screenPosition + vector58 / 2f, vector58 + new Vector2(400f))))
64059 {
64060 for (int num648 = 0; num648 < 7; num648++)
64061 {
64062 Gore.NewGore(position, Main.rand.NextVector2CircularEdge(0.5f, 0.5f) * velocity.Length(), Utils.SelectRandom<int>(Main.rand, 16, 17, 17, 17, 17, 17, 17, 17));
64063 }
64064 }
64065 }
64066 else
64067 {
64068 int num649 = 10;
64069 int num650 = 3;
64070 if (type == 503)
64071 {
64072 num649 = 40;
64073 num650 = 2;
64074 velocity /= 2f;
64075 }
64076 for (int num651 = 0; num651 < num649; num651++)
64077 {
64078 Dust.NewDust(position, width, height, 58, velocity.X * 0.1f, velocity.Y * 0.1f, 150, default(Color), 1.2f);
64079 }
64080 for (int num652 = 0; num652 < num650; num652++)
64081 {
64082 int num653 = Main.rand.Next(16, 18);
64083 if (type == 503)
64084 {
64085 num653 = 16;
64086 }
64087 Gore.NewGore(position, new Vector2(velocity.X * 0.05f, velocity.Y * 0.05f), num653);
64088 }
64089 if (type == 12 && damage < 100)
64090 {
64091 for (int num654 = 0; num654 < 10; num654++)
64092 {
64093 Dust.NewDust(position, width, height, 57, velocity.X * 0.1f, velocity.Y * 0.1f, 150, default(Color), 1.2f);
64094 }
64095 for (int num655 = 0; num655 < 3; num655++)
64096 {
64097 Gore.NewGore(position, new Vector2(velocity.X * 0.05f, velocity.Y * 0.05f), Main.rand.Next(16, 18));
64098 }
64099 }
64100 }
64101 }
64102 else if (type == 281)
64103 {
64104 if (ai[0] != -3f)
64105 {
64106 SoundEngine.PlaySound(4, (int)position.X, (int)position.Y);
64107 int num656 = Gore.NewGore(position, new Vector2((float)Main.rand.Next(-20, 21) * 0.2f, (float)Main.rand.Next(-20, 21) * 0.2f), 76);
64109 gore2.velocity -= velocity * 0.5f;
64110 num656 = Gore.NewGore(new Vector2(position.X, position.Y), new Vector2((float)Main.rand.Next(-20, 21) * 0.2f, (float)Main.rand.Next(-20, 21) * 0.2f), 77);
64111 gore2 = Main.gore[num656];
64112 gore2.velocity -= velocity * 0.5f;
64114 for (int num657 = 0; num657 < 20; num657++)
64115 {
64116 int num658 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 100, default(Color), 1.5f);
64118 dust2.velocity *= 1.4f;
64119 }
64120 for (int num659 = 0; num659 < 10; num659++)
64121 {
64122 int num660 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100, default(Color), 2.5f);
64123 Main.dust[num660].noGravity = true;
64125 dust2.velocity *= 5f;
64126 num660 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100, default(Color), 1.5f);
64127 dust2 = Main.dust[num660];
64128 dust2.velocity *= 3f;
64129 }
64130 num656 = Gore.NewGore(new Vector2(position.X, position.Y), default(Vector2), Main.rand.Next(61, 64));
64131 gore2 = Main.gore[num656];
64132 gore2.velocity *= 0.4f;
64133 Main.gore[num656].velocity.X += 1f;
64134 Main.gore[num656].velocity.Y += 1f;
64135 num656 = Gore.NewGore(new Vector2(position.X, position.Y), default(Vector2), Main.rand.Next(61, 64));
64136 gore2 = Main.gore[num656];
64137 gore2.velocity *= 0.4f;
64138 Main.gore[num656].velocity.X -= 1f;
64139 Main.gore[num656].velocity.Y += 1f;
64140 num656 = Gore.NewGore(new Vector2(position.X, position.Y), default(Vector2), Main.rand.Next(61, 64));
64141 gore2 = Main.gore[num656];
64142 gore2.velocity *= 0.4f;
64143 Main.gore[num656].velocity.X += 1f;
64144 Main.gore[num656].velocity.Y -= 1f;
64145 num656 = Gore.NewGore(new Vector2(position.X, position.Y), default(Vector2), Main.rand.Next(61, 64));
64146 gore2 = Main.gore[num656];
64147 gore2.velocity *= 0.4f;
64148 Main.gore[num656].velocity.X -= 1f;
64149 Main.gore[num656].velocity.Y -= 1f;
64150 if (damage > 0)
64151 {
64152 position.X += width / 2;
64153 position.Y += height / 2;
64154 width = 128;
64155 height = 128;
64156 position.X -= width / 2;
64157 position.Y -= height / 2;
64158 if (ai[0] == -2f)
64159 {
64160 hostile = true;
64161 }
64162 Damage();
64163 }
64164 }
64165 }
64166 else if (type == 162)
64167 {
64169 for (int num661 = 0; num661 < 20; num661++)
64170 {
64171 int num662 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 100, default(Color), 1.5f);
64173 dust2.velocity *= 1.4f;
64174 }
64175 for (int num663 = 0; num663 < 10; num663++)
64176 {
64177 int num664 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100, default(Color), 2.5f);
64178 Main.dust[num664].noGravity = true;
64180 dust2.velocity *= 5f;
64181 num664 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100, default(Color), 1.5f);
64182 dust2 = Main.dust[num664];
64183 dust2.velocity *= 3f;
64184 }
64185 int num665 = Gore.NewGore(new Vector2(position.X, position.Y), default(Vector2), Main.rand.Next(61, 64));
64187 gore2.velocity *= 0.4f;
64188 Main.gore[num665].velocity.X += 1f;
64189 Main.gore[num665].velocity.Y += 1f;
64190 num665 = Gore.NewGore(new Vector2(position.X, position.Y), default(Vector2), Main.rand.Next(61, 64));
64191 gore2 = Main.gore[num665];
64192 gore2.velocity *= 0.4f;
64193 Main.gore[num665].velocity.X -= 1f;
64194 Main.gore[num665].velocity.Y += 1f;
64195 num665 = Gore.NewGore(new Vector2(position.X, position.Y), default(Vector2), Main.rand.Next(61, 64));
64196 gore2 = Main.gore[num665];
64197 gore2.velocity *= 0.4f;
64198 Main.gore[num665].velocity.X += 1f;
64199 Main.gore[num665].velocity.Y -= 1f;
64200 num665 = Gore.NewGore(new Vector2(position.X, position.Y), default(Vector2), Main.rand.Next(61, 64));
64201 gore2 = Main.gore[num665];
64202 gore2.velocity *= 0.4f;
64203 Main.gore[num665].velocity.X -= 1f;
64204 Main.gore[num665].velocity.Y -= 1f;
64205 position.X += width / 2;
64206 position.Y += height / 2;
64207 width = 128;
64208 height = 128;
64209 position.X -= width / 2;
64210 position.Y -= height / 2;
64211 Damage();
64212 }
64213 else if (type == 240)
64214 {
64216 for (int num666 = 0; num666 < 20; num666++)
64217 {
64218 int num667 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 100, default(Color), 1.5f);
64220 dust2.velocity *= 1.4f;
64221 }
64222 for (int num668 = 0; num668 < 10; num668++)
64223 {
64224 int num669 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100, default(Color), 2.5f);
64225 Main.dust[num669].noGravity = true;
64227 dust2.velocity *= 5f;
64228 num669 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100, default(Color), 1.5f);
64229 dust2 = Main.dust[num669];
64230 dust2.velocity *= 3f;
64231 }
64232 int num670 = Gore.NewGore(new Vector2(position.X, position.Y), default(Vector2), Main.rand.Next(61, 64));
64234 gore2.velocity *= 0.4f;
64235 Main.gore[num670].velocity.X += 1f;
64236 Main.gore[num670].velocity.Y += 1f;
64237 num670 = Gore.NewGore(new Vector2(position.X, position.Y), default(Vector2), Main.rand.Next(61, 64));
64238 gore2 = Main.gore[num670];
64239 gore2.velocity *= 0.4f;
64240 Main.gore[num670].velocity.X -= 1f;
64241 Main.gore[num670].velocity.Y += 1f;
64242 num670 = Gore.NewGore(new Vector2(position.X, position.Y), default(Vector2), Main.rand.Next(61, 64));
64243 gore2 = Main.gore[num670];
64244 gore2.velocity *= 0.4f;
64245 Main.gore[num670].velocity.X += 1f;
64246 Main.gore[num670].velocity.Y -= 1f;
64247 num670 = Gore.NewGore(new Vector2(position.X, position.Y), default(Vector2), Main.rand.Next(61, 64));
64248 gore2 = Main.gore[num670];
64249 gore2.velocity *= 0.4f;
64250 Main.gore[num670].velocity.X -= 1f;
64251 Main.gore[num670].velocity.Y -= 1f;
64252 position.X += width / 2;
64253 position.Y += height / 2;
64254 width = 96;
64255 height = 96;
64256 position.X -= width / 2;
64257 position.Y -= height / 2;
64258 Damage();
64259 }
64260 else
64261 {
64262 _ = type;
64263 _ = 162;
64264 if (type == 283 || type == 282)
64265 {
64267 for (int num671 = 0; num671 < 10; num671++)
64268 {
64269 int num672 = Dust.NewDust(position, width, height, 171, 0f, 0f, 100);
64270 Main.dust[num672].scale = (float)Main.rand.Next(1, 10) * 0.1f;
64271 Main.dust[num672].noGravity = true;
64272 Main.dust[num672].fadeIn = 1.5f;
64274 dust2.velocity *= 0.75f;
64275 }
64276 }
64277 else if (type == 284)
64278 {
64279 for (int num673 = 0; num673 < 10; num673++)
64280 {
64281 int num674 = Main.rand.Next(139, 143);
64282 int num675 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, num674, (0f - velocity.X) * 0.3f, (0f - velocity.Y) * 0.3f, 0, default(Color), 1.2f);
64283 Main.dust[num675].velocity.X += (float)Main.rand.Next(-50, 51) * 0.01f;
64284 Main.dust[num675].velocity.Y += (float)Main.rand.Next(-50, 51) * 0.01f;
64285 Main.dust[num675].velocity.X *= 1f + (float)Main.rand.Next(-50, 51) * 0.01f;
64286 Main.dust[num675].velocity.Y *= 1f + (float)Main.rand.Next(-50, 51) * 0.01f;
64287 Main.dust[num675].velocity.X += (float)Main.rand.Next(-50, 51) * 0.05f;
64288 Main.dust[num675].velocity.Y += (float)Main.rand.Next(-50, 51) * 0.05f;
64290 dust2.scale *= 1f + (float)Main.rand.Next(-30, 31) * 0.01f;
64291 }
64292 for (int num676 = 0; num676 < 5; num676++)
64293 {
64294 int num677 = Main.rand.Next(276, 283);
64295 int num678 = Gore.NewGore(position, -velocity * 0.3f, num677);
64296 Main.gore[num678].velocity.X += (float)Main.rand.Next(-50, 51) * 0.01f;
64297 Main.gore[num678].velocity.Y += (float)Main.rand.Next(-50, 51) * 0.01f;
64298 Main.gore[num678].velocity.X *= 1f + (float)Main.rand.Next(-50, 51) * 0.01f;
64299 Main.gore[num678].velocity.Y *= 1f + (float)Main.rand.Next(-50, 51) * 0.01f;
64301 gore2.scale *= 1f + (float)Main.rand.Next(-20, 21) * 0.01f;
64302 Main.gore[num678].velocity.X += (float)Main.rand.Next(-50, 51) * 0.05f;
64303 Main.gore[num678].velocity.Y += (float)Main.rand.Next(-50, 51) * 0.05f;
64304 }
64305 }
64306 else if (type == 286)
64307 {
64309 for (int num679 = 0; num679 < 7; num679++)
64310 {
64311 int num680 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 100, default(Color), 1.5f);
64312 }
64313 for (int num681 = 0; num681 < 3; num681++)
64314 {
64315 int num682 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100, default(Color), 2.5f);
64316 Main.dust[num682].noGravity = true;
64318 dust2.velocity *= 3f;
64319 num682 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100, default(Color), 1.5f);
64320 dust2 = Main.dust[num682];
64321 dust2.velocity *= 2f;
64322 }
64323 int num683 = Gore.NewGore(new Vector2(position.X - 10f, position.Y - 10f), default(Vector2), Main.rand.Next(61, 64));
64325 gore2.velocity *= 0.3f;
64326 Main.gore[num683].velocity.X += (float)Main.rand.Next(-10, 11) * 0.05f;
64327 Main.gore[num683].velocity.Y += (float)Main.rand.Next(-10, 11) * 0.05f;
64328 if (owner == Main.myPlayer)
64329 {
64330 localAI[1] = -1f;
64331 maxPenetrate = 0;
64332 position.X += width / 2;
64333 position.Y += height / 2;
64334 width = 80;
64335 height = 80;
64336 position.X -= width / 2;
64337 position.Y -= height / 2;
64338 Damage();
64339 }
64340 }
64341 else if (type == 14 || type == 20 || type == 36 || type == 83 || type == 84 || type == 389 || type == 104 || type == 279 || type == 100 || type == 110 || type == 180 || type == 207 || type == 357 || type == 242 || type == 302 || type == 257 || type == 259 || type == 285 || type == 287 || type == 576 || type == 577 || type == 876 || type == 968)
64342 {
64343 Collision.HitTiles(position, velocity, width, height);
64345 }
64346 else if (type == 981)
64347 {
64348 Collision.HitTiles(position, velocity, width, height);
64351 {
64352 PositionInWorld = base.Center,
64353 MovementVector = Vector2.Zero
64354 }, owner);
64355 }
64356 else if (type == 1006)
64357 {
64358 Collision.HitTiles(position, velocity, width, height);
64359 SoundEngine.PlaySound(0, position);
64360 float num684 = Main.rand.NextFloat() * ((float)Math.PI * 2f);
64361 for (float num685 = 0f; num685 < 1f; num685 += 1f)
64362 {
64363 float num686 = num684 + (float)Math.PI * 2f * num685;
64364 Vector2 vector59 = Vector2.UnitX.RotatedBy(num686);
64365 Vector2 center = base.Center;
64366 float num687 = 0.4f;
64368 {
64369 PositionInWorld = center,
64370 MovementVector = vector59 * num687
64371 }, owner);
64372 }
64373 }
64374 else if (type == 660)
64375 {
64376 Collision.HitTiles(position, velocity, width, height);
64378 int num688 = Main.rand.Next(4, 10);
64379 for (int num689 = 0; num689 < num688; num689++)
64380 {
64381 int num690 = Dust.NewDust(base.Center, 0, 0, 180, 0f, 0f, 100);
64383 dust2.velocity *= 1.6f;
64384 Main.dust[num690].velocity.Y -= 1f;
64385 dust2 = Main.dust[num690];
64386 dust2.velocity += -velocity * (Main.rand.NextFloat() * 2f - 1f) * 0.5f;
64387 Main.dust[num690].scale = 2f;
64388 Main.dust[num690].fadeIn = 0.5f;
64389 Main.dust[num690].noGravity = true;
64390 }
64391 }
64392 else if (type == 761 || type == 762)
64393 {
64395 if (owner == Main.myPlayer && !noDropItem)
64396 {
64397 int num691 = 4343;
64398 if (type == 762)
64399 {
64400 num691 = 4344;
64401 }
64402 int num692 = Item.NewItem(GetItemSource_DropAsItem(), (int)position.X, (int)position.Y, width, height, num691);
64403 Main.item[num692].noGrabDelay = 0;
64404 if (Main.netMode == 1 && num692 >= 0)
64405 {
64406 NetMessage.SendData(21, -1, -1, null, num692, 1f);
64407 }
64408 }
64409 }
64410 else if (type == 712)
64411 {
64412 Collision.HitTiles(position, velocity, width, height);
64414 int num693 = Main.rand.Next(6, 12);
64415 for (int num694 = 0; num694 < num693; num694++)
64416 {
64417 int num695 = Dust.NewDust(base.Center, 0, 0, 15, 0f, 0f, 100);
64419 dust2.velocity *= 1.6f;
64420 Main.dust[num695].velocity.Y -= 1f;
64421 dust2 = Main.dust[num695];
64422 dust2.velocity += -velocity * (Main.rand.NextFloat() * 2f - 1f) * 0.5f;
64423 Main.dust[num695].scale = 1f;
64424 Main.dust[num695].fadeIn = 1.5f;
64425 Main.dust[num695].noGravity = true;
64426 Main.dust[num695].color = new Color(255, 255, 255, 0) * 0.3f;
64427 dust2 = Main.dust[num695];
64428 dust2.velocity *= 0.7f;
64429 dust2 = Main.dust[num695];
64430 dust2.position += Main.dust[num695].velocity * 5f;
64431 }
64432 for (int num696 = 0; num696 < 3; num696++)
64433 {
64434 Gore gore5 = Gore.NewGoreDirect(position, Vector2.Zero, 1008, 1f + Main.rand.NextFloatDirection() * 0.2f);
64435 Gore gore2 = gore5;
64436 gore2.velocity *= 4f;
64437 }
64438 }
64439 else if (type == 638)
64440 {
64441 Collision.HitTiles(position, velocity, width, height);
64443 int num697 = Main.rand.Next(2, 5);
64444 for (int num698 = 0; num698 < num697; num698++)
64445 {
64446 int num699 = Dust.NewDust(base.Center, 0, 0, 229, 0f, 0f, 100);
64448 dust2.velocity *= 1.6f;
64449 Main.dust[num699].velocity.Y -= 1f;
64450 dust2 = Main.dust[num699];
64451 dust2.position -= Vector2.One * 4f;
64452 Main.dust[num699].position = Vector2.Lerp(Main.dust[num699].position, base.Center, 0.5f);
64453 Main.dust[num699].noGravity = true;
64454 }
64455 }
64456 else if (type == 15 || type == 321)
64457 {
64459 for (int num700 = 0; num700 < 20; num700++)
64460 {
64461 int num701 = 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);
64462 Main.dust[num701].noGravity = true;
64464 dust2.velocity *= 2f;
64465 num701 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, (0f - velocity.X) * 0.2f, (0f - velocity.Y) * 0.2f, 100);
64466 dust2 = Main.dust[num701];
64467 dust2.velocity *= 2f;
64468 }
64469 }
64470 else if (type == 253)
64471 {
64473 for (int num702 = 0; num702 < 20; num702++)
64474 {
64475 int num703 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 135, (0f - velocity.X) * 0.2f, (0f - velocity.Y) * 0.2f, 100, default(Color), 2f);
64476 Main.dust[num703].noGravity = true;
64478 dust2.velocity *= 2f;
64479 num703 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 135, (0f - velocity.X) * 0.2f, (0f - velocity.Y) * 0.2f, 100);
64480 dust2 = Main.dust[num703];
64481 dust2.velocity *= 2f;
64482 }
64483 }
64484 else if (type == 95 || type == 96)
64485 {
64487 for (int num704 = 0; num704 < 20; num704++)
64488 {
64489 int num705 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 75, (0f - velocity.X) * 0.2f, (0f - velocity.Y) * 0.2f, 100, default(Color), 2f * scale);
64490 Main.dust[num705].noGravity = true;
64492 dust2.velocity *= 2f;
64493 num705 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 75, (0f - velocity.X) * 0.2f, (0f - velocity.Y) * 0.2f, 100, default(Color), 1f * scale);
64494 dust2 = Main.dust[num705];
64495 dust2.velocity *= 2f;
64496 }
64497 }
64498 else if (type == 17)
64499 {
64500 SoundEngine.PlaySound(0, (int)position.X, (int)position.Y);
64501 for (int num706 = 0; num706 < 5; num706++)
64502 {
64503 Dust.NewDust(new Vector2(position.X, position.Y), width, height, 0);
64504 }
64505 }
64506 else if (type == 31 || type == 42)
64507 {
64508 SoundEngine.PlaySound(0, (int)position.X, (int)position.Y);
64509 for (int num707 = 0; num707 < 5; num707++)
64510 {
64511 int num708 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 32);
64513 dust2.velocity *= 0.6f;
64514 }
64515 }
64516 else if (type >= 411 && type <= 414)
64517 {
64518 int num709 = 9;
64519 if (type == 412 || type == 414)
64520 {
64521 num709 = 11;
64522 }
64523 if (type == 413)
64524 {
64525 num709 = 19;
64526 }
64527 for (int num710 = 0; num710 < 5; num710++)
64528 {
64529 int num711 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, num709, 0f, velocity.Y / 2f);
64530 Main.dust[num711].noGravity = true;
64532 dust2.velocity -= velocity * 0.5f;
64533 }
64534 }
64535 else if (type == 109)
64536 {
64537 SoundEngine.PlaySound(0, (int)position.X, (int)position.Y);
64538 for (int num712 = 0; num712 < 5; num712++)
64539 {
64540 int num713 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 51, 0f, 0f, 0, default(Color), 0.6f);
64542 dust2.velocity *= 0.6f;
64543 }
64544 }
64545 else if (type == 39)
64546 {
64547 SoundEngine.PlaySound(0, (int)position.X, (int)position.Y);
64548 for (int num714 = 0; num714 < 5; num714++)
64549 {
64550 int num715 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 38);
64552 dust2.velocity *= 0.6f;
64553 }
64554 }
64555 else if (type == 71)
64556 {
64557 SoundEngine.PlaySound(0, (int)position.X, (int)position.Y);
64558 for (int num716 = 0; num716 < 5; num716++)
64559 {
64560 int num717 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 53);
64562 dust2.velocity *= 0.6f;
64563 }
64564 }
64565 else if (type == 179)
64566 {
64567 SoundEngine.PlaySound(0, (int)position.X, (int)position.Y);
64568 for (int num718 = 0; num718 < 5; num718++)
64569 {
64570 int num719 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 149);
64572 dust2.velocity *= 0.6f;
64573 }
64574 }
64575 else if (type == 40)
64576 {
64577 SoundEngine.PlaySound(0, (int)position.X, (int)position.Y);
64578 for (int num720 = 0; num720 < 5; num720++)
64579 {
64580 int num721 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 36);
64582 dust2.velocity *= 0.6f;
64583 }
64584 }
64585 else if (type == 21 || type == 471 || type == 532)
64586 {
64587 SoundEngine.PlaySound(0, (int)position.X, (int)position.Y);
64588 for (int num722 = 0; num722 < 10; num722++)
64589 {
64590 Dust.NewDust(new Vector2(position.X, position.Y), width, height, 26, 0f, 0f, 0, default(Color), 0.8f);
64591 }
64592 }
64593 else if (type == 583)
64594 {
64595 SoundEngine.PlaySound(0, (int)position.X, (int)position.Y);
64596 for (int num723 = 0; num723 < 10; num723++)
64597 {
64598 Dust.NewDust(new Vector2(position.X, position.Y), width, height, 4, 0f, 0f, 100, new Color(20, 250, 20, 240), 0.8f);
64599 }
64600 }
64601 else if (type == 584)
64602 {
64603 SoundEngine.PlaySound(0, (int)position.X, (int)position.Y);
64604 for (int num724 = 0; num724 < 10; num724++)
64605 {
64606 Dust.NewDust(new Vector2(position.X, position.Y), width, height, 4, 0f, 0f, 100, new Color(250, 20, 120, 240), 0.8f);
64607 }
64608 }
64609 else if (type == 24)
64610 {
64611 for (int num725 = 0; num725 < 10; num725++)
64612 {
64613 Dust.NewDust(new Vector2(position.X, position.Y), width, height, 1, velocity.X * 0.1f, velocity.Y * 0.1f, 0, default(Color), 0.75f);
64614 }
64615 }
64616 else if (type == 27)
64617 {
64619 for (int num726 = 0; num726 < 30; num726++)
64620 {
64621 int num727 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 172, velocity.X * 0.1f, velocity.Y * 0.1f, 100);
64622 Main.dust[num727].noGravity = true;
64623 Dust.NewDust(new Vector2(position.X, position.Y), width, height, 172, velocity.X * 0.1f, velocity.Y * 0.1f, 100, default(Color), 0.5f);
64624 }
64625 }
64626 else if (type == 38)
64627 {
64628 for (int num728 = 0; num728 < 10; num728++)
64629 {
64630 Dust.NewDust(new Vector2(position.X, position.Y), width, height, 42, velocity.X * 0.1f, velocity.Y * 0.1f);
64631 }
64632 }
64633 else if (type == 44 || type == 45)
64634 {
64636 for (int num729 = 0; num729 < 30; num729++)
64637 {
64638 int num730 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 27, velocity.X, velocity.Y, 100, default(Color), 1.7f);
64639 Main.dust[num730].noGravity = true;
64640 Dust.NewDust(new Vector2(position.X, position.Y), width, height, 27, velocity.X, velocity.Y, 100);
64641 }
64642 }
64643 else if (type == 41)
64644 {
64646 for (int num731 = 0; num731 < 10; num731++)
64647 {
64648 int num732 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 100, default(Color), 1.5f);
64649 }
64650 for (int num733 = 0; num733 < 5; num733++)
64651 {
64652 int num734 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100, default(Color), 2.5f);
64653 Main.dust[num734].noGravity = true;
64655 dust2.velocity *= 3f;
64656 num734 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100, default(Color), 1.5f);
64657 dust2 = Main.dust[num734];
64658 dust2.velocity *= 2f;
64659 }
64660 int num735 = Gore.NewGore(new Vector2(position.X, position.Y), default(Vector2), Main.rand.Next(61, 64));
64662 gore2.velocity *= 0.4f;
64663 Main.gore[num735].velocity.X += (float)Main.rand.Next(-10, 11) * 0.1f;
64664 Main.gore[num735].velocity.Y += (float)Main.rand.Next(-10, 11) * 0.1f;
64665 num735 = Gore.NewGore(new Vector2(position.X, position.Y), default(Vector2), Main.rand.Next(61, 64));
64666 gore2 = Main.gore[num735];
64667 gore2.velocity *= 0.4f;
64668 Main.gore[num735].velocity.X += (float)Main.rand.Next(-10, 11) * 0.1f;
64669 Main.gore[num735].velocity.Y += (float)Main.rand.Next(-10, 11) * 0.1f;
64670 if (owner == Main.myPlayer)
64671 {
64672 penetrate = -1;
64673 position.X += width / 2;
64674 position.Y += height / 2;
64675 width = 64;
64676 height = 64;
64677 position.X -= width / 2;
64678 position.Y -= height / 2;
64679 Damage();
64680 }
64681 }
64682 else if (type == 514)
64683 {
64685 for (int num736 = 0; num736 < 10; num736++)
64686 {
64687 int num737 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 100, default(Color), 1.3f);
64689 dust2.velocity *= 1.4f;
64690 }
64691 for (int num738 = 0; num738 < 6; num738++)
64692 {
64693 int num739 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100, default(Color), 2.1f);
64694 Main.dust[num739].noGravity = true;
64696 dust2.velocity *= 4.6f;
64697 num739 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100, default(Color), 1.3f);
64698 dust2 = Main.dust[num739];
64699 dust2.velocity *= 3.3f;
64700 if (Main.rand.Next(2) == 0)
64701 {
64702 num739 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100, default(Color), 1.1f);
64703 dust2 = Main.dust[num739];
64704 dust2.velocity *= 2.7f;
64705 }
64706 }
64707 if (owner == Main.myPlayer)
64708 {
64709 penetrate = -1;
64710 position.X += width / 2;
64711 position.Y += height / 2;
64712 width = 112;
64713 height = 112;
64714 position.X -= width / 2;
64715 position.Y -= height / 2;
64716 ai[0] = 2f;
64717 Damage();
64718 }
64719 }
64720 else if (type == 306)
64721 {
64722 SoundEngine.PlaySound(3, (int)position.X, (int)position.Y);
64723 for (int num740 = 0; num740 < 20; num740++)
64724 {
64725 int num741 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 184);
64727 dust2.scale *= 1.1f;
64728 Main.dust[num741].noGravity = true;
64729 }
64730 for (int num742 = 0; num742 < 30; num742++)
64731 {
64732 int num743 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 184);
64734 dust2.velocity *= 2.5f;
64735 dust2 = Main.dust[num743];
64736 dust2.scale *= 0.8f;
64737 Main.dust[num743].noGravity = true;
64738 }
64739 if (owner == Main.myPlayer)
64740 {
64741 int num744 = Main.rand.Next(2, 5);
64742 if (Main.rand.Next(1, 101) == 100)
64743 {
64744 num744 = 15;
64745 }
64746 for (int num745 = 0; num745 < num744; num745++)
64747 {
64748 float num746 = (float)Main.rand.Next(-35, 36) * 0.02f;
64749 float num747 = (float)Main.rand.Next(-35, 36) * 0.02f;
64750 num746 *= 10f;
64751 num747 *= 10f;
64752 NewProjectile(GetProjectileSource_FromThis(), position.X, position.Y, num746, num747, 307, (int)((double)damage * 0.75), (int)((double)knockBack * 0.35), Main.myPlayer);
64753 }
64754 }
64755 }
64756 else if (type == 469)
64757 {
64758 if (owner == Main.myPlayer)
64759 {
64760 int num748 = 6;
64761 for (int num749 = 0; num749 < num748; num749++)
64762 {
64763 if (num749 % 2 != 1 || Main.rand.Next(3) == 0)
64764 {
64765 Vector2 vector60 = position;
64766 Vector2 vector61 = oldVelocity;
64767 vector61.Normalize();
64768 vector61 *= 8f;
64769 float num750 = (float)Main.rand.Next(-35, 36) * 0.01f;
64770 float num751 = (float)Main.rand.Next(-35, 36) * 0.01f;
64772 num750 += oldVelocity.X / 6f;
64773 num751 += oldVelocity.Y / 6f;
64774 int num752 = NewProjectile(GetProjectileSource_FromThis(), vector60.X, vector60.Y, num750, num751, Main.player[owner].beeType(), Main.player[owner].beeDamage(damage / 3), Main.player[owner].beeKB(0f), Main.myPlayer);
64775 Main.projectile[num752].magic = false;
64776 Main.projectile[num752].ranged = true;
64777 Main.projectile[num752].penetrate = 2;
64778 }
64779 }
64780 }
64781 }
64782 else if (type == 183)
64783 {
64785 for (int num753 = 0; num753 < 20; num753++)
64786 {
64787 int num754 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 100, default(Color), 1.5f);
64789 dust2.velocity *= 1f;
64790 }
64791 int num755 = Gore.NewGore(new Vector2(position.X, position.Y), default(Vector2), Main.rand.Next(61, 64));
64792 Main.gore[num755].velocity.X += 1f;
64793 Main.gore[num755].velocity.Y += 1f;
64795 gore2.velocity *= 0.3f;
64796 num755 = Gore.NewGore(new Vector2(position.X, position.Y), default(Vector2), Main.rand.Next(61, 64));
64797 Main.gore[num755].velocity.X -= 1f;
64798 Main.gore[num755].velocity.Y += 1f;
64799 gore2 = Main.gore[num755];
64800 gore2.velocity *= 0.3f;
64801 num755 = Gore.NewGore(new Vector2(position.X, position.Y), default(Vector2), Main.rand.Next(61, 64));
64802 Main.gore[num755].velocity.X += 1f;
64803 Main.gore[num755].velocity.Y -= 1f;
64804 gore2 = Main.gore[num755];
64805 gore2.velocity *= 0.3f;
64806 num755 = Gore.NewGore(new Vector2(position.X, position.Y), default(Vector2), Main.rand.Next(61, 64));
64807 Main.gore[num755].velocity.X -= 1f;
64808 Main.gore[num755].velocity.Y -= 1f;
64809 gore2 = Main.gore[num755];
64810 gore2.velocity *= 0.3f;
64811 if (owner == Main.myPlayer)
64812 {
64813 int num756 = Main.rand.Next(15, 25);
64814 for (int num757 = 0; num757 < num756; num757++)
64815 {
64816 float speedX = (float)Main.rand.Next(-35, 36) * 0.02f;
64817 float speedY = (float)Main.rand.Next(-35, 36) * 0.02f;
64818 NewProjectile(GetProjectileSource_FromThis(), position.X, position.Y, speedX, speedY, Main.player[owner].beeType(), Main.player[owner].beeDamage(damage), Main.player[owner].beeKB(0f), Main.myPlayer);
64819 }
64820 }
64821 }
64822 else if (aiStyle == 34)
64823 {
64824 if (owner != Main.myPlayer)
64825 {
64826 timeLeft = 60;
64827 }
64829 if (type == 167)
64830 {
64831 for (int num758 = 0; num758 < 400; num758++)
64832 {
64833 float num759 = 16f;
64834 if (num758 < 300)
64835 {
64836 num759 = 12f;
64837 }
64838 if (num758 < 200)
64839 {
64840 num759 = 8f;
64841 }
64842 if (num758 < 100)
64843 {
64844 num759 = 4f;
64845 }
64846 int num760 = 130;
64847 int num761 = Dust.NewDust(new Vector2(position.X, position.Y), 6, 6, num760, 0f, 0f, 100);
64848 float num762 = Main.dust[num761].velocity.X;
64849 float y2 = Main.dust[num761].velocity.Y;
64850 if (num762 == 0f && y2 == 0f)
64851 {
64852 num762 = 1f;
64853 }
64854 float num763 = (float)Math.Sqrt(num762 * num762 + y2 * y2);
64855 num763 = num759 / num763;
64856 num762 *= num763;
64857 y2 *= num763;
64859 dust2.velocity *= 0.5f;
64860 Main.dust[num761].velocity.X += num762;
64861 Main.dust[num761].velocity.Y += y2;
64862 Main.dust[num761].scale = 1.3f;
64863 Main.dust[num761].noGravity = true;
64864 }
64865 }
64866 if (type == 168)
64867 {
64868 for (int num764 = 0; num764 < 400; num764++)
64869 {
64870 float num765 = 2f * ((float)num764 / 100f);
64871 if (num764 > 100)
64872 {
64873 num765 = 10f;
64874 }
64875 if (num764 > 250)
64876 {
64877 num765 = 13f;
64878 }
64879 int num766 = 131;
64880 int num767 = Dust.NewDust(new Vector2(position.X, position.Y), 6, 6, num766, 0f, 0f, 100);
64881 float num768 = Main.dust[num767].velocity.X;
64882 float y3 = Main.dust[num767].velocity.Y;
64883 if (num768 == 0f && y3 == 0f)
64884 {
64885 num768 = 1f;
64886 }
64887 float num769 = (float)Math.Sqrt(num768 * num768 + y3 * y3);
64888 num769 = num765 / num769;
64889 if (num764 <= 200)
64890 {
64891 num768 *= num769;
64892 y3 *= num769;
64893 }
64894 else
64895 {
64896 num768 = num768 * num769 * 1.25f;
64897 y3 = y3 * num769 * 0.75f;
64898 }
64900 dust2.velocity *= 0.5f;
64901 Main.dust[num767].velocity.X += num768;
64902 Main.dust[num767].velocity.Y += y3;
64903 if (num764 > 100)
64904 {
64905 Main.dust[num767].scale = 1.3f;
64906 Main.dust[num767].noGravity = true;
64907 }
64908 }
64909 }
64910 if (type == 169)
64911 {
64912 Vector2 vector62 = ((float)Main.rand.NextDouble() * ((float)Math.PI * 2f)).ToRotationVector2();
64913 float num770 = Main.rand.Next(5, 9);
64914 float num771 = Main.rand.Next(12, 17);
64915 float value9 = Main.rand.Next(3, 7);
64916 float num772 = 20f;
64917 for (float num773 = 0f; num773 < num770; num773++)
64918 {
64919 for (int num774 = 0; num774 < 2; num774++)
64920 {
64921 Vector2 value10 = vector62.RotatedBy(((num774 == 0) ? 1f : (-1f)) * ((float)Math.PI * 2f) / (num770 * 2f));
64922 for (float num775 = 0f; num775 < num772; num775++)
64923 {
64926 int num777 = Dust.NewDust(new Vector2(position.X, position.Y), 6, 6, 133, 0f, 0f, 100, default(Color), 1.3f);
64928 dust2.velocity *= 0.1f;
64929 Main.dust[num777].noGravity = true;
64930 dust2 = Main.dust[num777];
64931 dust2.velocity += vector63 * num776;
64932 }
64933 }
64934 vector62 = vector62.RotatedBy((float)Math.PI * 2f / num770);
64935 }
64936 for (float num778 = 0f; num778 < num770; num778++)
64937 {
64938 for (int num779 = 0; num779 < 2; num779++)
64939 {
64940 Vector2 value11 = vector62.RotatedBy(((num779 == 0) ? 1f : (-1f)) * ((float)Math.PI * 2f) / (num770 * 2f));
64941 for (float num780 = 0f; num780 < num772; num780++)
64942 {
64944 float num781 = MathHelper.Lerp(num771, value9, num780 / num772) / 2f;
64945 int num782 = Dust.NewDust(new Vector2(position.X, position.Y), 6, 6, 133, 0f, 0f, 100, default(Color), 1.3f);
64947 dust2.velocity *= 0.1f;
64948 Main.dust[num782].noGravity = true;
64949 dust2 = Main.dust[num782];
64950 dust2.velocity += vector64 * num781;
64951 }
64952 }
64953 vector62 = vector62.RotatedBy((float)Math.PI * 2f / num770);
64954 }
64955 for (int num783 = 0; num783 < 100; num783++)
64956 {
64957 float num784 = num771;
64958 int num785 = 132;
64959 int num786 = Dust.NewDust(new Vector2(position.X, position.Y), 6, 6, num785, 0f, 0f, 100);
64960 float num787 = Main.dust[num786].velocity.X;
64961 float y4 = Main.dust[num786].velocity.Y;
64962 if (num787 == 0f && y4 == 0f)
64963 {
64964 num787 = 1f;
64965 }
64966 float num788 = (float)Math.Sqrt(num787 * num787 + y4 * y4);
64967 num788 = num784 / num788;
64968 num787 *= num788;
64969 y4 *= num788;
64971 dust2.velocity *= 0.5f;
64972 Main.dust[num786].velocity.X += num787;
64973 Main.dust[num786].velocity.Y += y4;
64974 Main.dust[num786].scale = 1.3f;
64975 Main.dust[num786].noGravity = true;
64976 }
64977 }
64978 if (type == 170)
64979 {
64980 for (int num789 = 0; num789 < 400; num789++)
64981 {
64982 int num790 = 133;
64983 float num791 = 16f;
64984 if (num789 > 100)
64985 {
64986 num791 = 11f;
64987 }
64988 if (num789 > 100)
64989 {
64990 num790 = 134;
64991 }
64992 if (num789 > 200)
64993 {
64994 num791 = 8f;
64995 }
64996 if (num789 > 200)
64997 {
64998 num790 = 133;
64999 }
65000 if (num789 > 300)
65001 {
65002 num791 = 5f;
65003 }
65004 if (num789 > 300)
65005 {
65006 num790 = 134;
65007 }
65008 int num792 = Dust.NewDust(new Vector2(position.X, position.Y), 6, 6, num790, 0f, 0f, 100);
65009 float num793 = Main.dust[num792].velocity.X;
65010 float y5 = Main.dust[num792].velocity.Y;
65011 if (num793 == 0f && y5 == 0f)
65012 {
65013 num793 = 1f;
65014 }
65015 float num794 = (float)Math.Sqrt(num793 * num793 + y5 * y5);
65016 num794 = num791 / num794;
65017 if (num789 > 300)
65018 {
65019 num793 = num793 * num794 * 0.7f;
65020 y5 *= num794;
65021 }
65022 else if (num789 > 200)
65023 {
65024 num793 *= num794;
65025 y5 = y5 * num794 * 0.7f;
65026 }
65027 else if (num789 > 100)
65028 {
65029 num793 = num793 * num794 * 0.7f;
65030 y5 *= num794;
65031 }
65032 else
65033 {
65034 num793 *= num794;
65035 y5 = y5 * num794 * 0.7f;
65036 }
65038 dust2.velocity *= 0.5f;
65039 Main.dust[num792].velocity.X += num793;
65040 Main.dust[num792].velocity.Y += y5;
65041 if (Main.rand.Next(3) != 0)
65042 {
65043 Main.dust[num792].scale = 1.3f;
65044 Main.dust[num792].noGravity = true;
65045 }
65046 }
65047 }
65048 if (type == 415)
65049 {
65050 Vector2 vector65 = (vector65 = ((float)Main.rand.NextDouble() * ((float)Math.PI * 2f)).ToRotationVector2());
65051 float num795 = Main.rand.Next(5, 9);
65052 float num796 = (float)Main.rand.Next(10, 15) * 0.66f;
65053 float num797 = (float)Main.rand.Next(4, 7) / 2f;
65054 int num798 = 30;
65055 for (int num799 = 0; (float)num799 < (float)num798 * num795; num799++)
65056 {
65057 if (num799 % num798 == 0)
65058 {
65059 vector65 = vector65.RotatedBy((float)Math.PI * 2f / num795);
65060 }
65061 float num800 = MathHelper.Lerp(num797, num796, (float)(num799 % num798) / (float)num798);
65062 int num801 = 130;
65063 int num802 = Dust.NewDust(new Vector2(position.X, position.Y), 6, 6, num801, 0f, 0f, 100);
65065 dust2.velocity *= 0.1f;
65066 dust2 = Main.dust[num802];
65067 dust2.velocity += vector65 * num800;
65068 Main.dust[num802].scale = 1.3f;
65069 Main.dust[num802].noGravity = true;
65070 }
65071 for (int num803 = 0; num803 < 100; num803++)
65072 {
65073 float num804 = num796;
65074 if (num803 < 30)
65075 {
65076 num804 = (num797 + num796) / 2f;
65077 }
65078 int num805 = 130;
65079 int num806 = Dust.NewDust(new Vector2(position.X, position.Y), 6, 6, num805, 0f, 0f, 100);
65080 float num807 = Main.dust[num806].velocity.X;
65081 float y6 = Main.dust[num806].velocity.Y;
65082 if (num807 == 0f && y6 == 0f)
65083 {
65084 num807 = 1f;
65085 }
65086 float num808 = (float)Math.Sqrt(num807 * num807 + y6 * y6);
65087 num808 = num804 / num808;
65088 num807 *= num808;
65089 y6 *= num808;
65091 dust2.velocity *= 0.5f;
65092 Main.dust[num806].velocity.X += num807;
65093 Main.dust[num806].velocity.Y += y6;
65094 Main.dust[num806].scale = 1.3f;
65095 Main.dust[num806].noGravity = true;
65096 }
65097 }
65098 if (type == 416)
65099 {
65100 Vector2 vector66 = ((float)Main.rand.NextDouble() * ((float)Math.PI * 2f)).ToRotationVector2();
65102 float num809 = Main.rand.Next(3, 6) * 2;
65103 int num810 = 20;
65104 float num811 = ((Main.rand.Next(2) == 0) ? 1f : (-1f));
65105 bool flag3 = true;
65106 for (int num812 = 0; (float)num812 < (float)num810 * num809; num812++)
65107 {
65108 if (num812 % num810 == 0)
65109 {
65110 vector67 = vector67.RotatedBy(num811 * ((float)Math.PI * 2f / num809));
65112 flag3 = !flag3;
65113 }
65114 else
65115 {
65116 float num813 = (float)Math.PI * 2f / ((float)num810 * num809);
65117 vector66 = vector66.RotatedBy(num813 * num811 * 3f);
65118 }
65119 float num814 = MathHelper.Lerp(1f, 8f, (float)(num812 % num810) / (float)num810);
65120 int num815 = 131;
65121 int num816 = Dust.NewDust(new Vector2(position.X, position.Y), 6, 6, num815, 0f, 0f, 100, default(Color), 1.4f);
65123 dust2.velocity *= 0.1f;
65124 dust2 = Main.dust[num816];
65125 dust2.velocity += vector66 * num814;
65126 if (flag3)
65127 {
65128 Main.dust[num816].scale = 0.9f;
65129 }
65130 Main.dust[num816].noGravity = true;
65131 }
65132 }
65133 if (type == 417)
65134 {
65135 float num817 = (float)Main.rand.NextDouble() * ((float)Math.PI * 2f);
65136 float num818 = (float)Main.rand.NextDouble() * ((float)Math.PI * 2f);
65137 float num819 = 4f + (float)Main.rand.NextDouble() * 3f;
65138 float num820 = 4f + (float)Main.rand.NextDouble() * 3f;
65139 float num821 = num819;
65140 if (num820 > num821)
65141 {
65142 num821 = num820;
65143 }
65144 for (int num822 = 0; num822 < 150; num822++)
65145 {
65146 int num823 = 132;
65147 float num824 = num821;
65148 if (num822 > 50)
65149 {
65150 num824 = num820;
65151 }
65152 if (num822 > 50)
65153 {
65154 num823 = 133;
65155 }
65156 if (num822 > 100)
65157 {
65158 num824 = num819;
65159 }
65160 if (num822 > 100)
65161 {
65162 num823 = 132;
65163 }
65164 int num825 = Dust.NewDust(new Vector2(position.X, position.Y), 6, 6, num823, 0f, 0f, 100);
65165 Vector2 vector68 = Main.dust[num825].velocity;
65166 vector68.Normalize();
65167 vector68 *= num824;
65168 if (num822 > 100)
65169 {
65170 vector68.X *= 0.5f;
65171 vector68 = vector68.RotatedBy(num817);
65172 }
65173 else if (num822 > 50)
65174 {
65175 vector68.Y *= 0.5f;
65176 vector68 = vector68.RotatedBy(num818);
65177 }
65179 dust2.velocity *= 0.2f;
65180 dust2 = Main.dust[num825];
65181 dust2.velocity += vector68;
65182 if (num822 <= 200)
65183 {
65184 Main.dust[num825].scale = 1.3f;
65185 Main.dust[num825].noGravity = true;
65186 }
65187 }
65188 }
65189 if (type == 418)
65190 {
65191 Vector2 vector69 = ((float)Main.rand.NextDouble() * ((float)Math.PI * 2f)).ToRotationVector2();
65192 float num826 = Main.rand.Next(5, 12);
65193 float num827 = (float)Main.rand.Next(9, 14) * 0.66f;
65194 float num828 = (float)Main.rand.Next(2, 4) * 0.66f;
65195 float num829 = 15f;
65196 for (float num830 = 0f; num830 < num826; num830++)
65197 {
65198 for (int num831 = 0; num831 < 2; num831++)
65199 {
65200 Vector2 value12 = vector69.RotatedBy(((num831 == 0) ? 1f : (-1f)) * ((float)Math.PI * 2f) / (num826 * 2f));
65201 for (float num832 = 0f; num832 < num829; num832++)
65202 {
65205 int num834 = Dust.NewDust(new Vector2(position.X, position.Y), 6, 6, 134, 0f, 0f, 100, default(Color), 1.3f);
65207 dust2.velocity *= 0.1f;
65208 Main.dust[num834].noGravity = true;
65209 dust2 = Main.dust[num834];
65210 dust2.velocity += vector70 * num833;
65211 }
65212 }
65213 vector69 = vector69.RotatedBy((float)Math.PI * 2f / num826);
65214 }
65215 for (int num835 = 0; num835 < 120; num835++)
65216 {
65217 float num836 = num827;
65218 int num837 = 133;
65219 if (num835 < 80)
65220 {
65221 num836 = num828 - 0.5f;
65222 }
65223 else
65224 {
65225 num837 = 131;
65226 }
65227 int num838 = Dust.NewDust(new Vector2(position.X, position.Y), 6, 6, num837, 0f, 0f, 100);
65228 float num839 = Main.dust[num838].velocity.X;
65229 float y7 = Main.dust[num838].velocity.Y;
65230 if (num839 == 0f && y7 == 0f)
65231 {
65232 num839 = 1f;
65233 }
65234 float num840 = (float)Math.Sqrt(num839 * num839 + y7 * y7);
65235 num840 = num836 / num840;
65236 num839 *= num840;
65237 y7 *= num840;
65239 dust2.velocity *= 0.2f;
65240 Main.dust[num838].velocity.X += num839;
65241 Main.dust[num838].velocity.Y += y7;
65242 Main.dust[num838].scale = 1.3f;
65243 Main.dust[num838].noGravity = true;
65244 }
65245 }
65246 position.X += width / 2;
65247 position.Y += height / 2;
65248 width = 192;
65249 height = 192;
65250 position.X -= width / 2;
65251 position.Y -= height / 2;
65252 penetrate = -1;
65253 Damage();
65254 }
65255 else if (type == 312)
65256 {
65258 position.X += width / 2;
65259 position.Y += height / 2;
65260 width = 22;
65261 height = 22;
65262 position.X -= width / 2;
65263 position.Y -= height / 2;
65264 for (int num841 = 0; num841 < 30; num841++)
65265 {
65266 int num842 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 100, default(Color), 1.5f);
65268 dust2.velocity *= 1.4f;
65269 }
65270 for (int num843 = 0; num843 < 20; num843++)
65271 {
65272 int num844 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100, default(Color), 3.5f);
65273 Main.dust[num844].noGravity = true;
65275 dust2.velocity *= 7f;
65276 num844 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100, default(Color), 1.5f);
65277 dust2 = Main.dust[num844];
65278 dust2.velocity *= 3f;
65279 }
65280 for (int num845 = 0; num845 < 2; num845++)
65281 {
65282 float num846 = 0.4f;
65283 if (num845 == 1)
65284 {
65285 num846 = 0.8f;
65286 }
65287 int num847 = Gore.NewGore(new Vector2(position.X, position.Y), default(Vector2), Main.rand.Next(61, 64));
65289 gore2.velocity *= num846;
65290 Main.gore[num847].velocity.X += 1f;
65291 Main.gore[num847].velocity.Y += 1f;
65292 num847 = Gore.NewGore(new Vector2(position.X, position.Y), default(Vector2), Main.rand.Next(61, 64));
65293 gore2 = Main.gore[num847];
65294 gore2.velocity *= num846;
65295 Main.gore[num847].velocity.X -= 1f;
65296 Main.gore[num847].velocity.Y += 1f;
65297 num847 = Gore.NewGore(new Vector2(position.X, position.Y), default(Vector2), Main.rand.Next(61, 64));
65298 gore2 = Main.gore[num847];
65299 gore2.velocity *= num846;
65300 Main.gore[num847].velocity.X += 1f;
65301 Main.gore[num847].velocity.Y -= 1f;
65302 num847 = Gore.NewGore(new Vector2(position.X, position.Y), default(Vector2), Main.rand.Next(61, 64));
65303 gore2 = Main.gore[num847];
65304 gore2.velocity *= num846;
65305 Main.gore[num847].velocity.X -= 1f;
65306 Main.gore[num847].velocity.Y -= 1f;
65307 }
65308 position.X += width / 2;
65309 position.Y += height / 2;
65310 width = 128;
65311 height = 128;
65312 position.X -= width / 2;
65313 position.Y -= height / 2;
65314 Damage();
65315 }
65316 else if (type == 910 || type == 911)
65317 {
65318 Resize(22, 22);
65321 int num848 = 0;
65322 for (int num849 = 0; num849 < 30; num849++)
65323 {
65324 Dust dust51 = Dust.NewDustDirect(position, width, height, 31, 0f, 0f, 100, transparent2, 1.5f);
65325 Dust dust2 = dust51;
65326 dust2.velocity *= 1.4f;
65327 }
65328 for (int num850 = 0; num850 < 80; num850++)
65329 {
65330 Dust dust52 = Dust.NewDustDirect(position, width, height, num848, 0f, 0f, 100, transparent2, 2.2f);
65331 dust52.noGravity = true;
65332 dust52.velocity.Y -= 1.2f;
65333 Dust dust2 = dust52;
65334 dust2.velocity *= 4f;
65335 dust52 = Dust.NewDustDirect(position, width, height, num848, 0f, 0f, 100, transparent2, 1.3f);
65336 dust52.velocity.Y -= 1.2f;
65337 dust2 = dust52;
65338 dust2.velocity *= 2f;
65339 }
65340 for (int num851 = 1; num851 <= 2; num851++)
65341 {
65342 for (int num852 = -1; num852 <= 1; num852 += 2)
65343 {
65344 for (int num853 = -1; num853 <= 1; num853 += 2)
65345 {
65346 Gore gore6 = Gore.NewGoreDirect(position, Vector2.Zero, Main.rand.Next(61, 64));
65347 Gore gore2 = gore6;
65348 gore2.velocity *= ((num851 == 1) ? 0.4f : 0.8f);
65349 gore2 = gore6;
65350 gore2.velocity += new Vector2(num852, num853);
65351 }
65352 }
65353 }
65354 if (Main.netMode != 1)
65355 {
65356 Point pt = base.Center.ToTileCoordinates();
65357 Kill_DirtAndFluidProjectiles_RunDelegateMethodPushUpForHalfBricks(pt, 4.2f, DelegateMethods.SpreadDirt);
65358 }
65359 }
65360 else if (type == 784 || type == 785 || type == 786 || type == 805 || type == 903)
65361 {
65362 Resize(22, 22);
65363 if (type == 785)
65364 {
65366 }
65367 else
65368 {
65370 }
65372 int num854 = Dust.dustWater();
65373 for (int num855 = 0; num855 < 30; num855++)
65374 {
65375 Dust dust53 = Dust.NewDustDirect(position, width, height, 31, 0f, 0f, 100, transparent3, 1.5f);
65376 Dust dust2 = dust53;
65377 dust2.velocity *= 1.4f;
65378 }
65379 for (int num856 = 0; num856 < 80; num856++)
65380 {
65381 Dust dust54 = Dust.NewDustDirect(position, width, height, num854, 0f, 0f, 100, transparent3, 2.2f);
65382 dust54.noGravity = true;
65383 dust54.velocity.Y -= 1.2f;
65384 Dust dust2 = dust54;
65385 dust2.velocity *= 7f;
65386 dust54 = Dust.NewDustDirect(position, width, height, num854, 0f, 0f, 100, transparent3, 1.3f);
65387 dust54.velocity.Y -= 1.2f;
65388 dust2 = dust54;
65389 dust2.velocity *= 4f;
65390 }
65391 for (int num857 = 1; num857 <= 2; num857++)
65392 {
65393 for (int num858 = -1; num858 <= 1; num858 += 2)
65394 {
65395 for (int num859 = -1; num859 <= 1; num859 += 2)
65396 {
65397 Gore gore7 = Gore.NewGoreDirect(position, Vector2.Zero, Main.rand.Next(61, 64));
65398 Gore gore2 = gore7;
65399 gore2.velocity *= ((num857 == 1) ? 0.4f : 0.8f);
65400 gore2 = gore7;
65401 gore2.velocity += new Vector2(num858, num859);
65402 }
65403 }
65404 }
65405 if (Main.netMode != 1)
65406 {
65407 Point pt2 = base.Center.ToTileCoordinates();
65408 Kill_DirtAndFluidProjectiles_RunDelegateMethodPushUpForHalfBricks(pt2, 3f, DelegateMethods.SpreadWater);
65409 }
65410 }
65411 else if (type == 787 || type == 788 || type == 789 || type == 806 || type == 904)
65412 {
65413 Resize(22, 22);
65414 if (type == 788)
65415 {
65417 }
65418 else
65419 {
65421 }
65423 int num860 = 35;
65424 for (int num861 = 0; num861 < 30; num861++)
65425 {
65426 Dust dust55 = Dust.NewDustDirect(position, width, height, 31, 0f, 0f, 100, transparent4, 1.5f);
65427 Dust dust2 = dust55;
65428 dust2.velocity *= 1.4f;
65429 }
65430 for (int num862 = 0; num862 < 80; num862++)
65431 {
65432 Dust dust56 = Dust.NewDustDirect(position, width, height, num860, 0f, 0f, 100, transparent4, 1.2f);
65433 Dust dust2 = dust56;
65434 dust2.velocity *= 7f;
65435 dust56 = Dust.NewDustDirect(position, width, height, num860, 0f, 0f, 100, transparent4, 0.3f);
65436 dust2 = dust56;
65437 dust2.velocity *= 4f;
65438 }
65439 for (int num863 = 1; num863 <= 2; num863++)
65440 {
65441 for (int num864 = -1; num864 <= 1; num864 += 2)
65442 {
65443 for (int num865 = -1; num865 <= 1; num865 += 2)
65444 {
65445 Gore gore8 = Gore.NewGoreDirect(position, Vector2.Zero, Main.rand.Next(61, 64));
65446 Gore gore2 = gore8;
65447 gore2.velocity *= ((num863 == 1) ? 0.4f : 0.8f);
65448 gore2 = gore8;
65449 gore2.velocity += new Vector2(num864, num865);
65450 }
65451 }
65452 }
65453 if (Main.netMode != 1)
65454 {
65455 Point pt3 = base.Center.ToTileCoordinates();
65456 Kill_DirtAndFluidProjectiles_RunDelegateMethodPushUpForHalfBricks(pt3, 3f, DelegateMethods.SpreadLava);
65457 }
65458 }
65459 else if (type == 790 || type == 791 || type == 792 || type == 807 || type == 905)
65460 {
65461 Resize(22, 22);
65462 if (type == 791)
65463 {
65465 }
65466 else
65467 {
65469 }
65471 int num866 = 152;
65472 for (int num867 = 0; num867 < 30; num867++)
65473 {
65474 Dust dust57 = Dust.NewDustDirect(position, width, height, 31, 0f, 0f, 100, transparent5, 1.5f);
65475 Dust dust2 = dust57;
65476 dust2.velocity *= 1.4f;
65477 }
65478 for (int num868 = 0; num868 < 80; num868++)
65479 {
65480 Dust dust58 = Dust.NewDustDirect(position, width, height, num866, 0f, 0f, 100, transparent5, 2.2f);
65481 Dust dust2 = dust58;
65482 dust2.velocity *= 7f;
65483 dust58 = Dust.NewDustDirect(position, width, height, num866, 0f, 0f, 100, transparent5, 1.3f);
65484 dust2 = dust58;
65485 dust2.velocity *= 4f;
65486 }
65487 for (int num869 = 1; num869 <= 2; num869++)
65488 {
65489 for (int num870 = -1; num870 <= 1; num870 += 2)
65490 {
65491 for (int num871 = -1; num871 <= 1; num871 += 2)
65492 {
65493 Gore gore9 = Gore.NewGoreDirect(position, Vector2.Zero, Main.rand.Next(61, 64));
65494 Gore gore2 = gore9;
65495 gore2.velocity *= ((num869 == 1) ? 0.4f : 0.8f);
65496 gore2 = gore9;
65497 gore2.velocity += new Vector2(num870, num871);
65498 }
65499 }
65500 }
65501 if (Main.netMode != 1)
65502 {
65503 Point pt4 = base.Center.ToTileCoordinates();
65504 Kill_DirtAndFluidProjectiles_RunDelegateMethodPushUpForHalfBricks(pt4, 3f, DelegateMethods.SpreadHoney);
65505 }
65506 }
65507 else if (type == 799 || type == 800 || type == 801 || type == 810 || type == 906)
65508 {
65509 Resize(22, 22);
65510 if (type == 800)
65511 {
65513 }
65514 else
65515 {
65517 }
65519 int num872 = 31;
65520 for (int num873 = 0; num873 < 30; num873++)
65521 {
65522 Dust dust59 = Dust.NewDustDirect(position, width, height, 31, 0f, 0f, 100, transparent6, 1.5f);
65523 Dust dust2 = dust59;
65524 dust2.velocity *= 1.4f;
65525 }
65526 for (int num874 = 0; num874 < 80; num874++)
65527 {
65528 Dust dust60 = Dust.NewDustDirect(position, width, height, num872, 0f, 0f, 100, transparent6, 1.2f);
65529 Dust dust2 = dust60;
65530 dust2.velocity *= 7f;
65531 dust60 = Dust.NewDustDirect(position, width, height, num872, 0f, 0f, 100, transparent6, 0.3f);
65532 dust2 = dust60;
65533 dust2.velocity *= 4f;
65534 }
65535 for (int num875 = 1; num875 <= 2; num875++)
65536 {
65537 for (int num876 = -1; num876 <= 1; num876 += 2)
65538 {
65539 for (int num877 = -1; num877 <= 1; num877 += 2)
65540 {
65541 Gore gore10 = Gore.NewGoreDirect(position, Vector2.Zero, Main.rand.Next(61, 64));
65542 Gore gore2 = gore10;
65543 gore2.velocity *= ((num875 == 1) ? 0.4f : 0.8f);
65544 gore2 = gore10;
65545 gore2.velocity += new Vector2(num876, num877);
65546 }
65547 }
65548 }
65549 if (Main.netMode != 1)
65550 {
65551 Point pt5 = base.Center.ToTileCoordinates();
65552 Kill_DirtAndFluidProjectiles_RunDelegateMethodPushUpForHalfBricks(pt5, 3.5f, DelegateMethods.SpreadDry);
65553 }
65554 }
65555 else if (type == 793 || type == 796 || type == 794 || type == 797 || type == 795 || type == 798 || type == 808 || type == 809)
65556 {
65557 if (type == 794 || type == 797)
65558 {
65560 }
65561 else
65562 {
65564 }
65565 Resize(50, 50);
65566 float num878 = 3f;
65567 for (int num879 = 0; num879 < 50; num879++)
65568 {
65569 Dust dust61 = Dust.NewDustDirect(position, width, height, 31, 0f, 0f, 100, default(Color), 2f);
65570 dust61.velocity = (dust61.position - base.Center).SafeNormalize(Vector2.Zero);
65571 Dust dust2 = dust61;
65572 dust2.velocity *= 2f + (float)Main.rand.Next(5) * 0.1f;
65573 dust61.velocity.Y -= num878 * 0.5f;
65574 dust61.color = Color.Black * 0.9f;
65575 if (Main.rand.Next(2) == 0)
65576 {
65577 dust61.scale = 0.5f;
65578 dust61.fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
65579 dust61.color = Color.Black * 0.8f;
65580 }
65581 }
65582 for (int num880 = 0; num880 < 30; num880++)
65583 {
65584 Dust dust62 = Dust.NewDustDirect(position, width, height, 6, 0f, 0f, 100);
65585 dust62.noGravity = true;
65586 dust62.fadeIn = 1.4f;
65587 dust62.velocity = (dust62.position - base.Center).SafeNormalize(Vector2.Zero);
65588 Dust dust2 = dust62;
65589 dust2.velocity *= 5.5f + (float)Main.rand.Next(61) * 0.1f;
65590 dust62.velocity.Y -= num878 * 0.5f;
65591 dust62 = Dust.NewDustDirect(position, width, height, 6, 0f, 0f, 100);
65592 dust62.velocity = (dust62.position - base.Center).SafeNormalize(Vector2.Zero);
65593 dust62.velocity.Y -= num878 * 0.25f;
65594 dust2 = dust62;
65595 dust2.velocity *= 1.5f + (float)Main.rand.Next(5) * 0.1f;
65596 dust62.fadeIn = 0f;
65597 dust62.scale = 0.6f;
65598 dust62 = Dust.NewDustDirect(position, width, height, 6, 0f, 0f, 100, default(Color), 1.5f);
65599 dust62.noGravity = num880 % 2 == 0;
65600 dust62.velocity = (dust62.position - base.Center).SafeNormalize(Vector2.Zero);
65601 dust2 = dust62;
65602 dust2.velocity *= 3f + (float)Main.rand.Next(21) * 0.2f;
65603 dust62.velocity.Y -= num878 * 0.5f;
65604 dust62.fadeIn = 1.2f;
65605 if (!dust62.noGravity)
65606 {
65607 dust62.scale = 0.4f;
65608 dust62.fadeIn = 0f;
65609 }
65610 else
65611 {
65612 dust2 = dust62;
65613 dust2.velocity *= 2f + (float)Main.rand.Next(5) * 0.2f;
65614 dust62.velocity.Y -= num878 * 0.5f;
65615 }
65616 }
65617 int num881 = 0;
65618 for (int num882 = 1; num882 <= 3; num882++)
65619 {
65620 float num883 = (float)Math.PI * 2f * Main.rand.NextFloat();
65621 for (float num884 = 0f; num884 < 1f; num884 += 1f / 11f)
65622 {
65623 float f4 = (float)Math.PI * 2f * num884 + num883;
65624 Vector2 spinningpoint2 = f4.ToRotationVector2();
65625 spinningpoint2 *= new Vector2(1f, 0.4f);
65626 spinningpoint2 = spinningpoint2.RotatedBy((float)num881 - (float)Math.PI);
65627 Vector2 vector71 = ((float)num881 - (float)Math.PI / 2f).ToRotationVector2();
65628 Vector2 vector72 = base.Center + vector71 * 16f * 0f;
65630 dust63.fadeIn = 1.8f;
65631 dust63.noGravity = true;
65632 Dust dust2 = dust63;
65633 dust2.velocity *= (float)num882 * (Main.rand.NextFloat() * 2f + 0.2f);
65634 dust2 = dust63;
65635 dust2.velocity += vector71 * 0.8f * num882;
65636 dust2 = dust63;
65637 dust2.velocity *= 2f;
65638 }
65639 }
65640 for (int num885 = 1; num885 <= 3; num885++)
65641 {
65642 for (int num886 = -1; num886 <= 1; num886 += 2)
65643 {
65644 for (int num887 = -1; num887 <= 1; num887 += 2)
65645 {
65646 Gore gore11 = Gore.NewGoreDirect(position, Vector2.Zero, Main.rand.Next(61, 64));
65647 Gore gore2 = gore11;
65648 gore2.velocity *= (float)num885 / 3f;
65649 gore2 = gore11;
65650 gore2.velocity += new Vector2(num886, num887);
65651 }
65652 }
65653 }
65654 Resize(10, 10);
65655 }
65656 else if (type == 779 || type == 783 || type == 862 || type == 863)
65657 {
65658 Resize(22, 22);
65661 for (int num888 = 0; num888 < 15; num888++)
65662 {
65663 Dust dust64 = Dust.NewDustDirect(position, width, height, 31, 0f, 0f, 100, transparent7, 0.8f);
65664 dust64.fadeIn = 0f;
65665 Dust dust2 = dust64;
65666 dust2.velocity *= 0.5f;
65667 }
65668 for (int num889 = 0; num889 < 5; num889++)
65669 {
65670 Dust dust65 = Dust.NewDustDirect(position, width, height, 228, 0f, 0f, 100, transparent7, 2.5f);
65671 dust65.noGravity = true;
65672 Dust dust2 = dust65;
65673 dust2.velocity *= 2.5f;
65674 dust65 = Dust.NewDustDirect(position, width, height, 228, 0f, 0f, 100, transparent7, 1.1f);
65675 dust2 = dust65;
65676 dust2.velocity *= 2f;
65677 dust65.noGravity = true;
65678 }
65679 for (int num890 = 0; num890 < 3; num890++)
65680 {
65681 Dust dust66 = Dust.NewDustDirect(position, width, height, 226, 0f, 0f, 100, transparent7, 1.1f);
65682 Dust dust2 = dust66;
65683 dust2.velocity *= 2f;
65684 dust66.noGravity = true;
65685 }
65686 for (int num891 = -1; num891 <= 1; num891 += 2)
65687 {
65688 for (int num892 = -1; num892 <= 1; num892 += 2)
65689 {
65690 if (Main.rand.Next(5) == 0)
65691 {
65692 Gore gore12 = Gore.NewGoreDirect(position, Vector2.Zero, Main.rand.Next(61, 64));
65693 Gore gore2 = gore12;
65694 gore2.velocity *= 0.2f;
65695 gore2 = gore12;
65696 gore2.scale *= 0.65f;
65697 gore2 = gore12;
65698 gore2.velocity += new Vector2(num891, num892) * 0.5f;
65699 }
65700 }
65701 }
65702 }
65703 else if (type == 776 || type == 780 || type == 777 || type == 781 || type == 778 || type == 782 || type == 803 || type == 804)
65704 {
65705 Resize(22, 22);
65706 if (type == 777 || type == 781)
65707 {
65709 }
65710 else
65711 {
65713 }
65715 for (int num893 = 0; num893 < 30; num893++)
65716 {
65717 Dust dust67 = Dust.NewDustDirect(position, width, height, 31, 0f, 0f, 100, transparent8, 1.5f);
65718 Dust dust2 = dust67;
65719 dust2.velocity *= 1.4f;
65720 }
65721 for (int num894 = 0; num894 < 40; num894++)
65722 {
65723 Dust dust68 = Dust.NewDustDirect(position, width, height, 228, 0f, 0f, 100, transparent8, 3.5f);
65724 dust68.noGravity = true;
65725 Dust dust2 = dust68;
65726 dust2.velocity *= 7f;
65727 dust68 = Dust.NewDustDirect(position, width, height, 228, 0f, 0f, 100, transparent8, 1.3f);
65728 dust2 = dust68;
65729 dust2.velocity *= 4f;
65730 dust68.noGravity = true;
65731 }
65732 for (int num895 = 0; num895 < 8; num895++)
65733 {
65734 Dust dust69 = Dust.NewDustDirect(position, width, height, 226, 0f, 0f, 100, transparent8, 1.3f);
65735 Dust dust2 = dust69;
65736 dust2.velocity *= 4f;
65737 dust69.noGravity = true;
65738 }
65739 for (int num896 = 2; num896 <= 2; num896++)
65740 {
65741 for (int num897 = -1; num897 <= 1; num897 += 2)
65742 {
65743 for (int num898 = -1; num898 <= 1; num898 += 2)
65744 {
65745 Gore gore13 = Gore.NewGoreDirect(position, Vector2.Zero, Main.rand.Next(61, 64));
65746 Gore gore2 = gore13;
65747 gore2.velocity *= ((num896 == 1) ? 0.4f : 0.8f);
65748 gore2 = gore13;
65749 gore2.velocity += new Vector2(num897, num898);
65750 }
65751 }
65752 }
65753 if (owner == Main.myPlayer)
65754 {
65755 int num899 = 779;
65756 if (type == 780 || type == 781 || type == 782)
65757 {
65758 num899 = 783;
65759 }
65760 if (type == 803)
65761 {
65762 num899 = 862;
65763 }
65764 if (type == 804)
65765 {
65766 num899 = 863;
65767 }
65768 float num900 = Main.rand.NextFloat() * ((float)Math.PI * 2f);
65769 for (float num901 = 0f; num901 < 1f; num901 += 1f / 6f)
65770 {
65771 float f5 = num900 + num901 * ((float)Math.PI * 2f);
65772 Vector2 vector73 = f5.ToRotationVector2() * (4f + Main.rand.NextFloat() * 2f);
65773 vector73 += Vector2.UnitY * -1f;
65774 int num902 = NewProjectile(GetProjectileSource_FromThis(), base.Center, vector73, num899, damage / 2, 0f, owner);
65775 Projectile projectile = Main.projectile[num902];
65776 Projectile projectile2 = projectile;
65777 projectile2.timeLeft -= Main.rand.Next(30);
65778 }
65779 }
65780 }
65781 else if (type == 133 || type == 134 || type == 135 || type == 136 || type == 137 || type == 138 || type == 303 || type == 338 || type == 339 || type == 930)
65782 {
65783 if (type == 30 || type == 133 || type == 136)
65784 {
65786 }
65787 else
65788 {
65790 }
65791 position.X += width / 2;
65792 position.Y += height / 2;
65793 width = 22;
65794 height = 22;
65795 position.X -= width / 2;
65796 position.Y -= height / 2;
65797 for (int num903 = 0; num903 < 30; num903++)
65798 {
65799 int num904 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 100, default(Color), 1.5f);
65801 dust2.velocity *= 1.4f;
65802 }
65803 for (int num905 = 0; num905 < 20; num905++)
65804 {
65805 int num906 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100, default(Color), 3.5f);
65806 Main.dust[num906].noGravity = true;
65808 dust2.velocity *= 7f;
65809 num906 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100, default(Color), 1.5f);
65810 dust2 = Main.dust[num906];
65811 dust2.velocity *= 3f;
65812 }
65813 for (int num907 = 0; num907 < 2; num907++)
65814 {
65815 float num908 = 0.4f;
65816 if (num907 == 1)
65817 {
65818 num908 = 0.8f;
65819 }
65820 int num909 = Gore.NewGore(new Vector2(position.X, position.Y), default(Vector2), Main.rand.Next(61, 64));
65822 gore2.velocity *= num908;
65823 Main.gore[num909].velocity.X += 1f;
65824 Main.gore[num909].velocity.Y += 1f;
65825 num909 = Gore.NewGore(new Vector2(position.X, position.Y), default(Vector2), Main.rand.Next(61, 64));
65826 gore2 = Main.gore[num909];
65827 gore2.velocity *= num908;
65828 Main.gore[num909].velocity.X -= 1f;
65829 Main.gore[num909].velocity.Y += 1f;
65830 num909 = Gore.NewGore(new Vector2(position.X, position.Y), default(Vector2), Main.rand.Next(61, 64));
65831 gore2 = Main.gore[num909];
65832 gore2.velocity *= num908;
65833 Main.gore[num909].velocity.X += 1f;
65834 Main.gore[num909].velocity.Y -= 1f;
65835 num909 = Gore.NewGore(new Vector2(position.X, position.Y), default(Vector2), Main.rand.Next(61, 64));
65836 gore2 = Main.gore[num909];
65837 gore2.velocity *= num908;
65838 Main.gore[num909].velocity.X -= 1f;
65839 Main.gore[num909].velocity.Y -= 1f;
65840 }
65841 }
65842 else if (type == 139 || type == 140 || type == 141 || type == 142 || type == 143 || type == 144 || type == 340 || type == 341)
65843 {
65844 if (type == 139)
65845 {
65847 }
65848 else
65849 {
65851 }
65852 position.X += width / 2;
65853 position.Y += height / 2;
65854 width = 80;
65855 height = 80;
65856 position.X -= width / 2;
65857 position.Y -= height / 2;
65858 for (int num910 = 0; num910 < 40; num910++)
65859 {
65860 int num911 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 100, default(Color), 2f);
65862 dust2.velocity *= 3f;
65863 if (Main.rand.Next(2) == 0)
65864 {
65865 Main.dust[num911].scale = 0.5f;
65866 Main.dust[num911].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
65867 }
65868 }
65869 for (int num912 = 0; num912 < 70; num912++)
65870 {
65871 int num913 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100, default(Color), 3f);
65872 Main.dust[num913].noGravity = true;
65874 dust2.velocity *= 5f;
65875 num913 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100, default(Color), 2f);
65876 dust2 = Main.dust[num913];
65877 dust2.velocity *= 2f;
65878 }
65879 for (int num914 = 0; num914 < 3; num914++)
65880 {
65881 float num915 = 0.33f;
65882 if (num914 == 1)
65883 {
65884 num915 = 0.66f;
65885 }
65886 if (num914 == 2)
65887 {
65888 num915 = 1f;
65889 }
65890 int num916 = Gore.NewGore(new Vector2(position.X + (float)(width / 2) - 24f, position.Y + (float)(height / 2) - 24f), default(Vector2), Main.rand.Next(61, 64));
65892 gore2.velocity *= num915;
65893 Main.gore[num916].velocity.X += 1f;
65894 Main.gore[num916].velocity.Y += 1f;
65895 num916 = Gore.NewGore(new Vector2(position.X + (float)(width / 2) - 24f, position.Y + (float)(height / 2) - 24f), default(Vector2), Main.rand.Next(61, 64));
65896 gore2 = Main.gore[num916];
65897 gore2.velocity *= num915;
65898 Main.gore[num916].velocity.X -= 1f;
65899 Main.gore[num916].velocity.Y += 1f;
65900 num916 = Gore.NewGore(new Vector2(position.X + (float)(width / 2) - 24f, position.Y + (float)(height / 2) - 24f), default(Vector2), Main.rand.Next(61, 64));
65901 gore2 = Main.gore[num916];
65902 gore2.velocity *= num915;
65903 Main.gore[num916].velocity.X += 1f;
65904 Main.gore[num916].velocity.Y -= 1f;
65905 num916 = Gore.NewGore(new Vector2(position.X + (float)(width / 2) - 24f, position.Y + (float)(height / 2) - 24f), default(Vector2), Main.rand.Next(61, 64));
65906 gore2 = Main.gore[num916];
65907 gore2.velocity *= num915;
65908 Main.gore[num916].velocity.X -= 1f;
65909 Main.gore[num916].velocity.Y -= 1f;
65910 }
65911 position.X += width / 2;
65912 position.Y += height / 2;
65913 width = 10;
65914 height = 10;
65915 position.X -= width / 2;
65916 position.Y -= height / 2;
65917 }
65918 else if (type == 246)
65919 {
65921 for (int num917 = 0; num917 < 10; num917++)
65922 {
65923 int num918 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 100, default(Color), 1.5f);
65925 dust2.velocity *= 0.9f;
65926 }
65927 for (int num919 = 0; num919 < 5; num919++)
65928 {
65929 int num920 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100, default(Color), 2.5f);
65930 Main.dust[num920].noGravity = true;
65932 dust2.velocity *= 3f;
65933 num920 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100, default(Color), 1.5f);
65934 dust2 = Main.dust[num920];
65935 dust2.velocity *= 2f;
65936 }
65937 int num921 = Gore.NewGore(new Vector2(position.X, position.Y), default(Vector2), Main.rand.Next(61, 64));
65939 gore2.velocity *= 0.3f;
65940 Main.gore[num921].velocity.X += Main.rand.Next(-1, 2);
65941 Main.gore[num921].velocity.Y += Main.rand.Next(-1, 2);
65942 position.X += width / 2;
65943 position.Y += height / 2;
65944 width = 150;
65945 height = 150;
65946 position.X -= width / 2;
65947 position.Y -= height / 2;
65948 penetrate = -1;
65949 maxPenetrate = 0;
65950 Damage();
65951 if (owner == Main.myPlayer)
65952 {
65953 int num922 = Main.rand.Next(2, 6);
65954 for (int num923 = 0; num923 < num922; num923++)
65955 {
65956 float num924 = Main.rand.Next(-100, 101);
65957 num924 += 0.01f;
65958 float num925 = Main.rand.Next(-100, 101);
65959 num924 -= 0.01f;
65960 float num926 = (float)Math.Sqrt(num924 * num924 + num925 * num925);
65961 num926 = 8f / num926;
65962 num924 *= num926;
65963 num925 *= num926;
65964 int num927 = NewProjectile(GetProjectileSource_FromThis(), base.Center.X - oldVelocity.X, base.Center.Y - oldVelocity.Y, num924, num925, 249, damage, knockBack, owner);
65965 Main.projectile[num927].maxPenetrate = 0;
65966 }
65967 }
65968 }
65969 else if (type == 249)
65970 {
65972 for (int num928 = 0; num928 < 7; num928++)
65973 {
65974 int num929 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 100, default(Color), 1.5f);
65976 dust2.velocity *= 0.8f;
65977 }
65978 for (int num930 = 0; num930 < 2; num930++)
65979 {
65980 int num931 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100, default(Color), 2.5f);
65981 Main.dust[num931].noGravity = true;
65983 dust2.velocity *= 2.5f;
65984 num931 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100, default(Color), 1.5f);
65985 dust2 = Main.dust[num931];
65986 dust2.velocity *= 1.5f;
65987 }
65988 int num932 = Gore.NewGore(new Vector2(position.X, position.Y), default(Vector2), Main.rand.Next(61, 64));
65990 gore2.velocity *= 0.2f;
65991 Main.gore[num932].velocity.X += Main.rand.Next(-1, 2);
65992 Main.gore[num932].velocity.Y += Main.rand.Next(-1, 2);
65993 position.X += width / 2;
65994 position.Y += height / 2;
65995 width = 100;
65996 height = 100;
65997 position.X -= width / 2;
65998 position.Y -= height / 2;
65999 penetrate = -1;
66000 Damage();
66001 }
66002 else if (type == 588)
66003 {
66005 position = base.Center;
66006 width = (height = 22);
66007 base.Center = position;
66008 for (int num933 = 0; num933 < 8; num933++)
66009 {
66010 int num934 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 219 + Main.rand.Next(5));
66012 dust2.velocity *= 1.4f;
66013 Main.dust[num934].fadeIn = 1f;
66014 Main.dust[num934].noGravity = true;
66015 }
66016 for (int num935 = 0; num935 < 15; num935++)
66017 {
66018 int num936 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 139 + Main.rand.Next(4), 0f, 0f, 0, default(Color), 1.6f);
66019 Main.dust[num936].noGravity = true;
66021 dust2.velocity *= 5f;
66022 num936 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 139 + Main.rand.Next(4), 0f, 0f, 0, default(Color), 1.9f);
66023 dust2 = Main.dust[num936];
66024 dust2.velocity *= 3f;
66025 }
66026 if (Main.rand.Next(2) == 0)
66027 {
66028 int num937 = Gore.NewGore(new Vector2(position.X, position.Y), default(Vector2), Main.rand.Next(276, 283));
66030 gore2.velocity *= 0.4f;
66031 Main.gore[num937].velocity.X += 1f;
66032 Main.gore[num937].velocity.Y += 1f;
66033 }
66034 if (Main.rand.Next(2) == 0)
66035 {
66036 int num937 = Gore.NewGore(new Vector2(position.X, position.Y), default(Vector2), Main.rand.Next(276, 283));
66038 gore2.velocity *= 0.4f;
66039 Main.gore[num937].velocity.X -= 1f;
66040 Main.gore[num937].velocity.Y += 1f;
66041 }
66042 if (Main.rand.Next(2) == 0)
66043 {
66044 int num937 = Gore.NewGore(new Vector2(position.X, position.Y), default(Vector2), Main.rand.Next(276, 283));
66046 gore2.velocity *= 0.4f;
66047 Main.gore[num937].velocity.X += 1f;
66048 Main.gore[num937].velocity.Y -= 1f;
66049 }
66050 if (Main.rand.Next(2) == 0)
66051 {
66052 int num937 = Gore.NewGore(new Vector2(position.X, position.Y), default(Vector2), Main.rand.Next(276, 283));
66054 gore2.velocity *= 0.4f;
66055 Main.gore[num937].velocity.X -= 1f;
66056 Main.gore[num937].velocity.Y -= 1f;
66057 }
66058 }
66059 else if (type == 773)
66060 {
66061 Player player2 = Main.player[owner];
66062 Vector2 v = DirectionTo(player2.Center);
66063 float num938 = v.ToRotation() + (float)Math.PI / 2f;
66064 num938 += (float)Math.PI;
66065 Point scarabBombDigDirectionSnap = GetScarabBombDigDirectionSnap8();
66066 num938 = scarabBombDigDirectionSnap.ToVector2().ToRotation() + (float)Math.PI / 2f;
66067 if (type == 794 || type == 797)
66068 {
66070 }
66071 else
66072 {
66074 }
66075 Resize(80, 80);
66076 for (int num939 = 0; num939 < 60; num939++)
66077 {
66078 Dust dust70 = Dust.NewDustDirect(position, width, height, 31, 0f, 0f, 100, default(Color), 2f);
66079 dust70.velocity.Y -= 0.5f;
66080 Dust dust2 = dust70;
66081 dust2.velocity *= 1.2f;
66082 dust70.color = Color.Black * 0.9f;
66083 if (Main.rand.Next(2) == 0)
66084 {
66085 dust70.scale = 0.5f;
66086 dust70.fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
66087 dust70.color = Color.Black * 0.8f;
66088 }
66089 }
66090 for (int num940 = 0; num940 < 30; num940++)
66091 {
66092 Dust dust71 = Dust.NewDustDirect(position, width, height, 59, 0f, 0f, 100);
66093 dust71.noGravity = true;
66094 if (Math.Abs(velocity.X) > 0.25f)
66095 {
66096 velocity.X *= 0.25f / Math.Abs(velocity.X);
66097 }
66098 dust71.velocity.Y -= 0.5f;
66099 dust71.fadeIn = 1.2f;
66100 Dust dust2 = dust71;
66101 dust2.velocity *= 8f;
66102 dust71.velocity = dust71.velocity.RotatedBy(num938);
66103 dust71 = Dust.NewDustDirect(position, width, height, 59, 0f, 0f, 100, default(Color), 1.5f);
66104 dust2 = dust71;
66105 dust2.velocity *= 2f;
66106 dust71.velocity = dust71.velocity.RotatedBy(num938);
66107 dust71.velocity.Y -= 1.5f;
66108 dust71 = Dust.NewDustDirect(position, width, height, 59, 0f, 0f, 100, default(Color), 1.5f);
66109 dust71.noGravity = true;
66110 dust71.velocity.Y -= 1f;
66111 dust71.fadeIn = 2f;
66112 dust2 = dust71;
66113 dust2.velocity *= 4f;
66114 dust71.velocity = dust71.velocity.RotatedBy(num938);
66115 }
66117 for (int num941 = 1; num941 <= 3; num941++)
66118 {
66119 float num942 = (float)Math.PI * 2f * Main.rand.NextFloat();
66120 for (float num943 = 0f; num943 < 1f; num943 += 1f / 12f)
66121 {
66122 float f6 = (float)Math.PI * 2f * num943 + num942;
66123 Vector2 value13 = f6.ToRotationVector2();
66124 value13 *= new Vector2(0.7f, 0.3f);
66125 Dust dust72 = Dust.NewDustPerfect(base.Center, 59, value13);
66126 dust72.fadeIn = 2f;
66127 dust72.noGravity = true;
66128 Dust dust2 = dust72;
66129 dust2.velocity *= (float)num941 + Main.rand.NextFloat() * 0.6f;
66130 dust72.velocity.Y -= (float)num941 * 0.8f;
66131 dust72.velocity = dust72.velocity.RotatedBy(num938);
66132 if (flag4)
66133 {
66134 dust2 = dust72;
66135 dust2.velocity += scarabBombDigDirectionSnap.ToVector2() * (Main.rand.NextFloat() * 11f + 6f);
66136 }
66137 else
66138 {
66139 dust2 = dust72;
66140 dust2.velocity += scarabBombDigDirectionSnap.ToVector2() * (Main.rand.NextFloat() * 7f + 5f);
66141 }
66142 }
66143 }
66144 Vector2 vector74 = (num938 - (float)Math.PI / 2f).ToRotationVector2();
66145 for (int num944 = 1; num944 <= 1; num944++)
66146 {
66147 for (int num945 = -1; num945 <= 1; num945 += 2)
66148 {
66149 for (int num946 = -1; num946 <= 1; num946 += 2)
66150 {
66151 Gore gore14 = Gore.NewGoreDirect(base.Center - Vector2.One * 20f, Vector2.Zero, Main.rand.Next(61, 64));
66152 gore14.velocity = gore14.velocity * 0.5f + vector74 * 3f;
66153 Gore gore2 = gore14;
66154 gore2.velocity += new Vector2(num945, num946) * 0.2f;
66155 }
66156 }
66157 }
66158 Resize(10, 10);
66159 if (owner == Main.myPlayer)
66160 {
66161 Point p = base.Center.ToTileCoordinates();
66162 Vector2 vector75 = p.ToWorldCoordinates();
66163 bool wallSplode = false;
66164 int num947 = 15;
66166 {
66167 num947 = (int)((double)num947 * Math.Sqrt(2.0));
66168 }
66169 for (int num948 = 0; num948 < num947; num948++)
66170 {
66171 Vector2 vec = vector75 + scarabBombDigDirectionSnap.ToVector2() * 16f * num948 * 1f;
66172 Point p2 = vec.ToTileCoordinates();
66173 if (ShouldWallExplode(p2.ToWorldCoordinates(), 9999, p2.X - 1, p2.X + 1, p2.Y - 1, p2.Y + 1))
66174 {
66175 wallSplode = true;
66176 break;
66177 }
66178 }
66179 for (int num949 = 0; num949 < num947; num949++)
66180 {
66181 Vector2 vec2 = vector75 + scarabBombDigDirectionSnap.ToVector2() * 16f * num949 * 1f;
66182 Point p3 = vec2.ToTileCoordinates();
66183 ExplodeTiles(p3.ToWorldCoordinates(), 9999, p3.X - 1, p3.X + 1, p3.Y - 1, p3.Y + 1, wallSplode);
66184 }
66185 }
66186 }
66187 else if (type == 28 || type == 30 || type == 37 || type == 75 || type == 102 || type == 164 || type == 397 || type == 517 || type == 516 || type == 519 || type == 773)
66188 {
66190 position.X += width / 2;
66191 position.Y += height / 2;
66192 width = 22;
66193 height = 22;
66194 position.X -= width / 2;
66195 position.Y -= height / 2;
66196 int num950 = 6;
66197 if (type == 773)
66198 {
66199 num950 = 59;
66200 }
66201 for (int num951 = 0; num951 < 20; num951++)
66202 {
66203 int num952 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 100, default(Color), 1.5f);
66205 dust2.velocity *= 1.4f;
66206 }
66207 for (int num953 = 0; num953 < 10; num953++)
66208 {
66209 int num954 = Dust.NewDust(position, width, height, num950, 0f, 0f, 100, default(Color), 2.5f);
66210 Main.dust[num954].noGravity = true;
66212 dust2.velocity *= 5f;
66213 num954 = Dust.NewDust(position, width, height, num950, 0f, 0f, 100, default(Color), 1.5f);
66214 dust2 = Main.dust[num954];
66215 dust2.velocity *= 3f;
66216 }
66217 int num955 = Gore.NewGore(position, default(Vector2), Main.rand.Next(61, 64));
66219 gore2.velocity *= 0.4f;
66220 Main.gore[num955].velocity.X += 1f;
66221 Main.gore[num955].velocity.Y += 1f;
66222 num955 = Gore.NewGore(position, default(Vector2), Main.rand.Next(61, 64));
66223 gore2 = Main.gore[num955];
66224 gore2.velocity *= 0.4f;
66225 Main.gore[num955].velocity.X -= 1f;
66226 Main.gore[num955].velocity.Y += 1f;
66227 num955 = Gore.NewGore(position, default(Vector2), Main.rand.Next(61, 64));
66228 gore2 = Main.gore[num955];
66229 gore2.velocity *= 0.4f;
66230 Main.gore[num955].velocity.X += 1f;
66231 Main.gore[num955].velocity.Y -= 1f;
66232 num955 = Gore.NewGore(position, default(Vector2), Main.rand.Next(61, 64));
66233 gore2 = Main.gore[num955];
66234 gore2.velocity *= 0.4f;
66235 Main.gore[num955].velocity.X -= 1f;
66236 Main.gore[num955].velocity.Y -= 1f;
66237 if (type == 102)
66238 {
66239 Vector2 vector76 = position;
66240 position.X += width / 2;
66241 position.Y += height / 2;
66242 width = 128;
66243 height = 128;
66244 position.X -= width / 2;
66245 position.Y -= height / 2;
66246 damage = 40;
66247 Damage();
66248 position = vector76;
66249 width = 22;
66250 height = 22;
66251 }
66252 if (type == 75)
66253 {
66254 Resize(128, 128);
66255 damage = 60;
66256 knockBack = 8f;
66257 Damage();
66258 Resize(22, 22);
66259 }
66260 }
66261 else if (type == 29 || type == 108 || type == 470 || type == 637 || type == 1002)
66262 {
66264 if (type == 29)
66265 {
66266 position.X += width / 2;
66267 position.Y += height / 2;
66268 width = 200;
66269 height = 200;
66270 position.X -= width / 2;
66271 position.Y -= height / 2;
66272 }
66273 for (int num956 = 0; num956 < 50; num956++)
66274 {
66275 int num957 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 31, 0f, 0f, 100, default(Color), 2f);
66277 dust2.velocity *= 1.4f;
66278 }
66279 for (int num958 = 0; num958 < 80; num958++)
66280 {
66281 int num959 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100, default(Color), 3f);
66282 Main.dust[num959].noGravity = true;
66284 dust2.velocity *= 5f;
66285 num959 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 6, 0f, 0f, 100, default(Color), 2f);
66286 dust2 = Main.dust[num959];
66287 dust2.velocity *= 3f;
66288 }
66289 for (int num960 = 0; num960 < 2; num960++)
66290 {
66291 int num961 = Gore.NewGore(new Vector2(position.X + (float)(width / 2) - 24f, position.Y + (float)(height / 2) - 24f), default(Vector2), Main.rand.Next(61, 64));
66292 Main.gore[num961].scale = 1.5f;
66293 Main.gore[num961].velocity.X += 1.5f;
66294 Main.gore[num961].velocity.Y += 1.5f;
66295 num961 = Gore.NewGore(new Vector2(position.X + (float)(width / 2) - 24f, position.Y + (float)(height / 2) - 24f), default(Vector2), Main.rand.Next(61, 64));
66296 Main.gore[num961].scale = 1.5f;
66297 Main.gore[num961].velocity.X -= 1.5f;
66298 Main.gore[num961].velocity.Y += 1.5f;
66299 num961 = Gore.NewGore(new Vector2(position.X + (float)(width / 2) - 24f, position.Y + (float)(height / 2) - 24f), default(Vector2), Main.rand.Next(61, 64));
66300 Main.gore[num961].scale = 1.5f;
66301 Main.gore[num961].velocity.X += 1.5f;
66302 Main.gore[num961].velocity.Y -= 1.5f;
66303 num961 = Gore.NewGore(new Vector2(position.X + (float)(width / 2) - 24f, position.Y + (float)(height / 2) - 24f), default(Vector2), Main.rand.Next(61, 64));
66304 Main.gore[num961].scale = 1.5f;
66305 Main.gore[num961].velocity.X -= 1.5f;
66306 Main.gore[num961].velocity.Y -= 1.5f;
66307 }
66308 position.X += width / 2;
66309 position.Y += height / 2;
66310 width = 10;
66311 height = 10;
66312 position.X -= width / 2;
66313 position.Y -= height / 2;
66314 }
66315 else if (type == 69)
66316 {
66317 SoundEngine.PlaySound(13, (int)position.X, (int)position.Y);
66318 for (int num962 = 0; num962 < 5; num962++)
66319 {
66320 Dust.NewDust(new Vector2(position.X, position.Y), width, height, 13);
66321 }
66322 for (int num963 = 0; num963 < 30; num963++)
66323 {
66324 int num964 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 33, 0f, -2f, 0, default(Color), 1.1f);
66325 Main.dust[num964].alpha = 100;
66326 Main.dust[num964].velocity.X *= 1.5f;
66328 dust2.velocity *= 3f;
66329 }
66330 }
66331 else if (type == 70)
66332 {
66333 SoundEngine.PlaySound(13, (int)position.X, (int)position.Y);
66334 for (int num965 = 0; num965 < 5; num965++)
66335 {
66336 Dust.NewDust(new Vector2(position.X, position.Y), width, height, 13);
66337 }
66338 for (int num966 = 0; num966 < 30; num966++)
66339 {
66340 int num967 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 52, 0f, -2f, 0, default(Color), 1.1f);
66341 Main.dust[num967].alpha = 100;
66342 Main.dust[num967].velocity.X *= 1.5f;
66344 dust2.velocity *= 3f;
66345 }
66346 }
66347 else if (type == 621)
66348 {
66349 SoundEngine.PlaySound(13, (int)position.X, (int)position.Y);
66350 for (int num968 = 0; num968 < 5; num968++)
66351 {
66352 Dust.NewDust(new Vector2(position.X, position.Y), width, height, 13);
66353 }
66354 for (int num969 = 0; num969 < 30; num969++)
66355 {
66356 int num970 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 266, 0f, -2f, 0, default(Color), 1.1f);
66357 Main.dust[num970].alpha = 100;
66358 Main.dust[num970].velocity.X *= 1.5f;
66360 dust2.velocity *= 3f;
66361 }
66362 }
66363 else if (type == 114 || type == 115)
66364 {
66366 for (int num971 = 4; num971 < 31; num971++)
66367 {
66368 float num972 = oldVelocity.X * (30f / (float)num971);
66369 float num973 = oldVelocity.Y * (30f / (float)num971);
66370 int num974 = Dust.NewDust(new Vector2(position.X - num972, position.Y - num973), 8, 8, 27, oldVelocity.X, oldVelocity.Y, 100, default(Color), 1.4f);
66371 Main.dust[num974].noGravity = true;
66373 dust2.velocity *= 0.5f;
66374 num974 = Dust.NewDust(new Vector2(position.X - num972, position.Y - num973), 8, 8, 27, oldVelocity.X, oldVelocity.Y, 100, default(Color), 0.9f);
66375 dust2 = Main.dust[num974];
66376 dust2.velocity *= 0.5f;
66377 }
66378 }
66379 else if (type == 116)
66380 {
66382 for (int num975 = 4; num975 < 31; num975++)
66383 {
66384 float num976 = oldVelocity.X * (30f / (float)num975);
66385 float num977 = oldVelocity.Y * (30f / (float)num975);
66386 int num978 = Dust.NewDust(new Vector2(position.X - num976, position.Y - num977), 8, 8, 64, oldVelocity.X, oldVelocity.Y, 100, default(Color), 1.8f);
66387 Main.dust[num978].noGravity = true;
66388 num978 = Dust.NewDust(new Vector2(position.X - num976, position.Y - num977), 8, 8, 64, oldVelocity.X, oldVelocity.Y, 100, default(Color), 1.4f);
66389 Main.dust[num978].noGravity = true;
66390 }
66391 }
66392 else if (type == 173)
66393 {
66395 for (int num979 = 4; num979 < 24; num979++)
66396 {
66397 float num980 = oldVelocity.X * (30f / (float)num979);
66398 float num981 = oldVelocity.Y * (30f / (float)num979);
66399 int num982 = Main.rand.Next(3);
66400 int num983 = Dust.NewDust(new Vector2(position.X - num980, position.Y - num981), 8, 8, num982 switch
66401 {
66402 0 => 15,
66403 1 => 57,
66404 _ => 58,
66405 }, oldVelocity.X * 0.2f, oldVelocity.Y * 0.2f, 100, default(Color), 1.8f);
66407 dust2.velocity *= 1.5f;
66408 Main.dust[num983].noGravity = true;
66409 }
66410 }
66411 else if (type == 132)
66412 {
66414 for (int num984 = 4; num984 < 31; num984++)
66415 {
66416 float num985 = oldVelocity.X * (30f / (float)num984);
66417 float num986 = oldVelocity.Y * (30f / (float)num984);
66418 int num987 = Dust.NewDust(new Vector2(oldPosition.X - num985, oldPosition.Y - num986), 8, 8, 107, oldVelocity.X, oldVelocity.Y, 100, default(Color), 1.8f);
66419 Main.dust[num987].noGravity = true;
66421 dust2.velocity *= 0.5f;
66422 num987 = Dust.NewDust(new Vector2(oldPosition.X - num985, oldPosition.Y - num986), 8, 8, 107, oldVelocity.X, oldVelocity.Y, 100, default(Color), 1.4f);
66423 dust2 = Main.dust[num987];
66424 dust2.velocity *= 0.05f;
66425 }
66426 }
66427 else if (type == 156)
66428 {
66430 for (int num988 = 4; num988 < 31; num988++)
66431 {
66432 float num989 = oldVelocity.X * (30f / (float)num988);
66433 float num990 = oldVelocity.Y * (30f / (float)num988);
66434 int num991 = Dust.NewDust(new Vector2(oldPosition.X - num989, oldPosition.Y - num990), 8, 8, 73, oldVelocity.X, oldVelocity.Y, 255, default(Color), 1.8f);
66435 Main.dust[num991].noGravity = true;
66437 dust2.velocity *= 0.5f;
66438 num991 = Dust.NewDust(new Vector2(oldPosition.X - num989, oldPosition.Y - num990), 8, 8, 73, oldVelocity.X, oldVelocity.Y, 255, default(Color), 1.4f);
66439 dust2 = Main.dust[num991];
66440 dust2.velocity *= 0.05f;
66441 Main.dust[num991].noGravity = true;
66442 }
66443 }
66444 else if (type == 157)
66445 {
66447 for (int num992 = 4; num992 < 31; num992++)
66448 {
66449 int num993 = Dust.NewDust(position, width, height, 107, oldVelocity.X, oldVelocity.Y, 100, default(Color), 1.8f);
66450 Main.dust[num993].noGravity = true;
66452 dust2.velocity *= 0.5f;
66453 }
66454 }
66455 else if (type == 370)
66456 {
66458 for (int num994 = 0; num994 < 5; num994++)
66459 {
66460 Dust.NewDust(new Vector2(position.X, position.Y), width, height, 13);
66461 }
66462 for (int num995 = 0; num995 < 30; num995++)
66463 {
66464 Vector2 vector77 = new Vector2(Main.rand.Next(-10, 11), Main.rand.Next(-10, 11));
66465 vector77.Normalize();
66466 int num996 = Gore.NewGore(base.Center + vector77 * 10f, vector77 * Main.rand.Next(4, 9) * 0.66f + Vector2.UnitY * 1.5f, 331, (float)Main.rand.Next(40, 141) * 0.01f);
66467 Main.gore[num996].sticky = false;
66468 }
66469 }
66470 else if (type == 371)
66471 {
66472 SoundEngine.PlaySound(13, (int)position.X, (int)position.Y);
66474 for (int num997 = 0; num997 < 5; num997++)
66475 {
66476 Dust.NewDust(new Vector2(position.X, position.Y), width, height, 13);
66477 }
66478 for (int num998 = 0; num998 < 30; num998++)
66479 {
66480 Vector2 vector78 = new Vector2(Main.rand.Next(-10, 11), Main.rand.Next(-10, 11));
66481 vector78.Normalize();
66482 vector78 *= 0.4f;
66483 int num999 = Gore.NewGore(base.Center + vector78 * 10f, vector78 * Main.rand.Next(4, 9) * 0.66f + Vector2.UnitY * 1.5f, Main.rand.Next(435, 438), (float)Main.rand.Next(20, 100) * 0.01f);
66484 Main.gore[num999].sticky = false;
66485 }
66486 }
66487 else if (type == 936)
66488 {
66490 for (int num1000 = 0; num1000 < 20; num1000++)
66491 {
66492 Color newColor9 = Main.hslToRgb(0.7f + 0.2f * Main.rand.NextFloat(), 1f, 0.7f);
66493 newColor9.A /= 2;
66494 int num1001 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 4, 0f, 0f, 150, newColor9);
66496 dust2.velocity *= 1.5f;
66497 newColor9 = Main.hslToRgb(0.7f + 0.2f * Main.rand.NextFloat(), 1f, 0.5f);
66498 newColor9.A /= 2;
66499 num1001 = Dust.NewDust(new Vector2(position.X, position.Y), width, height, 4, 0f, 0f, 150, newColor9, 1.8f);
66501 dust2.velocity *= 3f;
66502 Main.dust[num1001].noGravity = true;
66503 }
66504 }
66505 }
66506 }
66507 if (owner == Main.myPlayer && (type == 370 || type == 371 || type == 936))
66508 {
66509 float num1002 = 80f;
66510 int num1003 = 119;
66511 if (type == 371)
66512 {
66513 num1003 = 120;
66514 }
66515 if (type == 936)
66516 {
66517 num1003 = 320;
66518 }
66519 for (int num1004 = 0; num1004 < 255; num1004++)
66520 {
66522 if (player3.active && !player3.dead && Vector2.Distance(base.Center, player3.Center) < num1002)
66523 {
66524 player3.AddBuff(num1003, 1800, quiet: false);
66525 }
66526 }
66527 for (int num1005 = 0; num1005 < 200; num1005++)
66528 {
66529 NPC nPC = Main.npc[num1005];
66530 if (nPC.active && nPC.life > 0 && Vector2.Distance(base.Center, nPC.Center) < num1002)
66531 {
66532 nPC.AddBuff(num1003, 1800);
66533 }
66534 }
66535 }
66536 if (owner == Main.myPlayer)
66537 {
66538 if (type == 30 || type == 517 || type == 397 || type == 588)
66539 {
66540 int num1006 = 4;
66541 Vector2 center2 = base.Center;
66542 int num1007 = (int)(center2.X / 16f - (float)num1006);
66543 int num1008 = (int)(center2.X / 16f + (float)num1006);
66544 int num1009 = (int)(center2.Y / 16f - (float)num1006);
66545 int num1010 = (int)(center2.Y / 16f + (float)num1006);
66546 if (num1007 < 0)
66547 {
66548 num1007 = 0;
66549 }
66550 if (num1008 > Main.maxTilesX)
66551 {
66553 }
66554 if (num1009 < 0)
66555 {
66556 num1009 = 0;
66557 }
66558 if (num1010 > Main.maxTilesY)
66559 {
66561 }
66562 ExplodeCrackedTiles(center2, num1006, num1007, num1008, num1009, num1010);
66563 }
66564 if (type == 28 || type == 29 || type == 37 || type == 108 || type == 136 || type == 137 || type == 138 || type == 142 || type == 143 || type == 144 || type == 339 || type == 341 || type == 470 || type == 516 || type == 519 || type == 637 || type == 716 || type == 718 || type == 780 || type == 781 || type == 782 || type == 804 || type == 783 || type == 863 || type == 796 || type == 797 || type == 798 || type == 809 || (type == 102 && Main.getGoodWorld && !Main.remixWorld))
66565 {
66566 int num1011 = 3;
66567 if (type == 102)
66568 {
66569 num1011 = 4;
66570 }
66571 if (type == 28 || type == 37 || type == 516 || type == 519)
66572 {
66573 num1011 = 4;
66574 }
66575 if (type == 29 || type == 470 || type == 637 || type == 796 || type == 797 || type == 798 || type == 809)
66576 {
66577 num1011 = 7;
66578 }
66579 if (type == 142 || type == 143 || type == 144 || type == 341)
66580 {
66581 num1011 = 5;
66582 }
66583 if (type == 716 || type == 780 || type == 781 || type == 782 || type == 804 || type == 783 || type == 863)
66584 {
66585 num1011 = 3;
66586 }
66587 if (type == 718)
66588 {
66589 num1011 = 5;
66590 }
66591 if (type == 108)
66592 {
66593 num1011 = 10;
66594 }
66595 if (type == 1002)
66596 {
66597 num1011 = 10;
66598 }
66599 Vector2 center3 = position;
66600 if (type == 716 || type == 718 || type == 773)
66601 {
66602 center3 = base.Center;
66603 }
66604 int num1012 = num1011;
66605 int num1013 = num1011;
66606 int num1014 = (int)(center3.X / 16f - (float)num1012);
66607 int num1015 = (int)(center3.X / 16f + (float)num1012);
66608 int num1016 = (int)(center3.Y / 16f - (float)num1013);
66609 int num1017 = (int)(center3.Y / 16f + (float)num1013);
66610 if (num1014 < 0)
66611 {
66612 num1014 = 0;
66613 }
66614 if (num1015 > Main.maxTilesX)
66615 {
66617 }
66618 if (num1016 < 0)
66619 {
66620 num1016 = 0;
66621 }
66622 if (num1017 > Main.maxTilesY)
66623 {
66625 }
66626 bool wallSplode2 = ShouldWallExplode(center3, num1011, num1014, num1015, num1016, num1017);
66628 }
66629 if (Main.netMode != 0)
66630 {
66631 NetMessage.SendData(29, -1, -1, null, identity, owner);
66632 }
66633 if (!noDropItem)
66634 {
66635 int num1018 = -1;
66636 if (type >= 736 && type <= 738)
66637 {
66639 for (int num1019 = 0; num1019 < 3; num1019++)
66640 {
66641 Dust.NewDust(position, 16, 16, type - 736 + 275);
66642 }
66643 int num1020 = (int)(base.Center.X / 16f);
66644 int num1021 = (int)(base.Center.Y / 16f) + 1;
66645 if (Main.myPlayer == owner && Main.tile[num1020, num1021].active() && TileID.Sets.CrackedBricks[Main.tile[num1020, num1021].type] && Main.rand.Next(2) == 0)
66646 {
66648 if (Main.netMode != 0)
66649 {
66650 NetMessage.SendData(17, -1, -1, null, 20, num1020, num1021);
66651 }
66652 }
66653 }
66654 else if (aiStyle == 10)
66655 {
66656 int num1022 = (int)(position.X + (float)(width / 2)) / 16;
66657 int num1023 = (int)(position.Y + (float)(height / 2)) / 16;
66658 int num1024 = 0;
66659 int num1025 = 2;
66660 if (type == 109)
66661 {
66662 num1024 = 147;
66663 num1025 = 0;
66664 }
66665 if (type == 31)
66666 {
66667 num1024 = 53;
66668 num1025 = 169;
66669 if (ai[0] == 2f)
66670 {
66671 num1025 = 0;
66672 }
66673 }
66674 if (type == 42)
66675 {
66676 num1024 = 53;
66677 num1025 = 0;
66678 }
66679 if (type == 56)
66680 {
66681 num1024 = 112;
66682 num1025 = 370;
66683 }
66684 if (type == 65)
66685 {
66686 num1024 = 112;
66687 num1025 = 0;
66688 }
66689 if (type == 67)
66690 {
66691 num1024 = 116;
66692 num1025 = 408;
66693 }
66694 if (type == 68)
66695 {
66696 num1024 = 116;
66697 num1025 = 0;
66698 }
66699 if (type == 71)
66700 {
66701 num1024 = 123;
66702 num1025 = 424;
66703 }
66704 if (type == 39)
66705 {
66706 num1024 = 59;
66707 num1025 = 0;
66708 }
66709 if (type == 40)
66710 {
66711 num1024 = 57;
66712 num1025 = 0;
66713 }
66714 if (type == 179)
66715 {
66716 num1024 = 224;
66717 num1025 = 1103;
66718 }
66719 if (type == 241)
66720 {
66721 num1024 = 234;
66722 num1025 = 1246;
66723 }
66724 if (type == 354)
66725 {
66726 num1024 = 234;
66727 num1025 = 0;
66728 }
66729 if (type == 411)
66730 {
66731 num1024 = 330;
66732 num1025 = 71;
66733 }
66734 if (type == 412)
66735 {
66736 num1024 = 331;
66737 num1025 = 72;
66738 }
66739 if (type == 413)
66740 {
66741 num1024 = 332;
66742 num1025 = 73;
66743 }
66744 if (type == 414)
66745 {
66746 num1024 = 333;
66747 num1025 = 74;
66748 }
66749 if (type == 812)
66750 {
66751 num1024 = 495;
66752 num1025 = 4090;
66753 }
66754 if (type == 109)
66755 {
66756 int num1026 = Player.FindClosest(position, width, height);
66757 if ((double)(base.Center - Main.player[num1026].Center).Length() > (double)Main.LogicCheckScreenWidth * 0.75)
66758 {
66759 num1024 = -1;
66760 num1025 = 593;
66761 }
66762 }
66763 if (Main.tile[num1022, num1023].nactive() && Main.tile[num1022, num1023].halfBrick() && velocity.Y > 0f && Math.Abs(velocity.Y) > Math.Abs(velocity.X))
66764 {
66765 num1023--;
66766 }
66767 if (!Main.tile[num1022, num1023].active() && num1024 >= 0)
66768 {
66769 bool flag5 = false;
66770 bool flag6 = false;
66771 if (num1023 < Main.maxTilesY - 2)
66772 {
66774 if (tile2 != null && tile2.active())
66775 {
66776 if (tile2.active() && tile2.type == 314)
66777 {
66778 flag6 = true;
66779 }
66781 {
66782 flag6 = true;
66783 }
66784 }
66785 }
66786 if (!flag6)
66787 {
66789 }
66790 if (!flag6 && Main.tile[num1022, num1023].active() && Main.tile[num1022, num1023].type == num1024)
66791 {
66792 if (Main.tile[num1022, num1023 + 1].halfBrick() || Main.tile[num1022, num1023 + 1].slope() != 0)
66793 {
66795 if (Main.netMode != 0)
66796 {
66797 NetMessage.SendData(17, -1, -1, null, 14, num1022, num1023 + 1);
66798 }
66799 }
66800 if (Main.netMode != 0)
66801 {
66802 NetMessage.SendData(17, -1, -1, null, 1, num1022, num1023, num1024);
66803 }
66804 }
66805 else if (!flag5 && num1025 > 0)
66806 {
66807 num1018 = Item.NewItem(GetItemSource_DropAsItem(), (int)position.X, (int)position.Y, width, height, num1025);
66808 }
66809 }
66810 else if (num1025 > 0)
66811 {
66812 num1018 = Item.NewItem(GetItemSource_DropAsItem(), (int)position.X, (int)position.Y, width, height, num1025);
66813 }
66814 }
66815 if (type == 171)
66816 {
66817 if (ai[1] == 0f)
66818 {
66819 num1018 = Item.NewItem(GetItemSource_DropAsItem(), (int)position.X, (int)position.Y, width, height, 985);
66820 Main.item[num1018].noGrabDelay = 0;
66821 }
66822 else if (ai[1] < 10f)
66823 {
66824 num1018 = Item.NewItem(GetItemSource_DropAsItem(), (int)position.X, (int)position.Y, width, height, 965, (int)(10f - ai[1]));
66825 Main.item[num1018].noGrabDelay = 0;
66826 }
66827 }
66828 if (type == 475)
66829 {
66830 if (ai[1] == 0f)
66831 {
66832 num1018 = Item.NewItem(GetItemSource_DropAsItem(), (int)position.X, (int)position.Y, width, height, 3005);
66833 Main.item[num1018].noGrabDelay = 0;
66834 }
66835 else if (ai[1] < 10f)
66836 {
66837 num1018 = Item.NewItem(GetItemSource_DropAsItem(), (int)position.X, (int)position.Y, width, height, 2996, (int)(10f - ai[1]));
66838 Main.item[num1018].noGrabDelay = 0;
66839 }
66840 }
66841 if (type == 505)
66842 {
66843 if (ai[1] == 0f)
66844 {
66845 num1018 = Item.NewItem(GetItemSource_DropAsItem(), (int)position.X, (int)position.Y, width, height, 3079);
66846 Main.item[num1018].noGrabDelay = 0;
66847 }
66848 else if (ai[1] < 10f)
66849 {
66850 num1018 = Item.NewItem(GetItemSource_DropAsItem(), (int)position.X, (int)position.Y, width, height, 3077, (int)(10f - ai[1]));
66851 Main.item[num1018].noGrabDelay = 0;
66852 }
66853 }
66854 if (type == 506)
66855 {
66856 if (ai[1] == 0f)
66857 {
66858 num1018 = Item.NewItem(GetItemSource_DropAsItem(), (int)position.X, (int)position.Y, width, height, 3080);
66859 Main.item[num1018].noGrabDelay = 0;
66860 }
66861 else if (ai[1] < 10f)
66862 {
66863 num1018 = Item.NewItem(GetItemSource_DropAsItem(), (int)position.X, (int)position.Y, width, height, 3078, (int)(10f - ai[1]));
66864 Main.item[num1018].noGrabDelay = 0;
66865 }
66866 }
66867 if (type == 12 && damage > 500 && !Main.remixWorld)
66868 {
66869 num1018 = Item.NewItem(GetItemSource_DropAsItem(), (int)position.X, (int)position.Y, width, height, 75);
66870 }
66871 if (type == 155)
66872 {
66873 num1018 = Item.NewItem(GetItemSource_DropAsItem(), (int)position.X, (int)position.Y, width, height, 859);
66874 }
66875 if (type == 861)
66876 {
66877 num1018 = Item.NewItem(GetItemSource_DropAsItem(), (int)position.X, (int)position.Y, width, height, 4743);
66878 }
66879 if (Main.netMode == 1 && num1018 >= 0)
66880 {
66881 NetMessage.SendData(21, -1, -1, null, num1018, 1f);
66882 }
66883 }
66884 if (type == 69 || type == 70 || type == 621)
66885 {
66886 int i2 = (int)(position.X + (float)(width / 2)) / 16;
66887 int j2 = (int)(position.Y + (float)(height / 2)) / 16;
66888 if (type == 69)
66889 {
66890 WorldGen.Convert(i2, j2, 2);
66891 }
66892 if (type == 70)
66893 {
66894 WorldGen.Convert(i2, j2, 1);
66895 }
66896 if (type == 621)
66897 {
66898 WorldGen.Convert(i2, j2, 4);
66899 }
66900 }
66901 if (type == 378)
66902 {
66903 int num1027 = Main.rand.Next(2, 4);
66904 if (Main.rand.Next(5) == 0)
66905 {
66906 num1027++;
66907 }
66908 for (int num1028 = 0; num1028 < num1027; num1028++)
66909 {
66910 float x2 = velocity.X;
66911 float y8 = velocity.Y;
66912 x2 *= 1f + (float)Main.rand.Next(-20, 21) * 0.01f;
66913 y8 *= 1f + (float)Main.rand.Next(-20, 21) * 0.01f;
66914 NewProjectile(GetProjectileSource_FromThis(), base.Center.X, base.Center.Y, x2, y8, 379, damage, knockBack, owner);
66915 }
66916 }
66917 }
66918 active = false;
66919 }
66920
66921 private void DropGeodeGems()
66922 {
66923 List<int> list = new List<int> { 181, 182, 180, 178, 179, 177, 999 };
66924 int item = list[Main.rand.Next(list.Count)];
66925 list.Remove(item);
66926 int stack = Main.rand.Next(3, 7);
66927 int item2 = list[Main.rand.Next(list.Count)];
66928 list.Remove(item2);
66929 int stack2 = Main.rand.Next(3, 7);
66930 int num = Item.NewItem(new EntitySource_Loot(this), position, base.Size, item, stack);
66931 Main.item[num].noGrabDelay = 0;
66932 if (Main.netMode == 1)
66933 {
66934 NetMessage.SendData(21, -1, -1, null, num, 1f);
66935 }
66936 num = Item.NewItem(new EntitySource_Loot(this), position, base.Size, item2, stack2);
66937 Main.item[num].noGrabDelay = 0;
66938 if (Main.netMode == 1)
66939 {
66940 NetMessage.SendData(21, -1, -1, null, num, 1f);
66941 }
66942 }
66943
66945 {
66946 if (owner != Main.myPlayer)
66947 {
66948 PrepareBombToBlow();
66949 Damage();
66950 }
66951 }
66952
66954 {
66955 Vector2 spinningpoint = new Vector2(0f, -3f).RotatedByRandom(3.1415927410125732);
66956 float num = Main.rand.Next(7, 13);
66957 Vector2 vector = new Vector2(2.1f, 2f);
66958 Color newColor = Main.hslToRgb(ai[0], 1f, 0.5f);
66959 newColor.A = byte.MaxValue;
66960 for (float num2 = 0f; num2 < num; num2 += 1f)
66961 {
66962 int num3 = Dust.NewDust(base.Center, 0, 0, 267, 0f, 0f, 0, newColor);
66963 Main.dust[num3].position = base.Center;
66964 Main.dust[num3].velocity = spinningpoint.RotatedBy((float)Math.PI * 2f * num2 / num) * vector * (0.8f + Main.rand.NextFloat() * 0.4f);
66965 Main.dust[num3].noGravity = true;
66966 Main.dust[num3].scale = 2f;
66967 Main.dust[num3].fadeIn = Main.rand.NextFloat() * 2f;
66968 if (num3 != 6000)
66969 {
66970 Dust dust = Dust.CloneDust(num3);
66971 dust.scale /= 2f;
66972 dust.fadeIn /= 2f;
66973 dust.color = new Color(255, 255, 255, 255);
66974 }
66975 }
66976 for (float num4 = 0f; num4 < num; num4 += 1f)
66977 {
66978 int num5 = Dust.NewDust(base.Center, 0, 0, 267, 0f, 0f, 0, newColor);
66979 Main.dust[num5].position = base.Center;
66980 Main.dust[num5].velocity = spinningpoint.RotatedBy((float)Math.PI * 2f * num4 / num) * vector * (0.8f + Main.rand.NextFloat() * 0.4f);
66981 Main.dust[num5].velocity *= Main.rand.NextFloat() * 0.8f;
66982 Main.dust[num5].noGravity = true;
66983 Main.dust[num5].scale = Main.rand.NextFloat() * 1f;
66984 Main.dust[num5].fadeIn = Main.rand.NextFloat() * 2f;
66985 if (num5 != 6000)
66986 {
66988 dust2.scale /= 2f;
66989 dust2.fadeIn /= 2f;
66990 dust2.color = new Color(255, 255, 255, 255);
66991 }
66992 }
66993 }
66994
66995 public bool ShouldWallExplode(Vector2 compareSpot, int radius, int minI, int maxI, int minJ, int maxJ)
66996 {
66997 bool result = false;
66998 for (int i = minI; i <= maxI; i++)
66999 {
67000 for (int j = minJ; j <= maxJ; j++)
67001 {
67002 float num = Math.Abs((float)i - compareSpot.X / 16f);
67003 float num2 = Math.Abs((float)j - compareSpot.Y / 16f);
67004 if (Math.Sqrt(num * num + num2 * num2) < (double)radius && Main.tile[i, j] != null && Main.tile[i, j].wall == 0)
67005 {
67006 result = true;
67007 break;
67008 }
67009 }
67010 }
67011 return result;
67012 }
67013
67015 {
67016 float num = (float)(whoAmI % 6) / 6f;
67017 return Main.hslToRgb(0.66f + 0.33f * num, 0.7f, 0.6f) * 0.7f;
67018 }
67019
67020 public bool CanExplodeTile(int x, int y)
67021 {
67022 if (Main.tileDungeon[Main.tile[x, y].type] || TileID.Sets.BasicChest[Main.tile[x, y].type])
67023 {
67024 return false;
67025 }
67026 switch (Main.tile[x, y].type)
67027 {
67028 case 26:
67029 case 88:
67030 case 107:
67031 case 108:
67032 case 111:
67033 case 211:
67034 case 221:
67035 case 222:
67036 case 223:
67037 case 226:
67038 case 237:
67039 case 470:
67040 case 475:
67041 return false;
67042 case 37:
67043 case 58:
67044 if (!Main.hardMode)
67045 {
67046 return false;
67047 }
67048 break;
67049 case 77:
67050 if (!Main.hardMode && y >= Main.UnderworldLayer)
67051 {
67052 return false;
67053 }
67054 break;
67055 case 48:
67056 case 232:
67057 if (Main.getGoodWorld)
67058 {
67059 return false;
67060 }
67061 break;
67062 case 137:
67063 if (!NPC.downedGolemBoss)
67064 {
67065 int num = Main.tile[x, y].frameY / 18;
67066 if ((uint)(num - 1) <= 3u)
67067 {
67068 return false;
67069 }
67070 }
67071 break;
67072 }
67073 return true;
67074 }
67075
67076 public void ExplodeTiles(Vector2 compareSpot, int radius, int minI, int maxI, int minJ, int maxJ, bool wallSplode)
67077 {
67078 AchievementsHelper.CurrentlyMining = true;
67079 for (int i = minI; i <= maxI; i++)
67080 {
67081 for (int j = minJ; j <= maxJ; j++)
67082 {
67083 float num = Math.Abs((float)i - compareSpot.X / 16f);
67084 float num2 = Math.Abs((float)j - compareSpot.Y / 16f);
67085 if (!(Math.Sqrt(num * num + num2 * num2) < (double)radius))
67086 {
67087 continue;
67088 }
67089 bool flag = true;
67090 if (Main.tile[i, j] != null && Main.tile[i, j].active())
67091 {
67092 flag = CanExplodeTile(i, j);
67093 if (flag)
67094 {
67095 WorldGen.KillTile(i, j);
67096 if (!Main.tile[i, j].active() && Main.netMode != 0)
67097 {
67098 NetMessage.SendData(17, -1, -1, null, 0, i, j);
67099 }
67100 }
67101 }
67102 if (!flag)
67103 {
67104 continue;
67105 }
67106 for (int k = i - 1; k <= i + 1; k++)
67107 {
67108 for (int l = j - 1; l <= j + 1; l++)
67109 {
67110 if (Main.tile[k, l] != null && Main.tile[k, l].wall > 0 && wallSplode)
67111 {
67112 WorldGen.KillWall(k, l);
67113 if (Main.tile[k, l].wall == 0 && Main.netMode != 0)
67114 {
67115 NetMessage.SendData(17, -1, -1, null, 2, k, l);
67116 }
67117 }
67118 }
67119 }
67120 }
67121 }
67122 AchievementsHelper.CurrentlyMining = false;
67123 }
67124
67125 public void ExplodeCrackedTiles(Vector2 compareSpot, int radius, int minI, int maxI, int minJ, int maxJ)
67126 {
67127 AchievementsHelper.CurrentlyMining = true;
67128 for (int i = minI; i <= maxI; i++)
67129 {
67130 for (int j = minJ; j <= maxJ; j++)
67131 {
67132 float num = Math.Abs((float)i - compareSpot.X / 16f);
67133 float num2 = Math.Abs((float)j - compareSpot.Y / 16f);
67134 if (Math.Sqrt(num * num + num2 * num2) < (double)radius && Main.tile[i, j] != null && Main.tile[i, j].active() && TileID.Sets.CrackedBricks[Main.tile[i, j].type])
67135 {
67136 WorldGen.KillTile(i, j);
67137 if (!Main.tile[i, j].active() && Main.netMode != 0)
67138 {
67139 NetMessage.SendData(17, -1, -1, null, 20, i, j);
67140 }
67141 }
67142 }
67143 }
67144 AchievementsHelper.CurrentlyMining = false;
67145 }
67146
67148 {
67149 containerIndex = -1;
67150 if (type == 525 || type == 960)
67151 {
67152 containerIndex = -2;
67153 return true;
67154 }
67155 if (type == 734)
67156 {
67157 containerIndex = -5;
67158 return true;
67159 }
67160 return false;
67161 }
67162
67163 public bool IsInteractible()
67164 {
67165 int num = type;
67166 if (num == 525 || num == 734 || num == 960)
67167 {
67168 return true;
67169 }
67170 return false;
67171 }
67172
67174 {
67175 if (type == 920 || type == 921)
67176 {
67177 return Color.Lerp(newColor, Color.White, 0.4f) * Opacity;
67178 }
67179 if (type == 47 && Main.player[owner].wet)
67180 {
67181 return Color.White;
67182 }
67183 if (type == 937)
67184 {
67185 newColor.A = (byte)((float)(int)newColor.A * 0.75f);
67186 }
67187 if (type == 880 || type == 929)
67188 {
67189 newColor.A /= 2;
67190 }
67191 if (type == 963)
67192 {
67193 float num = 0.85f;
67194 newColor *= num;
67195 newColor.A = (byte)((float)(int)newColor.A * num);
67196 if (ai[0] >= 2f)
67197 {
67198 newColor.G = (byte)((float)(int)newColor.G * 0.7f);
67199 newColor.B = (byte)((float)(int)newColor.B * 0.7f);
67200 }
67201 }
67202 if (type == 1021)
67203 {
67204 return Color.White;
67205 }
67206 if (type == 1006)
67207 {
67208 return Color.White;
67209 }
67210 if (type == 981)
67211 {
67212 return Color.White;
67213 }
67214 if (type == 75)
67215 {
67216 return Color.Lerp(newColor, Color.White, 0.66f) * Opacity;
67217 }
67218 int r;
67219 int g;
67220 int b;
67221 if (type == 969)
67222 {
67223 int num2 = 210;
67224 r = (g = (b = num2));
67225 if (newColor.R < num2)
67226 {
67227 r = newColor.R;
67228 }
67229 if (newColor.G < num2)
67230 {
67231 g = newColor.G;
67232 }
67233 if (newColor.B < num2)
67234 {
67235 b = newColor.B;
67236 }
67237 return new Color(r, g, b, 185) * Opacity;
67238 }
67239 if (type == 967)
67240 {
67241 return Color.White * Opacity;
67242 }
67243 if (type == 855)
67244 {
67245 newColor = Color.Lerp(newColor, new Color(255, 200, 60), 0.5f);
67246 }
67247 if (type == 933 || type == 1001)
67248 {
67249 newColor = Color.White * Opacity;
67250 }
67251 if (type == 270)
67252 {
67253 return new Color(255, 255, 255, (int)Utils.WrappedLerp(0f, 255f, (float)(timeLeft % 40) / 40f));
67254 }
67255 if (type == 837)
67256 {
67257 if (alpha > 0)
67258 {
67259 return Color.Transparent;
67260 }
67261 return new Color(255, 255, 255, 200);
67262 }
67263 if (type == 180 || type == 345)
67264 {
67265 return Color.Lerp(newColor, Color.White, 0.75f);
67266 }
67267 if (type == 586)
67268 {
67269 if (ai[2] == 1f)
67270 {
67271 Color value = new Color(newColor.R / 2, 0, newColor.G);
67272 float amount = (float)Math.Sin(ai[0] % 120f * ((float)Math.PI * 2f) / 120f) * 0.5f + 0.5f;
67274 return Color.Lerp(newColor, Color.Lerp(Color.White, value, amount), 0.75f);
67275 }
67276 return Color.Lerp(newColor, Color.White, 0.75f);
67277 }
67278 if (type == 764 || type == 856 || type == 857 || type == 864)
67279 {
67280 return Color.White;
67281 }
67282 if (type == 873 || type == 872 || type == 931 || type == 913 || type == 34)
67283 {
67284 return Color.White * Opacity;
67285 }
67286 if (type == 756 || type == 961)
67287 {
67288 return Color.Lerp(newColor, Color.Black, 0.25f);
67289 }
67290 if (type == 895)
67291 {
67292 return Color.White * Opacity;
67293 }
67294 if (type == 893 || type == 907)
67295 {
67296 return new Color(255, 255, 255, 150);
67297 }
67298 if (type == 833 || type == 834 || type == 835 || type == 912)
67299 {
67300 return Color.Lerp(newColor, Color.White, 0.25f);
67301 }
67302 if (type == 351 || type == 350)
67303 {
67304 Point point = base.Center.ToTileCoordinates();
67305 if (WorldGen.InWorld(point.X, point.Y) && !WorldGen.SolidTile(point.X, point.Y))
67306 {
67307 return Color.Lerp(newColor, Color.White, 0.15f);
67308 }
67309 return Color.Lerp(newColor, Color.White, 0.05f);
67310 }
67311 if (type == 346 || type == 347 || type == 325 || type == 755)
67312 {
67313 return Color.Lerp(newColor, Color.White, 0.75f);
67314 }
67315 if (type == 650)
67316 {
67317 r = (int)((double)(int)newColor.R * 1.5);
67318 g = (int)((double)(int)newColor.G * 1.5);
67319 b = (int)((double)(int)newColor.B * 1.5);
67320 if (r > 255)
67321 {
67322 r = 255;
67323 }
67324 if (g > 255)
67325 {
67326 g = 255;
67327 }
67328 if (b > 255)
67329 {
67330 b = 255;
67331 }
67332 }
67333 else
67334 {
67335 if (type == 948)
67336 {
67337 return Color.White;
67338 }
67339 if (type == 604 || type == 631)
67340 {
67341 return new Color(255 - alpha, 255 - alpha, 255 - alpha, 0);
67342 }
67343 if (type == 342)
67344 {
67345 return Color.Lerp(newColor, Color.White, 0.75f) * Opacity;
67346 }
67347 if (type == 636)
67348 {
67349 return new Color(255 - alpha, 255 - alpha, 255 - alpha, 64 - alpha / 4);
67350 }
67351 if (type == 673 || type == 706)
67352 {
67353 return new Color(255 - alpha, 255 - alpha, 255 - alpha, 180 - alpha / 2 - alpha / 4);
67354 }
67355 if (type == 603 || type == 633)
67356 {
67357 return new Color(255, 255, 255, 200);
67358 }
67359 if (type == 623 || (type >= 625 && type <= 628) || type == 710)
67360 {
67361 return new Color(255 - alpha, 255 - alpha, 255 - alpha, 255 - alpha);
67362 }
67363 if (type == 645 || type == 643)
67364 {
67365 return new Color(255 - alpha, 255 - alpha, 255 - alpha, 127 - alpha / 2);
67366 }
67367 if (type == 611)
67368 {
67369 return new Color(255, 255, 255, 200);
67370 }
67371 if (type == 640 || type == 644 || type == 658)
67372 {
67373 return new Color(255 - alpha, 255 - alpha, 255 - alpha, 0);
67374 }
67375 if (type == 612 || type == 953)
67376 {
67377 return new Color(255, 255, 255, 127);
67378 }
67379 if (type == 978)
67380 {
67381 return new Color(255, 255, 255, 127) * Opacity;
67382 }
67383 if (aiStyle == 105)
67384 {
67385 return new Color(255 - alpha, 255 - alpha, 255 - alpha, 255 - alpha);
67386 }
67387 if (type == 554)
67388 {
67389 return new Color(200, 200, 200, 200);
67390 }
67391 if (type == 601)
67392 {
67393 return PortalHelper.GetPortalColor(owner, (int)ai[0]);
67394 }
67395 if (type == 602)
67396 {
67397 Color portalColor = PortalHelper.GetPortalColor(owner, (int)ai[1]);
67398 portalColor.A = 227;
67399 return portalColor;
67400 }
67401 if (type == 585)
67402 {
67403 byte a = newColor.A;
67405 newColor.A = a;
67406 return newColor;
67407 }
67408 if (type == 714)
67409 {
67410 byte a2 = newColor.A;
67412 newColor.A = a2;
67413 newColor *= (float)(int)a2 / 255f;
67414 return newColor;
67415 }
67416 if (type == 573 || type == 578 || type == 579 || type == 617 || type == 641 || type == 707 || type == 813)
67417 {
67418 return new Color(255 - alpha, 255 - alpha, 255 - alpha, 255 - alpha);
67419 }
67420 if (type == 490)
67421 {
67422 return Color.White;
67423 }
67424 if (type == 575 || type == 596 || type == 659)
67425 {
67426 if (timeLeft < 30)
67427 {
67428 float num3 = (float)timeLeft / 30f;
67429 alpha = (int)(255f - 255f * num3);
67430 }
67431 return new Color(255 - alpha, 255 - alpha, 255 - alpha, 128 - alpha / 2);
67432 }
67433 if (type == 546)
67434 {
67435 return new Color(255, 200, 255, 200);
67436 }
67437 if (type == 553)
67438 {
67439 return new Color(255, 255, 200, 200);
67440 }
67441 if (type == 540)
67442 {
67443 return new Color(255 - alpha, 255 - alpha, 255 - alpha, 0);
67444 }
67445 if (type == 498)
67446 {
67447 return new Color(255, 100, 20, 200);
67448 }
67449 if (type == 538)
67450 {
67451 return new Color(255 - alpha, 255 - alpha, 255 - alpha, 255 - alpha);
67452 }
67453 if (type == 518)
67454 {
67455 float num4 = 1f - (float)alpha / 255f;
67456 return new Color((int)(200f * num4), (int)(200f * num4), (int)(200f * num4), (int)(100f * num4));
67457 }
67458 if (type == 518 || type == 595 || type == 735)
67459 {
67460 Color color = Color.Lerp(newColor, Color.White, 0.85f);
67461 color.A = 128;
67462 return color * (1f - (float)alpha / 255f);
67463 }
67464 if (type == 536 || type == 607)
67465 {
67466 return new Color(255 - alpha, 255 - alpha, 255 - alpha, 63 - alpha / 4);
67467 }
67468 if (type == 591)
67469 {
67470 return new Color(255 - alpha, 255 - alpha, 255 - alpha, 63 - alpha / 4);
67471 }
67472 if (type == 493 || type == 494)
67473 {
67474 return new Color(255 - alpha, 255 - alpha, 255 - alpha, 255 - alpha);
67475 }
67476 if (type == 492)
67477 {
67478 return new Color(255, 255, 255, 255);
67479 }
67480 if (type == 491)
67481 {
67482 return new Color(255, 255, 255, 255);
67483 }
67484 if (type == 485 || type == 502)
67485 {
67486 return new Color(255, 255, 255, 200);
67487 }
67488 if (type == 488)
67489 {
67490 return new Color(255, 255, 255, 255);
67491 }
67492 if (type == 477 || type == 478 || type == 479)
67493 {
67494 if (alpha == 0)
67495 {
67496 return new Color(255, 255, 255, 200);
67497 }
67498 return new Color(0, 0, 0, 0);
67499 }
67500 if (type == 473)
67501 {
67502 return new Color(255, 255, 255, 255);
67503 }
67504 if (type == 50 || type == 53 || type == 515 || type == 870)
67505 {
67506 return new Color(255, 255, 255, 0);
67507 }
67508 if (type == 723 || type == 724 || type == 725 || type == 726 || type == 728 || type == 9)
67509 {
67510 return new Color(255, 255, 255, 0) * Opacity;
67511 }
67512 if (type == 92)
67513 {
67514 return new Color(255, 255, 255, 0);
67515 }
67516 if (type == 91)
67517 {
67518 return new Color(200, 200, 200, 0);
67519 }
67520 if (type == 34 || type == 15 || type == 93 || type == 94 || type == 95 || type == 96 || type == 253 || type == 258 || (type == 102 && alpha < 255))
67521 {
67522 return new Color(200, 200, 200, 25);
67523 }
67524 if (type == 465)
67525 {
67526 return new Color(255, 255, 255, 0) * (1f - (float)alpha / 255f);
67527 }
67528 if (type == 503)
67529 {
67530 Color value2 = Color.Lerp(newColor, Color.White, 0.5f) * (1f - (float)alpha / 255f);
67532 float amount2 = 0.25f + (float)Math.Cos(localAI[0]) * 0.25f;
67533 return Color.Lerp(value2, value3, amount2);
67534 }
67535 if (type == 467)
67536 {
67537 return new Color(255, 255, 255, 255) * (1f - (float)alpha / 255f);
67538 }
67539 if (type == 694 || type == 695 || type == 696)
67540 {
67541 return new Color(255, 255, 255, 127) * (1f - (float)alpha / 255f);
67542 }
67543 if (type == 634 || type == 635)
67544 {
67545 return new Color(255, 255, 255, 127) * Opacity;
67546 }
67547 if (type == 671)
67548 {
67549 return new Color(255, 255, 255, 255) * Opacity;
67550 }
67551 if (type == 664 || type == 666 || type == 668)
67552 {
67554 return new Color(newColor.R, newColor.G, newColor.B, 200) * Opacity;
67555 }
67556 if (type == 451)
67557 {
67558 return new Color(255, 255, 255, 200) * ((255f - (float)alpha) / 255f);
67559 }
67560 if (type == 684)
67561 {
67562 return new Color(255, 255, 255, 200) * ((255f - (float)alpha) / 255f);
67563 }
67564 if (type == 454 || type == 452)
67565 {
67566 return new Color(255, 255, 255, 255) * (1f - (float)alpha / 255f);
67567 }
67568 if (type == 464)
67569 {
67570 return new Color(255, 255, 255, 255) * ((255f - (float)alpha) / 255f);
67571 }
67572 if (type == 450)
67573 {
67574 return new Color(200, 200, 200, 255 - alpha);
67575 }
67576 if (type == 459 || type == 709)
67577 {
67578 return new Color(255, 255, 255, 200);
67579 }
67580 if (type == 447)
67581 {
67582 return new Color(255, 255, 255, 200);
67583 }
67584 if (type == 446)
67585 {
67586 return Color.Lerp(newColor, Color.White, 0.8f) * (1f - (float)alpha / 255f);
67587 }
67588 if (type == 691 || type == 692 || type == 693)
67589 {
67590 return Color.Lerp(newColor, Color.White, 0.4f) * (1f - (float)alpha / 255f);
67591 }
67592 if (type >= 646 && type <= 649)
67593 {
67594 return Color.Lerp(newColor, Color.White, 0.8f) * (1f - (float)alpha / 255f);
67595 }
67596 if (type == 445)
67597 {
67598 return new Color(255, 255, 255, 128) * (1f - (float)alpha / 255f);
67599 }
67600 if (type == 440 || type == 449 || type == 606)
67601 {
67602 r = 255 - alpha;
67603 g = 255 - alpha;
67604 b = 255 - alpha;
67605 }
67606 else
67607 {
67608 if (type == 444)
67609 {
67610 return newColor * (1f - (float)alpha / 255f);
67611 }
67612 if (type == 443 || type == 675 || type == 686 || type == 711)
67613 {
67614 return new Color(255, 255, 255, 128) * (1f - (float)alpha / 255f);
67615 }
67616 if (type == 676)
67617 {
67618 return newColor * Opacity;
67619 }
67620 if (type == 438)
67621 {
67622 return new Color(255, 255, 255, 128) * (1f - (float)alpha / 255f);
67623 }
67624 if (type == 592)
67625 {
67626 return new Color(255, 255, 255, 128) * (1f - (float)alpha / 255f);
67627 }
67628 if (type == 437 || type == 700)
67629 {
67630 return new Color(255, 255, 255, 0) * (1f - (float)alpha / 255f);
67631 }
67632 if (type == 964 || type == 965)
67633 {
67634 return new Color(255, 255, 255, 255) * Opacity;
67635 }
67636 if (type == 462)
67637 {
67638 return new Color(255, 255, 255, 128) * (1f - (float)alpha / 255f);
67639 }
67640 if (type == 352)
67641 {
67643 color2.A = (byte)((float)(int)color2.A * ((float)alpha / 255f));
67644 return new Color(color2.R, color2.G, color2.B, color2.A);
67645 }
67646 if (type == 435 || type == 732 || type == 731)
67647 {
67649 return new Color(newColor.R, newColor.G, newColor.B, 25);
67650 }
67651 if (type == 682)
67652 {
67654 return new Color(newColor.R, newColor.G, newColor.B, 127);
67655 }
67656 if (type == 436)
67657 {
67659 return new Color(newColor.R, newColor.G, newColor.B, 25);
67660 }
67661 if (type == 409)
67662 {
67663 return new Color(250, 250, 250, 200);
67664 }
67665 if (type == 348 || type == 349)
67666 {
67667 return new Color(200, 200, 200, alpha);
67668 }
67669 if (type == 337)
67670 {
67671 return new Color(250, 250, 250, 150);
67672 }
67673 if (type >= 424 && type <= 426)
67674 {
67675 byte b2 = 150;
67676 if (newColor.R < b2)
67677 {
67678 newColor.R = b2;
67679 }
67680 if (newColor.G < b2)
67681 {
67682 newColor.G = b2;
67683 }
67684 if (newColor.B < b2)
67685 {
67686 newColor.B = b2;
67687 }
67688 return new Color(newColor.R, newColor.G, newColor.B, 255);
67689 }
67690 if (type == 431 || type == 432)
67691 {
67692 return new Color(250, 250, 250, 255 - alpha);
67693 }
67694 if (type == 343 || type == 344)
67695 {
67696 float num5 = 1f - (float)alpha / 255f;
67697 return new Color((int)(250f * num5), (int)(250f * num5), (int)(250f * num5), (int)(100f * num5));
67698 }
67699 if (type == 332)
67700 {
67701 return new Color(255, 255, 255, 255);
67702 }
67703 if (type == 329)
67704 {
67705 return new Color(200, 200, 200, 50);
67706 }
67707 if (type >= 326 && type <= 328)
67708 {
67709 return Color.Transparent;
67710 }
67711 if (type >= 400 && type <= 402)
67712 {
67713 return Color.Transparent;
67714 }
67715 if (type == 324 && frame >= 6 && frame <= 9)
67716 {
67717 return new Color(255, 255, 255, 255);
67718 }
67719 if (type == 16)
67720 {
67721 return new Color(255, 255, 255, 0);
67722 }
67723 if (type == 321)
67724 {
67725 return new Color(200, 200, 200, 0);
67726 }
67727 if (type == 76 || type == 77 || type == 78)
67728 {
67729 return new Color(255, 255, 255, 0);
67730 }
67731 if (type == 308)
67732 {
67733 return new Color(200, 200, 255, 125);
67734 }
67735 if (type == 263)
67736 {
67737 if (timeLeft < 255)
67738 {
67739 return new Color(255, 255, 255, (byte)timeLeft);
67740 }
67741 return new Color(255, 255, 255, 255);
67742 }
67743 if (type == 274)
67744 {
67745 if (timeLeft < 85)
67746 {
67747 byte b3 = (byte)(timeLeft * 3);
67748 byte a3 = (byte)(100f * ((float)(int)b3 / 255f));
67749 return new Color(b3, b3, b3, a3);
67750 }
67751 return new Color(255, 255, 255, 100);
67752 }
67753 if (type == 5)
67754 {
67755 return new Color(255, 255, 255, 0);
67756 }
67757 if (type == 300)
67758 {
67759 return new Color(250, 250, 250, 50);
67760 }
67761 if (type == 301)
67762 {
67763 if (ai[0] == 1f)
67764 {
67765 return newColor;
67766 }
67767 return new Color(250, 250, 250, 50);
67768 }
67769 if (type == 712)
67770 {
67771 return Color.Lerp(newColor, Color.White, 0.4f) * Opacity;
67772 }
67773 if (type == 304)
67774 {
67775 return new Color(255 - alpha, 255 - alpha, 255 - alpha, (byte)((float)(255 - alpha) / 3f));
67776 }
67777 if (type == 116 || type == 132 || type == 156 || type == 157 || type == 157 || type == 173)
67778 {
67779 if (localAI[1] >= 15f)
67780 {
67781 return new Color(255, 255, 255, alpha);
67782 }
67783 if (localAI[1] < 5f)
67784 {
67785 return Color.Transparent;
67786 }
67787 int num6 = (int)((localAI[1] - 5f) / 10f * 255f);
67788 return new Color(num6, num6, num6, num6);
67789 }
67790 if (type == 254)
67791 {
67792 if (timeLeft < 30)
67793 {
67794 float num7 = (float)timeLeft / 30f;
67795 alpha = (int)(255f - 255f * num7);
67796 }
67797 return new Color(255 - alpha, 255 - alpha, 255 - alpha, 0);
67798 }
67799 if (type == 265 || type == 355)
67800 {
67801 if (alpha > 0)
67802 {
67803 return Color.Transparent;
67804 }
67805 return new Color(255, 255, 255, 0);
67806 }
67807 if (type == 257)
67808 {
67809 if (alpha > 200)
67810 {
67811 return Color.Transparent;
67812 }
67813 return new Color(255 - alpha, 255 - alpha, 255 - alpha, 0);
67814 }
67815 if (type == 259)
67816 {
67817 if (alpha > 200)
67818 {
67819 return Color.Transparent;
67820 }
67821 return new Color(255 - alpha, 255 - alpha, 255 - alpha, 0);
67822 }
67823 if (type >= 150 && type <= 152)
67824 {
67825 return new Color(255 - alpha, 255 - alpha, 255 - alpha, 255 - alpha);
67826 }
67827 if (type == 250)
67828 {
67829 return Color.Transparent;
67830 }
67831 if (type == 251)
67832 {
67833 r = 255 - alpha;
67834 g = 255 - alpha;
67835 b = 255 - alpha;
67836 return new Color(r, g, b, 0);
67837 }
67838 if (type == 131)
67839 {
67840 return new Color(255 - alpha, 255 - alpha, 255 - alpha, 0);
67841 }
67842 if (type == 211)
67843 {
67844 return new Color(255, 255, 255, 0);
67845 }
67846 if (type == 229)
67847 {
67848 return new Color(255, 255, 255, 50);
67849 }
67850 if (type == 221 || type == 729 || type == 977)
67851 {
67852 return new Color(255, 255, 255, 200);
67853 }
67854 if (type == 20)
67855 {
67856 if (alpha <= 150)
67857 {
67858 return new Color(255, 255, 255, 0);
67859 }
67860 return new Color(0, 0, 0, 0);
67861 }
67862 if (type == 207)
67863 {
67864 r = 255 - alpha;
67865 g = 255 - alpha;
67866 b = 255 - alpha;
67867 }
67868 else
67869 {
67870 if (type == 242)
67871 {
67872 if (alpha < 140)
67873 {
67874 return new Color(255, 255, 255, 100);
67875 }
67876 return Color.Transparent;
67877 }
67878 if (type == 638)
67879 {
67880 return new Color(255, 255, 255, 100) * Opacity;
67881 }
67882 if (type == 660)
67883 {
67884 return new Color(150, 255, 255, 0) * Opacity;
67885 }
67886 if (type == 209)
67887 {
67888 r = newColor.R - alpha;
67889 g = newColor.G - alpha;
67890 b = newColor.B - alpha / 2;
67891 }
67892 else
67893 {
67894 if (type == 130)
67895 {
67896 return new Color(255, 255, 255, 175);
67897 }
67898 if (type == 182)
67899 {
67900 return new Color(255, 255, 255, 200);
67901 }
67902 if (type == 226)
67903 {
67904 r = 255;
67905 g = 255;
67906 b = 255;
67907 float num8 = (float)(int)Main.mouseTextColor / 200f - 0.3f;
67908 r = (int)((float)r * num8);
67909 g = (int)((float)g * num8);
67910 b = (int)((float)b * num8);
67911 r += 50;
67912 if (r > 255)
67913 {
67914 r = 255;
67915 }
67916 g += 50;
67917 if (g > 255)
67918 {
67919 g = 255;
67920 }
67921 b += 50;
67922 if (b > 255)
67923 {
67924 b = 255;
67925 }
67926 return new Color(r, g, b, 200);
67927 }
67928 if (type == 227)
67929 {
67930 r = (g = (b = 255));
67931 float num9 = (float)(int)Main.mouseTextColor / 100f - 1.6f;
67932 r = (int)((float)r * num9);
67933 g = (int)((float)g * num9);
67934 b = (int)((float)b * num9);
67935 int a4 = (int)(100f * num9);
67936 r += 50;
67937 if (r > 255)
67938 {
67939 r = 255;
67940 }
67941 g += 50;
67942 if (g > 255)
67943 {
67944 g = 255;
67945 }
67946 b += 50;
67947 if (b > 255)
67948 {
67949 b = 255;
67950 }
67951 return new Color(r, g, b, a4);
67952 }
67953 if (type == 114 || type == 115)
67954 {
67955 if (localAI[1] >= 15f)
67956 {
67957 return new Color(255, 255, 255, alpha);
67958 }
67959 if (localAI[1] < 5f)
67960 {
67961 return Color.Transparent;
67962 }
67963 int num10 = (int)((localAI[1] - 5f) / 10f * 255f);
67964 return new Color(num10, num10, num10, num10);
67965 }
67966 if (type == 83 || type == 88 || type == 89 || type == 90 || type == 100 || type == 104 || type == 279 || (type >= 283 && type <= 287) || type == 876)
67967 {
67968 if (alpha < 200)
67969 {
67970 return new Color(255 - alpha, 255 - alpha, 255 - alpha, 0);
67971 }
67972 return Color.Transparent;
67973 }
67974 if (type == 34 || type == 35 || type == 15 || type == 19 || type == 44 || type == 45)
67975 {
67976 return Color.White;
67977 }
67978 if (type == 79)
67979 {
67980 r = Main.DiscoR;
67981 g = Main.DiscoG;
67982 b = Main.DiscoB;
67983 return default(Color);
67984 }
67985 if (type == 9 || type == 15 || type == 34 || type == 50 || type == 53 || type == 76 || type == 77 || type == 78 || type == 92 || type == 91)
67986 {
67987 r = newColor.R - alpha / 3;
67988 g = newColor.G - alpha / 3;
67989 b = newColor.B - alpha / 3;
67990 }
67991 else
67992 {
67993 if (type == 18)
67994 {
67995 return new Color(255, 255, 255, 50);
67996 }
67997 if (type == 16 || type == 44 || type == 45)
67998 {
67999 r = newColor.R;
68000 g = newColor.G;
68001 b = newColor.B;
68002 }
68003 else if (type == 12 || type == 72 || type == 86 || type == 87 || type == 955)
68004 {
68005 return new Color(255, 255, 255, newColor.A - alpha);
68006 }
68007 }
68008 }
68009 }
68010 }
68011 }
68012 float num11 = (float)(255 - alpha) / 255f;
68013 r = (int)((float)(int)newColor.R * num11);
68014 g = (int)((float)(int)newColor.G * num11);
68015 b = (int)((float)(int)newColor.B * num11);
68016 int num12 = newColor.A - alpha;
68017 if (num12 < 0)
68018 {
68019 num12 = 0;
68020 }
68021 if (num12 > 255)
68022 {
68023 num12 = 255;
68024 }
68025 return new Color(r, g, b, num12);
68026 }
68027
68028 public override string ToString()
68029 {
68030 return "type:" + type + ", name:" + Name + ", active:" + active.ToString() + ", whoAmI:" + whoAmI + ", identity:" + identity + ", ai0:" + ai[0] + ", uuid:" + projUUID;
68031 }
68032}
static float Lerp(float value1, float value2, float amount)
Definition MathHelper.cs:53
static float WrapAngle(float angle)
Definition MathHelper.cs:87
static float Max(float value1, float value2)
Definition MathHelper.cs:41
static float ToRadians(float degrees)
Definition MathHelper.cs:21
static float SmoothStep(float value1, float value2, float amount)
Definition MathHelper.cs:63
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)
bool ICollection< KeyValuePair< TKey, TValue > >. Contains(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 decimal Round(decimal d)
Definition Math.cs:1096
static double Ceiling(double a)
static double IEEERemainder(double x, double y)
Definition Math.cs:679
static double Abs(double value)
static double Sin(double a)
const double PI
Definition Math.cs:16
static double Floor(double d)
static int Sign(decimal value)
Definition Math.cs:1202
static byte Max(byte val1, byte val2)
Definition Math.cs:738
static SlotId PlayTrackedLoopedSound(SoundStyle style, Vector2 position, ActiveSound.LoopedPlayCondition loopingCondition=null)
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
Item[] item
Definition Chest.cs:41
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 void HitTiles(Vector2 Position, Vector2 Velocity, int Width, int Height)
static void ExpandVertically(int startX, int startY, out int topY, out int bottomY, int maxExpandUp=100, int maxExpandDown=100)
static bool honey
Definition Collision.cs:24
static bool CheckAABBvLineCollision(Vector2 aabbPosition, Vector2 aabbDimensions, Vector2 lineStart, Vector2 lineEnd)
Definition Collision.cs:198
static bool CanHitLine(Vector2 Position1, int Width1, int Height1, Vector2 Position2, int Width2, int Height2)
Definition Collision.cs:551
static bool IsWorldPointSolid(Vector2 pos, bool treatPlatformsAsNonSolid=false)
static Vector2 TileCollision(Vector2 Position, Vector2 Velocity, int Width, int Height, bool fallThrough=false, bool fall2=false, int gravDir=1)
static Vector4 SlopeCollision(Vector2 Position, Vector2 Velocity, int Width, int Height, float gravity=0f, bool fall=false)
static bool shimmer
Definition Collision.cs:26
static void LaserScan(Vector2 samplingPoint, Vector2 directionUnit, float samplingWidth, float maxDistance, float[] samples)
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 SolidCollision(Vector2 Position, int Width, int Height)
static bool SwitchTiles(Vector2 Position, int Width, int Height, Vector2 oldPosition, int objType)
static Vector2 AnyCollisionWithSpecificTiles(Vector2 Position, Vector2 Velocity, int Width, int Height, bool[] tilesWeCanCollideWithByType, bool evenActuated=false)
static bool SolidTiles(Vector2 position, int width, int height)
static PlayerDeathReason ByOther(int type)
static PlayerDeathReason ByProjectile(int playerIndex, int projectileIndex)
static bool SpreadWater(int x, int y)
static bool SpreadLightOpen_StopForSolids(int x, int y)
static bool SpreadLava(int x, int y)
static bool SpreadDry(int x, int y)
static bool CutTiles(int x, int y)
static bool SpreadDirt(int x, int y)
static bool SpreadHoney(int x, int y)
static bool CastLight(int x, int y)
static bool CastLightOpen(int x, int y)
Vector2 position
Definition Dust.cs:20
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
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
float fadeIn
Definition Dust.cs:24
Vector2 velocity
Definition Dust.cs:22
static Dust QuickDust(int x, int y, Color color)
Definition Dust.cs:263
Vector2 oldPosition
Definition Entity.cs:18
bool honeyWet
Definition Entity.cs:34
Vector2 Center
Definition Entity.cs:43
bool shimmerWet
Definition Entity.cs:32
int oldDirection
Definition Entity.cs:22
Vector2 velocity
Definition Entity.cs:16
Vector2 Left
Definition Entity.cs:55
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
Vector2 Right
Definition Entity.cs:67
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 void HitGolfBall(Entity entity, Vector2 velocity, float roughLandResistance)
static bool ValidateShot(Entity golfBall, Player player, ref Vector2 shotVector)
static ShotStrength CalculateShotStrength(Vector2 shotVector, ClubProperties clubProperties)
static BallStepResult StepGolfBall(Entity entity, ref float angularVelocity)
static Color GetPortalColor(int colorIndex)
static int TryPlacingPortal(Projectile theBolt, Vector2 velocity, Vector2 theCrashVelocity)
static void SyncPortalSections(Vector2 portalPosition, int fluff)
static bool SupportedTilesAreFine(Vector2 portalCenter, float portalAngle)
Vector2 velocity
Definition Gore.cs:19
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 ArmorShaderDataSet Armor
Definition GameShaders.cs:7
static Dictionary< int, Item > ItemsByType
static BannerEffect[] BannerStrength
Definition ItemID.cs:1018
static bool[] CanFishInLava
Definition ItemID.cs:1024
static bool[] IsLavaBait
Definition ItemID.cs:1026
static readonly short Count
Definition ItemID.cs:12138
static bool[] CountsAsCritter
Definition NPCID.cs:4202
static bool[] ReflectStarShotsInForTheWorthy
Definition NPCID.cs:4097
static bool[] BelongsToInvasionOldOnesArmy
Definition NPCID.cs:4166
static bool[] ZappingJellyfish
Definition NPCID.cs:4111
static Color[] MagicAuraColor
Definition NPCID.cs:4232
static float[] YoyosLifeTimeMultiplier
static bool[] ImmediatelyUpdatesNPCBuffFlags
static GenSearch[] ExtendedCanHitCheckSearch
static bool[] RocketsSkipDamageForPlayers
static float[] ExtendedCanHitCheckRange
static bool[] AllowsContactDamageFromJellyfish
static bool[] DontApplyParryDamageBuff
static bool[] IsARocketThatDealsDoubleDamageToPrimaryEnemy
static bool[] IsAMineThatDealsTripleDamageWhenStationary
static ? bool[] ForcePlateDetection
static bool[] FallingBlockDoesNotFallThroughPlatforms
static bool[] DontCancelChannelOnKill
static ? bool[] WindPhysicsImmunity
static readonly short Count
static readonly LegacySoundStyle Item33
Definition SoundID.cs:480
static readonly LegacySoundStyle Item10
Definition SoundID.cs:434
static readonly LegacySoundStyle Item120
Definition SoundID.cs:654
static readonly LegacySoundStyle DD2_ExplosiveTrapExplode
Definition SoundID.cs:790
static readonly LegacySoundStyle Item50
Definition SoundID.cs:514
static readonly LegacySoundStyle Item115
Definition SoundID.cs:644
static readonly LegacySoundStyle Item127
Definition SoundID.cs:668
static readonly LegacySoundStyle Item101
Definition SoundID.cs:616
static readonly LegacySoundStyle Item36
Definition SoundID.cs:486
static readonly LegacySoundStyle DD2_SkyDragonsFuryShot
Definition SoundID.cs:954
static readonly LegacySoundStyle Item94
Definition SoundID.cs:602
static readonly LegacySoundStyle Item45
Definition SoundID.cs:504
static readonly LegacySoundStyle Item14
Definition SoundID.cs:442
static readonly LegacySoundStyle Item107
Definition SoundID.cs:628
static readonly LegacySoundStyle DD2_BallistaTowerShot
Definition SoundID.cs:788
static readonly LegacySoundStyle DD2_LightningBugZap
Definition SoundID.cs:880
static readonly LegacySoundStyle Item153
Definition SoundID.cs:720
static readonly LegacySoundStyle Item16
Definition SoundID.cs:446
static readonly LegacySoundStyle Item91
Definition SoundID.cs:596
static readonly LegacySoundStyle Item132
Definition SoundID.cs:678
static readonly LegacySoundStyle Item4
Definition SoundID.cs:422
static readonly LegacySoundStyle Item51
Definition SoundID.cs:516
static readonly LegacySoundStyle DD2_SkyDragonsFuryCircle
Definition SoundID.cs:952
static readonly LegacySoundStyle DD2_DarkMageAttack
Definition SoundID.cs:816
static readonly LegacySoundStyle Item118
Definition SoundID.cs:650
static readonly LegacySoundStyle Item27
Definition SoundID.cs:468
static readonly LegacySoundStyle Item34
Definition SoundID.cs:482
static readonly LegacySoundStyle DD2_DarkMageHealImpact
Definition SoundID.cs:822
static readonly LegacySoundStyle Item7
Definition SoundID.cs:428
static readonly LegacySoundStyle DD2_FlameburstTowerShot
Definition SoundID.cs:792
static readonly LegacySoundStyle Item113
Definition SoundID.cs:640
static readonly LegacySoundStyle DD2_SkeletonSummoned
Definition SoundID.cs:898
static readonly LegacySoundStyle Item28
Definition SoundID.cs:470
static readonly LegacySoundStyle Item15
Definition SoundID.cs:444
static readonly LegacySoundStyle Item124
Definition SoundID.cs:662
static readonly LegacySoundStyle AbigailCry
Definition SoundID.cs:978
static readonly LegacySoundStyle Item117
Definition SoundID.cs:648
static readonly LegacySoundStyle Item100
Definition SoundID.cs:614
static readonly LegacySoundStyle Item17
Definition SoundID.cs:448
static readonly LegacySoundStyle Item21
Definition SoundID.cs:456
static readonly LegacySoundStyle DD2_MonkStaffGroundMiss
Definition SoundID.cs:944
static readonly LegacySoundStyle Item62
Definition SoundID.cs:538
static readonly LegacySoundStyle DD2_BetsysWrathImpact
Definition SoundID.cs:932
static readonly LegacySoundStyle Item155
Definition SoundID.cs:724
static readonly LegacySoundStyle Item5
Definition SoundID.cs:424
static readonly LegacySoundStyle DD2_LightningAuraZap
Definition SoundID.cs:794
static readonly LegacySoundStyle DeerclopsIceAttack
Definition SoundID.cs:966
static readonly LegacySoundStyle Item154
Definition SoundID.cs:722
static readonly LegacySoundStyle Item169
Definition SoundID.cs:752
static readonly LegacySoundStyle Item12
Definition SoundID.cs:438
static readonly LegacySoundStyle Item159
Definition SoundID.cs:732
static readonly LegacySoundStyle Item22
Definition SoundID.cs:458
static readonly LegacySoundStyle Item82
Definition SoundID.cs:578
static readonly LegacySoundStyle Item1
Definition SoundID.cs:416
static readonly LegacySoundStyle Item126
Definition SoundID.cs:666
static readonly LegacySoundStyle DD2_MonkStaffGroundImpact
Definition SoundID.cs:942
static readonly LegacySoundStyle Item9
Definition SoundID.cs:432
static readonly LegacySoundStyle AbigailAttack
Definition SoundID.cs:980
static readonly LegacySoundStyle GlommerBounce
Definition SoundID.cs:984
static readonly LegacySoundStyle Item125
Definition SoundID.cs:664
static readonly LegacySoundStyle Item13
Definition SoundID.cs:440
static readonly LegacySoundStyle Item123
Definition SoundID.cs:660
static readonly LegacySoundStyle Item42
Definition SoundID.cs:498
static readonly LegacySoundStyle DD2_BetsyFireballShot
Definition SoundID.cs:800
static readonly LegacySoundStyle NPCDeath59
Definition SoundID.cs:398
static readonly LegacySoundStyle DD2_BetsyFireballImpact
Definition SoundID.cs:802
static readonly LegacySoundStyle AbigailUpgrade
Definition SoundID.cs:982
static readonly LegacySoundStyle Item116
Definition SoundID.cs:646
static readonly LegacySoundStyle Item156
Definition SoundID.cs:726
static readonly LegacySoundStyle Item8
Definition SoundID.cs:430
static readonly LegacySoundStyle Item89
Definition SoundID.cs:592
static readonly LegacySoundStyle Item26
Definition SoundID.cs:466
static readonly LegacySoundStyle Item121
Definition SoundID.cs:656
static readonly LegacySoundStyle DD2_PhantomPhoenixShot
Definition SoundID.cs:948
static readonly LegacySoundStyle Item11
Definition SoundID.cs:436
static readonly LegacySoundStyle DD2_GoblinBomb
Definition SoundID.cs:774
static readonly LegacySoundStyle Item96
Definition SoundID.cs:606
static readonly LegacySoundStyle Item171
Definition SoundID.cs:756
static readonly LegacySoundStyle Item54
Definition SoundID.cs:522
static readonly LegacySoundStyle Item46
Definition SoundID.cs:506
static readonly LegacySoundStyle Item60
Definition SoundID.cs:534
static readonly LegacySoundStyle Item20
Definition SoundID.cs:454
static readonly LegacySoundStyle Item110
Definition SoundID.cs:634
static readonly LegacySoundStyle DD2_BookStaffTwisterLoop
Definition SoundID.cs:936
static readonly LegacySoundStyle JimsDrone
Definition SoundID.cs:990
static readonly LegacySoundStyle Item74
Definition SoundID.cs:562
static readonly LegacySoundStyle DD2_GhastlyGlaiveImpactGhost
Definition SoundID.cs:938
static readonly LegacySoundStyle Item114
Definition SoundID.cs:642
static readonly LegacySoundStyle DD2_DefeatScene
Definition SoundID.cs:926
static bool[] CrackedBricks
Definition TileID.cs:113
static bool[] Falling
Definition TileID.cs:289
static bool[] CommonSapling
Definition TileID.cs:103
static bool[] BasicChest
Definition TileID.cs:223
static bool[] Platforms
Definition TileID.cs:163
static bool[] IsATreeTrunk
Definition TileID.cs:91
static readonly ushort Count
Definition TileID.cs:1698
float knockBack
Definition Item.cs:169
int fishingPole
Definition Item.cs:97
int shoot
Definition Item.cs:235
static int BannerToItem(int banner)
Definition Item.cs:1246
int damage
Definition Item.cs:167
static int NPCtoBanner(int i)
Definition Item.cs:1296
float shootSpeed
Definition Item.cs:237
int tileBoost
Definition Item.cs:159
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 LocalizedText GetProjectileName(int type)
Definition Lang.cs:413
static Color GetColor(Point tileCoords)
Definition Lighting.cs:182
static int OffScreenTiles
Definition Lighting.cs:17
static void AddLight(Vector2 position, Vector3 rgb)
Definition Lighting.cs:137
static string GetTextValue(string key)
Definition Language.cs:15
static NetworkText FromKey(string key, params object[] substitutions)
static float windPhysicsStrength
Definition Main.cs:1370
static bool[] tileDungeon
Definition Main.cs:1465
static float windSpeedCurrent
Definition Main.cs:1360
static double time
Definition Main.cs:1284
static float bottomWorld
Definition Main.cs:1112
static int maxTilesY
Definition Main.cs:1116
static bool windPhysics
Definition Main.cs:1368
static AchievementManager Achievements
Definition Main.cs:2756
static float cloudAlpha
Definition Main.cs:1302
static bool[] tileSolidTop
Definition Main.cs:1469
static Chest[] chest
Definition Main.cs:1699
static bool[] tileCut
Definition Main.cs:1433
static bool[] projPet
Definition Main.cs:1328
static Vector2 GetPlayerArmPosition(Projectile proj)
Definition Main.cs:34265
static Item[] item
Definition Main.cs:1681
static uint GameUpdateCount
Definition Main.cs:2811
static bool anglerQuestFinished
Definition Main.cs:1847
static double worldSurface
Definition Main.cs:1272
static int myPlayer
Definition Main.cs:1801
static int DiscoR
Definition Main.cs:1062
static Vector2 ReverseGravitySupport(Vector2 pos, float height=0f)
Definition Main.cs:3005
static int[,] projectileIdentity
Definition Main.cs:1693
static int netMode
Definition Main.cs:2095
static double rockLayer
Definition Main.cs:1274
static Vector2[] OffsetsPlayerHeadgear
Definition Main.cs:520
static Gore[] gore
Definition Main.cs:1687
static bool expertMode
Definition Main.cs:2737
static bool mouseRight
Definition Main.cs:616
static bool dayTime
Definition Main.cs:1282
static bool dedServ
Definition Main.cs:1226
static int[] projFrames
Definition Main.cs:1326
static bool bloodMoon
Definition Main.cs:1296
static int lastMouseY
Definition Main.cs:610
static float WindForVisuals
Definition Main.cs:2827
static double timeForVisualEffects
Definition Main.cs:1286
static Main instance
Definition Main.cs:283
static Vector2 MouseWorld
Definition Main.cs:2776
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 Vector2 MouseScreen
Definition Main.cs:2773
static byte mouseTextColor
Definition Main.cs:1751
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 int DiscoG
Definition Main.cs:1066
static int offScreenRange
Definition Main.cs:836
static Vector2[] OffsetsPlayerOnhand
Definition Main.cs:496
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 DroneCameraTracker DroneCameraTracker
Definition Main.cs:1878
static bool mouseRightRelease
Definition Main.cs:1757
static int lastMouseX
Definition Main.cs:608
static Projectile[] projectile
Definition Main.cs:1691
static GameModeData GameModeInfo
Definition Main.cs:2682
static int DiscoB
Definition Main.cs:1064
static UnifiedRandom rand
Definition Main.cs:1387
static bool notTheBeesWorld
Definition Main.cs:347
static NPC[] npc
Definition Main.cs:1685
static Vector3 rgbToHsl(Microsoft.Xna.Framework.Color newColor)
Definition Main.cs:44972
static int ProjectileUpdateLoopIndex
Definition Main.cs:2341
static bool tenthAnniversaryWorld
Definition Main.cs:343
static int dayRate
Definition Main.cs:746
static int screenWidth
Definition Main.cs:1719
static int UnderworldLayer
Definition Main.cs:2825
static Microsoft.Xna.Framework.Color hslToRgb(Vector3 hslVector)
Definition Main.cs:44913
static float leftWorld
Definition Main.cs:1106
static int mouseY
Definition Main.cs:606
static bool[] tileFrameImportant
Definition Main.cs:1495
static Player LocalPlayer
Definition Main.cs:2829
static bool mapFullscreen
Definition Main.cs:932
static bool hardMode
Definition Main.cs:1022
static Player[] player
Definition Main.cs:1803
static int[] anglerQuestItemNetIDs
Definition Main.cs:1851
static int mouseX
Definition Main.cs:604
static float GlobalTimeWrappedHourly
Definition Main.cs:405
static int anglerQuest
Definition Main.cs:1849
static bool IsTileSpelunkable(Tile t)
Definition Main.cs:20286
static bool remixWorld
Definition Main.cs:349
static Dust[] dust
Definition Main.cs:1677
static bool mouseLeft
Definition Main.cs:614
static int[] tileFrame
Definition Main.cs:1657
bool Active
Definition Mount.cs:345
static bool unlockedSlimeRainbowSpawn
Definition NPC.cs:315
static int ShieldStrengthTowerNebula
Definition NPC.cs:403
static readonly int maxBuffs
Definition NPC.cs:211
static int ShieldStrengthTowerSolar
Definition NPC.cs:399
static int ShieldStrengthTowerMax
Definition NPC.cs:785
static Color AI_121_QueenSlime_GetDustColor()
Definition NPC.cs:38257
static bool ShouldEmpressBeEnraged()
Definition NPC.cs:39121
static bool combatBookWasUsed
Definition NPC.cs:339
static bool unlockedSlimeRedSpawn
Definition NPC.cs:317
static int ShieldStrengthTowerStardust
Definition NPC.cs:405
static int ReleaseNPC(int x, int y, int Type, int Style, int who)
Definition NPC.cs:72344
static int ShieldStrengthTowerVortex
Definition NPC.cs:401
static bool AnyNPCs(int Type)
Definition NPC.cs:86689
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 int[] lazyNPCOwnedProjectileSearchArray
Definition NPC.cs:431
static bool downedGolemBoss
Definition NPC.cs:365
static bool downedBoss3
Definition NPC.cs:349
static bool unlockedSlimeYellowSpawn
Definition NPC.cs:319
static int GetAvailableAmountOfNPCsToSpawnUpToSlot(int amountWeWant, int highestNPCSlotIndexWeWillPick=100)
Definition NPC.cs:77558
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 void SendPlayerHurt(int playerTargetIndex, PlayerDeathReason reason, int damage, int direction, bool critical, bool pvp, int hitContext, int remoteClient=-1, int ignoreClient=-1)
static void SendTileSquare(int whoAmi, int tileX, int tileY, int xSize, int ySize, TileChangeType changeType=TileChangeType.None)
static void SendObjectPlacement(int whoAmi, int x, int y, int type, int style, int alternative, int random, int direction)
static bool CustomPlace(int type, int style)
static TileObjectData GetTileData(int type, int style, int alternate=0)
bool petFlagDD2Dragon
Definition Player.cs:1747
int itemAnimationMax
Definition Player.cs:2567
float whipRangeMultiplier
Definition Player.cs:901
bool abigailMinion
Definition Player.cs:1017
bool coolWhipBuff
Definition Player.cs:1717
int highestStormTigerGemOriginalDamage
Definition Player.cs:1009
float itemRotation
Definition Player.cs:1177
void MatchItemTimeToItemAnimation()
Definition Player.cs:3805
bool empressBlade
Definition Player.cs:1013
int GetWeaponDamage(Item sItem)
Definition Player.cs:49909
float meleeSpeed
Definition Player.cs:2043
bool creativeGodMode
Definition Player.cs:1529
bool CheckMana(int amount, bool pay=false, bool blockQuickMana=false)
Definition Player.cs:53313
static int crystalLeafKB
Definition Player.cs:635
bool companionCube
Definition Player.cs:1839
bool stardustGuardian
Definition Player.cs:997
bool suspiciouslookingTentacle
Definition Player.cs:1671
void SetItemTime(int frames)
Definition Player.cs:3746
Vector2 MountedCenter
Definition Player.cs:2853
int FindBuffIndex(int type)
Definition Player.cs:4425
float GetWeaponKnockback(Item sItem, float KnockBack)
Definition Player.cs:49867
bool ballistaPanic
Definition Player.cs:2013
bool petFlagDD2Ghost
Definition Player.cs:1745
bool setHuntressT3
Definition Player.cs:2393
static int tileTargetY
Definition Player.cs:2085
bool stardustDragon
Definition Player.cs:999
bool petFlagEaterOfWorldsPet
Definition Player.cs:1779
double Hurt(PlayerDeathReason damageSource, int Damage, int hitDirection, bool pvp=false, bool quiet=false, bool Crit=false, int cooldownCounter=-1, bool dodgeable=true)
Definition Player.cs:36134
IEntitySource GetProjectileSource_Item_WithPotentialAmmo(Item item, int ammoItemId)
Definition Player.cs:9292
bool crimsonHeart
Definition Player.cs:1673
void ChangeDir(int dir)
Definition Player.cs:40136
Vector2 MinionRestTargetPoint
Definition Player.cs:2559
byte meleeEnchant
Definition Player.cs:831
int[] grappling
Definition Player.cs:2305
bool petFlagLunaticCultistPet
Definition Player.cs:1799
PlayerFishingConditions GetFishingConditions()
Definition Player.cs:40242
Rectangle bodyFrame
Definition Player.cs:1373
void LimitPointToPlayerReachableArea(ref Vector2 pointPoisition)
Definition Player.cs:43259
float beeKB(float KB)
Definition Player.cs:11853
static int tileTargetX
Definition Player.cs:2083
bool petFlagDirtiestBlock
Definition Player.cs:1837
float miscCounterNormalized
Definition Player.cs:2880
bool pirateMinion
Definition Player.cs:987
int phantomPhoneixCounter
Definition Player.cs:949
bool setHuntressT2
Definition Player.cs:2401
static int crystalLeafDamage
Definition Player.cs:633
bool HasMinionRestTarget
Definition Player.cs:3521
float magicDamage
Definition Player.cs:2025
void AddBuff(int type, int timeToAdd, bool quiet=true, bool foodHack=false)
Definition Player.cs:4441
Vector2 RotatedRelativePoint(Vector2 pos, bool reverseRotation=false, bool addGfxOffY=true)
Definition Player.cs:3618
bool petFlagDD2Gato
Definition Player.cs:1743
int beeDamage(int dmg)
Definition Player.cs:11844
bool HasAmmo(Item sItem, bool canUse)
Definition Player.cs:49951
static byte FindClosest(Vector2 Position, int Width, int Height)
Definition Player.cs:4011
float fullRotation
Definition Player.cs:1291
void SetDummyItemTime(int frames)
Definition Player.cs:3762
bool petFlagUpbeatStar
Definition Player.cs:1749
DirectionalInputSyncCache LocalInputCache
Definition Player.cs:1379
bool petFlagDestroyerPet
Definition Player.cs:1787
int[] ownedProjectileCounts
Definition Player.cs:2545
Item[] inventory
Definition Player.cs:1257
bool controlUseItem
Definition Player.cs:1391
bool TryPlacingAGolfBallNearANearbyTee(Vector2 placePosition)
Definition Player.cs:46812
void PickAmmo(Item sItem, ref int projToShoot, ref float speed, ref bool canShoot, ref int Damage, ref float KnockBack, out int usedAmmoItemId, bool dontConsume=false)
Definition Player.cs:49978
TrackedProjectileReference piggyBankProjTracker
Definition Player.cs:2429
bool hasTitaniumStormBuff
Definition Player.cs:941
static int NewText(AdvancedPopupRequest request, Vector2 position)
Definition PopupText.cs:95
static void AssignAsSonarText(int sonarTextIndex)
Definition PopupText.cs:451
static void ClearSonarText()
Definition PopupText.cs:70
int Compare(Tuple< int, float > npcIndex1, Tuple< int, float > npcIndex2)
Definition Projectile.cs:34
float AI_061_FishingBobber_GetWaterLine(int X, int Y)
static void AI_192_GetJuminoFall(Projectile proj, out float timeSinceFall, out float fall)
void ProjectileFixDesperation()
void FishingCheck_RollDropLevels(int fishingLevel, out bool common, out bool uncommon, out bool rare, out bool veryrare, out bool legendary, out bool crate)
HallowBossPelletStormInfo AI_172_GetPelletStormInfo(int stormIndex)
void AI_173_HallowBossRainbowTrail()
void CreateImpactExplosion2_SleepyOctopod(Vector2 explosionOrigin, bool causedShockwaves)
void AI_061_FishingBobber_DoASplash()
int AI_134_Ballista_FindTarget(float shot_range, float deadBottomAngle, Vector2 shootingSpot)
Projectile FindStardustDragonHeadOfOwner()
void CheckUsability(Player player, ref bool currentlyUsable)
float ownerHitCheckDistance
Definition Projectile.cs:88
void CreateImpactExplosion(int dustAmountMultiplier, Vector2 explosionOrigin, ref Point scanAreaStart, ref Point scanAreaEnd, int explosionRange, out bool causedShockwaves)
void UpdatePosition(Vector2 wetVelocity)
void AI_156_GetIdlePosition(int stackedIndex, int totalIndexes, out Vector2 idleSpot, out float idleRotation)
static int GetBallistraShotDelay(Player player)
void AI_009_MagicMissiles_Old()
static void KillOldestJavelin(int protectedProjectileIndex, int projectileType, int targetNPCIndex, Point[] bufferForScan)
void HandleMovement(Vector2 wetVelocity, out int overrideWidth, out int overrideHeight)
Color GetFairyQueenWeaponsColor(float alphaChannelMultiplier=1f, float lerpToWhite=0f, float? rawHueOverride=null)
static void GetFishingPondState(int x, int y, out bool lava, out bool honey, out int numWaters, out int chumCount)
void DoRainbowCrystalStaffExplosion()
static List< Tuple< int, float > > _medusaHeadTargetList
Point GetScarabBombDigDirectionSnap8()
int AI_130_FlameBurstTower_FindTarget(float shot_range, float angleRatioMax, Vector2 shootingSpot, bool canChangeDirection=true)
void ghostHeal(int dmg, Vector2 Position, Entity victim)
void AI_120_StardustGuardian_FindTarget(float lookupRange, ref int targetNPCIndex, ref float distanceToClosestTarget)
static Conditions.NotNull _cachedConditions_notNull
static NPCDistanceByIndexComparator _medusaTargetComparer
static List< int > _ai164_blacklistedTargets
void AI_180_FairyQueenSunDance()
static void InitializeStaticThings()
static List< int > _ai156_blacklistedTargets
bool IsInRangeOfMeOrMyOwner(Entity entity, float maxDistance, out float myDistance, out float playerDistance, out bool closerIsMe)
IEntitySource GetItemSource_OnHit(Entity victim, int itemSourceId)
IEntitySource GetProjectileSource_FromThis()
bool stopsDealingDamageAfterPenetrateHits
int CountEnemiesWhoAreImmuneToMeRightNow(int cap)
bool CanExplodeTile(int x, int y)
int FindTargetWithLineOfSight(float maxRange=800f)
IEntitySource GetItemSource_DropAsItem()
static Point[] _javelinsMax8
void CreateGroundExplosion(float MAX_SPREAD, int fluff, int distFluff, int layerStart, int layerEnd, int layerJump)
void BombsHurtPlayers(Rectangle projRectangle, int j)
static void FillWhipControlPoints(Projectile proj, List< Vector2 > controlPoints)
void EmitEnchantmentVisualsAt(Vector2 boxPosition, int boxWidth, int boxHeight)
void ReduceRemainingChumsInPool()
bool CanHitWithOwnBody(Entity ent)
void Minion_FindTargetInRange(int startAttackRange, ref int attackTarget, bool skipIfCannotHitWithOwnBody, Func< Entity, int, bool > customEliminationCheck=null)
void FishingCheck_RollItemDrop(ref FishingAttempt fisher)
NPC FindTargetWithinRange(float maxRange, bool checkCanHit=false)
IEntitySource GetProjectileSource_OnHit(Entity victim, int projectileSourceId)
void ExplodeCrackedTiles(Vector2 compareSpot, int radius, int minI, int maxI, int minJ, int maxJ)
void AI_155_SpawnRopeIn(int x, int y)
static float[] _CompanionCubeScreamCooldown
static Vector2 AI_158_GetHomeLocation(Player master, int stackedIndex)
void SetDefaults(int Type)
bool AI_067_TigerSpecialAttack()
void AI_156_Think(List< int > blacklist)
void TryGettingHitByOtherPlayersExplosives()
static IEntitySource GetNoneSource()
const int SentryLifeTime
Definition Projectile.cs:84
override string ToString()
static Rectangle _lanceHitboxBounds
static Vector2 AI_164_GetHomeLocation(Player master, int stackedIndex, int totalIndexes)
void SummonSuperStarSlash(Vector2 target)
void vampireHeal(int dmg, Vector2 Position, Entity victim)
void TryDoingOnHitEffects(Entity entity)
static void FindBannerToAssociateTo(IEntitySource spawnSource, Projectile next)
bool AutomaticallyChangesDirection()
bool AI_019_Spears_GetExtensionHitbox(out Rectangle extensionBox)
static Conditions.IsSolid _cachedConditions_solid
static Color GetGolfTrailColor(Projectile proj)
void MakeBoulderOfEarthExplosion()
static int GetNextSlot()
void BetsySharpnel(int npcIndex)
bool TryGetContainerIndex(out int containerIndex)
static Point[] _javelinsMax6
bool appliesImmunityTimeOnSingleHits
bool ShouldWallExplode(Vector2 compareSpot, int radius, int minI, int maxI, int minJ, int maxJ)
static void EmitBlackLightningParticles(NPC targetNPC)
void FishingCheck_ProbeForQuestFish(ref FishingAttempt fisher)
static void UseGasTrapInChest(int chestIndex, Chest theChest, int gasTrapIndex, int gasOffsetX, int gasOffsetY)
void ghostHurt(int dmg, Vector2 Position, Entity victim)
void StatusPlayer(int i)
void Kill_DirtAndFluidProjectiles_RunDelegateMethodPushUpForHalfBricks(Point pt, float size, Utils.TileActionAttempt plot)
void AI_066_TryInterceptingTarget(Vector2 targetDir, Vector2 targetVelocity, float speed)
void ResetLocalNPCHitImmunity()
void ExplodeTiles(Vector2 compareSpot, int radius, int minI, int maxI, int minJ, int maxJ, bool wallSplode)
float GetLastPrismHue(float laserIndex, ref float laserLuminance, ref float laserAlphaMultiplier)
static Point[] _javelinsMax10
void AI_139_ExplosiveTrapExplosion()
Color GetAlpha(Color newColor)
void AI_GetMyGroupIndexAndFillBlackList(List< int > blackListedTargets, out int index, out int totalIndexesInGroup)
void AI_141_MonkStaffT1Explosion()
void AI_015_HandleMovementCollision_Old(ref Vector2 wetVelocity, ref Vector2 lastVelocity)
bool CanHitWithMeleeWeapon(Entity ent)
bool Chester_IsAnyPlayerTrackingThisProjectile()
void AI_181_FairyQueenRangedItemShot()
void AI_175_TitaniumStormShards()
static int GetByUUID(int owner, float uuid)
static int GetExplosiveTrapCooldown(Player player)
void AI_172_HallowBossRainbowPelletStorm()
void Interrupt(Player player)
IEntitySource GetNPCSource_FromThis()
static bool IsNPCIndexImmuneToProjectileType(int projectileType, int npcIndex)
void AI_155_RemoveRope(Point start, Point end)
int AI_172_GetPelletStormsCount()
void Resize(int newWidth, int newHeight)
void UpdateEnchantmentVisuals()
void CopyLocalNPCImmunityTimes(Projectile p)
bool AI_067_CustomEliminationCheck_Pirates(Entity otherEntity, int currentTarget)
List< Vector2 > WhipPointsForCollision
bool Colliding(Rectangle myRect, Rectangle targetRect)
int AI_156_TryAttackingNPCs(List< int > blackListedTargets, bool skipBodyCheck=false)
bool AI_007_GrapplingHooks_CanTileBeLatchedOnTo(Tile theTile)
void AI_015_Flails_Dust(bool doFastThrowDust)
void AI_047_MagnetSphere_TryAttacking()
static void RandomizeInsanityShadowFor(Entity targetEntity, bool isHostile, out Vector2 spawnposition, out Vector2 spawnvelocity, out float ai0, out float ai1)
void LightDisc_Bounce(Vector2 hitPoint, Vector2 normal)
IEntitySource GetItemSource_FromThis()
static int FindOldestProjectile()
void StatusPvP(int i)
static int NewProjectile(IEntitySource spawnSource, float X, float Y, float SpeedX, float SpeedY, int Type, int Damage, float KnockBack, int Owner=-1, float ai0=0f, float ai1=0f, float ai2=0f)
static List< int > _ai158_blacklistedTargets
void StatusNPC(int i)
Color GetFloatingDaggerMinionGlowColor()
void CutTilesAt(Vector2 boxPosition, int boxWidth, int boxHeight)
static void GetWhipSettings(Projectile proj, out float timeToFlyOut, out int segments, out float rangeMultiplier)
void AI_015_HandleMovementCollision(ref Vector2 wetVelocity, ref Vector2 lastVelocity)
const int ArrowLifeTime
Definition Projectile.cs:86
static bool GasTrapCheck(int x, int y, Player user)
bool AI_137_CanHit(Vector2 targetPosition)
bool IsAttachedTo(NPC npc)
void CreateImpactExplosion2_FlailTileCollision(Vector2 explosionOrigin, bool causedShockwaves, Vector2 velocityBeforeCollision)
bool originatedFromActivableTile
static uint[][] perIDStaticNPCImmunity
Definition Projectile.cs:82
static int GetByUUID(int owner, int uuid)
bool IsInterruptible(Player player)
static IEntitySource InheritSource(Projectile projectile)
Rectangle Damage_GetHitbox()
void AI_061_FishingBobber_GiveItemToPlayer(Player thePlayer, int itemType)
void FishingCheck_RollEnemySpawns(ref FishingAttempt fisher)
static void ResetImmunity()
void AI_171_HallowBossRainbowStreak()
void AI_187_ShadowHand_GetVariation(out int variation, out float fakeCounter, out float counterMax)
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 GetFishingPondWidth(int x, int y, out int minX, out int maxX)
static void CheckSection(int playerIndex, Vector2 position, int fluff=1)
static int ReadSign(int i, int j, bool CreateIfMissing=true)
Definition Sign.cs:24
static void TextSign(int i, string text)
Definition Sign.cs:63
static void StarFall(float positionX)
Definition Star.cs:60
bool nactive()
Definition Tile.cs:257
bool topSlope()
Definition Tile.cs:307
ushort type
Definition Tile.cs:8
bool active()
Definition Tile.cs:565
bool halfBrick()
Definition Tile.cs:650
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
delegate bool TileActionAttempt(int x, int y)
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 float Turn01ToCyclic010(float value)
Definition Utils.cs:161
static bool PlotTileArea(int x, int y, TileActionAttempt plot)
Definition Utils.cs:1765
static bool PlotTileLine(Vector2 start, Vector2 end, float width, TileActionAttempt plot)
Definition Utils.cs:1670
static float PingPongFrom01To010(float value)
Definition Utils.cs:166
static Rectangle CenteredRectangle(Vector2 center, Vector2 size)
Definition Utils.cs:604
static void MassWireOperation(Point ps, Point pe, Player master)
Definition Wiring.cs:393
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 TileEmpty(int i, int j)
static bool AttemptToGrowTreeFromSapling(int x, int y, bool underground)
static ? Rectangle GetTileVisualHitbox(int x, int y)
static bool SolidTile(Tile testTile)
static void CheckAchievement_RealEstateAndTownSlimes()
Definition WorldGen.cs:2158
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 TreeTopsInfo TreeTops
Definition WorldGen.cs:1178
static bool InAPlaceWithWind(Vector2 position, int width, int height)
static void Convert(int i, int j, int conversionType, int size=4)
static int KillTile_MakeTileDust(int i, int j, Tile tileCache)
static void RandomizeBackgroundBasedOnPlayer(UnifiedRandom random, Player player)
Definition WorldGen.cs:4162
static bool BlockBelowMakesSandFall(int i, int j)
static bool SlopeTile(int i, int j, int slope=0, bool noEffects=false)
static void KillWall(int i, int j, bool fail=false)
static void RandomizeMoonState(UnifiedRandom random, bool garenteeNewStyle=false)
Definition WorldGen.cs:4152
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 bool IsRope(int x, int y)
static void SquareTileFrame(int i, int j, bool resetFrame=true)
static bool CanCutTile(int x, int y, TileCuttingContext context)
static bool SolidOrSlopedTile(Tile tile)
static Color CornflowerBlue
Definition Color.cs:112
static Color Transparent
Definition Color.cs:76
static Color Lerp(Color value1, Color value2, float amount)
Definition Color.cs:491
void Inflate(int horizontalAmount, int verticalAmount)
Definition Rectangle.cs:84
bool Intersects(Rectangle value)
Definition Rectangle.cs:129
static float Dot(Vector2 value1, Vector2 value2)
Definition Vector2.cs:121
static Vector2 Reflect(Vector2 vector, Vector2 normal)
Definition Vector2.cs:157
static Vector2 CatmullRom(Vector2 value1, Vector2 value2, Vector2 value3, Vector2 value4, float amount)
Definition Vector2.cs:273
static Vector2 SmoothStep(Vector2 value1, Vector2 value2, float amount)
Definition Vector2.cs:255
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 Vector3 Lerp(Vector3 value1, Vector3 value2, float amount)
Definition Vector3.cs:307
static readonly SlotId Invalid
Definition SlotId.cs:5
static SlotId FromFloat(float value)
Definition SlotId.cs:80
static FinalFractalProfile GetFinalFractalProfile(int usedSwordId)
Vector2 GetBulletPosition(int bulletIndex, Vector2 centerPoint)
Definition Projectile.cs:71
Rectangle GetBulletHitbox(int bulletIndex, Vector2 centerPoint)
Definition Projectile.cs:76
static bool Place(TileObject toBePlaced)
Definition TileObject.cs:29
static bool CanPlace(int x, int y, int type, int style, int dir, out TileObject objectData, bool onlyCheck=false, int? forcedRandom=null)