Example #1
0
 private void RunTeleport(Player player, Vector2 pos)
 {
     player.Teleport(pos, 2, 0);
     player.velocity = Vector2.Zero;
     Main.PlaySound(SoundID.Item6, player.Center);
     DustHelper.DrawStar(player.Center, DustID.GoldCoin, pointAmount: 4, mainSize: 1.7425f, dustDensity: 6, dustSize: .65f, pointDepthMult: 3.6f, noGravity: true);
 }
Example #2
0
        public void flowerAttack(Player player)
        {
            bool expertMode = Main.expertMode;
            int  damage     = expertMode ? 11 : 16;

            if (npc.ai[0] % 15 == 0)
            {
                Main.PlaySound(new LegacySoundStyle(SoundID.Item, 104).WithPitchVariance(0.2f), npc.Center);
                if (Main.netMode != NetmodeID.MultiplayerClient)
                {
                    int p = Projectile.NewProjectile(npc.Center.X + Main.rand.Next(-60, 60), npc.Center.Y + Main.rand.Next(-60, 60), Main.rand.NextFloat(-5.3f, 5.3f), Main.rand.NextFloat(-5.3f, 5.3f), ModContent.ProjectileType <ReachBossFlower>(), damage, 1, Main.myPlayer, 0, 0);
                    Main.projectile[p].scale = Main.rand.NextFloat(.6f, .8f);
                    DustHelper.DrawStar(Main.projectile[p].Center, 272, pointAmount: 6, mainSize: .9425f, dustDensity: 2, dustSize: .5f, pointDepthMult: 0.3f, noGravity: true);
                    if (Main.projectile[p].velocity == Vector2.Zero)
                    {
                        Main.projectile[p].velocity = new Vector2(2.25f, 2.25f);
                    }
                    if (Main.projectile[p].velocity.X <2.25f && Math.Sign(Main.projectile[p].velocity.X) == Math.Sign(1) || Main.projectile[p].velocity.X> -2.25f && Math.Sign(Main.projectile[p].velocity.X) == Math.Sign(-1))
                    {
                        Main.projectile[p].velocity.X *= 2.15f;
                    }
                    Main.projectile[p].netUpdate = true;
                }
            }
        }
 public override void Kill(int timeLeft)
 {
     DustHelper.DrawStar(projectile.Center, dustType, pointAmount: 5, mainSize: 1.2f * ScaleMult, dustDensity: 0.5f, pointDepthMult: 0.3f);
     Main.PlaySound(SoundID.Item10, projectile.Center);
     for (int k = 0; k < 35; k++)
     {
         Dust.NewDustPerfect(projectile.Center, dustType, Vector2.One.RotatedByRandom(6.28f) * (Main.rand.NextFloat(0.25f, 1.2f) * ScaleMult), 0, default, 1.5f);
Example #4
0
        public override void AI()
        {
            alphaCounter += 0.04f;
            Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.091f, 0.24f, .24f);
            npc.rotation = npc.velocity.X * .009f;
            aiTimer++;
            if (aiTimer == 100 || aiTimer == 240 || aiTimer == 360 || aiTimer == 620)
            {
                Vector2 direction = Main.player[npc.target].Center - npc.Center;
                direction.Normalize();
                Main.PlaySound(SoundID.DD2_WyvernDiveDown, npc.Center);
                direction.X    = direction.X * Main.rand.Next(8, 10);
                direction.Y    = direction.Y * Main.rand.Next(8, 10);
                npc.velocity.X = direction.X;
                npc.velocity.Y = direction.Y;
                npc.velocity  *= 0.96f;
            }
            if (aiTimer >= 680)
            {
                Main.PlaySound(SoundID.Item, npc.Center, 109);
                float ScaleMult = 2.33f;
                DustHelper.DrawStar(new Vector2(npc.Center.X, npc.Center.Y), DustID.GoldCoin, pointAmount: 5, mainSize: 2.25f * ScaleMult, dustDensity: 2, pointDepthMult: 0.3f, noGravity: true);

                for (int i = 0; i < 5; i++)
                {
                    if (Main.netMode != NetmodeID.MultiplayerClient)
                    {
                        Projectile.NewProjectile(npc.Center.X, npc.Center.Y, Main.rand.Next(-8, 8), Main.rand.Next(-8, 8), ModContent.ProjectileType <ShootingStarHostile>(), 30, 1, Main.myPlayer, 0, 0);
                    }
                }
                aiTimer = 0;
            }
        }
Example #5
0
        public void summonSpores()
        {
            bool expertMode = Main.expertMode;
            int  damage     = expertMode ? 15 : 21;

            if (npc.ai[0] % 9 == 0)
            {
                Main.PlaySound(new Terraria.Audio.LegacySoundStyle(42, 4), npc.Center);
                Main.PlaySound(new Terraria.Audio.LegacySoundStyle(6, 0).WithPitchVariance(0.2f), npc.Center);
                Main.PlaySound(new Terraria.Audio.LegacySoundStyle(4, 55).WithPitchVariance(0.2f), npc.Center);
                int p = NPC.NewNPC((int)npc.Center.X + Main.rand.Next(-100, 100), (int)npc.Center.Y + Main.rand.Next(-200, -100), mod.NPCType("ExplodingSpore"));
                DustHelper.DrawStar(new Vector2(Main.npc[p].Center.X, Main.npc[p].Center.Y), DustID.GoldCoin, pointAmount: 4, mainSize: .9425f, dustDensity: 2, dustSize: .5f, pointDepthMult: 0.3f, noGravity: true);
                Main.npc[p].ai[1]     = npc.whoAmI;
                Main.npc[p].netUpdate = true;
            }
        }
Example #6
0
        private void CheckColliding(ref int Damage)
        {
            var list = Main.projectile.Where(x => x.active && x.type == oppositearrow && x.active && (x.Hitbox.Intersects(projectile.Hitbox) || x.ai[1] == projectile.ai[1] && x.ai[0] == 1 && projectile.ai[0] == 1));

            if (list.Any())
            {
                foreach (var proj in list)
                {
                    DustHelper.DrawStar(new Vector2(proj.Center.X, proj.Center.Y), 226, pointAmount: 5, mainSize: 4.5f, dustDensity: 2, pointDepthMult: 0.3f, noGravity: true);
                    proj.Kill();
                }

                Main.PlaySound(SoundID.Item93, projectile.position);
                for (int num621 = 0; num621 < 40; num621++)
                {
                    int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, DustID.Electric, 0f, 0f, 100, default, 2f);
Example #7
0
        public override bool PreAI()
        {
            if (npc.collideY && jump && npc.velocity.Y > 0)
            {
                npc.ai[3]++;
                if (npc.ai[3] >= 2)
                {
                    npc.ai[3] = 0;
                    Main.PlaySound(SoundID.Item, (int)npc.position.X, (int)npc.position.Y, 9);
                    float ScaleMult = 2.33f;
                    DustHelper.DrawStar(new Vector2(npc.Center.X, npc.Center.Y), 206, pointAmount: 5, mainSize: 4.25f * ScaleMult, dustDensity: 2, pointDepthMult: 0.3f, noGravity: true);
                    for (int i = 0; i < Main.rand.Next(1, 3); i++)
                    {
                        Vector2 vector2_1 = new Vector2((float)((double)npc.position.X + (double)npc.width * 0.5 + (double)(Main.rand.Next(201) * -npc.direction) + ((double)Main.mouseX + (double)Main.screenPosition.X - (double)npc.position.X)), (float)((double)npc.position.Y + (double)npc.height * 0.5 - 600.0));                           //this defines the projectile width, direction and position
                        vector2_1.X  = (float)(((double)vector2_1.X + (double)npc.Center.X) / 2.0) + (float)Main.rand.Next(-200, 201);
                        vector2_1.Y -= (float)(100);
                        float num12 = Main.rand.Next(-30, 30);
                        float num13 = 120;
                        if ((double)num13 < 0.0)
                        {
                            num13 *= -1f;
                        }
                        if ((double)num13 < 20.0)
                        {
                            num13 = 20f;
                        }
                        float num14  = (float)Math.Sqrt((double)num12 * (double)num12 + (double)num13 * (double)num13);
                        float num15  = 10 / num14;
                        float num16  = num12 * num15;
                        float num17  = num13 * num15;
                        float SpeedX = num16 + (float)Main.rand.Next(-40, 41) * 0.02f;                          //this defines the projectile X position speed and randomnes
                        float SpeedY = num17 + (float)Main.rand.Next(-40, 41) * 0.02f;                          //this defines the projectile Y position speed and randomnes
                        int   proj   = Projectile.NewProjectile(npc.Center.X + Main.rand.Next(-60, 60), npc.Center.Y + Main.rand.Next(-1200, -900), SpeedX, SpeedY, ModContent.ProjectileType <LunarStar>(), 20, 3, Main.myPlayer, 0.0f, 1);
                    }
                }
                jump = false;
            }
            if (!npc.collideY)
            {
                jump = true;
            }


            return(true);
        }
Example #8
0
        public void CircleSpikeAttack(Player player)
        {
            bool expertMode = Main.expertMode;

            if (npc.ai[0] == 489 || npc.ai[0] == 690)
            {
                DustHelper.DrawStar(npc.Center, 163, pointAmount: 163, mainSize: 2.7425f, dustDensity: 4, dustSize: .65f, pointDepthMult: 3.6f, noGravity: true);
                Main.PlaySound(new Terraria.Audio.LegacySoundStyle(4, 55).WithPitchVariance(0.2f), npc.Center);
                float  spread     = 10f * 0.0174f;
                double startAngle = Math.Atan2(6, 6) - spread / 2;
                double deltaAngle = spread / 8f;
                for (int i = 0; i < 6; i++)
                {
                    double offsetAngle = (startAngle + deltaAngle * (i + i * i) / 2f) + 32f * i;
                    int    damage      = expertMode ? 15 : 17;
                    Projectile.NewProjectile(npc.Center.X, npc.Center.Y, (float)(Math.Sin(offsetAngle) * 3f), (float)(Math.Cos(offsetAngle) * 3f), ModContent.ProjectileType <Yikes>(), damage, 0, player.whoAmI);
                    Projectile.NewProjectile(npc.Center.X, npc.Center.Y, (float)(-Math.Sin(offsetAngle) * 3f), (float)(-Math.Cos(offsetAngle) * 3f), ModContent.ProjectileType <Yikes>(), damage, 0, player.whoAmI);
                }
            }
        }
Example #9
0
        public void Explode()
        {
            Main.PlaySound(new LegacySoundStyle(2, 14).WithPitchVariance(0.2f), npc.Center);
            npc.life   = 0;
            npc.active = false;
            DustHelper.DrawStar(new Vector2(npc.Center.X, npc.Center.Y), DustID.GoldCoin, pointAmount: 5, mainSize: 8f, dustDensity: 2.5f, dustSize: .75f, pointDepthMult: 0.4f, noGravity: true);
            if (Main.netMode != NetmodeID.MultiplayerClient)
            {
                int p = Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, 0f, ModContent.ProjectileType <SporeExplosion>(), 24, 1, Main.myPlayer, 0, 0);
            }
            Vector2 spinningpoint1 = ((float)Main.rand.NextDouble() * 6.283185f).ToRotationVector2();
            Vector2 spinningpoint2 = spinningpoint1;
            float   dagada         = (float)(Main.rand.Next(3, 6) * 2);
            int     num2           = 10;
            float   num3           = Main.rand.Next(2) == 0 ? 1f : -1f;
            bool    flag           = true;

            for (int index1 = 0; (double)index1 < (double)num2 * (double)dagada; ++index1)
            {
                if (index1 % num2 == 0)
                {
                    spinningpoint2 = spinningpoint2.RotatedBy((double)num3 * (6.28318548202515 / (double)dagada), new Vector2());
                    spinningpoint1 = spinningpoint2;
                    flag           = !flag;
                }
                else
                {
                    float num4 = 6.283185f / ((float)num2 * dagada);
                    spinningpoint1 = spinningpoint1.RotatedBy((double)num4 * (double)num3 * 3.0, new Vector2());
                }
                float adada  = MathHelper.Lerp(1f, 4f, (float)(index1 % num2) / (float)num2);
                int   index2 = Dust.NewDust(new Vector2(npc.Center.X, npc.Center.Y), 6, 6, DustID.GoldCoin, 0.0f, 0.0f, 100, new Color(), 1.4f);
                Main.dust[index2].velocity *= 0.1f;
                Main.dust[index2].velocity += spinningpoint1 * adada;
                if (flag)
                {
                    Main.dust[index2].scale = 0.9f;
                }
                Main.dust[index2].noGravity = true;
            }
        }
        public override void AI()
        {
            Lighting.AddLight(npc.Center, Color.Cyan.R * 0.005f, Color.Cyan.G * 0.005f, Color.Cyan.B * 0.005f);
            float shakeMult = (float)Math.Sqrt(1 - (npc.life / 4000f)) * 0.05f;

            shakeRotation += Main.rand.NextFloat(0 - shakeMult, shakeMult);
            npc.ai[1]++;
            npc.ai[2]++;
            if (npc.ai[2] > npc.life / 100)
            {
                npc.ai[2] = 0;
                float size = 2 - (npc.life / 2000f);
                DustHelper.DrawStar(npc.position + new Vector2(Main.rand.Next(npc.width), Main.rand.Next(npc.height)), 206, 5, size, size, size);
                npc.netUpdate = true;
            }
            if (npc.ai[1] == 20)
            {
                Main.PlaySound(SoundID.DD2_EtherianPortalIdleLoop, npc.Center);
            }
            npc.rotation = npc.ai[1] / 60f;
        }
Example #11
0
 public override void HitEffect(int hitDirection, double damage)
 {
     for (int k = 0; k < 8; k++)
     {
         Dust.NewDust(npc.position, npc.width, npc.height, 206, hitDirection, -1f, 0, default(Color), 1.4f);
     }
     if (npc.life <= 0)
     {
         npc.position.X = npc.position.X + (float)(npc.width / 2);
         npc.position.Y = npc.position.Y + (float)(npc.height / 2);
         npc.width      = 30;
         npc.height     = 30;
         npc.position.X = npc.position.X - (float)(npc.width / 2);
         npc.position.Y = npc.position.Y - (float)(npc.height / 2);
         for (int num621 = 0; num621 < 100; num621++)
         {
             int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 206, 0f, 0f, 100, default(Color), 1.1f);
             Main.dust[num622].velocity *= 3f;
         }
         float ScaleMult = 2.33f;
         DustHelper.DrawStar(new Vector2(npc.Center.X, npc.Center.Y), 206, pointAmount: 5, mainSize: 5.25f * ScaleMult, dustDensity: 4, pointDepthMult: 0.3f, noGravity: true);
     }
 }
        public override void AI()
        {
            alphaCounter += 0.03f;
            Player player = Main.player[projectile.owner];

            if (player.HasAccessory <CimmerianScepter>())
            {
                projectile.timeLeft = 2;
            }

            for (int num526 = 0; num526 < 1000; num526++)
            {
                if (num526 != projectile.whoAmI && Main.projectile[num526].active && Main.projectile[num526].owner == projectile.owner && Main.projectile[num526].type == projectile.type && Math.Abs(projectile.position.X - Main.projectile[num526].position.X) + Math.Abs(projectile.position.Y - Main.projectile[num526].position.Y) < (float)projectile.width)
                {
                    if (projectile.position.X < Main.projectile[num526].position.X)
                    {
                        projectile.velocity.X = projectile.velocity.X - 0.05f;
                    }
                    else
                    {
                        projectile.velocity.X = projectile.velocity.X + 0.05f;
                    }

                    if (projectile.position.Y < Main.projectile[num526].position.Y)
                    {
                        projectile.velocity.Y = projectile.velocity.Y - 0.05f;
                    }
                    else
                    {
                        projectile.velocity.Y = projectile.velocity.Y + 0.05f;
                    }
                }
            }

            float num529 = 900f;
            bool  flag19 = false;

            if (projectile.ai[0] == 0f)
            {
                for (int num531 = 0; num531 < 200; num531++)
                {
                    if (Main.npc[num531].CanBeChasedBy(projectile, false))
                    {
                        float num532 = Main.npc[num531].position.X + 40 + (float)(Main.npc[num531].width / 2);
                        float num533 = Main.npc[num531].position.Y - 90 + (float)(Main.npc[num531].height / 2);
                        float num534 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num532) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num533);
                        if (num534 < num529 && Collision.CanHit(projectile.position, projectile.width, projectile.height, Main.npc[num531].position, Main.npc[num531].width, Main.npc[num531].height))
                        {
                            num529 = num534;
                            flag19 = true;
                        }
                    }
                }
            }
            else
            {
                projectile.tileCollide = false;
            }

            if (!flag19)
            {
                projectile.friendly = true;
                float num535 = 8f;
                if (projectile.ai[0] == 1f)
                {
                    num535 = 12f;
                }

                Vector2 vector38 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f);
                float   num536   = Main.player[projectile.owner].Center.X - vector38.X;
                float   num537   = Main.player[projectile.owner].Center.Y - vector38.Y - 60f;
                float   num538   = (float)Math.Sqrt((double)(num536 * num536 + num537 * num537));
                if (num538 < 100f && projectile.ai[0] == 1f && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height))
                {
                    projectile.ai[0] = 0f;
                }
                if (num538 > 2000f)
                {
                    projectile.position.X = Main.player[projectile.owner].Center.X - (projectile.width * .5f);
                    projectile.position.Y = Main.player[projectile.owner].Center.Y - (projectile.width * .5f);
                }

                if (num538 > 70f)
                {
                    num538  = num535 / num538;
                    num536 *= num538;
                    num537 *= num538;
                    projectile.velocity.X = (projectile.velocity.X * 20f + num536) * (1f / 21f);
                    projectile.velocity.Y = (projectile.velocity.Y * 20f + num537) * (1f / 21f);
                }
                else
                {
                    if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f)
                    {
                        projectile.velocity.X = -0.05f;
                        projectile.velocity.Y = -0.025f;
                    }
                    projectile.velocity *= 1.0035f;
                }
                projectile.friendly = false;
                projectile.rotation = projectile.velocity.X * 0.15f;

                if (Math.Abs(projectile.velocity.X) > 0.05)
                {
                    projectile.spriteDirection = -projectile.direction;
                    return;
                }
            }

            else
            {
                timer++;
                if (timer > 130 && timer < 170)
                {
                    projectile.rotation += .3f;
                }
                else
                {
                    for (int num531 = 0; num531 < 200; num531++)
                    {
                        if (Main.npc[num531].CanBeChasedBy(projectile, false))
                        {
                            projectile.rotation = projectile.DirectionTo(Main.npc[num531].Center).ToRotation() + 1.57f;
                        }
                    }
                }
                if (timer >= Main.rand.Next(180, 210))
                {
                    int   range         = 100;             //How many tiles away the projectile targets NPCs
                    float shootVelocity = 9.5f;            //magnitude of the shoot vector (speed of arrows shot)

                    //TARGET NEAREST NPC WITHIN RANGE
                    float lowestDist = float.MaxValue;
                    for (int i = 0; i < 200; ++i)
                    {
                        NPC npc = Main.npc[i];
                        //if npc is a valid target (active, not friendly, and not a critter)
                        if (npc.active && npc.CanBeChasedBy(projectile) && !npc.friendly)
                        {
                            //if npc is within 50 blocks
                            float dist = projectile.Distance(npc.Center);
                            if (dist / 16 < range)
                            {
                                //if npc is closer than closest found npc
                                if (dist < lowestDist)
                                {
                                    lowestDist = dist;

                                    //target this npc
                                    projectile.ai[1]     = npc.whoAmI;
                                    projectile.netUpdate = true;
                                }
                            }
                        }
                    }
                    NPC target = (Main.npc[(int)projectile.ai[1]] ?? new NPC());
                    timer = 0;
                    Vector2 ShootArea = new Vector2(projectile.Center.X, projectile.Center.Y - 13);
                    Vector2 direction = Vector2.Normalize(target.Center - ShootArea) * shootVelocity;
                    switch (Main.rand.Next(3))
                    {
                    case 0:                             //star attack
                        colorVer = new Color(126, 61, 255);
                        Main.PlaySound(SoundID.Item, projectile.Center, 9);
                        for (int z = 0; z < 4; z++)
                        {
                            Vector2 pos = new Vector2(projectile.Center.X + Main.rand.Next(-30, 30), projectile.Center.Y + Main.rand.Next(-30, 30));
                            DustHelper.DrawStar(pos, 272, pointAmount: 5, mainSize: 1.425f, dustDensity: 2, dustSize: .5f, pointDepthMult: 0.3f, noGravity: true);
                            int proj2 = Projectile.NewProjectile(pos.X, pos.Y, direction.X + Main.rand.Next(-2, 2), direction.Y + Main.rand.Next(-2, 2), mod.ProjectileType("CimmerianStaffStar"), projectile.damage, 0, Main.myPlayer);
                        }

                        break;

                    case 1:                             //explosion attack
                        colorVer = new Color(255, 20, 52);
                        Main.PlaySound(SoundID.DD2_GhastlyGlaiveImpactGhost, projectile.Center);
                        DustHelper.DrawCircle(projectile.Center, 130, 1, 1f, 1f, .85f, .85f);
                        int proj23 = Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, mod.ProjectileType("CimmerianRedGlyph"), projectile.damage, 0, Main.myPlayer);

                        break;

                    case 2:                             //lightning attack
                        colorVer = new Color(61, 184, 255);
                        Main.PlaySound(SoundID.Item, projectile.Center, 12);
                        for (int k = 0; k < 15; k++)
                        {
                            Dust d = Dust.NewDustPerfect(projectile.Center, 226, Vector2.One.RotatedByRandom(6.28f) * Main.rand.NextFloat(3), 0, default, Main.rand.NextFloat(.4f, .8f));
                            d.noGravity = true;
                        }
                        for (int i = 0; i < 3; i++)
                        {
                            DustHelper.DrawElectricity(projectile.Center, target.Center, 226, 0.3f);
                        }
                        target.StrikeNPC((int)(projectile.damage * 1.5f), 1f, 0, false);
                        for (int k = 0; k < 10; k++)
                        {
                            Dust d = Dust.NewDustPerfect(target.Center, 226, Vector2.One.RotatedByRandom(6.28f) * Main.rand.NextFloat(2), 0, default, Main.rand.NextFloat(.2f, .4f));
Example #13
0
        public override void AI()
        {
            Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.301f, 0.110f, 0.126f);
            Player player     = Main.player[npc.target];
            bool   expertMode = Main.expertMode;

            npc.rotation      = MathHelper.Lerp(npc.rotation, 0, 0.06f);
            npc.noTileCollide = true;

            if (!player.active || player.dead)
            {
                npc.TargetClosest(false);
                npc.velocity.Y = -2000;
            }
            if (player.GetSpiritPlayer().ZoneReach)
            {
                npc.defense = 25;
                npc.damage  = 45;
            }
            else
            {
                npc.defense = 14;
                npc.damage  = 28;
            }
            if (npc.life <= (npc.lifeMax / 10 * 4) && npc.ai[3] == 0)
            {
                npc.ai[0] = 0;
                DustHelper.DrawStar(npc.Center, 235, pointAmount: 7, mainSize: 2.7425f, dustDensity: 6, dustSize: .65f, pointDepthMult: 3.6f, noGravity: true);
                Main.PlaySound(new Terraria.Audio.LegacySoundStyle(4, 55).WithPitchVariance(0.2f), npc.Center);
                Main.PlaySound(42, (int)npc.position.X, (int)npc.position.Y, 180, 1f, -0.9f);
                npc.netUpdate = true;
                npc.ai[3]++;
            }
            if (npc.life <= (npc.lifeMax / 10 * 4))
            {
                npc.ai[0] += 1.5f;
            }
            else
            {
                npc.ai[0]++;
            }
            if (npc.ai[0] < 470 || npc.ai[0] > 730 && npc.ai[0] < 900 || npc.ai[0] > 1051 && npc.ai[0] < 1120 || npc.ai[0] > 1750)
            {
                generalMovement(player);
            }

            float[] stoptimes = new float[] { 471, 540, 669, 900, 1051 };
            if (stoptimes.Contains(npc.ai[0]))
            {
                npc.velocity  = Vector2.Zero;
                npc.netUpdate = true;
            }

            if (npc.ai[0] >= 480 && npc.ai[0] < 730)
            {
                sideFloat(player);
                pulseTrail = true;
            }
            else
            {
                pulseTrail = false;
            }

            if (npc.ai[0] == 880)
            {
                DustHelper.DrawStar(npc.Center, 272, pointAmount: 8, mainSize: 3.7425f, dustDensity: 6, dustSize: .65f, pointDepthMult: 3.6f, noGravity: true);
                Main.PlaySound(new Terraria.Audio.LegacySoundStyle(4, 55).WithPitchVariance(0.2f), npc.Center);
            }

            if (npc.ai[0] > 900 && npc.ai[0] < 1050)
            {
                pulseTrailPurple = true;
                flowerAttack(player);
            }
            else
            {
                pulseTrailPurple = false;
            }

            if (npc.ai[0] >= 1120 && npc.ai[0] < 1740)
            {
                DashAttack(player);
                pulseTrailYellow = true;
            }

            else
            {
                pulseTrailYellow = false;
                trailbehind      = false;
                npc.TargetClosest(true);
                npc.spriteDirection = npc.direction;
            }
            if (npc.ai[0] > 1800 && npc.ai[0] < 1970)
            {
                summonSpores();
                pulseTrailYellow = true;
            }
            else
            {
                pulseTrailYellow = false;
            }
            if (npc.ai[0] > 2000)
            {
                pulseTrailPurple = false;
                pulseTrailYellow = false;
                pulseTrail       = false;
                npc.ai[0]        = 0;
                npc.ai[1]        = 0;
                npc.ai[2]        = 0;
                npc.netUpdate    = true;
            }
        }
 public override void Kill(int timeLeft)
 {
     Main.PlaySound(SoundID.Item10, projectile.position);
     DustHelper.DrawStar(projectile.Center, 111, 5, 1.5f, 1, 1, 1, 0.5f, true);
 }
        public override void AI()
        {
            //Chain.UpdateChain(projectile.Center); //chain example

            Player projOwner = Main.player[projectile.owner];

            projectile.rotation += 0.3f;

            if (projectile.timeLeft == 1200)
            {
                StarlightPlayer mp = Main.player[projectile.owner].GetModPlayer <StarlightPlayer>();
                if (mp.Empowered)
                {
                    projectile.frame = 1;
                    lightColor       = new Vector3(0.1f, 0.2f, 0.4f);
                    ScaleMult        = 3;
                    dustType         = ModContent.DustType <Dusts.BlueStamina>();
                    empowered        = true;
                }
            }

            Lighting.AddLight(projectile.Center, lightColor * 0.5f);

            switch (projectile.ai[0])
            {
            case 0:    //flying outward
                if (empowered)
                {
                    projectile.velocity += Vector2.Normalize(Main.MouseWorld - projectile.Center);
                    if (projectile.velocity.Length() > 10)                                 //swap this for shootspeed or something
                    {                                                                      //if more than max speed
                        projectile.velocity = Vector2.Normalize(projectile.velocity) * 10; //cap to max speed
                    }
                }

                if (projectile.timeLeft < maxDistTime)
                {    //if it doesn't collide, start it over time
                    NextPhase(0);
                }
                break;

            case 1:    //has hit something
                if (projOwner.controlUseItem || projectile.ai[1] >= maxChargeTime - 5)
                {
                    if (projectile.ai[1] == 0)
                    {
                        Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/ImpactHeal"), projectile.Center);
                    }

                    chargeMult = projectile.ai[1] / (maxChargeTime + 3);
                    projectile.ai[1]++;
                    projectile.velocity *= 0.75f;
                    Lighting.AddLight(projectile.Center, lightColor * chargeMult);


                    if (projectile.ai[1] >= maxChargeTime + 3)    //reset stats and start return phase
                    {
                        projectile.position = projectile.Center;
                        projectile.width    = 18;
                        projectile.height   = 18;
                        projectile.Center   = projectile.position;
                        for (int k = 0; k < projectile.oldPos.Length; k++)
                        {
                            projectile.oldPos[k] = projectile.position;
                        }
                        NextPhase(1);                           //ai[]s reset here
                    }
                    else if (projectile.ai[1] == maxChargeTime) //change hitbox size, stays for 3 frames
                    {
                        projectile.position = projectile.Center;
                        projectile.width    = 67 * ScaleMult;
                        projectile.height   = 67 * ScaleMult;
                        projectile.Center   = projectile.position;
                        for (int k = 0; k < projectile.oldPos.Length; k++)
                        {
                            projectile.oldPos[k] = projectile.position;
                        }
                    }
                    else if (projectile.ai[1] == maxChargeTime - 5)    //sfx
                    {
                        DustHelper.DrawStar(projectile.Center, dustType, pointAmount: 5, mainSize: 2.25f * ScaleMult, dustDensity: 2, pointDepthMult: 0.3f);
                        Lighting.AddLight(projectile.Center, lightColor * 2);
                        //Main.PlaySound(SoundID.Item74, projectile.Center);
                        Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/MagicAttack"), projectile.Center);
                        for (int k = 0; k < 50; k++)
                        {
                            Dust.NewDustPerfect(projectile.Center, dustType, Vector2.One.RotatedByRandom(6.28f) * (Main.rand.NextFloat(0.25f, 1.5f) * ScaleMult), 0, default, 1.5f);
                        }
                    }
 public override void Kill(int timeLeft)
 {
     DustHelper.DrawStar(projectile.Center, 223, pointAmount: 5, mainSize: 1.6425f, dustDensity: 1.5f, dustSize: .5f, pointDepthMult: 0.3f, noGravity: true);
     for (int i = 0; i < 15; i++)
     {
         Dust.NewDustPerfect(projectile.Center, 223, Vector2.One.RotatedByRandom(6.28f) * Main.rand.NextFloat(3), 0, default, 0.5f);
Example #17
0
        public override void AI()
        {
            Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.075f, 0.184f, 0.062f);
            npc.spriteDirection = npc.direction;
            Player player     = Main.player[npc.target];
            bool   expertMode = Main.expertMode;

            if (!player.active || player.dead)
            {
                npc.TargetClosest(false);
                npc.velocity.Y = -2000;
            }
            if (npc.life <= npc.lifeMax / 2)
            {
                npc.ai[0] += 1.5f;
            }
            else
            {
                npc.ai[0]++;
            }
            if (npc.ai[0] < 120 || npc.ai[0] > 180 && npc.ai[0] < 300)
            {
                generalMovement(player);
            }
            if (npc.ai[0] == 150)
            {
                Main.PlaySound(SoundID.Grass, (int)npc.position.X, (int)npc.position.Y);
                Main.PlaySound(new Terraria.Audio.LegacySoundStyle(SoundID.Item, 104).WithPitchVariance(0.2f), npc.Center);
                DustHelper.DrawStar(npc.Center, 163, pointAmount: 163, mainSize: 2.7425f, dustDensity: 4, dustSize: .65f, pointDepthMult: 3.6f, noGravity: true);
                if (Main.netMode != NetmodeID.MultiplayerClient)
                {
                    Vector2 direction = Main.player[npc.target].Center - npc.Center;
                    direction.Normalize();
                    direction.X *= 8f;
                    direction.Y *= 8f;

                    int amountOfProjectiles = 2;
                    if (npc.life <= npc.lifeMax / 2)
                    {
                        amountOfProjectiles = 3;
                    }
                    for (int i = 0; i < amountOfProjectiles; ++i)
                    {
                        float A      = (float)Main.rand.Next(-200, 200) * 0.01f;
                        float B      = (float)Main.rand.Next(-200, 200) * 0.01f;
                        int   damage = expertMode ? 15 : 17;
                        Projectile.NewProjectile(npc.Center.X, npc.Center.Y, direction.X + A, direction.Y + B, ModContent.ProjectileType <BouncingSpore>(), damage, 1, Main.myPlayer, 0, 0);
                    }
                }
            }
            float[] stoptimes = new float[] { 120, 300 };
            if (stoptimes.Contains(npc.ai[0]))
            {
                npc.velocity  = Vector2.Zero;
                npc.netUpdate = true;
            }
            if (npc.ai[0] >= 300 && npc.ai[0] < 900)
            {
                DashAttack(player);
            }
            if (npc.life <= (npc.lifeMax / 2))
            {
                if (npc.ai[3] == 0)
                {
                    npc.ai[0] = 0;
                    CombatText.NewText(new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height), new Color(0, 200, 80, 100),
                                       "The Bramble shall consume you...");
                    Main.PlaySound(SoundID.Grass, (int)npc.position.X, (int)npc.position.Y);
                    Main.PlaySound(42, (int)npc.position.X, (int)npc.position.Y, 39);
                    npc.ai[3]++;
                    npc.netUpdate = true;
                }
                if (npc.ai[0] > 460 && npc.ai[0] < 501 || npc.ai[0] > 661 && npc.ai[0] < 699)
                {
                    CircleSpikeAttack(player);
                }
            }
            if (npc.ai[0] >= 900)
            {
                npc.ai[0]     = 0;
                npc.ai[1]     = 0;
                npc.ai[2]     = 0;
                npc.netUpdate = true;
            }
        }
Example #18
0
        public override void AI()
        {
            Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.301f, 0.110f, 0.126f);
            Player player     = Main.player[npc.target];
            bool   expertMode = Main.expertMode;

            npc.rotation      = MathHelper.Lerp(npc.rotation, 0, 0.06f);
            npc.noTileCollide = true;

            if (!player.active || player.dead)
            {
                npc.TargetClosest(false);
                npc.velocity.Y = -2000;
            }
            if (player.GetSpiritPlayer().ZoneReach)
            {
                npc.defense = 25;
                npc.damage  = 45;
            }
            else
            {
                npc.defense = 14;
                npc.damage  = 28;
            }

            npc.ai[0]++;
            if (npc.ai[0] < 470 || npc.ai[0] > 730 && npc.ai[0] < 900 || npc.ai[0] > 1051 && npc.ai[0] < 1120)
            {
                generalMovement(player);
            }

            float[] stoptimes = new float[] { 470, 540, 670, 900, 1051, 1800 };
            if (stoptimes.Contains(npc.ai[0]))
            {
                npc.velocity  = Vector2.Zero;
                npc.netUpdate = true;
            }

            if (npc.ai[0] >= 480 && npc.ai[0] < 730)
            {
                sideFloat(player);
                pulseTrail = true;
            }
            else
            {
                pulseTrail = false;
            }

            if (npc.ai[0] == 880)
            {
                DustHelper.DrawStar(npc.Center, 272, pointAmount: 8, mainSize: 3.7425f, dustDensity: 6, dustSize: .65f, pointDepthMult: 3.6f, noGravity: true);
            }

            if (npc.ai[0] > 900 && npc.ai[0] < 1050)
            {
                pulseTrailPurple = true;
                flowerAttack(player);
            }
            else
            {
                pulseTrailPurple = false;
            }

            if (npc.ai[0] >= 1120 && npc.ai[0] < 1740)
            {
                DashAttack(player);
            }

            else
            {
                pulseTrailYellow = false;
                trailbehind      = false;
                npc.TargetClosest(true);
                npc.spriteDirection = npc.direction;
            }
            if (npc.ai[0] > 1800 && npc.ai[0] < 1930)
            {
                summonBouncingProjectiles();
                pulseTrail = true;
            }
            else
            {
                pulseTrail = false;
            }
            if (npc.ai[0] > 2000)
            {
                pulseTrailPurple = false;
                pulseTrailYellow = false;
                pulseTrail       = false;
                for (int i = 0; i < npc.ai.Length; i++)
                {
                    npc.ai[i] = 0;
                }

                npc.netUpdate = true;
            }
        }