Beispiel #1
0
        public override void UpdateAccessory(Player player, bool hideVisual)
        {
            player.endurance -= 0.3f;
            BTFAPlayer modPlayer = player.GetModPlayer <BTFAPlayer>(mod);

            modPlayer.Tartarus = true;
        }
        public override void AI()
        {
            Player     player    = Main.player[projectile.owner];
            BTFAPlayer modPlayer = (BTFAPlayer)player.GetModPlayer(mod, "BTFAPlayer");

            if (player.dead)
            {
                modPlayer.EaterMinion = false;
            }
            if (modPlayer.EaterMinion)
            {
                projectile.timeLeft = 2;
            }
        }
        public override void AI()
        {
            Player     player    = Main.player[projectile.owner];
            BTFAPlayer modPlayer = player.GetModPlayer <BTFAPlayer>(mod);

            if (Main.player[projectile.owner].dead)
            {
                projectile.Kill();
            }
            if (Main.myPlayer == projectile.owner && modPlayer.Chicken)
            {
                projectile.timeLeft = 2;
            }
        }
        public override void CheckActive()
        {
            Player     player    = Main.player[projectile.owner];
            BTFAPlayer modPlayer = player.GetModPlayer <BTFAPlayer>(mod);

            if (player.dead)
            {
                modPlayer.BlightstoneDragon = false;
            }
            if (modPlayer.BlightstoneDragon)
            {
                projectile.timeLeft = 2;
            }
        }
Beispiel #5
0
        public override void AI()
        {
            Player     player    = Main.player[projectile.owner];
            BTFAPlayer modPlayer = player.GetModPlayer <BTFAPlayer>(mod);

            if (modPlayer.slimeGuard)
            {
                projectile.timeLeft = 2;
            }
            else
            {
                projectile.Kill();
            }
        }
        public override void AI()
        {
            Lighting.AddLight(projectile.position, 0f, 0f, 1f);
            projectile.frameCounter++;
            if (projectile.frameCounter > 8)
            {
                projectile.frame++;
                projectile.frameCounter = 1;
            }
            if (projectile.frame > 3)
            {
                projectile.frame = 0;
            }


            if (projectile.alpha > 0)
            {
                projectile.alpha -= 5;
            }

            Player     player    = Main.player[projectile.owner];
            BTFAPlayer modPlayer = player.GetModPlayer <BTFAPlayer>(mod);

            if (modPlayer.Tartarus)
            {
                projectile.timeLeft = 2;
            }
            if (player.dead)
            {
                modPlayer.Tartarus = false;
            }
            projectile.ai[1] += 0.1f;
            int mememaster = (int)Math.Sin(projectile.ai[1]) * 10;

            projectile.position.Y = (player.position.Y - 50) + mememaster;
            projectile.position.X = player.Center.X - 24;

            projectile.ai[0]++;
            Lighting.AddLight(projectile.position, 0f, 0f, 1f);

            int closest = FindClosestNPC(projectile.Center, 0, 0);

            if (AnyNPCs() == true && projectile.ai[0] >= 60)
            {
                projectile.ai[0] = 0;
                Projectile.NewProjectile(Main.npc[closest].Center.X, Main.npc[closest].Center.Y, 0, 0, mod.ProjectileType("Tartarus"), 50, 0, projectile.owner);
            }
        }
        public override void Update(Player player, ref int buffIndex)
        {
            BTFAPlayer modPlayer = player.GetModPlayer <BTFAPlayer>(mod);

            if (player.ownedProjectileCounts[mod.ProjectileType("BloodSlime")] > 0)
            {
                modPlayer.BloodSlime = true;
            }
            if (!modPlayer.BloodSlime)
            {
                player.DelBuff(buffIndex);
                buffIndex--;
            }
            else
            {
                player.buffTime[buffIndex] = 18000;
            }
        }
Beispiel #8
0
        public override void AI()
        {
            bool       flag64    = projectile.type == mod.ProjectileType("Servant");
            Player     player    = Main.player[projectile.owner];
            BTFAPlayer modPlayer = player.GetModPlayer <BTFAPlayer>(mod);

            if (flag64)
            {
                if (player.dead)
                {
                    modPlayer.Servant = false;
                }
                if (modPlayer.Servant)
                {
                    projectile.timeLeft = 2;
                }
            }
        }
        public override void Update(Player player, ref int buffIndex)
        {
            BTFAPlayer modPlayer = (BTFAPlayer)player.GetModPlayer(mod, "BTFAPlayer");

            if (player.ownedProjectileCounts[mod.ProjectileType("TreeMinion")] > 0)
            {
                modPlayer.treeMinion = true;
            }
            if (!modPlayer.treeMinion)
            {
                player.DelBuff(buffIndex);
                buffIndex--;
            }
            else
            {
                player.buffTime[buffIndex] = 18000;
            }
        }
        public override void AI()
        {
            Player     player    = Main.player[projectile.owner];
            BTFAPlayer modPlayer = (BTFAPlayer)player.GetModPlayer(mod, "BTFAPlayer");

            if (player.dead)
            {
                modPlayer.ShadowflameSpirit = false;
            }
            if (modPlayer.ShadowflameSpirit)
            {
                projectile.timeLeft = 2;
            }
            for (int i = 0; i <= 3; i++)
            {
                int dust;
                dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, 173, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f);
                Main.dust[dust].scale = 0.7f;
            }
        }
