예제 #1
0
 public void Dispose()
 {
     Log.Dispose();
     TypeDiscovery.Dispose();
     DelegateDiscovery.Dispose();
     DelegateDiscoveryGrouped.Dispose();
     DelegateClassification.Dispose();
     DelegateMethods.Dispose();
     TypeClassification.Dispose();
     CustomMethodDiscovery.Dispose();
     Error.Dispose();
 }
예제 #2
0
 private bool CutTilesAndBreakWalls(int x, int y)
 {
     return(DelegateMethods.CutTiles(x, y));
 }
예제 #3
0
파일: MenuMethods.cs 프로젝트: itonroe/IDC
 public void Action()
 {
     DelegateMethods.ShowDate();
 }
예제 #4
0
파일: MenuMethods.cs 프로젝트: itonroe/IDC
 public void Action()
 {
     DelegateMethods.ShowVersion();
 }
예제 #5
0
파일: MenuMethods.cs 프로젝트: itonroe/IDC
 public void Action()
 {
     DelegateMethods.CountCapitals();
 }
예제 #6
0
        public override void AI()
        {
            Player           player    = Main.player[Projectile.owner];
            FargoSoulsPlayer modPlayer = player.GetModPlayer <FargoSoulsPlayer>();

            if (player.whoAmI == Main.myPlayer && (player.dead || !modPlayer.AncientHallowEnchantActive || !player.GetToggleValue("Hallowed")))
            {
                Projectile.Kill();
                return;
            }

            List <int> ai156_blacklistedTargets = new List <int>();

            DelegateMethods.v3_1 = Color.Transparent.ToVector3();
            Point point2 = Projectile.Center.ToTileCoordinates();

            DelegateMethods.CastLightOpen(point2.X, point2.Y);

            ai156_blacklistedTargets.Clear();

            //AI_156_Think
            int num  = 60;
            int num2 = num - 1;
            int num3 = num + 60;
            int num4 = num3 - 1;
            int num5 = num + 1;

            num  = 40;
            num2 = num - 1;
            num3 = num + 40;
            num4 = num3 - 1;
            num5 = num + 1;

            if (player.active && Vector2.Distance(player.Center, Projectile.Center) > 2000f)
            {
                Projectile.ai[0]     = 0f;
                Projectile.ai[1]     = 0f;
                Projectile.netUpdate = true;
                Projectile.Center    = player.Center;
            }
            if (Projectile.ai[0] == -1f)
            {
                int stackedIndex;
                int totalIndexes;
                AI_GetMyGroupIndexAndFillBlackList(ai156_blacklistedTargets, out stackedIndex, out totalIndexes);
                Vector2 vector;
                float   targetAngle;
                AI_156_GetIdlePosition(stackedIndex, totalIndexes, out vector, out targetAngle);
                Projectile.velocity = Vector2.Zero;
                Projectile.Center   = Projectile.Center.MoveTowards(vector, 32f);
                Projectile.rotation = Projectile.rotation.AngleLerp(targetAngle, 0.2f);
                if (Projectile.Distance(vector) < 2f)
                {
                    Projectile.ai[0]     = 0f;
                    Projectile.netUpdate = true;
                    return;
                }
            }
            else if (Projectile.ai[0] == 0f)
            {
                int stackedIndex3;
                int totalIndexes3;
                AI_GetMyGroupIndexAndFillBlackList(ai156_blacklistedTargets, out stackedIndex3, out totalIndexes3);
                Vector2 value2;
                float   targetAngle2;
                AI_156_GetIdlePosition(stackedIndex3, totalIndexes3, out value2, out targetAngle2);
                Projectile.velocity = Vector2.Zero;
                Projectile.Center   = Vector2.SmoothStep(Projectile.Center, value2, 0.45f);
                Projectile.rotation = Projectile.rotation.AngleLerp(targetAngle2, 0.45f);
                if (Main.rand.Next(20) == 0)
                {
                    int num8 = AI_156_TryAttackingNPCs(ai156_blacklistedTargets, false);
                    if (num8 != -1)
                    {
                        Projectile.ai[0] = (float)Main.rand.NextFromList(new int[]
                        {
                            num,
                            num3
                        });
                        Projectile.ai[0]     = (float)num3;
                        Projectile.ai[1]     = (float)num8;
                        Projectile.netUpdate = true;
                        return;
                    }
                }
            }
            else
            {
                bool skipBodyCheck = true;
                int  num14         = 0;
                int  num15         = num2;
                int  num16         = 0;
                if (Projectile.ai[0] >= (float)num5)
                {
                    num14 = 1;
                    num15 = num4;
                    num16 = num5;
                }
                int num17 = (int)Projectile.ai[1];
                if (!Main.npc.IndexInRange(num17))
                {
                    int num18 = AI_156_TryAttackingNPCs(ai156_blacklistedTargets, skipBodyCheck);
                    if (num18 != -1)
                    {
                        Projectile.ai[0] = (float)Main.rand.NextFromList(new int[]
                        {
                            num,
                            num3
                        });
                        Projectile.ai[1]     = (float)num18;
                        Projectile.netUpdate = true;
                        return;
                    }
                    Projectile.ai[0]     = -1f;
                    Projectile.ai[1]     = 0f;
                    Projectile.netUpdate = true;
                    return;
                }
                else
                {
                    NPC npc2 = Main.npc[num17];
                    if (!npc2.CanBeChasedBy(Projectile, false))
                    {
                        int num19 = AI_156_TryAttackingNPCs(ai156_blacklistedTargets, skipBodyCheck);
                        if (num19 != -1)
                        {
                            Projectile.ai[0] = (float)Main.rand.NextFromList(new int[]
                            {
                                num,
                                num3
                            });
                            Projectile.ai[1]     = (float)num19;
                            Projectile.netUpdate = true;
                            return;
                        }
                        Projectile.ai[0]     = -1f;
                        Projectile.ai[1]     = 0f;
                        Projectile.netUpdate = true;
                        return;
                    }
                    else
                    {
                        Projectile.ai[0] -= 1f;
                        if (Projectile.ai[0] >= (float)num15)
                        {
                            Projectile.direction = ((Projectile.Center.X < npc2.Center.X) ? 1 : -1);
                            if (Projectile.ai[0] == (float)num15)
                            {
                                Projectile.localAI[0] = Projectile.Center.X;
                                Projectile.localAI[1] = Projectile.Center.Y;
                            }
                        }
                        float lerpValue2 = Utils.GetLerpValue((float)num15, (float)num16, Projectile.ai[0], true);
                        if (num14 == 0)
                        {
                            Vector2 vector3 = new Vector2(Projectile.localAI[0], Projectile.localAI[1]);
                            if (lerpValue2 >= 0.5f)
                            {
                                vector3 = Vector2.Lerp(npc2.Center, Main.player[Projectile.owner].Center, 0.5f);
                            }
                            Vector2 center4 = npc2.Center;
                            float   num20   = (center4 - vector3).ToRotation();
                            float   num21   = (Projectile.direction == 1) ? -3.14159274f : 3.14159274f;
                            float   num22   = num21 + -num21 * lerpValue2 * 2f;
                            Vector2 vector4 = num22.ToRotationVector2();
                            vector4.Y *= 0.5f;
                            vector4.Y *= 0.8f + (float)Math.Sin((double)((float)Projectile.identity * 2.3f)) * 0.2f;
                            vector4    = vector4.RotatedBy((double)num20, default(Vector2));
                            float   scaleFactor2 = (center4 - vector3).Length() / 2f;
                            Vector2 center5      = Vector2.Lerp(vector3, center4, 0.5f) + vector4 * scaleFactor2;
                            Projectile.Center = center5;
                            float num23 = MathHelper.WrapAngle(num20 + num22 + 0f);
                            Projectile.rotation = num23 + 1.57079637f;
                            Vector2 velocity2 = num23.ToRotationVector2() * 10f;
                            Projectile.velocity  = velocity2;
                            Projectile.position -= Projectile.velocity;
                        }
                        if (num14 == 1)
                        {
                            Vector2 vector5 = new Vector2(Projectile.localAI[0], Projectile.localAI[1]);
                            vector5 += new Vector2(0f, Utils.GetLerpValue(0f, 0.4f, lerpValue2, true) * -100f);
                            Vector2 v            = npc2.Center - vector5;
                            Vector2 value3       = v.SafeNormalize(Vector2.Zero) * MathHelper.Clamp(v.Length(), 60f, 150f);
                            Vector2 value4       = npc2.Center + value3;
                            float   lerpValue3   = Utils.GetLerpValue(0.4f, 0.6f, lerpValue2, true);
                            float   lerpValue4   = Utils.GetLerpValue(0.6f, 1f, lerpValue2, true);
                            float   targetAngle3 = v.SafeNormalize(Vector2.Zero).ToRotation() + 1.57079637f;
                            Projectile.rotation = Projectile.rotation.AngleTowards(targetAngle3, 0.628318548f);
                            Projectile.Center   = Vector2.Lerp(vector5, npc2.Center, lerpValue3);
                            if (lerpValue4 > 0f)
                            {
                                Projectile.Center = Vector2.Lerp(npc2.Center, value4, lerpValue4);
                            }
                        }
                        if (Projectile.ai[0] == (float)num16)
                        {
                            int num24 = AI_156_TryAttackingNPCs(ai156_blacklistedTargets, skipBodyCheck);
                            if (num24 != -1)
                            {
                                Projectile.ai[0] = (float)Main.rand.NextFromList(new int[]
                                {
                                    num,
                                    num3
                                });
                                Projectile.ai[1]     = (float)num24;
                                Projectile.netUpdate = true;
                                return;
                            }
                            Projectile.ai[0]     = -1f;
                            Projectile.ai[1]     = 0f;
                            Projectile.netUpdate = true;
                        }
                    }
                }
            }
        }