46227    {
46230        {
46232        }
46233        int num = 300;
46235        {
46236            num = 0;
46237        }
46238        bool flag = Main.raining;
46239        if (!Main.dayTime)
46240        {
46241            flag = true;
46242        }
46243        if (Main.eclipse)
46244        {
46245            flag = true;
46246        }
46247        if (Main.slimeRain)
46248        {
46249            flag = true;
46250        }
46252        if (Main.masterMode)
46253        {
46255        }
46256        else if (Main.expertMode)
46257        {
46259        }
46260        else
46261        {
46263        }
46265        {
46267            {
46270            }
46272            {
46275            }
46277            {
46280            }
46282            {
46285            }
46287            {
46290            }
46292            {
46295            }
46296            if (Main.hardMode)
46297            {
46300            }
46302            {
46305            }
46307            {
46310            }
46312            {
46315            }
46317            {
46320            }
46322            {
46325            }
46327            {
46330            }
46332            {
46335            }
46337            {
46340            }
46341        }
46342        if (
type == 142 && Main.netMode != 1 && !Main.xMas)
 
46343        {
46345            if (Main.netMode == 2)
46346            {
46347                NetMessage.SendData(28, -1, -1, 
null, 
whoAmI, 9999f);
 
46348            }
46349        }
46351        {
46352            localAI[0] = Main.rand.Next(1, 5);
 
46353        }
46355        {
46357            bool flag2 = 
false;
 
46358            if (Main.projectile.IndexInRange(
num3))
 
46359            {
46360                Projectile projectile = Main.projectile[
num3];
 
46361                if (projectile.active && projectile.type == 582 && projectile.ai[1] == (
float)
whoAmI)
 
46362                {
46364                }
46365            }
46367        }
46369        {
46375            return;
46376        }
46378        {
46379        case 588:
46381            break;
46382        case 441:
46384            break;
46385        case 107:
46387            break;
46388        case 108:
46390            break;
46391        case 124:
46393            break;
46394        case 353:
46396            break;
46397        case 369:
46399            break;
46400        case 550:
46402            break;
46403        }
46406        {
46409            {
46410                velocity.X = 0f;
46411            }
46416            if (
ai[1] == 0f && Main.netMode == 1)
 
46417            {
46418                return;
46419            }
46420            if (
ai[1] == 0f && 
ai[2] < 1f)
 
46421            {
46423            }
46425            {
46428                {
46430                }
46431                return;
46432            }
46435            {
46437                {
46439                }
46440                else
46441                {
46443                }
46445            }
46447            hitbox.Y += 20;
46448            hitbox.Height -= 20;
46449            float num5 = Main.rand.NextFloatDirection();
 
46450            Lighting.AddLight(
base.Center, Main.hslToRgb((
float)Main.timeForVisualEffects / 360f % 1f, 0.6f, 0.65f).ToVector3() * Utils.Remap(
ai[1], 30f, 90f, 0f, 0.7f));
 
46451            if (Main.rand.NextFloat() > Utils.Remap(
ai[1], 30f, 60f, 1f, 0.5f))
 
46452            {
46453                Dust.NewDustPerfect(Main.rand.NextVector2FromRectangle(
hitbox) + Main.rand.NextVector2Circular(8f, 0f) + 
new Vector2(0f, 4f), 309, 
new Vector2(0f, -2f).RotatedBy(
num5 * ((
float)
Math.
PI * 2f) * 0.11f), 0, 
default(
Color), 1.7f - 
Math.
Abs(
num5) * 1.3f);
 
46454            }
46455            if (
ai[1] > 60f && Main.rand.Next(15) == 0)
 
46456            {
46457                for (
int i = 0; 
i < 3; 
i++)
 
46458                {
46461                    {
46462                        PositionInWorld = 
vector,
 
46463                        MovementVector = 
DirectionTo(
vector).RotatedBy((
float)
Math.
PI * 9f / 20f * (
float)(Main.rand.Next(2) * 2 - 1)) * Main.rand.NextFloat()
 
46464                    });
46465                }
46466            }
46470            {
46483                NetMessage.SendData(56, -1, -1, 
null, 
whoAmI);
 
46486                {
46487                    PositionInWorld = base.Center
46488                });
46489            }
46490            return;
46491        }
46493        {
46496            {
46499            }
46501            {
46504            }
46506            {
46508            }
46509        }
46511        {
46513        }
46514        bool flag3 = 
false;
 
46519        {
46521        }
46524        {
46526        }
46528        {
46529            for (
int j = 0; 
j < 255; 
j++)
 
46530            {
46531                if (Main.player[
j].active && Main.player[
j].talkNPC == 
whoAmI)
 
46532                {
46535                    {
46537                    }
46541                    if (Main.player[
j].position.X + (
float)(Main.player[
j].width / 2) < 
position.
X + (
float)(
width / 2))
 
46542                    {
46544                    }
46545                    else
46546                    {
46548                    }
46549                }
46550            }
46551        }
46553        {
46559            {
46561            }
46562            return;
46563        }
46564        if (
type == 37 && Main.netMode != 1)
 
