public override void HitEffect(int hitDirection, double damage)
        {
            if (npc.life <= 0)
            {
                Gore.NewGorePerfect(GradiusExplode.CenterSpawn(npc.Center), Vector2.Zero,
                                    mod.GetGoreSlot("Gores/GradiusExplode"));
                if (Main.expertMode)
                {
                    if (RetaliationOverride == null)
                    {
                        switch (EnemyType)
                        {
                        case Types.Small:
                        case Types.Large:
                            RetaliationSpread(npc.Center);
                            break;

                        case Types.Boss:
                            RetaliationExplode(npc.Center);
                            break;
                        }
                    }
                    else
                    {
                        RetaliationOverride(npc.Center);
                    }
                }
            }
        }
Ejemplo n.º 2
0
 public void Break(Player player)
 {
     broken = true;
     for (int i = 0; i < 4; i++)
     {
         Gore shard = Gore.NewGorePerfect(player.MountedCenter, new Vector2(0f, -8f).RotatedByRandom(MathHelper.ToRadians(360f)), mod.GetGoreSlot <Details.BottleShards>());
         shard.frame = (byte)i;
     }
 }
Ejemplo n.º 3
0
 public override void Kill(int timeLeft)
 {
     Gore.NewGorePerfect(GradiusExplode.CenterSpawn(projectile.Center), Vector2.Zero,
                         mod.GetGoreSlot("Gores/GradiusExplode"), .5f);
     Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Enemies/Gradius2Death"),
                    projectile.Center);
     if (IsMotherValid)
     {
         ActualMotherProjectile.alliedZalks.Remove(projectile);
     }
 }