Beispiel #11
0
        public override void AI()
        {
            Player     player    = Main.player[projectile.owner];
            BTFAPlayer modPlayer = (BTFAPlayer)player.GetModPlayer(mod, "BTFAPlayer");

            for (int k = 0; k < 200; k++)
            {
                if (Main.projectile[k].active && Main.projectile[k].type == mod.ProjectileType("BlightOrb") && Main.projectile[k].owner == projectile.owner)
                {
                    projectile.Center = Main.projectile[k].Center;
                }
            }

            projectile.rotation += 0.1f;

            if (modPlayer.BlightOrb)
            {
                projectile.timeLeft = 2;
            }
        }
        public override void AI()
        {
            Player     player    = Main.player[projectile.owner];
            BTFAPlayer modPlayer = (BTFAPlayer)player.GetModPlayer(mod, "BTFAPlayer");

            if (player.dead)
            {
                modPlayer.Fernling = false;
            }
            if (modPlayer.Fernling)
            {
                projectile.timeLeft = 2;
            }

            for (int index = 0; index < 1000; ++index)
            {
                if (index != projectile.whoAmI && Main.projectile[index].active && (Main.projectile[index].owner == projectile.owner && Main.projectile[index].type == projectile.type) && (double)Math.Abs((float)(projectile.position.X - Main.projectile[index].position.X)) + (double)Math.Abs((float)(projectile.position.Y - Main.projectile[index].position.Y)) < (double)projectile.width)
                {
                    if (projectile.position.X < Main.projectile[index].position.X)
                    {
                        projectile.velocity.X -= 0.05f;
                    }
                    else
                    {
                        projectile.velocity.X += 0.05f;
                    }
                    if (projectile.position.Y < Main.projectile[index].position.Y)
                    {
                        projectile.velocity.Y -= 0.05f;
                    }
                    else
                    {
                        projectile.velocity.Y += 0.05f;
                    }
                }
            }
            float num1 = (float)projectile.position.X;
            float num2 = (float)projectile.position.Y;
            float num3 = 900f;
            bool  flag = false;
            int   num4 = 500;

            if ((double)projectile.ai[1] != 0.0 || projectile.friendly)
            {
                num4 = 1400;
            }
            if ((double)Math.Abs((float)(projectile.Center.X - Main.player[projectile.owner].Center.X)) + (double)Math.Abs((float)(projectile.Center.Y - Main.player[projectile.owner].Center.Y)) > (double)num4)
            {
                projectile.ai[0] = 1f;
            }
            if ((double)projectile.ai[0] == 0.0)
            {
                projectile.tileCollide = true;
                NPC minionAttackTargetNpc = projectile.OwnerMinionAttackTargetNPC;
                if (minionAttackTargetNpc != null && minionAttackTargetNpc.CanBeChasedBy((object)this, false))
                {
                    float num5 = (float)minionAttackTargetNpc.position.X + (float)(minionAttackTargetNpc.width / 2);
                    float num6 = (float)minionAttackTargetNpc.position.Y + (float)(minionAttackTargetNpc.height / 2);
                    float num7 = Math.Abs((float)projectile.position.X + (float)(projectile.width / 2) - num5) + Math.Abs((float)projectile.position.Y + (float)(projectile.height / 2) - num6);
                    if ((double)num7 < (double)num3 && Collision.CanHit(projectile.position, projectile.width, projectile.height, minionAttackTargetNpc.position, minionAttackTargetNpc.width, minionAttackTargetNpc.height))
                    {
                        num3 = num7;
                        num1 = num5;
                        num2 = num6;
                        flag = true;
                    }
                }
                if (!flag)
                {
                    for (int index = 0; index < 200; ++index)
                    {
                        if (Main.npc[index].CanBeChasedBy((object)this, false))
                        {
                            float num5 = (float)Main.npc[index].position.X + (float)(Main.npc[index].width / 2);
                            float num6 = (float)Main.npc[index].position.Y + (float)(Main.npc[index].height / 2);
                            float num7 = Math.Abs((float)projectile.position.X + (float)(projectile.width / 2) - num5) + Math.Abs((float)projectile.position.Y + (float)(projectile.height / 2) - num6);
                            if ((double)num7 < (double)num3 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[index].position, Main.npc[index].width, Main.npc[index].height))
                            {
                                num3 = num7;
                                num1 = num5;
                                num2 = num6;
                                flag = true;
                            }
                        }
                    }
                }
            }
            else
            {
                projectile.tileCollide = false;
            }
            if (!flag)
            {
                projectile.friendly = true;
                float num5 = 8f;
                if ((double)projectile.ai[0] == 1.0)
                {
                    num5 = 12f;
                }
                Vector2 vector2 = new Vector2((float)(projectile.position.X + (double)projectile.width * 0.5), (float)(projectile.position.Y + (double)projectile.height * 0.5));
                float   num6    = (float)(Main.player[projectile.owner].Center.X - vector2.X);
                float   num7    = (float)(Main.player[projectile.owner].Center.Y - vector2.Y - 60.0);
                float   num8    = (float)Math.Sqrt((double)num6 * (double)num6 + (double)num7 * (double)num7);
                if ((double)num8 < 100.0 && (double)projectile.ai[0] == 1.0 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height))
                {
                    projectile.ai[0] = 0.0f;
                }
                if ((double)num8 > 2000.0)
                {
                    projectile.position.X = (Main.player[projectile.owner].Center.X - (projectile.width / 2));
                    projectile.position.Y = (Main.player[projectile.owner].Center.Y - (projectile.width / 2));
                }
                if ((double)num8 > 70.0)
                {
                    float num9  = num5 / num8;
                    float num10 = num6 * num9;
                    float num11 = num7 * num9;
                    projectile.velocity.X = ((projectile.velocity.X * 20 + num10) / 21);
                    projectile.velocity.Y = ((projectile.velocity.Y * 20 + num11) / 21);
                }
                else
                {
                    if (projectile.velocity.X == 0.0 && projectile.velocity.Y == 0.0)
                    {
                        projectile.velocity.X = -0.15f;
                        projectile.velocity.Y = -0.05f;
                    }
                    projectile.velocity *= 1.01f;
                }
                projectile.friendly     = false;
                projectile.rotation     = (float)(projectile.velocity.X * 0.05f);
                projectile.frameCounter = projectile.frameCounter + 1;
                if (projectile.frameCounter >= 4)
                {
                    projectile.frameCounter = 0;
                    projectile.frame        = projectile.frame + 1;
                }
                if (projectile.frame > 3)
                {
                    projectile.frame = 0;
                }
                if ((double)Math.Abs((float)projectile.velocity.X) <= 0.2)
                {
                    return;
                }
                projectile.spriteDirection = -projectile.direction;
            }
            else
            {
                if ((double)projectile.ai[1] == -1.0)
                {
                    projectile.ai[1] = 17f;
                }
                if ((double)projectile.ai[1] > 0.0)
                {
                    projectile.ai[1]--;
                }
                if ((double)projectile.ai[1] == 0.0)
                {
                    projectile.friendly = true;
                    float   num5    = 8f;
                    Vector2 vector2 = new Vector2((float)(projectile.position.X + (double)projectile.width * 0.5), (float)(projectile.position.Y + (double)projectile.height * 0.5));
                    float   num6    = num1 - (float)vector2.X;
                    float   num7    = num2 - (float)vector2.Y;
                    float   num8    = (float)Math.Sqrt((double)num6 * (double)num6 + (double)num7 * (double)num7);
                    if ((double)num8 < 100.0)
                    {
                        num5 = 10f;
                    }
                    float num9  = num5 / num8;
                    float num10 = num6 * num9;
                    float num11 = num7 * num9;
                    projectile.velocity.X = ((projectile.velocity.X * 14 + num10) / 15);
                    projectile.velocity.Y = ((projectile.velocity.Y * 14 + num11) / 15);
                }
                else
                {
                    projectile.friendly = false;
                    if ((double)Math.Abs((float)projectile.velocity.X) + (double)Math.Abs((float)projectile.velocity.Y) < 10.0)
                    {
                        projectile.velocity *= 1.05f;
                    }
                }
                projectile.rotation     = (float)(projectile.velocity.X * 0.05f);
                projectile.frameCounter = projectile.frameCounter + 1;
                if (projectile.frameCounter >= 4)
                {
                    projectile.frameCounter = 0;
                    projectile.frame        = projectile.frame + 1;
                }
                if (projectile.frame < 4)
                {
                    projectile.frame = 4;
                }
                if (projectile.frame > 7)
                {
                    projectile.frame = 4;
                }
                if ((double)Math.Abs((float)projectile.velocity.X) <= 0.2)
                {
                    return;
                }
                projectile.spriteDirection = -projectile.direction;
            }
        }
