Ejemplo n.º 1
0
        public override void AI()
        {
            Lighting.AddLight(npc.Center, FahrenheitUtils.FireGradient(0f).ToVector3() * FahrenheitUtils.LightStrength);
            npc.rotation        = npc.velocity.ToRotation();
            npc.direction       = (npc.velocity.X >= 0).ToDirectionInt();
            npc.spriteDirection = npc.direction;
            for (int i = 0; i < 2; i++)
            {
                Dust dust = Dust.NewDustDirect(npc.position, npc.width, npc.height, DustID.Fire);
                dust.noGravity = true;
                dust.velocity  = -npc.velocity * 0.2f;
            }

            if (attackTimer == 120)
            {
                npc.life = 0;
                for (int i = 0; i < 50; i++)
                {
                    Dust dust = Dust.NewDustDirect(npc.position, npc.width, npc.height, DustID.Fire);
                    dust.scale     = 2f;
                    dust.noGravity = true;
                    dust.velocity  = npc.velocity * 1.5f;
                }
            }

            if (++attackTimer > attackTimerMax)
            {
                attackTimer = 0;
            }

            Vector2 sine = new Vector2(0f, (float)Math.Sin((int)attackTimer * 0.1f) * 3f).RotatedBy(npc.rotation);

            npc.position += sine;
        }