Ejemplo n.º 4
0
        private void SpawnAnimation() //The animation which plays when the boss is spawning
        {
            rotationLocked = true;
            lockedRotation = 1.57f;

            if (checkSpecificTime(2))
            {
                RandomizeTarget(); //pick a random target so the eyes will follow them
                startPos = npc.Center;

                if (IsInsideArena())
                {
                    StarlightPlayer mp = Main.LocalPlayer.GetModPlayer <StarlightPlayer>();
                    mp.ScreenMoveTarget = npc.Center + new Vector2(0, -600);
                    mp.ScreenMoveTime   = 650;
                }

                music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/VitricBossAmbient");

                SetFrameX(0);
                SetFrameY(0);
                lastTwistState = 0;

                Helper.PlayPitched("VitricBoss/CeirosEarthquake", 0.4f, 0, npc.Center);
                Helper.PlayPitched("VitricBoss/CeirosRumble", 0.4f, 0, npc.Center);
            }

            if (checkSpecificTime(90))
            {
                //Helper.PlayPitched("VitricBoss/StoneBreak", 0.25f, 0.3f, npc.Center);
                Helper.PlayPitched("VitricBoss/ceiroslidclose", 0.35f, 0.4f, npc.Center);
            }


            if (checkSpecificTime(120))
            {
                if (IsInsideArena())
                {
                    StarlightPlayer mp = Main.LocalPlayer.GetModPlayer <StarlightPlayer>();
                    mp.Shake += 10;

                    ZoomHandler.SetZoomAnimation(1.1f, 60);
                }

                for (int k = 0; k < 10; k++)
                {
                    Gore.NewGorePerfect(arena.Center() + new Vector2(Main.rand.Next(-600, 600), -450), Vector2.UnitY * Main.rand.NextFloat(-1, 2), ModGore.GetGoreSlot(AssetDirectory.VitricBoss + "Gore/Cluster" + Main.rand.Next(1, 19)));
                }

                for (int k = 0; k < 20; k++)
                {
                    Dust.NewDustPerfect(arena.Center() + new Vector2(Main.rand.Next(-600, 600), -450), DustID.Stone, Vector2.UnitY * Main.rand.NextFloat(6, 12), 0, default, Main.rand.NextFloat(1, 3));
Ejemplo n.º 5
0
        public override bool CheckDead()
        {
            for (int i = 0; i < 2; i++)
            {
                Gore gore = Gore.NewGorePerfect(npc.position + new Vector2(0f, 10f), npc.velocity, mod.GetGoreSlot("Gores/FahrenheitFlameStandGore"), npc.scale);
                gore.numFrames = 2;
                gore.frame     = (byte)i;
                gore.velocity  = new Vector2(0f, -4f).RotatedByRandom(MathHelper.ToRadians(90f)) + npc.velocity * 0.5f;
                gore.rotation  = npc.rotation;
            }

            return(true);
        }
Ejemplo n.º 6
0
        public override void Kill(int timeLeft)
        {
            Gore.NewGorePerfect(GradiusExplode.CenterSpawn(projectile.Center), Vector2.Zero,
                                mod.GetGoreSlot("Gores/GradiusExplode"), .5f);
            Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Enemies/Gradius2Death"),
                           projectile.Center);
            Vector2 oldCenter = projectile.Center;

            projectile.width  = projectile.height = 200;
            projectile.Center = oldCenter;
            projectile.Damage();
            for (int i = 0; i < 100; i++)
            {
                Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, DustID.ApprenticeStorm, 0f, 0f, 0, default, 1f);
Ejemplo n.º 7
0
        public override void AI()
        {
            Player owner     = Main.player[projectile.owner];
            float  grabrange = (owner.manaMagnet) ? 400 : 100;

            if (projectile.Distance(owner.Center) < grabrange)
            {
                projectile.velocity = Vector2.Lerp(projectile.velocity, projectile.DirectionTo(owner.Center) * 4, 0.05f);
            }
            else
            {
                projectile.velocity = Vector2.Lerp(projectile.velocity, Vector2.Zero, 0.1f);
            }
            if (projectile.Hitbox.Intersects(owner.Hitbox))
            {
                projectile.Kill();
                owner.statMana = owner.statManaMax;
                owner.ManaEffect(owner.statMana);
                owner.AddBuff(mod.BuffType("ManajinxBuff"), 360);
                Main.PlaySound(SoundID.Item29, owner.Center);
            }
            if (projectile.timeLeft > 40)
            {
                if (projectile.alpha > 0)
                {
                    projectile.alpha -= 7;
                }
                else
                {
                    projectile.alpha = 0;
                    projectile.ai[0] = 1;
                }
            }
            else
            {
                projectile.alpha += 7;
                if (projectile.alpha > 230)
                {
                    projectile.Kill();
                }
            }
            if (Main.rand.Next(20) == 0)
            {
                Vector2 spawnpos = projectile.position + Main.rand.NextVector2Circular(70, 70);
                Vector2 gorevel  = (projectile.position - spawnpos) / 45;
                Gore.NewGorePerfect(spawnpos, gorevel, mod.GetGoreSlot("Gores/StarjinxGore"), 0.4f);
            }
        }
Ejemplo n.º 8
0
        public override void AI()
        {
            projectile.ai[0]++;
            if (projectile.ai[0] > passivetime && projectile.ai[1] == 0)
            {
                projectile.ai[1]++;
                Main.PlaySound(new LegacySoundStyle(SoundID.Item, 14).WithVolume(0.5f).WithPitchVariance(0.2f), projectile.Center);
                projectile.velocity.Y = -12;
                for (int i = 0; i < 3; i++)
                {
                    Gore gore = Gore.NewGoreDirect(projectile.Center + Main.rand.NextVector2Square(-18, 18), Main.rand.NextVector2Circular(3, 3), GoreID.ChimneySmoke1);
                    gore.timeLeft = 20;
                }
            }

            if (projectile.ai[1] == 0)
            {
                startingpoint = projectile.Center;
                Vector2 dustvel = -Vector2.UnitY.RotatedByRandom(MathHelper.Pi / 5) * 3;
                Gore    gore    = Gore.NewGoreDirect(projectile.Center + Main.rand.NextVector2Square(-18, 18), Main.rand.NextVector2Circular(3, 3), GoreID.ChimneySmoke1, 0.6f);
                gore.timeLeft = 20;
                for (int i = 0; i < 4; i++)
                {
                    Dust dust = Dust.NewDustPerfect(projectile.Center + (Vector2.UnitY * 20), mod.DustType("SandDust"), dustvel);
                    dust.position.X += Main.rand.NextFloat(-6, 6);
                    dust.noGravity   = false;
                    dust.scale       = 0.75f;
                }
            }
            else
            {
                projectile.hide      = false;
                projectile.alpha     = (activetime - projectile.timeLeft) * (255 / activetime);
                projectile.rotation += 0.1f + projectile.direction;
                if (Main.rand.Next(4) == 0)
                {
                    Gore.NewGorePerfect(projectile.Center, projectile.velocity.RotatedByRandom(MathHelper.Pi / 14) / 2, mod.GetGoreSlot("Gores/SandBall"), Main.rand.NextFloat(0.6f, 0.8f));
                }

                for (int i = 0; i < 3; i++)
                {
                    Dust dust = Dust.NewDustPerfect(projectile.Center + (Vector2.UnitY * 16), mod.DustType("SandDust"), projectile.velocity.RotatedByRandom(MathHelper.Pi / 8) * 0.2f);
                    dust.position += dust.velocity * Main.rand.NextFloat(20, 25);
                    dust.noGravity = true;
                    dust.scale     = Main.rand.NextFloat(0.5f, 1.2f);
                }
            }
        }
Ejemplo n.º 9
0
        private void SpawnFloorCloud(int x, int y)
        {
            Vector2 worldCoordinates = new Point(x, y - 1).ToWorldCoordinates(8f, 8f);
            int     Type             = this._random.Next(1087, 1090);
            float   num1             = 16f * this._random.NextFloat();

            worldCoordinates.Y -= num1;
            if ((double)num1 < 4.0)
            {
                Type = 1090;
            }
            float num2  = 0.4f;
            float Scale = (float)(0.800000011920929 + (double)this._random.NextFloat() * 0.200000002980232);

            Gore.NewGorePerfect(worldCoordinates, Vector2.UnitX * num2 * Main.WindForVisuals, Type, Scale);
        }
Ejemplo n.º 10
0
        private void SpawnFloorCloud(int x, int y)
        {
            Vector2 position = new Point(x, y - 1).ToWorldCoordinates();
            int     type     = _random.Next(1087, 1090);
            float   num      = 16f * _random.NextFloat();

            position.Y -= num;
            if (num < 4f)
            {
                type = 1090;
            }
            float scaleFactor = 0.4f;
            float scale       = 0.8f + _random.NextFloat() * 0.2f;

            Gore.NewGorePerfect(position, Vector2.UnitX * scaleFactor * Main.WindForVisuals, type, scale);
        }
Ejemplo n.º 11
0
        private void SpawnAirborneCloud(int x, int y)
        {
            int   num  = _random.Next(2, 6);
            float num2 = 1.1f;
            float num3 = 2.2f;
            float num4 = (float)Math.PI * 3f / 400f * _random.NextFloatDirection();
            float num5 = (float)Math.PI * 3f / 400f * _random.NextFloatDirection();

            while (num5 > (float)Math.PI * -3f / 800f && num5 < (float)Math.PI * 3f / 800f)
            {
                num5 = (float)Math.PI * 3f / 400f * _random.NextFloatDirection();
            }
            if (_random.Next(4) == 0)
            {
                num  = _random.Next(9, 16);
                num2 = 1.1f;
                num3 = 1.2f;
            }
            else if (_random.Next(4) == 0)
            {
                num  = _random.Next(9, 16);
                num2 = 1.1f;
                num3 = 0.2f;
            }
            Vector2 value  = new Vector2(-10f, 0f);
            Vector2 value2 = new Point(x, y).ToWorldCoordinates();

            num4 -= num5 * (float)num * 0.5f;
            float num6 = num4;

            for (int i = 0; i < num; i++)
            {
                if (Main.rand.Next(10) == 0)
                {
                    num5 *= _random.NextFloatDirection();
                }
                Vector2 value3      = _random.NextVector2Circular(4f, 4f);
                int     type        = 1091 + _random.Next(2) * 2;
                float   scaleFactor = 1.4f;
                float   num7        = num2 + _random.NextFloat() * num3;
                float   num8        = num6 + num5;
                Vector2 value4      = Vector2.UnitX.RotatedBy(num8) * scaleFactor;
                Gore.NewGorePerfect(value2 + value3 - value, value4 * Main.WindForVisuals, type, num7);
                value2 += value4 * 6.5f * num7;
                num6    = num8;
            }
        }
Ejemplo n.º 12
0
        private void SpawnAirborneCloud(int x, int y)
        {
            int   num1 = this._random.Next(2, 6);
            float num2 = 1.1f;
            float num3 = 2.2f;
            float num4 = 3f * (float)Math.PI / 400f * this._random.NextFloatDirection();
            float num5 = 3f * (float)Math.PI / 400f * this._random.NextFloatDirection();

            while ((double)num5 > -3.0 * Math.PI / 800.0 && (double)num5 < 3.0 * Math.PI / 800.0)
            {
                num5 = 3f * (float)Math.PI / 400f * this._random.NextFloatDirection();
            }
            if (this._random.Next(4) == 0)
            {
                num1 = this._random.Next(9, 16);
                num2 = 1.1f;
                num3 = 1.2f;
            }
            else if (this._random.Next(4) == 0)
            {
                num1 = this._random.Next(9, 16);
                num2 = 1.1f;
                num3 = 0.2f;
            }
            Vector2 vector2_1        = new Vector2(-10f, 0.0f);
            Vector2 worldCoordinates = new Point(x, y).ToWorldCoordinates(8f, 8f);
            float   num6             = num4 - (float)((double)num5 * (double)num1 * 0.5);

            for (int index = 0; index < num1; ++index)
            {
                if (Main.rand.Next(10) == 0)
                {
                    num5 *= this._random.NextFloatDirection();
                }
                Vector2 vector2_2 = this._random.NextVector2Circular(4f, 4f);
                int     Type      = 1091 + this._random.Next(2) * 2;
                float   num7      = 1.4f;
                float   Scale     = num2 + this._random.NextFloat() * num3;
                float   num8      = num6 + num5;
                Vector2 vector2_3 = Vector2.UnitX.RotatedBy((double)num8, new Vector2()) * num7;
                Gore.NewGorePerfect(worldCoordinates + vector2_2 - vector2_1, vector2_3 * Main.WindForVisuals, Type, Scale);
                worldCoordinates += vector2_3 * 6.5f * Scale;
                num6              = num8;
            }
        }
Ejemplo n.º 13
0
        public override void AI()
        {
            npc.GivenName = "";
            Rectangle room = Common.Worlds.MWorld.TorizoRoomLocation;

            if (room.X > 0 && room.Y > 0)
            {
                Vector2 pos = new Vector2(room.X + 8, room.Y + room.Height - 4);
                npc.direction = 1;
                if (room.X > Main.maxTilesX / 2)
                {
                    pos.X         = (room.X + room.Width - 8);
                    npc.direction = -1;
                }
                pos *= 16f;
                npc.spriteDirection = npc.direction;

                npc.position.X = pos.X - npc.width / 2;
                npc.position.Y = pos.Y - npc.height;
            }

            for (int i = 0; i < 255; i++)
            {
                Player player = Main.player[i];
                if (player.active && !player.dead && Vector2.Distance(player.Center, npc.Center) < 200f &&
                    Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height) && npc.ai[0] == 0)
                {
                    npc.ai[0]  = 1;
                    npc.target = player.whoAmI;
                }
            }

            sAttackFrameCounter++;
            if (sAttackFrameCounter > 6)
            {
                sAttackFrame       += sAttackNum;
                sAttackFrameCounter = 0;
            }
            if (sAttackFrame >= 2)
            {
                sAttackFrame = 2;
                sAttackNum   = -1;
            }
            if (sAttackFrame <= 0)
            {
                sAttackFrame = 0;
                sAttackNum   = 1;
            }

            if (npc.ai[0] == 1)
            {
                if (npc.ai[1] <= 0)
                {
                    Vector2 ePos = npc.Center + new Vector2(sAttackPos.X * npc.direction, sAttackPos.Y);
                    if (Main.netMode != 2)
                    {
                        for (int i = 0; i < 10; i++)
                        {
                            Dust dust = Dust.NewDustDirect(ePos - new Vector2(16, 16), 32, 32, 57, 0f, 0f, 100, default(Color), 3f);
                            dust.velocity *= 1.4f;
                            dust.noGravity = true;
                            dust           = Dust.NewDustDirect(ePos - new Vector2(16, 16), 32, 32, 30, 0f, 0f, 100, default(Color), 3f);
                            dust.velocity *= 1.4f;
                            dust.noGravity = true;
                        }
                        for (int i = 1; i <= 4; i++)
                        {
                            Vector2 velocity = new Vector2(-Main.rand.Next(31), -Main.rand.Next(31)) * 0.2f * 0.4f;
                            if (i % 2 == 0)
                            {
                                velocity.X *= -1;
                            }
                            Gore gore = Gore.NewGoreDirect(ePos, velocity, mod.GetGoreSlot("Gores/TorizoETankGore" + i));
                            gore.velocity.X = velocity.X;
                            gore.timeLeft   = 60;
                        }
                        Main.PlaySound(2, (int)ePos.X, (int)ePos.Y, 14);
                    }
                    drawSAttack = false;

                    npc.ai[1] = 1;
                }
                else
                {
                    npc.ai[1]++;
                    if (npc.ai[1] > 100)
                    {
                        npc.ai[0] = 2;
                        npc.ai[1] = 0;
                    }
                }
            }
            if (npc.ai[0] == 2)
            {
                if (Main.netMode != 2)
                {
                    for (int i = 9; i >= 0; i--)
                    {
                        Vector2 gPos      = npc.Center + gorePos[i];
                        byte    goreFrame = 0;
                        if (npc.direction == -1)
                        {
                            gPos.X    = npc.Center.X - gorePos[i].X;
                            goreFrame = 1;
                        }
                        Vector2 velocity = new Vector2(gPos.X - npc.Center.X, gPos.Y - (npc.position.Y + npc.height)) * 0.02f;

                        int type = mod.GetGoreSlot("Gores/TorizoStatueGore" + (1 + i));
                        gPos.X -= Main.goreTexture[type].Width / 2;
                        gPos.Y -= Main.goreTexture[type].Height / 4;
                        Gore gore = Gore.NewGorePerfect(gPos, velocity, type);
                        gore.numFrames = 2;
                        gore.frame     = goreFrame;
                        gore.timeLeft  = 60;
                        int stype = 0;
                        if (i % 2 == 0)
                        {
                            stype = 21;
                        }
                        Main.PlaySound(stype, (int)gPos.X, (int)gPos.Y, 1, 1f, 0f);
                    }
                    for (int i = 0; i < 35; i++)
                    {
                        Dust dust = Main.dust[Dust.NewDust(npc.position - new Vector2(8, 8), npc.width + 16, npc.height + 16, 30, 0f, 0f, 100, default(Color), 2.5f)];
                        dust.velocity *= 1.4f;
                        dust.noGravity = true;
                    }
                }

                if (!NPC.AnyNPCs(mod.NPCType("GoldenTorizo")))
                {
                    Vector2 tPos = new Vector2(npc.Center.X - 26 * npc.direction, npc.position.Y + npc.height - 117);
                    //NPC.NewNPC((int)tPos.X,(int)tPos.Y,mod.NPCType("GoldenTorizo"),npc.whoAmI, 0,1,0,0, npc.target);
                    NPC.SpawnOnPlayer(npc.target, mod.NPCType("GoldenTorizo"));
                }

                /*if (Main.netMode == 0)
                 * {
                 *      Main.NewText(Language.GetTextValue("Announcement.HasAwoken", "Golden Torizo"), 175, 75, 255, false);
                 * }
                 * if (Main.netMode == 2)
                 * {
                 *      NetMessage.BroadcastChatMessage(NetworkText.FromKey("Announcement.HasAwoken", "The Golden Torizo"), new Color(175, 75, 255), -1);
                 * }*/
                npc.active = false;
            }
        }
Ejemplo n.º 14
0
        public override bool PreAI()
        {
            if (collided || stuck || projectile.timeLeft % 6 == 0)
            {
                if (trailWidth > 0.3f)
                {
                    trailWidth *= 0.995f;
                    if (trailWidth < 3.5f)
                    {
                        trailWidth *= 0.95f;
                    }
                }
                else
                {
                    trailWidth = 0;
                }
            }

            if (!collided)
            {
                if (stuck)
                {
                    NPC target = Main.npc[enemyID];
                    cooldown--;

                    if (!target.active)
                    {
                        if (projectile.timeLeft > 5)
                        {
                            projectile.timeLeft = 5;
                        }
                        projectile.velocity = Vector2.Zero;
                    }
                    else
                    {
                        var collidingProj = Main.projectile.Where(n => n.active && n != projectile && !collidedWith.Contains(n) && n.modProjectile is RebarProj modProj && Collision.CheckLinevLine(GetA(), GetB(), modProj.GetA2(), modProj.GetB2()).Length > 0 && !modProj.collidedWith.Contains(projectile) && modProj.distanceIn < distanceIn).OrderBy(n => n.velocity.Length()).FirstOrDefault();

                        if (collidingProj != default)
                        {
                            float angleBetween = Math.Abs(((((collidingProj.rotation - projectile.rotation) % 6.28f) + 9.42f) % 6.28f) - 3.14f);

                            float effectiveness = (3.14f - angleBetween) / 3.14f;

                            if (effectiveness >= 0.5f)
                            {
                                var mp = collidingProj.modProjectile as RebarProj;
                                mp.collidedWith.Add(collidingProj);

                                Vector2 vel = initialVel;
                                vel.Normalize();
                                vel *= effectiveness;
                                vel *= 4;
                                collidedWith.Clear();
                                if (cooldown < 0)
                                {
                                    projectile.friendly = true;
                                }

                                Vector2[] dustPositions = Collision.CheckLinevLine(GetA(), GetB(), mp.GetA2(), mp.GetB2());

                                if (dustPositions.Length > 0 && initialVel.Length() < 1)
                                {
                                    for (float i = 0; i < 15; i++)
                                    {
                                        Dust.NewDustPerfect(dustPositions[0], ModContent.DustType <RebarLine>(), Vector2.One.RotatedByRandom(6.28f) * Main.rand.NextFloat(3, 6), 0, new Color(248, 126, 0), Main.rand.NextFloat(0.35f, 0.5f));
                                    }
                                }

                                initialVel += vel;

                                projectile.damage = initialDamage + (int)Math.Pow(distanceIn, 0.5f);
                            }
                        }

                        offset     += initialVel;
                        distanceIn += initialVel.Length();

                        if (initialVel.Length() > 0.02f)
                        {
                            initialVel *= 0.5f;
                        }

                        var targetCollection = Main.npc.Where(n => n.active && !n.townNPC && (Collision.CheckAABBvLineCollision(n.position, n.Size, GetA3(), GetB3()) || Collision.CheckAABBvAABBCollision(projectile.position, projectile.Size, n.position, n.Size))).OrderBy(n => 1).FirstOrDefault();
                        if (targetCollection == default)
                        {
                            projectile.extraUpdates = 0;

                            if (projectile.timeLeft > 80)
                            {
                                projectile.timeLeft = 80;
                            }

                            projectile.friendly = false;
                            projectile.velocity = Vector2.Zero;

                            if (!collided)
                            {
                                projectile.alpha = 255;
                                Gore.NewGorePerfect(projectile.Center, initialVel, ModGore.GetGoreSlot(Texture));
                                collided = true;
                            }
                        }

                        projectile.position = target.position + offset;
                    }
                }

                else
                {
                    projectile.rotation = projectile.velocity.ToRotation();
                    ManageCaches();
                }
            }
            else
            {
                if (enemyID != -1)
                {
                    NPC target = Main.npc[enemyID];
                    projectile.position = target.position + offset;
                }
                projectile.alpha += 4;
            }

            ManageTrail();
            return(true);
        }
Ejemplo n.º 15
0
        public override void AI()
        {
            Lighting.AddLight(npc.Center, Color.OrangeRed.ToVector3());

            Player player = Main.player[npc.target];

            npc.TargetClosest(true);
            npc.spriteDirection = -npc.direction;

            npc.ai[0] = ((npc.Distance(player.Center) < 800 || npc.ai[2] > rechargetime) &&
                         Collision.CanHit(npc.position, npc.width, npc.height, player.position, 0, 0) &&
                         player.active &&
                         !player.dead) ? 1 : 0;

            if (npc.ai[0] == 0)
            {
                IdleMovement();
                npc.ai[1] = 0;                 //dash timer
                npc.ai[2] = 0;                 //targetting timer
                npc.ai[3] = 0;
            }
            else               //set its target position as the player's center when it starts its enrage, then dash to it once per frame cycle. If it's close enough to the target position, explode and retarget

            {
                if (npc.ai[2] <= rechargetime)
                {
                    IdleMovement();
                    targetpos = player.Center;
                    npc.ai[2]++;
                }
                else
                {
                    if (npc.ai[3] == 0)
                    {
                        SpiritMod.primitives.CreateTrail(new PrimFireTrail(npc, new Color(255, 170, 0), 26));
                        npc.ai[3] = 1;
                    }

                    npc.spriteDirection = -Math.Sign(npc.velocity.X);

                    if (Main.rand.Next(4) == 0)
                    {
                        Gore.NewGorePerfect(npc.Center + Main.rand.NextVector2Circular(10, 10), npc.velocity.RotatedByRandom(MathHelper.Pi / 8) / 2, mod.GetGoreSlot("Gores/FireTrail"), Main.rand.NextFloat(0.7f, 1.2f));
                    }

                    if (Main.expertMode)
                    {
                        targetpos = Vector2.Lerp(targetpos, player.Center, 0.03f);
                    }
                    if (npc.ai[1] == 0)
                    {
                        Main.PlaySound(mod.GetLegacySoundSlot(Terraria.ModLoader.SoundType.Custom, "Sounds/skullscrem").WithPitchVariance(0.2f), npc.Center);
                        npc.velocity = npc.DirectionTo(targetpos) * 14;
                        npc.ai[1]++;
                    }
                    if (Main.expertMode)
                    {
                        npc.velocity = Vector2.Lerp(npc.velocity, npc.DirectionTo(targetpos) * 14, 0.2f);
                    }
                    if (frame > 10)
                    {
                        npc.velocity = Vector2.Lerp(npc.velocity, Vector2.Zero, 0.05f);
                    }

                    if (npc.Distance(targetpos) < 20)
                    {
                        Main.PlaySound(SoundID.Item14, npc.Center);
                        int damage = (Main.expertMode) ? npc.damage / 4 : npc.damage / 2;
                        for (int i = 0; i < 6; i++)
                        {
                            Gore.NewGore(npc.Center + Main.rand.NextVector2Square(-20, 20), Main.rand.NextVector2Circular(3, 3), 11);
                        }
                        Projectile.NewProjectile(npc.Center, Vector2.Zero, mod.ProjectileType("WrathBoom"), damage, 1, Main.myPlayer);
                        npc.velocity = Vector2.Zero;
                        npc.ai[2]    = 0;
                        npc.ai[3]    = 0;
                    }

                    UpdateFrame(20, 6, 16);
                }
            }
            CheckPlatform();
        }
Ejemplo n.º 16
0
 public override void OnConsumeAmmo(Player player) => Gore.NewGorePerfect(player.Center, 2 * (-Vector2.UnitY * Main.rand.NextFloat(2, 3) - Vector2.UnitX * player.direction).RotatedByRandom(MathHelper.Pi / 16),
                                                                          mod.GetGoreSlot("Gores/DrainedLunazoa"), Main.rand.NextFloat(0.5f, 0.8f));