예제 #1
0
 public override void AI()
 {
     if (projectile.frameCounter == 0)
     {
         projectile.rotation = Main.rand.NextFloat(6.28f);
         for (int i = 0; i < 8; i++)
         {
             Vector2 vel = (projectile.rotation + 3.14f).ToRotationVector2() * 5;
             vel.Normalize();
             vel  = vel.RotatedBy(Main.rand.NextFloat(-0.5f, 0.5f));
             vel *= Main.rand.NextFloat(2, 5);
             ImpactLine line = new ImpactLine(Main.npc[(int)projectile.ai[0]].Center - (vel * 5), vel, Color.Red, new Vector2(0.25f, Main.rand.NextFloat(0.75f, 1.75f)), 70);
             line.TimeActive = 30;
             ParticleHandler.SpawnParticle(line);
         }
     }
     projectile.Center   = Main.npc[(int)projectile.ai[0]].Center;
     projectile.velocity = Vector2.Zero;
     projectile.frameCounter++;
     if (projectile.frameCounter % 5 == 0)
     {
         projectile.frame++;
     }
     if (projectile.frame >= Main.projFrames[projectile.type])
     {
         projectile.active = false;
     }
 }
예제 #2
0
        public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
        {
            for (int i = 0; i < 8; i++)
            {
                Vector2 vel = Vector2.Zero - projectile.velocity;
                vel.Normalize();
                vel  = vel.RotatedBy(Main.rand.NextFloat(-0.5f, 0.5f));
                vel *= Main.rand.NextFloat(2, 5);
                ImpactLine line = new ImpactLine(target.Center - (vel * 10), vel, new Color(48, 255, 176), new Vector2(0.25f, Main.rand.NextFloat(0.75f, 1.75f)), 70);
                line.TimeActive = 30;
                ParticleHandler.SpawnParticle(line);
            }

            for (int j = 0; j < 7; j++)
            {
                Vector2 vel      = Vector2.Zero - projectile.velocity.RotatedBy(Main.rand.NextFloat(-0.3f, 0.3f)) * 0.25f;
                int     timeLeft = Main.rand.Next(40, 100);

                StarParticle particle = new StarParticle(
                    projectile.Center + Main.rand.NextVector2Circular(10, 10) - (vel * 5),
                    vel + Main.rand.NextVector2Circular(3, 3),
                    new Color(48, 255, 176),
                    Main.rand.NextFloat(0.1f, 0.2f),
                    timeLeft);
                particle.TimeActive = (uint)(timeLeft / 2);
                ParticleHandler.SpawnParticle(particle);
            }

            if (!target.GetGlobalNPC <ArtemisGNPC>().artemisMarked)
            {
                Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType <ArtemisCrescent>(), 0, 0, projectile.owner, target.whoAmI);
            }
            target.GetGlobalNPC <ArtemisGNPC>().artemisMarked = true;
            target.GetGlobalNPC <ArtemisGNPC>().artemisTicker = 180;
        }
예제 #3
0
        public override void AI()
        {
            Player player = Main.player[projectile.owner];

            player.ChangeDir(Main.MouseWorld.X > player.position.X ? 1 : -1);

            player.itemTime      = 5;        // Set item time to 5 frames while we are used
            player.itemAnimation = 5;        // Set item animation time to 5 frames while we are used
            projectile.Center    = player.Center;
            player.heldProj      = projectile.whoAmI;

            direction = Main.MouseWorld - player.Center;
            direction.Normalize();

            if (frame < NUMBEROFFRAMES)
            {
                frameCounter++;
                if (frameCounter >= FRAMETIME)
                {
                    frameCounter = 0;
                    frame++;
                    projectile.frame++;
                }
            }

            if (Firing)
            {
                shootCounter++;
                if (shootCounter % SHOOTTIME == 0 && projectile.timeLeft > 30)
                {
                    Main.PlaySound(new Terraria.Audio.LegacySoundStyle(2, 20).WithPitchVariance(0.2f), projectile.Center);

                    offsetAngle += SPREAD;
                    Projectile proj = Projectile.NewProjectileDirect(projectile.Center, direction.RotatedBy(offsetAngle) * 20, ModContent.ProjectileType <ArtemisHuntVolley>(), projectile.damage, projectile.knockBack, projectile.owner);

                    ImpactLine line = new ImpactLine(projectile.Center - (direction.RotatedBy(offsetAngle) * 50), direction.RotatedBy(offsetAngle) * 4, new Color(125, 255, 253), new Vector2(0.25f, 2f), 70);
                    line.TimeActive = 30;
                    ParticleHandler.SpawnParticle(line);

                    shots--;
                    if (shots <= 0)
                    {
                        projectile.timeLeft = 30;
                    }
                }
                direction = direction.RotatedBy(offsetAngle);
            }
            else
            {
            }

            player.itemRotation = direction.ToRotation();
            if (player.direction != 1)
            {
                player.itemRotation -= 3.14f;
            }
        }