46565        {
46568            {
46571            }
46572        }
46574        {
46576            if (!Main.dayTime)
46577            {
46579                {
46581                }
46583                {
46586                }
46587                flag = false;
46588            }
46589        }
46591        {
46593            {
46597            }
46599            {
46601            }
46602            else if (
position.
X / 16f > (
float)(Main.maxTilesX - 300))
 
46603            {
46605            }
46606        }
46608        {
46609            return;
46610        }
46612        {
46614            for (
int k = 0; 
k < 2; 
k++)
 
46615            {
46617                {
46618                    break;
46619                }
46622                {
46624                }
46625                for (
int l = 0; 
l < 255; 
l++)
 
46626                {
46627                    if (Main.player[
l].active && 
new Rectangle((
int)Main.player[
l].position.X, (
int)Main.player[
l].position.Y, Main.player[
l].width, Main.player[
l].height).
Intersects(
rectangle))
 
46628                    {
46630                        break;
46631                    }
46632                }
46633            }
46635            {
46637            }
46638        }
46650        {
46652        }
46661        {
46662            for (
int m = 0; 
m < 200; 
m++)
 
46663            {
46664                if (!Main.npc[
m].active || Main.npc[
m].friendly || Main.npc[
m].damage <= 0 || !(Main.npc[
m].Distance(
base.Center) < 
num8) || (
type == 453 && 
NPCID.
Sets.
Skeletons[Main.npc[
m].type]) || (!Main.npc[
m].noTileCollide && !Collision.CanHit(
base.Center, 0, 0, Main.npc[
m].Center, 0, 0)))
 
46665                {
46666                    continue;
46667                }
46668                bool flag15 = Main.npc[
m].CanBeChasedBy(
this);
 
46670                float num14 = Main.npc[
m].Center.X - 
base.Center.X;
 
46672                {
46674                    {
46677                    }
46679                    {
46682                    }
46683                    continue;
46684                }
46686                {
46689                    {
46691                    }
46692                }
46694                {
46697                    {
46699                    }
46700                }
46701            }
46703            {
46707                {
46709                }
46711                {
46713                }
46715                {
46717                    {
46719                        ai[1] = 300 + Main.rand.Next(300);
 
46723                    }
46724                }
46725                else if (
ai[0] != 10f && 
ai[0] != 12f && 
ai[0] != 13f && 
ai[0] != 14f && 
ai[0] != 15f)
 
46726                {
46728                    {
46731                    }
46732                    else if (
ai[0] != 1f)
 
46733                    {
46739                        {
46740                            if (
ai[0] == 3f || 
ai[0] == 4f || 
ai[0] == 16f || 
ai[0] == 17f)
 
46741                            {
46744                                {
46746                                    nPC.ai[1] = 120 + Main.rand.Next(120);
 
46748                                    nPC.localAI[3] = 0f;
 
46749                                    nPC.direction = -
num11;
 
46750                                    nPC.netUpdate = true;
46751                                }
46752                            }
46754                            ai[1] = 120 + Main.rand.Next(120);
 
46759                        }
46760                    }
46762                    {
46765                    }
46766                }
46767            }
46768        }
46770        {
46772            {
46774            }
46777            {
46779            }
46781            {
46783                ai[1] = 200 + Main.rand.Next(500, 700);
 
46787            }
46789            {
46790                if (Main.netMode != 1)
46791                {
46793                    {
46795                        {
46797                        }
46799                        {
46800                            velocity.X -= 0.1f;
46801                        }
46803                        {
46804                            velocity.X += 0.1f;
46805                        }
46806                        else
46807                        {
46808                            velocity.X = 0f;
46810                        }
46812                        {
46814                        }
46815                    }
46816                    else
46817                    {
46819                        {
46821                        }
46822                        else
46823                        {
46825                        }
46827                        ai[1] = 200 + Main.rand.Next(200);
 
46831                    }
46832                }
46833            }
46834            else
46835            {
46837                {
46838                    velocity.X *= 0.5f;
46839                }
46841                {
46842                    velocity.X -= 0.1f;
46843                }
46845                {
46846                    velocity.X += 0.1f;
46847                }
46848                else
46849                {
46850                    velocity.X = 0f;
46851                }
46852                if (Main.netMode != 1)
46853                {
46855                    {
46857                    }
46859                    {
46861                    }
46868                    {
46871                        {
46873                            ai[1] = 200 + Main.rand.Next(300);
 
46876                            {
46877                                ai[1] += Main.rand.Next(200, 400);
 
46878                            }
46881                        }
46882                    }
46884                    {
46886                    }
46888                    {
46890                        {
46892                            ai[1] = 200 + Main.rand.Next(300);
 
46895                            {
46896                                ai[1] += Main.rand.Next(200, 400);
 
46897                            }
46900                        }
46901                        else
46902                        {
46904                            ai[1] = 60 + Main.rand.Next(120);
 
46906                        }
46907                    }
46908                }
46909            }
46911            {
46913                {
46915                    {
46917                        {
46920                        }
46922                        {
46925                        }
46926                    }
46927                }
46928                else if (Main.rand.Next(80) == 0 && 
localAI[3] == 0f)
 
46929                {
46933                }
46934            }
46935        }
46936        else if (
ai[0] == 1f)
 
