41304 {
41305 bool flag = false;
41307 if (Main.netMode != 1 &&
ai[2] > 1f)
41308 {
41309 int num = 18000;
41311 if (
localAI[1] >= (
float)num)
41312 {
41314 if (Main.player[
target].Center.X <
base.Center.X)
41315 {
41317 }
41318 else
41319 {
41321 }
41323 }
41324 }
41325 switch ((
int)
ai[2])
41326 {
41327 case 0:
41328 {
41331 if (
ai[0] == 0f &&
ai[1] == 0f)
41332 {
41335 }
41337 {
41342 }
41345 {
41349 {
41350 velocity.Y *= 0.95f;
41351 }
41352 }
41355 if (!player.dead && player.Distance(
base.Center) < 250f)
41356 {
41358 direction = ((!(player.Center.X >
base.Center.X)) ? 1 : (-1));
41360 {
41362 }
41365 }
41366 break;
41367 }
41368 case 1:
41369 {
41373 {
41376 }
41378 {
41379 velocity.Y = ((oldVelocity.Y > 0f) ? 1 : (-1));
41380 }
41381 float num12 = 4.5f;
41383 {
41384 velocity.X += (float)
direction * 0.04f;
41386 {
41388 {
41390 }
41391 else
41392 {
41394 }
41395 }
41397 {
41399 }
41400 }
41404 {
41406 }
41410 bool flag6 =
false;
41412 {
41414 {
41415 if (Main.tile[i,
j] ==
null)
41416 {
41417 Main.tile[
i,
j] =
new Tile();
41418 }
41419 if ((Main.tile[i,
j].nactive() && Main.tileSolid[Main.tile[i,
j].type]) || Main.tile[i,
j].liquid > 0)
41420 {
41422 {
41424 }
41426 break;
41427 }
41428 }
41429 }
41431 {
41432 velocity.Y += 0.05f;
41433 }
41434 else
41435 {
41436 velocity.Y -= 0.2f;
41437 }
41439 {
41440 velocity.Y -= 0.3f;
41441 }
41443 {
41444 velocity.Y = 3f;
41445 }
41447 {
41448 velocity.Y = -5f;
41449 }
41450 break;
41451 }
41452 case 2:
41453 {
41456 bool flag3 =
false;
41458 {
41460 }
41462 {
41464 direction = ((!(targetData.Center.X >
base.Center.X)) ? 1 : (-1));
41466 {
41468 }
41471 break;
41472 }
41474 if (Main.netMode != 1 &&
base.Hitbox.Intersects(
r))
41475 {
41477 {
41483 }
41484 else
41485 {
41489 }
41490 break;
41491 }
41496 {
41498 }
41499 else if (
num8 > 80f)
41500 {
41502 }
41504 Point point =
base.Center.ToTileCoordinates();
41506 {
41509 {
41510 velocity.Y += 0.05f;
41511 }
41513 {
41514 velocity.Y -= 0.02f;
41515 }
41517 {
41518 velocity.Y = 2f;
41519 }
41521 {
41522 velocity.Y = -4f;
41523 }
41524 }
41526 {
41528 {
41530 }
41531 else
41532 {
41534 }
41535 }
41536 break;
41537 }
41538 case 3:
41541 {
41543 }
41545 {
41547 }
41548 else
41549 {
41550 if (Main.player[
target].Center.X >
base.Center.X)
41551 {
41553 }
41554 else
41555 {
41557 }
41558 flag = true;
41560 float num7 =
ai[3] - 15f;
41563 {
41566 }
41567 else if (
num7 <= 130f)
41568 {
41571 }
41576 }
41579 {
41584 }
41585 break;
41586 case 6:
41587 {
41590 if (
vector.Length() > 100f)
41591 {
41596 break;
41597 }
41599 {
41602 {
41603 velocity.X *= -1f;
41604 }
41606 {
41607 velocity.Y *= -1f;
41608 }
41609 }
41610 if (
vector.Length() > 20f)
41611 {
41615 {
41616 velocity.Y *= 0.95f;
41617 }
41618 }
41620 {
41626 }
41627 break;
41628 }
41629 case 4:
41630 {
41633 bool flag4 =
false;
41635 {
41637 }
41639 {
41641 direction = ((!(targetData2.Center.X >
base.Center.X)) ? 1 : (-1));
41643 {
41645 }
41648 break;
41649 }
41650 Rectangle r2 = Utils.CenteredRectangle(
new Vector2(
ai[0] * 16f + 8f,
ai[1] * 16f + 8f), Vector2.One * 5f);
41651 if (
base.Hitbox.Intersects(
r2))
41652 {
41656 break;
41657 }
41659 float num10 = 300f;
41661 {
41663 {
41666 {
41667 velocity.X *= -1f;
41668 }
41670 {
41671 velocity.Y *= -1f;
41672 }
41673 }
41674 flag = true;
41675 if (Main.player[
target].Center.X >
base.Center.X)
41676 {
41678 }
41679 else
41680 {
41682 }
41685 {
41687 if (Main.rand.Next(30) == 0)
41688 {
41690 }
41691 }
41693 {
41697 }
41699 {
41701 }
41702 break;
41703 }
41708 {
41710 }
41711 else if (
num11 > 80f)
41712 {
41714 }
41717 {
41721 {
41722 velocity.Y += 0.05f;
41723 }
41725 {
41726 velocity.Y -= 0.05f;
41727 }
41729 {
41730 velocity.Y = 1f;
41731 }
41733 {
41734 velocity.Y = -1f;
41735 }
41736 }
41737 else
41738 {
41740 }
41742 {
41744 }
41745 else
41746 {
41748 }
41749 break;
41750 }
41751 case 5:
41752 {
41755 bool flag2 =
false;
41758 {
41760 }
41762 {
41764 }
41766 {
41768 }
41769 else
41770 {
41771 flag = true;
41773 float num3 =
ai[3] - 15f;
41776 num2 = (float)
Math.
Cos((
float)
num5 * 1f) * ((
float)Math.PI * 2f) / 16f;
41782 if (Main.player[
target].Center.X >
base.Center.X)
41783 {
41785 }
41786 else
41787 {
41789 }
41790 }
41792 if (Main.netMode != 1 &&
ai[3] > 200f)
41793 {
41795 if (Main.netMode == 0)
41796 {
41798 }
41799 else if (Main.netMode == 2)
41800 {
41803 NetMessage.SendData(23, -1, -1,
null,
whoAmI);
41804 NetMessage.SendData(112, -1, -1,
null, 2, (
int)
base.Center.X, (
int)
base.Center.Y, 0f,
type - 583);
41805 }
41806 }
41807 break;
41808 }
41809 case 7:
41811 velocity.X += 0.05f * (float)
direction;
41813 velocity.Y -= 0.025f;
41816 break;
41817 }
41819 for (
int k = 0;
k < 200;
k++)
41820 {
41822 {
41824 {
41825 velocity.Y -= 0.05f;
41826 }
41827 else
41828 {
41829 velocity.Y += 0.05f;
41830 }
41831 }
41832 }
41833 if (!flag)
41834 {
41835 direction = ((velocity.X >= 0f) ? 1 : (-1));
41837 }
41842 {
41845 }
41847 {
41850 }
41851 if ((int)Main.timeForVisualEffects % 2 == 0)
41852 {
41854 Dust dust = Dust.NewDustDirect(
base.Center -
new Vector2(
num17) * 0.5f,
num17 + 4,
num17 + 4, 278, 0f, 0f, 200,
Color.
Lerp(
value3,
value4, Main.rand.NextFloat()), 0.65f);
41855 dust.velocity *= 0f;
41857 dust.noGravity = true;
41858 dust.noLight = true;
41860 }
41861 Lighting.AddLight(
base.Center,
value3.ToVector3() * 0.7f);
41862 if (Main.netMode != 2)
41863 {
41866 {
41868 }
41869 }
41870 }
static float Lerp(float value1, float value2, float amount)
static float Clamp(float value, float min, float max)
static double Cos(double d)
static byte Min(byte val1, byte val2)
static double Abs(double value)
static int Sign(decimal value)
static byte Max(byte val1, byte val2)
static void PlaySound(int type, Vector2 position, int style=1)
Vector2 DirectionFrom(Vector2 Source)
float Distance(Vector2 Other)
Vector2 DirectionTo(Vector2 Destination)
static void HandleSpecialEvent(Player player, int eventID)
void EncourageDespawn(int despawnTime)
void TargetClosest(bool faceTarget=true)
NPCAimedTarget GetTargetData(bool ignorePlayerTankPets=true)
bool dontTakeDamageFromHostiles
bool GetFairyTreasureCoords(out Point treasureCoords)
void GetBirdFlightRecommendation(int downScanRange, int upRange, Point tCoords, out bool goDownwards, out bool goUpwards)
static void FairyEffects(Vector2 Position, int type)
Vector2 GetFairyCircleOffset(float elapsedTime, float circleRotation, float circleHeight)
static Color LightSeaGreen
static Color Lerp(Color value1, Color value2, float amount)
static Vector2 Lerp(Vector2 value1, Vector2 value2, float amount)