예제 #4
0
        public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
        {
            if (Main.rand.NextBool(3))
            {
                target.AddBuff(BuffID.Frostburn, 240);
            }

            for (int i = 0; i < 2; i++)
            {
                ImpactLine line = new ImpactLine(target.Center, new Vector2(projectile.velocity.X * .65f, Main.rand.NextFloat(-.5f, .5f)), Color.Lerp(White, Blue, Main.rand.NextFloat()), new Vector2(0.25f, Main.rand.NextFloat(0.4f, .55f) * 1.5f), 70);
                line.TimeActive = 30;
                ParticleHandler.SpawnParticle(line);
            }
        }
예제 #5
0
        public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
        {
            int cooldown = 20;

            projectile.localNPCImmunity[target.whoAmI] = 20;
            target.immune[projectile.owner]            = cooldown;

            for (int i = 0; i < 8; i++)
            {
                Vector2 vel = Main.rand.NextFloat(6.28f).ToRotationVector2() * 4;
                vel.Normalize();
                vel  = vel.RotatedBy(Main.rand.NextFloat(-0.5f, 0.5f));
                vel *= Main.rand.NextFloat(2, 5);
                ImpactLine line = new ImpactLine(target.Center - (vel * 5), vel, Color.Purple, new Vector2(0.25f, Main.rand.NextFloat(0.75f, 1.75f)), 70);
                line.TimeActive = 30;
                ParticleHandler.SpawnParticle(line);
            }
        }
예제 #6
0
        public override void AI()
        {
            projectile.Center = player.Center;

            if (!player.GetModPlayer <MyPlayer>().AnimeSword)
            {
                projectile.active = false;
            }
            else
            {
                for (int i = 0; i < 3; i++)
                {
                    ImpactLine line = new ImpactLine(projectile.Center + Main.rand.NextVector2Circular(90, 90), Vector2.Normalize(player.velocity) * 0.5f, Color.Lerp(Color.Orange, Color.OrangeRed, Main.rand.NextFloat()), new Vector2(0.25f, Main.rand.NextFloat(0.5f, 1.5f)) * 5, 60);
                    line.TimeActive = 30;
                    ParticleHandler.SpawnParticle(line);
                }
            }
        }
예제 #7
0
        public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
        {
            if (Slam)
            {
                crit = true;
            }
            if (Collision.CheckAABBvAABBCollision(target.position, target.Size, projectile.position, projectile.Size))
            {
                damage = (int)(damage * 1.5f);
                for (int i = 0; i < 8; i++)
                {
                    Vector2 vel = Main.rand.NextFloat(6.28f).ToRotationVector2();
                    vel *= Main.rand.NextFloat(2, 5);
                    ImpactLine line = new ImpactLine(target.Center - (vel * 10), vel, Color.Green, new Vector2(0.25f, Main.rand.NextFloat(0.75f, 1.75f) * 1.5f), 70);
                    line.TimeActive = 30;
                    ParticleHandler.SpawnParticle(line);
                }
                float progress = Timer / SwingTime;                 //How far the projectile is through its swing
                if (Slam)
                {
                    progress = EaseFunction.EaseCubicInOut.Ease(progress);
                }

                if (Slam && progress > 0.4f && progress < 0.6f)
                {
                    if (Owner.GetModPlayer <MyPlayer>().Shake < 5)
                    {
                        Owner.GetModPlayer <MyPlayer>().Shake += 5;
                    }
                    for (int j = 0; j < 14; j++)
                    {
                        int timeLeft = Main.rand.Next(20, 40);

                        StarParticle particle = new StarParticle(
                            target.Center,
                            Main.rand.NextVector2Circular(10, 7),
                            Color.Lerp(new Color(106, 255, 35), new Color(18, 163, 85), Main.rand.NextFloat()),
                            Main.rand.NextFloat(0.15f, 0.3f),
                            timeLeft);
                        ParticleHandler.SpawnParticle(particle);
                    }
                }
            }
        }