46937        {
46939            {
46941                ai[1] = 200 + Main.rand.Next(200);
 
46944            }
46945            else
46946            {
46949                {
46951                    {
46953                        {
46955                        }
46957                        {
46959                        }
46960                    }
46962                }
46964                {
46966                    ai[1] = 300 + Main.rand.Next(300);
 
46969                    {
46970                        ai[1] -= Main.rand.Next(100);
 
46971                    }
46972                    else
46973                    {
46974                        ai[1] += Main.rand.Next(900);
 
46975                    }
46978                }
46980                {
46983                    {
46985                        {
46988                        }
46990                        {
46992                        }
46993                    }
46995                    {
46997                        {
46999                            NetMessage.SendData(19, -1, -1, 
null, 5, 
doorX, 
doorY);
 
47000                        }
47002                        {
47004                        }
47005                    }
47006                    else
47007                    {
47009                    }
47010                }
47012                float num18 = 0.07f;
 
47014                {
47017                }
47019                {
47021                }
47023                {
47025                    {
47028                    }
47029                    else
47030                    {
47033                    }
47034                }
47036                {
47038                    {
47041                    }
47042                    else
47043                    {
47046                    }
47047                }
47049                {
47052                }
47054                {
47059                }
47061                {
47064                }
47066                {
47068                    {
47070                    }
47071                    else
47072                    {
47073                        velocity.X *= 0.9f;
47074                    }
47075                }
47077                {
47079                    {
47081                    }
47082                }
47084                {
47085                    velocity.X += 
num18;
 
47087                    {
47088                        velocity.X = 
num17;
 
47089                    }
47090                }
47092                {
47093                    velocity.X -= 
num18;
 
47095                    {
47096                        velocity.X = 
num17;
 
47097                    }
47098                }
47101                {
47103                }
47105                {
47107                }
47109                {
47111                }
47113                {
47121                    {
47126                        {
47128                        }
47129                        float num24 = 0.3f;
 
47132                        {
47134                        }
47135                        velocity.Y = 0f - 
num25;
 
47138                    }
47140                    {
47144                        {
47147                            {
47149                            }
47150                        }
47152                        {
47154                            {
47156                            }
47159                            ai[1] = 50 + Main.rand.Next(50);
 
47162                        }
47163                    }
47165                    {
47169                    }
47171                    {
47173                        {
47175                        }
47177                        {
47179                        }
47180                    }
47181                    else
47182                    {
47184                    }
47189                    if (
townNPC && 
tileSafely5.nactive() && (tileSafely5.type == 10 || tileSafely5.type == 388) && (Main.rand.Next(10) == 0 || flag))
 
47190                    {
47191                        if (Main.netMode != 1)
47192                        {
47194                            {
47201                            }
47203                            {
47210                            }
47212                            {
47216                                NetMessage.SendData(19, -1, -1, 
null, 4, 
num20, 
num21 - 2);
 
47219                            }
47220                            else
47221                            {
47224                            }
47225                        }
47226                    }
47227                    else
47228                    {
47230                        {
47234                            {
47236                                {
47237                                    velocity.Y = -6f;
47239                                }
47241                                {
47243                                    {
47245                                        velocity.X *= 0f;
47247                                    }
47248                                }
47250                                {
47253                                }
47255                                {
47257                                }
47258                            }
47260                            {
47262                                {
47263                                    velocity.Y = -5f;
47265                                }
47267                                {
47270                                }
47271                                else
47272                                {
47274                                }
47275                            }
47277                            {
47279                                {
47280                                    velocity.Y = -4.4f;
47282                                }
47284                                {
47287                                }
47288                                else
47289                                {
47291                                }
47292                            }
47294                            {
47296                                {
47298                                }
47300                                {
47302                                }
47303                            }
47305                            {
47306                                velocity.Y = -5f;
47308                            }
47310                            {
47312                                velocity.X = 0f;
47316                            }
47318                            {
47320                                velocity.X *= -1f;
47322                            }
47324                            {
47327                            }
47329                            {
47331                            }
47332                        }
47334                        {
47335                            velocity.Y *= 1.2f;
47336                        }
47338                        {
47339                            velocity.Y *= 1.2f;
47340                        }
47341                    }
47342                }
47344                {
47345                    int num29 = (int)(
base.Center.X / 16f);
 
47349                    {
47351                        {
47354                            {
47356                            }
47357                        }
47358                    }
47360                    {
47362                        {
47364                        }
47365                        velocity.X *= 0.2f;
47367                        ai[1] = 50 + Main.rand.Next(50);
 
47370                    }
47371                }
47372            }
47373        }
47374        else if (
ai[0] == 2f || 
ai[0] == 11f)
 