Beispiel #13
0
        public override void AI()
        {
            Player     player    = Main.player[projectile.owner];
            BTFAPlayer modPlayer = player.GetModPlayer <BTFAPlayer>(mod);

            if (player.dead)
            {
                modPlayer.BlightOrb = false;
            }
            if (modPlayer.BlightOrb)
            {
                projectile.timeLeft = 2;
            }

            Lighting.AddLight(projectile.Center, 0.4f, 0.4f, 0f);
            if ((double)projectile.localAI[1] > 0.0)
            {
                --projectile.localAI[1];
            }


            if ((double)projectile.ai[0] == 2.0)
            {
                --projectile.ai[1];
                projectile.tileCollide = false;
                if ((double)projectile.ai[1] > 3.0)
                {
                    if (projectile.numUpdates < 20)
                    {
                        for (int index = 0; index < 3; ++index)
                        {
                            Dust dust = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 173, 0.0f, 0.0f, 0, new Color(), 1f)];
                            dust.noGravity = true;
                            dust.position  = projectile.Center;
                            dust.velocity *= 3f;
                            dust.velocity += projectile.velocity * 3f;
                            dust.fadeIn    = 1f;
                        }
                    }

                    float num1 = (float)(2.0 - (double)projectile.numUpdates / 30.0);
                    if ((double)projectile.scale > 0.0)
                    {
                        float num2 = 2f;
                        for (int index = 0; (double)index < (double)num2; ++index)
                        {
                            Dust dust = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 173, 0.0f, 0.0f, 0, new Color(), 1f)];
                            dust.noGravity = true;
                            dust.position  = projectile.Center + Vector2.UnitY.RotatedBy((double)projectile.numUpdates * 0.104719758033752 + (double)projectile.whoAmI * 0.785398185253143 + 1.57079637050629, new Vector2()) * (float)(projectile.height / 2) - projectile.velocity * ((float)index / num2);
                            dust.velocity  = projectile.velocity / 3f;
                            dust.fadeIn    = num1 / 2f;
                            dust.scale     = num1;
                        }
                    }
                }

                if ((double)projectile.ai[1] != 0.0)
                {
                    return;
                }
                projectile.ai[1] = 30f;
                projectile.ai[0] = 0.0f;
                Vector2 vector2 = projectile.velocity / 5f;
                projectile.velocity     = vector2;
                projectile.velocity.Y   = 0.0f;
                projectile.extraUpdates = 0;
                projectile.numUpdates   = 0;
                projectile.netUpdate    = true;
                float num = 15f;
                for (int index = 0; (double)index < (double)num; ++index)
                {
                    Dust dust = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 173, 0.0f, 0.0f, 0, new Color(), 1f)];
                    dust.noGravity = true;
                    dust.position  = projectile.Center - projectile.velocity * 5f;
                    dust.velocity *= 3f;
                    dust.velocity += projectile.velocity * 3f;
                    dust.fadeIn    = 1f;
                    if (Main.rand.Next(3) != 0)
                    {
                        dust.fadeIn    = 2f;
                        dust.scale     = 2f;
                        dust.velocity /= 8f;
                    }
                }
                for (int index = 0; (double)index < (double)num; ++index)
                {
                    Dust dust = Main.dust[Dust.NewDust(projectile.position, projectile.width, projectile.height, 173, 0.0f, 0.0f, 0, new Color(), 1f)];
                    dust.noGravity = true;
                    dust.position  = projectile.Center;
                    dust.velocity *= 3f;
                    dust.velocity += projectile.velocity * 3f;
                    dust.fadeIn    = 1f;
                    if (Main.rand.Next(3) != 0)
                    {
                        dust.fadeIn    = 2f;
                        dust.scale     = 2f;
                        dust.velocity /= 8f;
                    }
                }
                projectile.extraUpdates = 0;
                projectile.numUpdates   = 0;
            }
            if (projectile.extraUpdates > 1)
            {
                projectile.extraUpdates = 0;
            }
            if (projectile.numUpdates > 1)
            {
                projectile.numUpdates = 0;
            }

            if ((double)projectile.localAI[0] > 0.0)
            {
                --projectile.localAI[0];
            }

            float num3  = 0.05f;
            float width = (float)projectile.width;

            for (int index = 0; index < 1000; ++index)
            {
                if (index != projectile.whoAmI && Main.projectile[index].active && (Main.projectile[index].owner == projectile.owner && Main.projectile[index].type == projectile.type) && (double)Math.Abs(projectile.position.X - Main.projectile[index].position.X) + (double)Math.Abs(projectile.position.Y - Main.projectile[index].position.Y) < (double)width)
                {
                    if ((double)projectile.position.X < (double)Main.projectile[index].position.X)
                    {
                        projectile.velocity.X -= num3;
                    }
                    else
                    {
                        projectile.velocity.X += num3;
                    }
                    if ((double)projectile.position.Y < (double)Main.projectile[index].position.Y)
                    {
                        projectile.velocity.Y -= num3;
                    }
                    else
                    {
                        projectile.velocity.Y += num3;
                    }
                }
            }
            Vector2 vector2_1 = projectile.position;
            float   num4      = 300f;
            bool    flag      = false;
            int     num5      = -1;

            projectile.tileCollide = true;

            Vector2 center                = Main.player[projectile.owner].Center;
            Vector2 vector2_2             = new Vector2(0.5f);
            NPC     minionAttackTargetNpc = projectile.OwnerMinionAttackTargetNPC;

            if (minionAttackTargetNpc != null && minionAttackTargetNpc.CanBeChasedBy((object)this, false))
            {
                Vector2 vector2_3 = minionAttackTargetNpc.position + minionAttackTargetNpc.Size * vector2_2;
                float   num1      = Vector2.Distance(vector2_3, center);
                if (((double)Vector2.Distance(center, vector2_1) > (double)num1 && (double)num1 < (double)num4 || !flag) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, minionAttackTargetNpc.position, minionAttackTargetNpc.width, minionAttackTargetNpc.height))
                {
                    num4      = num1;
                    vector2_1 = vector2_3;
                    flag      = true;
                    num5      = minionAttackTargetNpc.whoAmI;
                }
            }
            if (!flag)
            {
                for (int index = 0; index < 200; ++index)
                {
                    NPC npc = Main.npc[index];
                    if (npc.CanBeChasedBy((object)this, false))
                    {
                        Vector2 vector2_3 = npc.position + npc.Size * vector2_2;
                        float   num1      = Vector2.Distance(vector2_3, center);
                        if (((double)Vector2.Distance(center, vector2_1) > (double)num1 && (double)num1 < (double)num4 || !flag) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height))
                        {
                            num4      = num1;
                            vector2_1 = vector2_3;
                            flag      = true;
                            num5      = index;
                        }
                    }
                }
            }

            int num6 = 1350;

            if ((double)Vector2.Distance(player.Center, projectile.Center) > (double)num6)
            {
                projectile.ai[0]     = 1f;
                projectile.netUpdate = true;
            }
            if ((double)projectile.ai[0] == 1.0)
            {
                projectile.tileCollide = false;
            }
            if (flag && (double)projectile.ai[0] == 0.0)
            {
                vector2_2 = vector2_1 - projectile.Center;
                float num1 = vector2_2.Length();
                vector2_2.Normalize();

                Vector2 vector2_3 = vector2_1;
                Vector2 vector2_4 = projectile.Center - vector2_3;
                if (vector2_4 == Vector2.Zero)
                {
                    vector2_4 = -Vector2.UnitY;
                }
                vector2_4.Normalize();
                Vector2 vector2_5 = vector2_3 + vector2_4 * 60f;
                int     index     = (int)vector2_5.Y / 16;
                if (index < 0)
                {
                    index = 0;
                }
                Tile tile1 = Main.tile[(int)vector2_5.X / 16, index];
                if (tile1 != null && tile1.active() && (Main.tileSolid[(int)tile1.type] && !Main.tileSolidTop[(int)tile1.type]))
                {
                    vector2_5 += Vector2.UnitY * 16f;
                    Tile tile2 = Main.tile[(int)vector2_5.X / 16, (int)vector2_5.Y / 16];
                    if (tile2 != null && tile2.active() && (Main.tileSolid[(int)tile2.type] && !Main.tileSolidTop[(int)tile2.type]))
                    {
                        vector2_5 += Vector2.UnitY * 16f;
                    }
                }
                vector2_2 = vector2_5 - projectile.Center;
                num1      = vector2_2.Length();
                vector2_2.Normalize();
                if ((double)num1 > 400.0 && (double)num1 <= 800.0 && (double)projectile.localAI[0] == 0.0)
                {
                    projectile.ai[0]        = 2f;
                    projectile.ai[1]        = (float)(int)((double)num1 / 10.0);
                    projectile.extraUpdates = (int)projectile.ai[1];
                    projectile.velocity     = vector2_2 * 10f;
                    projectile.localAI[0]   = 60f;
                    return;
                }


                if ((double)num1 > 200.0)
                {
                    float num2 = 6f;
                    vector2_3             = vector2_2 * num2;
                    projectile.velocity.X = (float)(((double)projectile.velocity.X * 40.0 + (double)vector2_3.X) / 41.0);
                    projectile.velocity.Y = (float)(((double)projectile.velocity.Y * 40.0 + (double)vector2_3.Y) / 41.0);
                }

                else
                {
                    if ((double)num1 > 70.0 && (double)num1 < 130.0)
                    {
                        float num2 = 7f;
                        if ((double)num1 < 100.0)
                        {
                            num2 = -3f;
                        }
                        vector2_3           = vector2_2 * num2;
                        projectile.velocity = (projectile.velocity * 20f + vector2_3) / 21f;
                        if ((double)Math.Abs(vector2_3.X) > (double)Math.Abs(vector2_3.Y))
                        {
                            projectile.velocity.X = (float)(((double)projectile.velocity.X * 10.0 + (double)vector2_3.X) / 11.0);
                        }
                    }
                    else
                    {
                        vector2_3           = projectile.velocity * 0.97f;
                        projectile.velocity = vector2_3;
                    }
                }
            }

            else
            {
                if (!Collision.CanHitLine(projectile.Center, 1, 1, Main.player[projectile.owner].Center, 1, 1))
                {
                    projectile.ai[0] = 1f;
                }
                float num1 = 6f;
                if ((double)projectile.ai[0] == 1.0)
                {
                    num1 = 15f;
                }
                vector2_2 = player.Center - projectile.Center + new Vector2(0.0f, -60f);
                float num7 = vector2_2.Length();
                if ((double)num7 > 200.0 && (double)num1 < 9.0)
                {
                    num1 = 9f;
                }
                if ((double)num7 < 100.0 && (double)projectile.ai[0] == 1.0 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height))
                {
                    projectile.ai[0]     = 0.0f;
                    projectile.netUpdate = true;
                }
                if ((double)num7 > 2000.0)
                {
                    projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2);
                    projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.width / 2);
                }

                if ((double)num7 > 70.0)
                {
                    vector2_2.Normalize();
                    vector2_2          *= num1;
                    projectile.velocity = (projectile.velocity * 20f + vector2_2) / 21f;
                }

                else
                {
                    if ((double)projectile.velocity.X == 0.0 && (double)projectile.velocity.Y == 0.0)
                    {
                        projectile.velocity.X = -0.15f;
                        projectile.velocity.Y = -0.05f;
                    }
                    Vector2 vector2_3 = projectile.velocity * 1.01f;
                    projectile.velocity = vector2_3;
                }
            }

            //num1 = 3;

            if ((double)projectile.velocity.X > 0.0)
            {
                projectile.spriteDirection = projectile.direction = -1;
            }
            else if ((double)projectile.velocity.X < 0.0)
            {
                projectile.spriteDirection = projectile.direction = 1;
            }

            if ((double)projectile.ai[1] > 0.0)
            {
                ++projectile.ai[1];
                if (Main.rand.Next(3) != 0)
                {
                    ++projectile.ai[1];
                }
            }
            if ((double)projectile.ai[1] > 60.0)
            {
                projectile.ai[1]     = 0.0f;
                projectile.netUpdate = true;
            }

            if ((double)projectile.ai[0] != 0.0)
            {
                return;
            }
            float num8 = 14f;
            int   Type = mod.ProjectileType("BlightOrbShoot");

            if (!flag)
            {
                return;
            }

            if ((double)projectile.ai[1] == 0.0)
            {
                if ((double)(vector2_1 - projectile.Center).Length() > 500.0 || (double)projectile.ai[1] != 0.0)
                {
                    return;
                }
                ++projectile.ai[1];
                if (Main.myPlayer == projectile.owner)
                {
                    vector2_2 = vector2_1 - projectile.Center;
                    vector2_2.Normalize();
                    Vector2 vector2_3 = vector2_2 * num8;
                    int     index     = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vector2_3.X, vector2_3.Y, Type, projectile.damage, 0.0f, Main.myPlayer, 0.0f, (float)num5);
                    Main.projectile[index].timeLeft  = 300;
                    Main.projectile[index].netUpdate = true;
                    Vector2 vector2_4 = projectile.velocity - vector2_3 / 3f;
                    projectile.velocity  = vector2_4;
                    projectile.netUpdate = true;
                }

                for (int index1 = 0; index1 < 5; ++index1)
                {
                    int num1 = projectile.width / 4;
                    vector2_2 = ((float)Main.rand.NextDouble() * 6.283185f).ToRotationVector2() * (float)Main.rand.Next(24, 41) / 8f;
                    int     index2    = Dust.NewDust(projectile.Center - Vector2.One * (float)num1, num1 * 2, num1 * 2, 173, 0.0f, 0.0f, 0, new Color(), 1f);
                    Dust    dust      = Main.dust[index2];
                    Vector2 vector2_3 = Vector2.Normalize(dust.position - projectile.Center);
                    dust.position = projectile.Center + vector2_3 * (float)num1 * projectile.scale - new Vector2(4f);
                    dust.velocity = index1 >= 30 ? 2f * vector2_3 * (float)Main.rand.Next(45, 91) / 10f : vector2_3 *dust.velocity.Length() * 2f;

                    dust.noGravity = true;
                    dust.scale     = 0.7f + Main.rand.NextFloat();
                }
            }
        }
