示例#1
0
        protected virtual void Attack()
        {
            npc.velocity = Vector2.Zero;
            if (npc.frameCounter < 1)
            {
                shot = false;
            }

            if (npc.frameCounter > 2 && !shot)
            {
                int glyphnum = Main.rand.Next(10);
                DustHelper.DrawDustImage(npc.Center, 6, 0.05f, "SpiritMod/Effects/Glyphs/Glyph" + glyphnum, 1.5f);
                int proj = Projectile.NewProjectile(npc.Center, npc.velocity, ModContent.ProjectileType <AutomataCreeperProj>(), Main.expertMode ? 40 : 60, 4, npc.target, npc.ai[0], npc.ai[1]);
                if (Main.projectile[proj].modProjectile is AutomataCreeperProj modproj)
                {
                    modproj.moveDirection = moveDirection;
                }

                shot = true;

                if (Main.netMode == NetmodeID.MultiplayerClient)
                {
                    NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI);
                    NetMessage.SendData(MessageID.SyncProjectile, -1, -1, null, proj);
                }
            }
        }
        public override void ExplodeEffect()
        {
            Main.PlaySound(new LegacySoundStyle(soundId: SoundID.Item, style: 14).WithPitchVariance(0.1f), projectile.Center);
            DustHelper.DrawDustImage(projectile.Center, ModContent.DustType <WinterbornDust>(), 0.3f, "SpiritMod/Effects/Snowflakes/Flake" + Main.rand.Next(3), 0.4f);
            float rot = Main.rand.NextFloat(MathHelper.TwoPi);

            for (int i = 0; i < 8; i++)
            {
                DustHelper.DrawDustImage(projectile.Center + (Vector2.UnitX.RotatedBy(rot + (MathHelper.TwoPi * i / 8f)) * 60), ModContent.DustType <WinterbornDust>(), 0.15f, "SpiritMod/Effects/Snowflakes/Flake" + Main.rand.Next(3), 0.25f, rot: Main.rand.NextFloat(MathHelper.TwoPi));
            }

            for (int i = 0; i < 30; i++)
            {
                float   maxDist = 100;
                float   Dist    = Main.rand.NextFloat(maxDist);
                Vector2 offset  = Main.rand.NextVector2Unit();
                ParticleHandler.SpawnParticle(new SmokeParticle(projectile.Center + (offset * Dist), Main.rand.NextFloat(5f) * offset * (1 - (Dist / maxDist)), new Color(30, 30, 90) * 0.5f, Main.rand.NextFloat(0.4f, 0.6f), 40));
            }

            for (int i = 0; i < 8; i++)
            {
                ParticleHandler.SpawnParticle(new FireParticle(projectile.Center, (projectile.velocity / 4) - (Vector2.UnitY.RotatedByRandom(MathHelper.PiOver2 * 3) * Main.rand.NextFloat(4)),
                                                               new Color(135, 253, 255), new Color(0, 21, 255), Main.rand.NextFloat(0.5f, 0.7f), 40, delegate(Particle particle)
                {
                    if (particle.Velocity.Y < 16)
                    {
                        particle.Velocity.Y += 0.12f;
                    }
                }));
            }
        }
示例#3
0
        public override void Kill(int timeLeft)
        {
            int sizeX = 120;
            int sizeY = 45;

            projectile.hostile     = false;
            projectile.tileCollide = false;
            projectile.alpha       = 255;
            projectile.position.X  = projectile.position.X + (float)(projectile.width / 2);
            projectile.position.Y  = projectile.position.Y + (float)(projectile.height / 2);
            projectile.width       = sizeX;
            projectile.height      = sizeY;
            projectile.position.X  = projectile.position.X - (float)(projectile.width / 2);
            projectile.position.Y  = projectile.position.Y - (float)(projectile.height / 2);
            projectile.Damage();
            Main.projectileIdentity[projectile.owner, projectile.identity] = -1;
            projectile.position.X = projectile.position.X + (float)(projectile.width / 2);
            projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2);
            projectile.width      = (int)((float)sizeX / 5.8f);
            projectile.height     = (int)((float)sizeY / 5.8f);
            projectile.position.X = projectile.position.X - (float)(projectile.width / 2);
            projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2);

            DustHelper.DrawDustImage(projectile.position, ModContent.DustType <MarbleDust>(), 0.075f, "SpiritMod/Effects/DustImages/Boom", 1.66f);
        }