47375        {
47376            if (Main.netMode != 1)
47377            {
47379                if (Main.rand.Next(60) == 0 && 
localAI[3] == 0f)
 
47380                {
47384                }
47385            }
47387            velocity.X *= 0.8f;
47389            {
47392                ai[1] = 60 + Main.rand.Next(60);
 
47394            }
47395        }
47396        else if (
ai[0] == 3f || 
ai[0] == 4f || 
ai[0] == 5f || 
ai[0] == 8f || 
ai[0] == 9f || 
ai[0] == 16f || 
ai[0] == 17f || 
ai[0] == 20f || 
ai[0] == 21f || 
ai[0] == 22f || 
ai[0] == 23f)
 
47397        {
47398            velocity.X *= 0.8f;
47401            {
47404            }
47406            {
47407                Point coords = (base.Bottom + Vector2.UnitY * -2f).ToTileCoordinates();
 
47408                Tile tile = Main.tile[coords.
X, coords.
Y];
 
47409                if (tile.type != 15 && tile.type != 497)
47410                {
47412                }
47413                else
47414                {
47415                    Main.sittingManager.AddNPC(
whoAmI, coords);
 
47416                }
47417            }
47419            {
47421                ai[1] = 60 + Main.rand.Next(60);
 
47423                localAI[3] = 30 + Main.rand.Next(60);
 
47425            }
47426        }
47427        else if (
ai[0] == 6f || 
ai[0] == 7f || 
ai[0] == 18f || 
ai[0] == 19f)
 
47428        {
47430            {
47432            }
47433            velocity.X *= 0.8f;
47437            {
47439            }
47441            {
47442                int num35 = ((base.Center.X < Main.player[
num34].Center.X) ? 1 : (-1));
 
47444                {
47446                }
47448            }
47449            else
47450            {
47452                ai[1] = 60 + Main.rand.Next(60);
 
47454                localAI[3] = 30 + Main.rand.Next(60);
 
47456            }
47457        }
47458        else if (
ai[0] == 10f)
 
47459        {
47462            float knockBack = 0f;
47471            {
47474            }
47476            {
47484                knockBack = 7f;
47485            }
47486            else if (
type == 633)
 
47487            {
47493                knockBack = 7f;
47497                {
47500                }
47501            }
47502            else if (
type == 550)
 
47503            {
47511                knockBack = 9f;
47512            }
47513            else if (
type == 588)
 
47514            {
47522                knockBack = 9f;
47523            }
47524            else if (
type == 208)
 
47525            {
47533                knockBack = 6f;
47534            }
47535            else if (
type == 17)
 
47536            {
47544                knockBack = 1.5f;
47545            }
47546            else if (
type == 369)
 
47547            {
47555                knockBack = 3f;
47556            }
47557            else if (
type == 453)
 
47558            {
47566                knockBack = 3f;
47567            }
47568            else if (
type == 107)
 
47569            {
47577                knockBack = 1f;
47578            }
47579            else if (
type == 124)
 
47580            {
47587                knockBack = 3.5f;
47588            }
47589            else if (
type == 18)
 
47590            {
47597                knockBack = 2f;
47599            }
47600            else if (
type == 142)
 
47601            {
47608                knockBack = 2f;
47610            }
47611            if (Main.expertMode)
47612            {
47613                num37 = (int)((
float)
num37 * Main.GameModeInfo.TownNPCDamageMultiplier);
 
47614            }
47616            velocity.X *= 0.8f;
47620            {
47623                {
47625                }
47627                {
47629                }
47631                {
47633                }
47637                num44 = ((
type == 124) ? Projectile.NewProjectile(
GetSpawnSource_ForProjectile(), base.Center.X + (float)(
spriteDirection * 16), base.Center.Y - 2f, 
vec.X, 
vec.Y, 
num36, 
num37, knockBack, Main.myPlayer, 0f, 
whoAmI, 
townNpcVariationIndex) : ((
type != 142) ? Projectile.NewProjectile(
GetSpawnSource_ForProjectile(), 
base.
Center.
X + (float)(
spriteDirection * 16), 
base.
Center.
Y - 2f, 
vec.
X, 
vec.
Y, 
num36, 
num37, knockBack, Main.myPlayer) : Projectile.NewProjectile(
GetSpawnSource_ForProjectile(), 
base.
Center.
X + (float)(
spriteDirection * 16), 
base.
Center.
Y - 2f, 
vec.
X, 
vec.
Y, 
num36, 
num37, knockBack, Main.myPlayer, 0f, Main.rand.
Next(5))));
 
47638                Main.projectile[
num44].npcProj = 
true;
 
47639                Main.projectile[
num44].noDropItem = 
true;
 
47641                {
47642                    Main.projectile[
num44].timeLeft = 480;
 
47643                }
47644            }
47645            if (
ai[1] <= 0f && 0 == 0)
 
47646            {
47652            }
47653        }
47654        else if (
ai[0] == 12f)
 