Beispiel #14
0
        public override void AI()
        {
            Player     player    = Main.player[projectile.owner];
            BTFAPlayer modPlayer = player.GetModPlayer <BTFAPlayer>(mod);

            if (player.dead)
            {
                modPlayer.BloodSlime = false;
            }
            if (modPlayer.BloodSlime)
            {
                projectile.timeLeft = 2;
            }

            Lighting.AddLight(projectile.Center, 0.5f, 0.2f, 0f);

            float spacing = (float)projectile.width;

            for (int k = 0; k < 1000; k++)
            {
                Projectile otherProj = Main.projectile[k];
                if (k != projectile.whoAmI && otherProj.active && otherProj.owner == projectile.owner && otherProj.type == projectile.type && System.Math.Abs(projectile.position.X - otherProj.position.X) + System.Math.Abs(projectile.position.Y - otherProj.position.Y) < spacing)
                {
                    if (projectile.position.X < Main.projectile[k].position.X)
                    {
                        projectile.velocity.X -= 0.05f;
                    }
                    else
                    {
                        projectile.velocity.X += 0.05f;
                    }
                    if (projectile.position.Y < Main.projectile[k].position.Y)
                    {
                        projectile.velocity.Y -= 0.05f;
                    }
                    else
                    {
                        projectile.velocity.Y += 0.05f;
                    }
                }
            }
            Vector2 targetPos  = projectile.position;
            float   targetDist = 400f;
            bool    target     = false;

            projectile.tileCollide = true;
            NPC minionAttackTargetNpc = projectile.OwnerMinionAttackTargetNPC;

            if (minionAttackTargetNpc != null && minionAttackTargetNpc.CanBeChasedBy((object)this, false) && Vector2.Distance(minionAttackTargetNpc.Center, projectile.Center) < 400f && Collision.CanHit(projectile.position, projectile.width, projectile.height, minionAttackTargetNpc.position, minionAttackTargetNpc.width, minionAttackTargetNpc.height))
            {
                targetPos = minionAttackTargetNpc.Center;
                target    = true;
            }
            else
            {
                for (int k = 0; k < 200; k++)
                {
                    NPC npc = Main.npc[k];
                    if (npc.CanBeChasedBy(this, false))
                    {
                        float distance = Vector2.Distance(npc.Center, projectile.Center);
                        if ((distance < targetDist || !target) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height))
                        {
                            targetDist = distance;
                            targetPos  = npc.Center;
                            target     = true;
                        }
                    }
                }
            }
            if (Vector2.Distance(player.Center, projectile.Center) > (target ? 1000f : 500f))
            {
                projectile.ai[0]     = 1f;
                projectile.netUpdate = true;
            }
            if (projectile.ai[0] == 1f)
            {
                projectile.tileCollide = false;
            }
            if (target && projectile.ai[0] == 0f)
            {
                Vector2 direction = targetPos - projectile.Center;
                direction.Normalize();
                direction *= Main.rand.Next(16, 19);
                if (Vector2.Distance(targetPos, projectile.Center) > 100f)
                {
                    direction *= 1.1f;
                }
                if (Vector2.Distance(targetPos, projectile.Center) > 200f)
                {
                    direction *= 1.1f;
                }
                if (Vector2.Distance(targetPos, projectile.Center) > 400f)
                {
                    direction *= 1.2f;
                }
                projectile.ai[1]++;
                if (projectile.ai[1] >= Main.rand.Next(30, 41))
                {
                    projectile.ai[1]     = 0f;
                    projectile.velocity  = direction;
                    projectile.netUpdate = true;
                }
                else
                {
                    projectile.velocity = Vector2.Lerp(projectile.velocity, Vector2.Zero, 0.08f);
                }
            }
            else
            {
                projectile.ai[1] = 0;
                if (!Collision.CanHitLine(projectile.Center, 1, 1, player.Center, 1, 1))
                {
                    projectile.ai[0] = 1f;
                }
                float speed = 6f;
                if (projectile.ai[0] == 1f)
                {
                    speed = 15f;
                }
                Vector2 center    = projectile.Center;
                Vector2 direction = player.Center - center;
                projectile.ai[1]     = 3600f;
                projectile.netUpdate = true;
                int num = 1;
                for (int k = 0; k < projectile.whoAmI; k++)
                {
                    if (Main.projectile[k].active && Main.projectile[k].owner == projectile.owner && Main.projectile[k].type == projectile.type)
                    {
                        num++;
                    }
                }
                direction.X -= (float)((10 + num * 40) * player.direction);
                direction.Y -= 70f;
                float distanceTo = direction.Length();
                if (distanceTo > 200f && speed < 9f)
                {
                    speed = 9f;
                }
                if (distanceTo < 100f && projectile.ai[0] == 1f && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height))
                {
                    projectile.ai[0]     = 0f;
                    projectile.netUpdate = true;
                }
                if (distanceTo > 2000f)
                {
                    projectile.Center = player.Center;
                }
                if (distanceTo > 48f)
                {
                    direction.Normalize();
                    direction *= speed;
                    float temp = inertia / 2f;
                    projectile.velocity = (projectile.velocity * temp + direction) / (temp + 1);
                }
                else
                {
                    projectile.direction = Main.player[projectile.owner].direction;
                    projectile.velocity *= (float)Math.Pow(0.9, 40.0 / inertia);
                }
            }
            projectile.rotation = projectile.velocity.X * 0.05f;
            if (projectile.velocity.X > 0f)
            {
                projectile.spriteDirection = (projectile.direction = -1);
            }
            else if (projectile.velocity.X < 0f)
            {
                projectile.spriteDirection = (projectile.direction = 1);
            }
        }