示例#4
0
 public override void NearbyEffects(int i, int j, bool closer)
 {
     if (Main.rand.Next(1100) == 1)
     {
         int glyphnum = Main.rand.Next(10);
         DustHelper.DrawDustImage(new Vector2(i * 16, j * 16), ModContent.DustType <MarbleDust>(), 0.05f, "SpiritMod/Effects/Glyphs/Glyph" + glyphnum, 1f);
     }
 }
 public override void AI()
 {
     projectile.rotation = 0f;
     alphaCounter       += .095f;
     if (Main.rand.NextBool(15))
     {
         int glyphnum = Main.rand.Next(4);
         DustHelper.DrawDustImage(new Vector2(projectile.Center.X + Main.rand.Next(-30, 30), projectile.Center.Y + Main.rand.Next(-30, 30)), 130, 0.05f, "SpiritMod/Effects/DustImages/CimmerianGlyph" + glyphnum, 1f);
     }
     DoDustEffect(projectile.Center, 34f);
     sineAdd = (float)Math.Sin(alphaCounter) + 2;
     if (!chooseFrame)
     {
         chooseFrame      = true;
         projectile.frame = Main.rand.Next(0, 4);
     }
     projectile.velocity = Vector2.Zero;
 }
        public override bool UseItem(Player player)
        {
            if (player.GetSpiritPlayer().inMarble)
            {
                int w = NPC.FindFirstNPC(ModContent.NPCType <Oracle>());
                if (w != -1)
                {
                    var oracle = Main.npc[w].modNPC as Oracle;
                    oracle.Teleport  = 200;
                    oracle.TeleportX = player.Center.X;
                    oracle.TeleportY = player.Center.Y;

                    int glyphnum = Main.rand.Next(10);
                    DustHelper.DrawDustImage(new Vector2(player.Center.X, player.Center.Y - 25), ModContent.DustType <Dusts.MarbleDust>(), 0.05f, "SpiritMod/Effects/Glyphs/Glyph" + glyphnum, 1f);
                    Main.PlaySound(SoundID.DD2_DarkMageHealImpact, player.Center);


                    return(true);
                }
            }
            return(false);
        }
        public override void Kill(int timeLeft)
        {
            Vector2 vector9 = projectile.position;
            Vector2 value19 = (projectile.rotation - 1.57079637f).ToRotationVector2();

            vector9 += value19 * 16f;
            for (int num257 = 0; num257 < 24; num257++)
            {
                int newDust = Dust.NewDust(vector9, projectile.width, projectile.height, 180, 0f, 0f, 0, default(Color), 1.2f);
                Main.dust[newDust].position  = (Main.dust[newDust].position + projectile.Center) / 2f;
                Main.dust[newDust].velocity += value19 * 2f;
                Main.dust[newDust].velocity *= 0.5f;
                Main.dust[newDust].noGravity = true;
                vector9 -= value19 * 8f;
            }
            if (projectile.minion)
            {
                ProjectileExtras.Explode(projectile.whoAmI, 60, 60, delegate
                {
                    Main.PlaySound(new Terraria.Audio.LegacySoundStyle(3, 3));
                    {
                        for (int i = 0; i < 10; i++)
                        {
                            int num = Dust.NewDust(projectile.position, projectile.width, projectile.height, 180, 0f, -2f, 0, default(Color), 2f);
                            Main.dust[num].noGravity   = true;
                            Main.dust[num].position.X += Main.rand.Next(-50, 51) * .05f - 1.5f;
                            Main.dust[num].position.Y += Main.rand.Next(-50, 51) * .05f - 1.5f;
                            Main.dust[num].scale      *= .25f;
                            if (Main.dust[num].position != projectile.Center)
                            {
                                Main.dust[num].velocity = projectile.DirectionTo(Main.dust[num].position) * 6f;
                            }
                        }
                    }
                    DustHelper.DrawDustImage(projectile.Center, 226, 0.15f, "SpiritMod/Effects/DustImages/MoonSigil", 1f);
                }, true);
            }
        }