47655        {
47667            {
47670            }
47673            {
47675            }
47677            {
47679            }
47681            {
47691                {
47694                }
47695                if (Main.hardMode)
47696                {
47699                    {
47702                    }
47704                    {
47707                    }
47709                    {
47712                    }
47713                }
47714            }
47715            else if (
type == 227)
 
47716            {
47726                {
47729                }
47731                {
47734                }
47735                if (Main.hardMode)
47736                {
47738                }
47739            }
47740            else if (
type == 368)
 
47741            {
47750                if (Main.hardMode)
47751                {
47754                }
47755            }
47756            else if (
type == 22)
 
47757            {
47761                if (Main.hardMode)
47762                {
47767                }
47768                else
47769                {
47773                }
47777            }
47778            else if (
type == 228)
 
47779            {
47789            }
47790            else if (
type == 178)
 
47791            {
47794                num46 = ((!Main.hardMode) ? 11 : 15);
 
47800                {
47803                }
47805                {
47808                }
47810            }
47811            else if (
type == 229)
 
47812            {
47822                {
47825                }
47827                {
47830                }
47832                {
47835                }
47837                {
47840                }
47842                {
47845                }
47847                {
47853                }
47854            }
47855            else if (
type == 209)
 
47856            {
47857                num45 = Utils.SelectRandom<
int>(Main.rand, 134, 133, 135);
 
47860                {
47861                case 135:
47868                    break;
47869                case 133:
47876                    break;
47877                case 134:
47884                    break;
47885                }
47886            }
47887            if (Main.expertMode)
47888            {
47889                num46 = (int)((
float)
num46 * Main.GameModeInfo.TownNPCDamageMultiplier);
 
47890            }
47892            velocity.X *= 0.8f;
47896            {
47899                {
47901                }
47903                {
47905                }
47909                num53 = ((
type != 227) ? Projectile.NewProjectile(
GetSpawnSource_ForProjectile(), base.Center.X + (float)(
spriteDirection * 16), base.Center.Y - 2f, 
vec2.X, 
vec2.Y, 
num45, 
num46, 
knockBack2, Main.myPlayer) : Projectile.NewProjectile(
GetSpawnSource_ForProjectile(), 
base.
Center.
X + (float)(
spriteDirection * 16), 
base.
Center.
Y - 2f, 
vec2.
X, 
vec2.
Y, 
num45, 
num46, 
knockBack2, Main.myPlayer, 0f, (float)Main.rand.
Next(12) / 6f));
 
47910                Main.projectile[
num53].npcProj = 
true;
 
47911                Main.projectile[
num53].noDropItem = 
true;
 
47912            }
47914            {
47917                {
47919                }
47920            }
47921            if (
ai[1] <= 0f && 0 == 0)
 
47922            {
47928            }
47929        }
47930        else if (
ai[0] == 13f)
 
47931        {
47932            velocity.X *= 0.8f;
47934            {
47936            }
47939            if (
localAI[3] == 1f && Main.netMode != 1)
 
47940            {
47943                {
47945                }
47948                Main.projectile[
num54].npcProj = 
true;
 
47949                Main.projectile[
num54].noDropItem = 
true;
 
47950            }
47952            {
47954                ai[1] = 10 + Main.rand.Next(10);
 
47956                localAI[3] = 5 + Main.rand.Next(10);
 
47958            }
47959        }
47960        else if (
ai[0] == 14f)
 