Beispiel #15
0
        public override void AI()
        {
            Player     player    = Main.player[projectile.owner];
            BTFAPlayer modPlayer = player.GetModPlayer <BTFAPlayer>(mod);

            if (player.dead)
            {
                modPlayer.Frog = false;
            }
            if (modPlayer.Frog)
            {
                projectile.timeLeft = 2;
            }
            projectile.frameCounter++;

            if (projectile.frameCounter > 6)
            {
                projectile.frame++;
                projectile.frameCounter = 0;
            }
            if (projectile.frame > 2)
            {
                projectile.frame = 0;
            }

            if (Main.rand.Next(2500) == 0)
            {
                Main.PlaySound(31, projectile.position);
            }
            if (projectile.alpha > 70)
            {
                projectile.alpha -= 15;
                if (projectile.alpha < 70)
                {
                    projectile.alpha = 70;
                }
            }
            if (projectile.localAI[0] == 0f)
            {
                AdjustMagnitude(ref projectile.velocity);
                projectile.localAI[0] = 1f;
            }
            projectile.direction = player.direction;
            Vector2 move       = Vector2.Zero;
            float   distance   = 800f;
            bool    target     = false;
            Vector2 newMove    = player.Center - projectile.Center;
            float   distanceTo = (float)Math.Sqrt(newMove.X * newMove.X + newMove.Y * newMove.Y);

            if (distanceTo < distance)
            {
                move     = newMove;
                distance = distanceTo;
                target   = true;
            }
            if (target)
            {
                AdjustMagnitude(ref move);
                projectile.velocity = (8 * projectile.velocity + move) / 3f;
                AdjustMagnitude(ref projectile.velocity);
            }
        }
        public override void AI()
        {
            Player     player    = Main.player[projectile.owner];
            BTFAPlayer modPlayer = player.GetModPlayer <BTFAPlayer>(mod);

            if (Main.player[projectile.owner].dead)
            {
                projectile.Kill();
            }
            if (Main.myPlayer == projectile.owner && modPlayer.hauntedCandle)
            {
                projectile.timeLeft = 2;
            }
            if (projectile.tileCollide)
            {
                if (!Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.player[projectile.owner].Center, 1, 1))
                {
                    projectile.tileCollide = false;
                }
                else if (!Collision.SolidCollision(projectile.position, projectile.width, projectile.height) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, Main.player[projectile.owner].Center, 1, 1))
                {
                    projectile.tileCollide = true;
                }
            }
            projectile.direction       = Main.player[projectile.owner].direction;
            projectile.spriteDirection = -projectile.direction;
            Lighting.AddLight(projectile.position, 0f, 0f, 1f);
            Vector2 vector2 = (Main.player[projectile.owner].Center - projectile.Center);

            vector2.X += projectile.direction * 40;
            vector2.Y -= 40;
            float num4 = vector2.Length();

            if ((double)num4 > 1000.0)
            {
                projectile.Center = Main.player[projectile.owner].Center;
            }
            float num5 = 3f;
            float num6 = 4f;

            if ((double)num4 > 200.0)
            {
                num6 += (float)(((double)num4 - 200.0) * 0.100000001490116);
                projectile.tileCollide = false;
            }
            if ((double)num4 < (double)num6)
            {
                projectile.velocity = (projectile.velocity * 0.25f);
                num6 = num4;
            }
            if (vector2.X != 0.0 || vector2.Y != 0.0)
            {
                vector2.Normalize();
                vector2 *= num6;
            }
            projectile.velocity = ((projectile.velocity * (num5 - 1f)) + vector2) / num5;
            if (projectile.velocity.Length() > 6.0)
            {
                float num1 = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f;
                if ((double)Math.Abs(projectile.rotation - num1) >= 3.14)
                {
                    projectile.rotation = (double)num1 >= (double)projectile.rotation ? projectile.rotation + 6.28f : projectile.rotation - 6.28f;
                }
                projectile.rotation = (float)(((double)projectile.rotation * 4.0 + (double)num1) / 5.0);
            }
            else
            {
                if ((double)projectile.rotation > 3.14)
                {
                    projectile.rotation = projectile.rotation - 6.28f;
                }
                projectile.rotation = (double)projectile.rotation <= -0.01 || (double)projectile.rotation >= 0.01 ? projectile.rotation * 0.9f : 0.0f;
            }
            projectile.frameCounter = projectile.frameCounter + 1;
            if (projectile.frameCounter > 6)
            {
                projectile.frameCounter = 0;
                projectile.frame        = projectile.frame + 1;
                if (projectile.frame > 3)
                {
                    projectile.frame = 0;
                }
            }
        }