示例#8
0
 public override void Kill(int timeLeft)
 {
     ProjectileExtras.Explode(projectile.whoAmI, 60, 60, delegate
     {
         {
             Main.PlaySound(new Terraria.Audio.LegacySoundStyle(3, 3));
             {
                 for (int i = 0; i < 10; i++)
                 {
                     int num = Dust.NewDust(projectile.position, projectile.width, projectile.height, 226, 0f, -2f, 0, default(Color), 2f);
                     Main.dust[num].noGravity   = true;
                     Main.dust[num].position.X += Main.rand.Next(-50, 51) * .05f - 1.5f;
                     Main.dust[num].position.Y += Main.rand.Next(-50, 51) * .05f - 1.5f;
                     Main.dust[num].scale      *= .25f;
                     if (Main.dust[num].position != projectile.Center)
                     {
                         Main.dust[num].velocity = projectile.DirectionTo(Main.dust[num].position) * 6f;
                     }
                 }
             }
             DustHelper.DrawDustImage(projectile.Center, 226, 0.25f, "SpiritMod/Effects/DustImages/MoonSigil2", 1f);
         }
     }, true);
 }
示例#9
0
        public override bool PreAI()
        {
            bool expertMode = Main.expertMode;

            npc.TargetClosest(true);
            npc.velocity.X = npc.velocity.X * 0.93f;
            if (npc.velocity.X > -0.1F && npc.velocity.X < 0.1F)
            {
                npc.velocity.X = 0;
            }
            if (npc.ai[0] == 0)
            {
                npc.ai[0] = 500f;
            }

            if (npc.ai[2] != 0 && npc.ai[3] != 0)
            {
                // Teleport effects: away.
                Main.PlaySound(SoundID.Item, (int)npc.position.X, (int)npc.position.Y, 8);
                for (int index1 = 0; index1 < 50; ++index1)
                {
                    int newDust = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 187, 0.0f, 0.0f, 100, new Color(), 1.5f);
                    Main.dust[newDust].velocity *= 3f;
                    Main.dust[newDust].noGravity = true;
                }
                npc.position.X = (npc.ai[2] * 16 - (npc.width / 2) + 8);
                npc.position.Y = npc.ai[3] * 16f - npc.height;
                npc.velocity.X = 0.0f;
                npc.velocity.Y = 0.0f;
                npc.ai[2]      = 0.0f;
                npc.ai[3]      = 0.0f;
                // Teleport effects: arrived.
                Main.PlaySound(SoundID.Item, (int)npc.position.X, (int)npc.position.Y, 8);
                for (int index1 = 0; index1 < 50; ++index1)
                {
                    int newDust = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 187, 0.0f, 0.0f, 100, new Color(), 1.5f);
                    Main.dust[newDust].velocity *= 3f;
                    Main.dust[newDust].noGravity = true;
                }
            }

            ++npc.ai[0];

            if (npc.ai[0] == 100 || npc.ai[0] == 300)
            {
                npc.ai[1]     = 30f;
                npc.netUpdate = true;
            }

            bool teleport = false;

            // Teleport
            if (npc.ai[0] >= 500 && Main.netMode != NetmodeID.MultiplayerClient)
            {
                teleport = true;
            }

            if (teleport)
            {
                Teleport();
                npc.ai[0] = 1;
                npc.ai[1] = 0;
            }
            if (npc.ai[1] > 0)
            {
                --npc.ai[1];
                if (npc.ai[1] == 15)
                {
                    Main.PlaySound(SoundID.Item, (int)npc.position.X, (int)npc.position.Y, 8);
                    if (Main.netMode != NetmodeID.MultiplayerClient)
                    {
                        int amountOfProjectiles = 1;
                        int flakenum            = Main.rand.Next(3);
                        DustHelper.DrawDustImage(new Vector2(npc.Center.X, npc.Center.Y - 40), ModContent.DustType <WinterbornDust>(), 0.25f, "SpiritMod/Effects/Snowflakes/Flake" + flakenum, 1.33f);
                        for (int i = 0; i < amountOfProjectiles; ++i)
                        {
                            if (Main.rand.Next(2) == 0)
                            {
                                int somedamage = expertMode ? 15 : 30;
                                int p          = Projectile.NewProjectile(Main.player[npc.target].Center.X, Main.player[npc.target].Center.Y - 300, 0, 0, ModContent.ProjectileType <IceCloudHostile>(), somedamage, 1, Main.myPlayer, 0, 0);
                                Main.projectile[p].hostile     = true;
                                Main.projectile[p].friendly    = false;
                                Main.projectile[p].tileCollide = false;
                            }
                            else
                            {
                                Vector2 direction = Main.player[npc.target].Center - (npc.Center - new Vector2(0, 30));
                                direction.Normalize();
                                direction.X *= 4.9f;
                                direction.Y *= 4.9f;
                                int somedamage = expertMode ? 17 : 34;
                                int p          = Projectile.NewProjectile(npc.Center.X, npc.Center.Y - 30, direction.X, direction.Y, ProjectileID.IceBolt, somedamage, 1, Main.myPlayer, 0, 0);
                                Main.projectile[p].hostile     = true;
                                Main.projectile[p].friendly    = false;
                                Main.projectile[p].tileCollide = false;
                            }
                        }
                    }
                }
            }

            if (Main.rand.Next(3) == 0)
            {
                return(false);
            }
            Dust dust = Main.dust[Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + 2f), npc.width, npc.height, 187, npc.velocity.X * 0.2f, npc.velocity.Y * 0.2f, 100, new Color(), 0.9f)];

            dust.noGravity  = true;
            dust.velocity.X = dust.velocity.X * 0.3f;
            dust.velocity.Y = (dust.velocity.Y * 0.2f) - 1;

            return(false);
        }