47961        {
47974            {
47977            }
47980            {
47982            }
47984            {
47986            }
47988            {
47997            }
47998            else if (
type == 108)
 
47999            {
48008            }
48009            else if (
type == 160)
 
48010            {
48018                {
48019                }
48020            }
48021            else if (
type == 663)
 
48022            {
48024                num56 = ((!Main.hardMode) ? 15 : 20);
 
48030                {
48031                }
48032            }
48033            else if (
type == 20)
 
48034            {
48040            }
48041            if (Main.expertMode)
48042            {
48043                num56 = (int)((
float)
num56 * Main.GameModeInfo.TownNPCDamageMultiplier);
 
48044            }
48046            velocity.X *= 0.8f;
48050            {
48053                {
48055                }
48057                {
48059                }
48063                {
48064                    int num65 = Utils.SelectRandom<
int>(Main.rand, 1, 1, 1, 1, 2, 2, 3);
 
48066                    {
48068                        int num67 = Projectile.NewProjectile(
GetSpawnSource_ForProjectile(), base.Center.X + (float)(
spriteDirection * 16), base.Center.Y - 2f, vec4.X + 
vector3.X, vec4.Y + 
vector3.Y, 
num55, 
num56, 
knockBack3, Main.myPlayer, 0f, 0f, 
townNpcVariationIndex);
 
48069                        Main.projectile[
num67].npcProj = 
true;
 
48070                        Main.projectile[
num67].noDropItem = 
true;
 
48071                    }
48072                }
48073                else if (
type == 160)
 
48074                {
48076                    {
48077                        Vector2 vector4 = Main.npc[
num64].position - Main.npc[
num64].Size * 2f + Main.npc[
num64].Size * Utils.RandomVector2(Main.rand, 0f, 1f) * 5f;
 
48080                        {
48082                            vector4 = Main.npc[
num64].position - Main.npc[
num64].Size * 2f + Main.npc[
num64].Size * Utils.RandomVector2(Main.rand, 0f, 1f) * 5f;
 
48083                        }
48084                        int num69 = Projectile.NewProjectile(
GetSpawnSource_ForProjectile(), 
vector4.X, 
vector4.Y, 0f, 0f, 
num55, 
num56, 
knockBack3, Main.myPlayer, 0f, 0f, 
townNpcVariationIndex);
 
48085                        Main.projectile[
num69].npcProj = 
true;
 
48086                        Main.projectile[
num69].noDropItem = 
true;
 
48087                    }
48088                }
48089                else if (
type == 663)
 
48090                {
48092                    {
48096                        {
48098                            vector5 = Main.npc[
num64].position + Main.npc[
num64].Size * Utils.RandomVector2(Main.rand, 0f, 1f) * 1f;
 
48099                        }
48100                        int num71 = Projectile.NewProjectile(
GetSpawnSource_ForProjectile(), 
vector5.X, 
vector5.Y, 0f, 0f, 
num55, 
num56, 
knockBack3, Main.myPlayer, 0f, 0f, 
townNpcVariationIndex);
 
48101                        Main.projectile[
num71].npcProj = 
true;
 
48102                        Main.projectile[
num71].noDropItem = 
true;
 
48103                    }
48104                }
48105                else if (
type == 20)
 
48106                {
48107                    int num72 = Projectile.NewProjectile(
GetSpawnSource_ForProjectile(), base.Center.X + (float)(
spriteDirection * 16), base.Center.Y - 2f, 
vec4.X, 
vec4.Y, 
num55, 
num56, 
knockBack3, Main.myPlayer, 0f, 
whoAmI, 
townNpcVariationIndex);
 
48108                    Main.projectile[
num72].npcProj = 
true;
 
48109                    Main.projectile[
num72].noDropItem = 
true;
 
48110                }
48111                else
48112                {
48114                    Main.projectile[
num73].npcProj = 
true;
 
48115                    Main.projectile[
num73].noDropItem = 
true;
 
48116                }
48117            }
48119            {
48122            }
48123            if (
ai[1] <= 0f && 0 == 0)
 
48124            {
48130            }
48131        }
48132        else if (
ai[0] == 15f)
 
48133        {
48137            {
48140            }
48146            {
48149            }
48151            {
48154            }
48156            {
48162            }
48163            else if (
type == 441)
 
48164            {
48171                {
48174                }
48175            }
48176            else if (
type == 353)
 
48177            {
48183            }
48185            {
48191            }
48192            if (Main.expertMode)
48193            {
48194                num75 = (int)((
float)
num75 * Main.GameModeInfo.TownNPCDamageMultiplier);
 
48195            }
48197            velocity.X *= 0.8f;
48199            if (Main.netMode != 1)
48200            {
48204                {
48205                    itemRectangle.X -= 
num77;
 
48206                }
48207                itemRectangle.Y -= 
num78;
 
48209                int myPlayer = Main.myPlayer;
48211                {
48214                    {
48216                        if (Main.netMode != 0)
48217                        {
48219                        }
48220                        nPC2.netUpdate = true;
48221                        nPC2.immune[myPlayer] = (int)
ai[1] + 2;
 
48222                    }
48223                }
48224            }
48226            {
48229                {
48232                    {
48234                    }
48236                    {
48240                        if (
num82 != -1 && !Collision.CanHit(
base.Center, 0, 0, Main.npc[
num82].Center, 0, 0))
 
48241                        {
48243                        }
48245                        {
48250                            direction = ((position.X < Main.npc[
num82].position.X) ? 1 : (-1));
 
48252                        }
48253                        else
48254                        {
48256                        }
48257                    }
48258                }
48260                {
48266                }
48267            }
48268        }
48269        else if (
ai[0] == 24f)
 