Ejemplo n.º 2
0
        public override void AI()
        {
            Lighting.AddLight(npc.Center, FahrenheitUtils.FireGradient(0f).ToVector3() * FahrenheitUtils.LightStrength);

            if (attackTimer == 0)
            {
                if (CanFunction && dashing)
                {
                    #region Cross Skull Fire
                    if (PAFMUtils.NetmodeCheck)
                    {
                        if (Main.expertMode)
                        {
                            if (phase2)
                            {
                                int points = 4;
                                for (int i = 0; i < points; i++)
                                {
                                    NPC minion = Main.npc[NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, ModContent.NPCType <FahrenheitMinion>())];
                                    minion.Center   = npc.Center + new Vector2(0f, -512f).RotatedBy(MathHelper.ToRadians(360f / points * i - 45f)) * new Vector2(1.5f, 1f);
                                    minion.velocity = Vector2.Normalize(npc.Center - minion.Center) * 10f;
                                    if (minion.modNPC is FahrenheitBaseNPC minionModNPC)
                                    {
                                        minionModNPC.npcOwnerIndex = npc.whoAmI;
                                    }
                                }
                            }
                        }
                    }
                    #endregion

                    float   speed    = Main.expertMode ? 1.4f : 1f;
                    Vector2 position = Target.Center + new Vector2(Target.direction * 64f, 0f);
                    npc.velocity = Vector2.Normalize(position - npc.Center) * TargetDistance / 16f * 0.6f * speed;
                    dashing      = false;
                }
                Player oldTarget = Target;
                npc.TargetClosest();
                if (Target != oldTarget)
                {
                    Main.PlaySound(SoundID.DD2_FlameburstTowerShot, Target.Center);
                    int points = 45;
                    for (int i = 0; i < points; i++)
                    {
                        float   rotation     = 360f / points * i;
                        float   distance     = rotation % (360f / (5f));
                        Vector2 dustPosition = Target.Center + new Vector2(0f, distance).RotatedBy(MathHelper.ToRadians(rotation));
                        Vector2 dustSpeed    = new Vector2(0f, distance * -0.3f).RotatedBy(MathHelper.ToRadians(rotation));
                        Dust    dust1        = Dust.NewDustPerfect(dustPosition, DustID.RainbowMk2, dustSpeed, 0, default, 3f);
Ejemplo n.º 3
0
        public override void AI()
        {
            projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(-90f);
            Lighting.AddLight(projectile.Center, FahrenheitUtils.FireGradient(0f).ToVector3() * FahrenheitUtils.LightStrength);

            for (int i = 0; i < 2; i++)
            {
                Dust dust = Dust.NewDustDirect(projectile.position + projectile.velocity, projectile.width, projectile.height, DustID.Fire);
                dust.noGravity  = true;
                dust.velocity.Y = -1f;
            }

            if (++projectile.frameCounter >= 5)
            {
                projectile.frameCounter = 0;
                if (++projectile.frame >= Main.projFrames[projectile.type])
                {
                    projectile.frame = 0;
                }
            }
        }
Ejemplo n.º 4
0
        public override void AI()
        {
            Lighting.AddLight(npc.Center, FahrenheitUtils.FireGradient(0f).ToVector3() * FahrenheitUtils.LightStrength);

            int flames = 2;

            for (int i = 0; i < flames; i++)
            {
                int   type  = DustID.Fire;
                int   alpha = 0;
                Color color = default;
                if (extinguished)
                {
                    type  = DustID.Smoke;
                    alpha = 100;
                    color = Color.LightGray;
                }
                Dust dust = Dust.NewDustPerfect(FirePosition, type, new Vector2(Main.rand.NextFloat(-2f, 2f), Main.rand.NextFloat(-3f, -6f)) + npc.velocity, alpha, color, npc.scale * 2f);
                dust.noGravity = true;
            }

            if (npcOwnerIndex >= 0 && npcOwnerIndex < Main.maxNPCs)
            {
                if (NPCOwner.modNPC is Fahrenheit npcOwnerModNPC)
                {
                    if (NPCOwner.active && !extinguished)
                    {
                        if (!npcOwnerModNPC.despawn)
                        {
                            if (!npcOwnerModNPC.dashing)
                            {
                                if (npcOwnerModNPC.shotEscapeFire)
                                {
                                    npc.velocity    = npcOwnerModNPC.TargetDirection * 25f;
                                    npc.velocity.Y += Math.Sign(npcOwnerModNPC.TargetDirection.Y) * 6f;
                                }

                                if (Vector2.Distance(npc.Center, NPCOwner.Center) >= 900f)
                                {
                                    npc.Center = NPCOwner.Center;
                                    float rotation = 90f;
                                    npc.velocity += new Vector2(0f, -12f).RotatedBy(MathHelper.ToRadians(Main.rand.NextFloat(-rotation * 0.5f, rotation * 0.5f)));
                                }
                            }

                            if (npcOwnerModNPC.phase2)
                            {
                                if (attackTimer % (Main.expertMode ? 120 : 180) == 0 && attackTimer != 0)
                                {
                                    Projectile projectile = FahrenheitUtils.NewProjectile(FirePosition, Vector2.Normalize(npcOwnerModNPC.Target.Center - FirePosition) * 5f, ModContent.ProjectileType <FahrenheitBounceFireball>(), npc.damage, 0f);
                                    projectile.hostile  = true;
                                    projectile.friendly = false;
                                    projectile.timeLeft = 240;
                                }
                            }
                            else
                            {
                                float time          = Main.expertMode ? 144 : 180;
                                float telegraphTime = Main.expertMode ? 60 : 80;
                                if (attackTimer % time >= Math.Abs(time - telegraphTime))
                                {
                                    int     points    = 16;
                                    Vector2 direction = new Vector2(0f, -1f);
                                    for (int i = 0; i < points; i++)
                                    {
                                        Dust dust = Dust.NewDustPerfect(FirePosition + (i * direction * 10f), DustID.RainbowMk2, new Vector2(0f, -16f), 0, Color.White, 1f);
                                        dust.noGravity = true;
                                    }
                                }
                                if (!npcOwnerModNPC.dashing)
                                {
                                    if (attackTimer % time == 0)
                                    {
                                        float rotation = 135f;
                                        npc.velocity += new Vector2(0f, -6f).RotatedBy(MathHelper.ToRadians(Main.rand.NextFloat(-rotation * 0.5f, rotation * 0.5f)));
                                        Projectile projectile = FahrenheitUtils.NewProjectile(FirePosition, -Vector2.UnitY, ProjectileID.GeyserTrap, npc.damage, 0f);
                                        projectile.hostile  = true;
                                        projectile.friendly = false;
                                    }
                                }
                            }
                        }

                        if (!NPCOwner.active || npcOwnerModNPC.death)
                        {
                            extinguished = true;
                        }
                    }
                    else
                    {
                        extinguished = true;
                    }
                }
            }
            else
            {
                extinguished = true;
            }

            if (extinguished)
            {
                if (npc.dontTakeDamage)
                {
                    int points = 8;
                    for (int i = 0; i < points; i++)
                    {
                        Vector2 velocity = new Vector2(0f, -4f).RotatedBy(MathHelper.ToRadians(360f / points * i));
                        Dust    dust     = Dust.NewDustPerfect(FirePosition, DustID.Smoke, velocity, 100, Color.White, 3f);
                        dust.noGravity = true;
                    }
                    npc.dontTakeDamage = false;
                }
            }

            if (npc.velocity.Y == 0f)
            {
                npc.velocity.X = 0f;
            }
            if (npc.velocity.Y <= 10f)
            {
                npc.velocity.Y += 0.3f;
            }

            npc.velocity *= 0.98f;

            if (++attackTimer > attackTimerMax)
            {
                attackTimer = 0;
            }
        }