示例#10
0
        public override bool PreAI()
        {
            Player player = Main.player[projectile.owner];

            if (player.channel && player.HasAmmo(player.inventory[player.selectedItem], true))
            {
                if (counter % 10 == 0)
                {
                    direction = Main.MouseWorld - (player.Center - new Vector2(4, 4));
                    direction.Normalize();
                    direction *= 5f;
                }

                if (counter == 45 || counter == 140)
                {
                    Main.PlaySound(SoundID.Item5, (int)projectile.position.X, (int)projectile.position.Y);
                    DustHelper.DrawDustImage(player.Center, 226, counter == 45 ? 0.11f : 0.18f, "SpiritMod/Effects/DustImages/MoonSigil", 1f);
                }

                player.itemTime      = 5;
                player.itemAnimation = 5;
                projectile.position  = player.Center + holdOffset;
                player.velocity.X   *= 0.97f;
                counter++;
            }
            else
            {
                if (player.HasAmmo(player.inventory[player.selectedItem], true))
                {
                    int   shoot    = 0;
                    float speed    = 0;
                    bool  canshoot = true;
                    player.PickAmmo(player.inventory[player.selectedItem], ref shoot, ref speed, ref canshoot, ref projectile.damage, ref projectile.knockBack, false);
                    if (counter < 45)
                    {
                        Main.PlaySound(SoundID.Item, projectile.Center, 96);
                        direction /= 2f;
                        int proj = Projectile.NewProjectile(player.Center - new Vector2(4, 4), direction * speed, shoot, 12, projectile.knockBack / 4, 0, projectile.owner);
                        Main.projectile[proj].GetGlobalProjectile <SpiritGlobalProjectile>().shotFromMaliwanShockCommon = true;
                    }
                    else if (counter >= 45 && counter < 140)
                    {
                        Main.PlaySound(new Terraria.Audio.LegacySoundStyle(2, 109));
                        direction *= 2.25f;
                        Projectile.NewProjectile(player.Center - new Vector2(4, 4), direction, ModContent.ProjectileType <MoonshotBulletLarge>(), (int)(projectile.damage / 4 * 3), 5, projectile.owner);
                    }
                    else if (counter > 140)
                    {
                        direction *= .8f;
                        Main.PlaySound(new Terraria.Audio.LegacySoundStyle(2, 109));
                        int proj = Projectile.NewProjectile(player.Center - new Vector2(4, 4), direction, mod.ProjectileType("SineBall"), projectile.damage / 3, projectile.knockBack * 0.25f, projectile.owner, 180);
                        int p1   = Projectile.NewProjectile(player.Center - new Vector2(4, 4), direction, mod.ProjectileType("SineBall"), projectile.damage / 3, projectile.knockBack * 0.25f, projectile.owner, 0, proj + 1);
                        Main.projectile[proj].hostile  = false;
                        Main.projectile[p1].hostile    = false;
                        Main.projectile[proj].friendly = true;
                        Main.projectile[p1].friendly   = true;
                        Main.projectile[proj].scale   *= .65f;
                        Main.projectile[p1].scale     *= .65f;
                        Main.projectile[proj].timeLeft = 120;
                        Main.projectile[p1].timeLeft   = 120;
                    }
                }
                projectile.active = false;
            }
            player.heldProj      = projectile.whoAmI;
            player.itemTime      = 2;
            player.itemAnimation = 2;
            return(true);
        }
示例#11
0
 public override void Kill(int timeLeft)
 {
     DustHelper.DrawDustImage(projectile.Center, 226, 0.15f, "SpiritMod/Effects/DustImages/MoonSigil3", 1f);
 }