48270        {
48271            velocity.X *= 0.8f;
48279            {
48285            }
48286        }
48288        {
48289            int num84 = (int)(
base.Center.X / 16f);
 
48292            {
48294                velocity.X *= -0.25f;
48296            }
48297            velocity.Y *= 0.9f;
48298            velocity.Y -= 0.5f;
48300            {
48301                velocity.Y = -15f;
48302            }
48303        }
48305        {
48307            {
48309            }
48310            int num86 = (int)(
base.Center.X / 16f);
 
48313            {
48315                velocity.X *= -0.25f;
48317            }
48319            {
48320                float num88 = base.Center.Y + 1f;
 
48322                {
48323                    velocity.Y -= 0.8f;
48325                    {
48326                        velocity.Y = -4f;
48327                    }
48329                    {
48331                    }
48332                }
48333                else
48334                {
48336                }
48337            }
48338            else
48339            {
48340                velocity.Y -= 0.2f;
48341            }
48342        }
48344        {
48348            {
48350            }
48352            {
48354            }
48356            {
48358            }
48360            {
48363                {
48366                    {
48368                        break;
48369                    }
48370                }
48371            }
48373            {
48375                num90 = ((Main.rand.Next(2) != 0) ? (
num90 * Main.rand.Next(1, 3)) : (
num90 * Main.rand.
Next(1, 4)));
 
48379                {
48383                    {
48384                        int num94 = (position.X < 
nPC4.position.X).ToDirectionInt();
 
48393                        nPC4.direction = -
num94;
 
48394                        nPC4.netUpdate = true;
48395                        break;
48396                    }
48397                }
48398            }
48400            {
48402                num95 = ((Main.rand.Next(2) != 0) ? (
num95 * Main.rand.Next(1, 3)) : (
num95 * Main.rand.
Next(1, 4)));
 
48406                {
48410                    {
48411                        int num99 = (position.X < 
nPC5.position.X).ToDirectionInt();
 
48415                        localAI[2] = Main.rand.Next(4);
 
48422                        nPC5.localAI[2] = 0f;
 
48423                        nPC5.localAI[3] = 0f;
 
48424                        nPC5.direction = -
num99;
 
48425                        nPC5.netUpdate = true;
48426                        break;
48427                    }
48428                }
48429            }
48431            {
48435                {
48437                    if (player.active && !player.dead && player.Distance(
base.Center) < (float)
num101 && Collision.CanHitLine(
base.Top, 0, 0, player.Top, 0, 0))
 
48438                    {
48439                        int num103 = (position.X < player.position.X).ToDirectionInt();
 
48445                        break;
48446                    }
48447                }
48448            }
48450            {
48454                {
48457                    {
48458                        int num107 = (position.X < 
player2.position.X).ToDirectionInt();
 
48464                        break;
48465                    }
48466                }
48467            }
48469            {
48471                ai[1] = 45 * Main.rand.Next(1, 2);
 
48473            }
48475            {
48477                ai[1] = 30 * Main.rand.Next(1, 4);
 
48479            }
48480            else if (
flag26 && 
ai[0] == 0f && 
velocity.
Y == 0f && Main.rand.Next(1200) == 0)
 
48481            {
48485                {
48488                    {
48489                        int num111 = (position.X < 
player3.position.X).ToDirectionInt();
 
48495                        break;
48496                    }
48497                }
48498            }
48499            else if (
flag26 && 
ai[0] == 1f && 
velocity.
Y == 0f && num > 0 && Main.rand.Next(num) == 0)
 
48500            {
48501                Point point = (base.Bottom + Vector2.UnitY * -2f).ToTileCoordinates();
 
48504                {
48506                    {
48508                        {
48510                            break;
48511                        }
48512                    }
48514                    {
48515                        if (Main.player[
num113].active && Main.player[
num113].sitting.isSitting && Main.player[
num113].Center.ToTileCoordinates() == point)
 
48516                        {
48518                            break;
48519                        }
48520                    }
48521                }
48523                {
48525                    flag30 = tile2.type == 15 || tile2.type == 497;
 
48527                    {
48529                    }
48531                    {
48533                        ai[1] = 900 + Main.rand.Next(10800);
 
48534                        direction = ((tile2.frameX != 0) ? 1 : (-1));
 
48539                    }
48540                }
48541            }
48542            else if (
flag26 && 
ai[0] == 1f && 
velocity.
Y == 0f && Main.rand.Next(600) == 0 && Utils.PlotTileLine(
base.Top, 
base.Bottom, 
width, DelegateMethods.SearchAvoidedByNPCs))
 
48543            {
48547                {
48550                    {
48552                    }
48553                }
48555                {
48557                    ai[1] = 40 + Main.rand.Next(90);
 
48561                }
48562            }
48564            {
48567                {
48570                    {
48572                    }
48573                }
48575                {
48582                }
48583            }
48585            {
48589                if (
num117 != -1 && !Collision.CanHit(
base.Center, 0, 0, Main.npc[
num117].Center, 0, 0))
 
48590                {
48592                }
48595                {
48597                }
48599                {
48607                }
48608            }
48610            {
48614                if (
num120 != -1 && !Collision.CanHitLine(
base.Center, 0, 0, Main.npc[
num120].Center, 0, 0))
 
48615                {
48617                }
48619                {
48622                    {
48630                    }
48631                }
48632            }
48634            {
48638                if (
num123 != -1 && !Collision.CanHitLine(
base.Center, 0, 0, Main.npc[
num123].Center, 0, 0))
 
48639                {
48641                }
48643                {
48651                }
48652                else if (
type == 20)
 
48653                {
48660                }
48661            }
48663            {
48667                if (
num126 != -1 && !Collision.CanHit(
base.Center, 0, 0, Main.npc[
num126].Center, 0, 0))
 
48668                {
48670                }
48672                {
48680                }
48681            }
48682        }
48684        {
48693            Lighting.AddLight(
base.Center, 
R, 
G, 
B);
 
48694        }
48696        {
48697            float num129 = Utils.WrappedLerp(0.75f, 1f, (
float)Main.timeForVisualEffects % 120f / 120f);
 
48699        }
48700    }
static float Clamp(float value, float min, float max)
 