예제 #8
0
        public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
        {
            for (int i = 0; i < 6; i++)
            {
                Vector2 vel = Vector2.Zero - projectile.velocity;
                vel.Normalize();
                vel  = vel.RotatedBy(Main.rand.NextFloat(-0.5f, 0.5f));
                vel *= Main.rand.NextFloat(2, 5);
                ImpactLine line = new ImpactLine(target.Center - (vel * 10), vel, Main.rand.NextBool() ? new Color(125, 255, 253) : new Color(48, 255, 176), new Vector2(0.25f, Main.rand.NextFloat(0.5f, 1.5f)), 70);
                line.TimeActive = 30;
                ParticleHandler.SpawnParticle(line);
            }

            for (int j = 0; j < 10; j++)
            {
                Vector2 vel      = Vector2.Zero - projectile.velocity.RotatedBy(Main.rand.NextFloat(-0.3f, 0.3f)) * 0.25f;
                int     timeLeft = Main.rand.Next(40, 100);

                StarParticle particle = new StarParticle(
                    projectile.Center + Main.rand.NextVector2Circular(10, 10) - (vel * 5),
                    vel + Main.rand.NextVector2Circular(3, 3),
                    new Color(48, 255, 176),
                    Main.rand.NextFloat(0.1f, 0.2f),
                    timeLeft);
                particle.TimeActive = (uint)(timeLeft / 2);
                ParticleHandler.SpawnParticle(particle);
            }
            StarParticle particle2 = new StarParticle(
                projectile.Center,
                Vector2.Zero,
                Color.White,
                0.6f,
                20);

            ParticleHandler.SpawnParticle(particle2);
        }
예제 #9
0
        public override void AI()
        {
            Player player = Main.player[projectile.owner];

            projectile.Center = player.Center;

            if (player.channel && projectile.timeLeft > 237)
            {
                player.heldProj      = projectile.whoAmI;
                player.itemTime      = 5;
                player.itemAnimation = 5;
                projectile.timeLeft  = 240;
                charge++;

                if (charge < 40)
                {
                    charge++;
                }

                if (charge == 40)
                {
                    startPos  = player.Center;
                    direction = Main.MouseWorld - (player.Center);
                    direction.Normalize();
                    direction *= DISTANCE;
                    endPos     = player.Center + direction;
                    Main.PlaySound(SpiritMod.Instance.GetLegacySoundSlot(SoundType.Custom, "Sounds/slashdash").WithPitchVariance(0.4f).WithVolume(0.4f), projectile.Center);
                    SpiritMod.primitives.CreateTrail(new DragonPrimTrail(projectile));
                    oldCenter = player.Center;
                }

                if (charge > 40 && charge < MAXCHARGE)
                {
                    float progress = (charge - 41) / (float)(MAXCHARGE - 41);
                    progress = EaseFunction.EaseCircularInOut.Ease(progress);

                    float nextProgress = (charge - 40) / (float)(MAXCHARGE - 41);
                    nextProgress = EaseFunction.EaseCircularInOut.Ease(nextProgress);

                    var nextPoint = Vector2.Lerp(startPos, endPos, nextProgress);

                    var currentPoint = Vector2.Lerp(startPos, endPos, progress);

                    float oldSpeed = player.velocity.Length();
                    if (oldSpeed > 2)
                    {
                        for (int i = 0; i < oldSpeed / 7f; i++)
                        {
                            var line = new ImpactLine(Vector2.Lerp(oldCenter, projectile.Center, Main.rand.NextFloat()) + Main.rand.NextVector2Circular(35, 35), Vector2.Normalize(player.velocity) * 0.5f, Color.Lerp(Color.Green, Color.LightGreen, Main.rand.NextFloat()), new Vector2(0.25f, Main.rand.NextFloat(0.5f, 1.5f)) * 3, 60);
                            line.TimeActive = 30;
                            ParticleHandler.SpawnParticle(line);
                        }
                    }

                    player.velocity = nextPoint - currentPoint;

                    player.GetModPlayer <MyPlayer>().AnimeSword      = true;
                    player.GetModPlayer <DragonPlayer>().DrawSparkle = true;

                    oldCenter = player.Center;
                }
                if (charge == MAXCHARGE)
                {
                    player.GetModPlayer <MyPlayer>().AnimeSword = false;
                    player.velocity = Vector2.Zero;
                    projectile.Kill();
                }
            }
            else
            {
                if (charge > 40 && charge < MAXCHARGE)
                {
                    player.GetModPlayer <MyPlayer>().AnimeSword = false;
                    player.velocity = Vector2.Zero;
                }
                projectile.Kill();
            }
        }