Beispiel #17
0
        public override void AI()
        {
            projectile.velocity = Vector2.Zero;
            float num1069 = 1000f;

            {
                projectile.alpha -= 5;
                if (projectile.alpha < 0)
                {
                    projectile.alpha = 0;
                }
                if (projectile.direction == 0)
                {
                    projectile.direction = Main.player[projectile.owner].direction;
                }
                int num3 = projectile.frameCounter + 1;
                projectile.frameCounter = num3;
                if (num3 >= 3)
                {
                    projectile.frameCounter = 0;
                    num3             = projectile.frame + 1;
                    projectile.frame = num3;
                    if (num3 >= Main.projFrames[projectile.type])
                    {
                        projectile.frame = 0;
                    }
                }
                if (projectile.alpha == 0 && Main.rand.Next(15) == 0)
                {
                    Dust dust128 = Main.dust[Dust.NewDust(projectile.Top, 0, 0, 135, 0f, 0f, 100, default(Color), 1f)];
                    dust128.velocity.X = 0f;
                    dust128.noGravity  = true;
                    dust128.fadeIn     = 1f;
                    dust128.position   = projectile.Center + Vector2.UnitY.RotatedByRandom(6.2831854820251465) * (4f * Main.rand.NextFloat() + 26f);
                    dust128.scale      = 0.5f;
                }
                projectile.localAI[0] += 1f;
                if (projectile.localAI[0] >= 60f)
                {
                    projectile.localAI[0] = 0f;
                }
            }
            if (projectile.ai[0] < 0f)
            {
                projectile.ai[0] += 1f;
                //if (flag69)
                //{
                projectile.ai[1] -= (float)projectile.direction * 0.3926991f / 50f;
                //}
            }
            if (projectile.ai[0] == 0f)
            {
                int   num1071 = -1;
                float num1072 = num1069;
                NPC   ownerMinionAttackTargetNPC6 = projectile.OwnerMinionAttackTargetNPC;
                if (ownerMinionAttackTargetNPC6 != null && ownerMinionAttackTargetNPC6.CanBeChasedBy(this, false))
                {
                    float num1073 = projectile.Distance(ownerMinionAttackTargetNPC6.Center);
                    if (num1073 < num1072 && Collision.CanHitLine(projectile.Center, 0, 0, ownerMinionAttackTargetNPC6.Center, 0, 0))
                    {
                        num1072 = num1073;
                        num1071 = ownerMinionAttackTargetNPC6.whoAmI;
                    }
                }
                if (num1071 < 0)
                {
                    int num3;
                    for (int num1074 = 0; num1074 < 200; num1074 = num3 + 1)
                    {
                        NPC nPC16 = Main.npc[num1074];
                        if (nPC16.CanBeChasedBy(this, false))
                        {
                            float num1075 = projectile.Distance(nPC16.Center);
                            if (num1075 < num1072 && Collision.CanHitLine(projectile.Center, 0, 0, nPC16.Center, 0, 0))
                            {
                                num1072 = num1075;
                                num1071 = num1074;
                            }
                        }
                        num3 = num1074;
                    }
                }
                if (num1071 != -1)
                {
                    projectile.ai[0]     = 1f;
                    projectile.ai[1]     = (float)num1071;
                    projectile.netUpdate = true;
                    return;
                }
            }
            if (projectile.ai[0] > 0f)
            {
                int num1076 = (int)projectile.ai[1];
                if (!Main.npc[num1076].CanBeChasedBy(this, false))
                {
                    projectile.ai[0]     = 0f;
                    projectile.ai[1]     = 0f;
                    projectile.netUpdate = true;
                    return;
                }
                projectile.ai[0] += 1f;
                float num1077 = 30f;
                if (projectile.ai[0] >= num1077)
                {
                    Vector2 vector152 = projectile.DirectionTo(Main.npc[num1076].Center);
                    if (vector152.HasNaNs())
                    {
                        vector152 = Vector2.UnitY;
                    }
                    float num1078 = vector152.ToRotation();
                    int   num1079 = (vector152.X > 0f) ? 1 : -1;
                    projectile.direction = num1079;
                    projectile.ai[0]     = -60f;
                    projectile.ai[1]     = num1078 + (float)num1079 * 3.14159274f / 16f;
                    projectile.netUpdate = true;
                    Player     player    = Main.player[projectile.owner];
                    Mod        mod       = ModLoader.GetMod("ForgottenMemories");
                    BTFAPlayer modPlayer = player.GetModPlayer <BTFAPlayer>(mod);
                    if (projectile.owner == Main.myPlayer && modPlayer.cryotine1 == true)
                    {
                        int p = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vector152.X * 4, vector152.Y * 4, mod.ProjectileType("PermafrostThing"), (int)(projectile.damage * 1.2), projectile.knockBack, projectile.owner, 0f, (float)projectile.whoAmI);
                        Main.projectile[p].GetGlobalProjectile <Info>(mod).FrostCrystal = true;
                        //Main.projectile[p].extraUpdates = 2;
                        Main.projectile[p].height = 4;
                        Main.projectile[p].width  = 4;
                    }

                    else if (projectile.owner == Main.myPlayer)
                    {
                        int p = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vector152.X * 3, vector152.Y * 3, mod.ProjectileType("PermafrostThing"), projectile.damage, projectile.knockBack, projectile.owner, 0f, (float)projectile.whoAmI);
                        Main.projectile[p].height = 4;
                        Main.projectile[p].width  = 4;
                    }
                }
            }
        }