static float Min(float value1, float value2)
 
static double Sqrt(double d)
 
static double Abs(double value)
 
static int Sign(decimal value)
 
static void PlaySound(int type, Vector2 position, int style=1)
 
float Distance(Vector2 Other)
 
Vector2 DirectionTo(Vector2 Destination)
 
static void BroadcastParticleSpawn(ParticleOrchestraType type, ParticleOrchestraSettings settings)
 
static void RequestParticleSpawn(bool clientOnly, ParticleOrchestraType type, ParticleOrchestraSettings settings, int? overrideInvokingPlayerIndex=null)
 
static bool[] TownCritter
 
static bool[] IsTownSlime
 
static int[] AttackAverageChance
 
static int[] DangerDetectRange
 
static readonly short Count
 
static bool[] InteractibleByNPCs
 
static void TorchColor(int torchID, out float R, out float G, out float B)
 
Color GetMagicAuraColor()
 
bool ShouldBestiaryGirlBeLycantrope()
 
static bool downedMechBoss2
 
void Teleport(Vector2 newPos, int Style=0, int extraInfo=0)
 
bool AI_007_TownEntities_CheckIfWillDrown(bool currentlyDrowning)
 
static bool savedTaxCollector
 
void TweakSwingStats(int swingMax, int swingCurrent, int aimDir, ref Rectangle itemRectangle)
 
void TargetClosest(bool faceTarget=true)
 
static bool downedEmpressOfLight
 
int townNpcVariationIndex
 
void UpdateHomeTileState(bool homeless, int x, int y)
 
NPCAimedTarget GetTargetData(bool ignorePlayerTankPets=true)
 
bool AI_007_TownEntities_IsInAGoodRestingSpot(int tileX, int tileY, int idealRestX, int idealRestY)
 
static bool combatBookWasUsed
 
static bool[] ShimmeredTownNPCs
 
static bool downedMechBoss3
 
void AI_007_TownEntities_Shimmer_TeleportToLandingSpot()
 
void AI_007_TownEntities_GetWalkPrediction(int myTileX, int homeFloorX, bool canBreathUnderWater, bool currentlyDrowning, int tileX, int tileY, out bool keepwalking, out bool avoidFalling)
 
static bool downedQueenBee
 
double StrikeNPCNoInteraction(int Damage, float knockBack, int hitDirection, bool crit=false, bool noEffect=false, bool fromNet=false)
 
float shimmerTransparency
 
void AI_007_FindGoodRestingSpot(int myTileX, int myTileY, out int floorX, out int floorY)
 
void AI_007_AttemptToPlayIdleAnimationsForPets(int petIdleChance)
 
static int[] lazyNPCOwnedProjectileSearchArray
 
static bool combatBookVolumeTwoWasUsed
 
void HitEffect(int hitDirection=0, double dmg=10.0)
 
Tuple< Vector2, float > GetSwingStats(int swingMax, int swingCurrent, int aimDir, int itemWidth, int itemHeight)
 
static bool downedGolemBoss
 
static bool downedAncientCultist
 
void Transform(int newType)
 
IEntitySource GetSpawnSource_ForProjectile()
 
static bool downedPlantBoss
 
static bool savedBartender
 
void AI_007_TownEntities_TeleportToHome(int homeFloorX, int homeFloorY)
 
static bool downedMechBoss1
 
void AI_007_TryForcingSitting(int homeFloorX, int homeFloorY)
 
static bool downedQueenSlime
 
bool Intersects(Rectangle value)
 
static float Distance(Vector2 value1, Vector2 value2)