Ejemplo n.º 1
0
 public override void TownNPCAttackProj(ref int projType, ref int attackDelay)
 {
     projType    = ModContent.ProjectileType <StarcrescentProjectile>();
     attackDelay = 1;
 }
Ejemplo n.º 2
0
 public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
 {
     if (Main.rand.NextBool(4))
     {
         int n         = Main.rand.Next(5, 6);
         int deviation = Main.rand.Next(0, 300);
         for (int i = 0; i < n; i++)
         {
             float   rotation       = MathHelper.ToRadians(270 / n * i + deviation);
             Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(rotation);
             perturbedSpeed.Normalize();
             perturbedSpeed.X *= 3.5f;
             perturbedSpeed.Y *= 3.5f;
             Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, ModContent.ProjectileType <ThornBowThorn>(), projectile.damage / 5 * 3, projectile.knockBack, projectile.owner);
         }
     }
 }
Ejemplo n.º 3
0
        public override void Kill(int timeLeft)
        {
            int n         = 6;
            int deviation = Main.rand.Next(0, 360);

            for (int i = 0; i < n; i++)
            {
                float   rotation       = MathHelper.ToRadians(270 / n * i + deviation);
                Vector2 perturbedSpeed = new Vector2(projectile.velocity.X, projectile.velocity.Y).RotatedBy(rotation);
                perturbedSpeed.Normalize();
                perturbedSpeed.X *= 5.5f;
                perturbedSpeed.Y *= 5.5f;
                Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, ModContent.ProjectileType <OmicronPin>(), projectile.damage, projectile.knockBack, projectile.owner);
            }

            Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14);
            projectile.position.X = projectile.position.X + (float)(projectile.width / 2);
            projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2);
            projectile.width      = 10;
            projectile.height     = 10;
            projectile.position.X = projectile.position.X - (float)(projectile.width / 2);
            projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2);

            for (int num621 = 0; num621 < 20; num621++)
            {
                int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 87, 0f, 0f, 100, default(Color));
                Main.dust[num622].velocity *= 3f;
                if (Main.rand.Next(2) == 0)
                {
                    Main.dust[num622].scale  = 0.5f;
                    Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
                }
            }
            for (int num623 = 0; num623 < 35; num623++)
            {
                int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 87, 0f, 0f, 100, default(Color));
                Main.dust[num624].noGravity = true;
                Main.dust[num624].velocity *= 5f;
                num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 87, 0f, 0f, 100, default(Color));
                Main.dust[num624].velocity *= 2f;
            }

            projectile.position.X = projectile.position.X + (float)(projectile.width / 2);
            projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2);
            projectile.width      = 10;
            projectile.height     = 10;
            projectile.position.X = projectile.position.X - (float)(projectile.width / 2);
            projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2);
        }
Ejemplo n.º 4
0
 public override void Kill(int timeLeft)
 {
     for (int i = 0; i < 6; ++i)
     {
         Vector2 targetDir = ((((float)Math.PI * 2) / 6) * i).ToRotationVector2();
         targetDir.Normalize();
         targetDir *= 7;
         Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, targetDir.X, targetDir.Y, ModContent.ProjectileType <GodHomingProj>(), projectile.damage, 0.5f, Main.myPlayer);
     }
     Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 94);
 }
Ejemplo n.º 5
0
 public override bool OnTileCollide(Vector2 oldVelocity)
 {
     if (Main.myPlayer == projectile.owner)
     {
         Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0, 0, ModContent.ProjectileType <HadesGeyser>(), projectile.damage, 3f, Main.myPlayer);
     }
     projectile.Kill();
     return(false);
 }
Ejemplo n.º 6
0
        public override void AI()
        {
            // Consistently update the worm
            if ((int)Main.time % 120 == 0)
            {
                projectile.netUpdate = true;
            }

            if (projectile.ai[1] == 1f)
            {
                projectile.ai[1]     = 0f;
                projectile.netUpdate = true;
            }

            float segmentAheadRotation;

            // This, and Size will likely need to be changed based on the sprite size of the segment
            float travelFactor = 108f;

            Vector2 segmentAheadCenter;
            int     byUUID = Projectile.GetByUUID(projectile.owner, (int)projectile.ai[0]);

            // Verify the projectile we specified as the segment ahead is a part of this worm, and exists
            if (byUUID >= 0 && Main.projectile[byUUID].active &&
                (Main.projectile[byUUID].type == ModContent.ProjectileType <DogBody>()) ||
                Main.projectile[byUUID].type == ModContent.ProjectileType <DogHead>())
            {
                segmentAheadCenter   = Main.projectile[byUUID].Center;
                segmentAheadRotation = Main.projectile[byUUID].rotation;

                // Define the localAI[0] (i.e segment behind) of the segment ahead as this segment
                Main.projectile[byUUID].localAI[0] = projectile.localAI[0] + 1f;

                // If this is a tail, and the UUID projectile is a head, kill the tail and head
                if (Main.projectile[byUUID].type == ModContent.ProjectileType <DogHead>() &&
                    projectile.type == ModContent.ProjectileType <DogTail>())
                {
                    Main.projectile[byUUID].Kill();
                    projectile.Kill();
                    return;
                }
            }
            // Otherwise, kill the segment and ignore the rest of the code
            else
            {
                projectile.Kill();
                return;
            }
            projectile.velocity = Vector2.Zero;
            Vector2 vectorToAhead = segmentAheadCenter - projectile.Center;

            if (segmentAheadRotation != projectile.rotation)
            {
                // Fix the angle between -pi and pi (wraps back over if one of the bounds are reached)
                float deltaAngle = MathHelper.WrapAngle(segmentAheadRotation - projectile.rotation);
                vectorToAhead = vectorToAhead.RotatedBy(deltaAngle * 0.1f);
            }
            projectile.rotation = vectorToAhead.ToRotation() + MathHelper.PiOver2;
            projectile.position = projectile.Center;

            // If scale is not 1, adjust the width and height based on that too
            projectile.width  = projectile.height = Size;
            projectile.Center = projectile.position;

            // Adjust the position of this segment relative to the one ahead
            if (vectorToAhead != Vector2.Zero)
            {
                projectile.Center = segmentAheadCenter - Vector2.Normalize(vectorToAhead) * travelFactor;
            }
            projectile.spriteDirection = (vectorToAhead.X > 0f).ToDirectionInt();

            Player         player    = Main.player[projectile.owner];
            CalValEXPlayer modPlayer = player.GetModPlayer <CalValEXPlayer>();

            if (modPlayer.voreworm)
            {
                projectile.timeLeft = 2;
            }
        }
Ejemplo n.º 7
0
        public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
        {
            Vector2 muzzleOffset = Vector2.Normalize(new Vector2(speedX, speedY)) * 25f;

            if (Collision.CanHit(position, 0, 0, position + muzzleOffset, 0, 0))
            {
                position   += muzzleOffset;
                position.Y += -14;
            }
            float mySpeedX = Main.mouseX + Main.screenPosition.X - position.X;
            float mySpeedY = Main.mouseY + Main.screenPosition.Y - position.Y;
            float speedAbs = (float)Math.Sqrt((mySpeedX * mySpeedX) + (mySpeedY * mySpeedY));

            speedAbs  = 7f / speedAbs; // for speed consistency
            mySpeedX *= speedAbs;
            mySpeedY *= speedAbs;
            Projectile.NewProjectile(new Vector2(position.X, position.Y), new Vector2(mySpeedX, mySpeedY), ModContent.ProjectileType <Projectiles.SoulArrow>(), damage, knockBack, player.whoAmI);

            return(false);
        }
Ejemplo n.º 8
0
        public override bool Shoot(Item item, Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
        {
            var accPlayer = player.GetModPlayer <ACCPlayer>();

            if (accPlayer.spellbladeToggle && item.melee)
            {
                Vector2 vel = Main.MouseWorld - player.position;
                vel.Normalize();
                vel *= 15;

                Projectile.NewProjectile(player.Center.X, player.position.Y, vel.X, vel.Y, ModContent.ProjectileType <Projectiles.Spellblade.Blade>(), accPlayer.magicBladeBaseDamage, 1, player.whoAmI);
            }
            return(base.Shoot(item, player, ref position, ref speedX, ref speedY, ref type, ref damage, ref knockBack));
        }
Ejemplo n.º 9
0
        public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
        {
            Vector2 muzzleOffset = Vector2.Normalize(new Vector2(speedX, speedY)) * 45.0f;

            if (Collision.CanHit(position, 0, 0, position + muzzleOffset, 0, 0))
            {
                position += muzzleOffset;
            }
            if (player.Center.X < Main.mouseX + (double)Main.screenPosition.X)
            {
                player.direction = 1;
            }
            else
            {
                player.direction = -1;
            }
            for (int k = 0; k < Main.rand.Next(2, 4); k++)
            {
                Projectile.NewProjectile(player.Center.X + -40 * player.direction + Main.rand.Next(-20, 21), player.Center.Y - Main.rand.Next(-20, 40), speedX / 2.0f, speedY / 2.0f, ModContent.ProjectileType <CrystalEnergy>(), (int)((item.damage * (double)player.rangedDamage) / 1.5f), 4.0f, player.whoAmI, 0.0f, 0.0f);
            }
            return(true);
        }
Ejemplo n.º 10
0
        public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
        {
            Vector2 muzzleOffset = Vector2.Normalize(new Vector2(speedX, speedY)) * 25f;

            if (Collision.CanHit(position, 0, 0, position + muzzleOffset, 0, 0))
            {
                position += muzzleOffset;
            }
            int numberProjectiles = 2;

            for (int i = 0; i < numberProjectiles; i++)
            {
                Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedByRandom(MathHelper.ToRadians(2));
                float   scale          = 1f - (Main.rand.NextFloat() * .3f);
                perturbedSpeed = perturbedSpeed * scale;
                if (type == ProjectileID.SnowBallFriendly)
                {
                    Projectile.NewProjectile(position.X, position.Y, perturbedSpeed.X, perturbedSpeed.Y, ModContent.ProjectileType <FrostballProjectile>(), damage, knockBack, player.whoAmI);
                }
                else
                {
                    Projectile.NewProjectile(position.X, position.Y, perturbedSpeed.X, perturbedSpeed.Y, type, damage, knockBack, player.whoAmI);
                }
            }
            return(false);
        }
Ejemplo n.º 11
0
        public override bool UseItem(Item item, Player player)
        {
            var accPlayer = player.GetModPlayer <ACCPlayer>();

            if (accPlayer.spellbladeToggle && player.itemAnimation == item.useAnimation && item.melee && item.axe <= 0 && item.pick <= 0 && item.hammer <= 0)
            {
                Vector2 vel = Main.MouseWorld - player.position;
                vel.Normalize();
                vel *= 15;

                Projectile.NewProjectile(player.Center.X, player.position.Y, vel.X, vel.Y, ModContent.ProjectileType <Projectiles.Spellblade.Blade>(), accPlayer.magicBladeBaseDamage, 1, player.whoAmI);
                return(true);
            }
            else
            {
                return(base.UseItem(item, player));
            }
        }
Ejemplo n.º 12
0
 public override void AI()
 {
     projectile.rotation = projectile.velocity.ToRotation();
     timer++;
     if (timer % 5 == 0)
     {
         Vector2 offset = new Vector2(0, -500);
         Projectile.NewProjectile(projectile.Center + offset, new Vector2(0 + ((float)Main.rand.Next(20) / 10) - 1, -3 + ((float)Main.rand.Next(20) / 10) - 1), ModContent.ProjectileType <HailIcicle>(), 6, 1f, Main.myPlayer);
     }
 }
Ejemplo n.º 13
0
 public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
 {
     for (int num842 = 0; num842 < 3; num842++)
     {
         Vector2 vector82 = new Vector2(speedX, speedY);
         float   ai       = Main.rand.Next(100);
         Vector2 vector83 = Vector2.Normalize(vector82.RotatedByRandom(0.6)) * 14f;
         Projectile.NewProjectile(position.X, position.Y, vector83.X * 2, vector83.Y * 2, ModContent.ProjectileType <Projectiles.Zero.ZeroTaze>(), damage, 0f, Main.myPlayer, vector82.ToRotation(), ai);
     }
     return(false);
 }
Ejemplo n.º 14
0
        public override bool PreAI()
        {
            projectile.timeLeft = 50;
            int rightValue = (int)projectile.ai[1];

            if (rightValue < (double)Main.projectile.Length && rightValue != 0)
            {
                Projectile other = Main.projectile[rightValue];
                if (other.active)
                {
                    //rotating
                    direction9 = other.Center - projectile.Center;
                    int distance = (int)Math.Sqrt((direction9.X * direction9.X) + (direction9.Y * direction9.Y));
                    direction9.Normalize();
                    projectile.rotation = direction9.ToRotation();
                    other.ai[1]         = projectile.whoAmI;
                    //shoot to other guy
                    timer++;
                    if (timer > 3 && distance < 500)
                    {
                        timer = 0;
                        int proj = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)direction9.X * 30, (float)direction9.Y * 30, ModContent.ProjectileType <GateLaser>(), 27, 1, Main.myPlayer);
                        Main.projectile[proj].timeLeft = (int)(distance / 30) - 1;
                    }
                }
            }
            return(true);
        }
Ejemplo n.º 15
0
        public override void AI()
        {
            bitherial = true;
            Dust.NewDust(npc.position + npc.velocity, npc.width, npc.height, 127, 0f, 0f);

            //DESPAWN
            int despawn = 0;

            if (!Main.player[npc.target].active || Main.player[npc.target].dead || Main.player[npc.target].statLife < 1 || Main.player[npc.target].ZoneRockLayerHeight == false)
            {
                npc.TargetClosest(true);
                if (!Main.player[npc.target].active || Main.player[npc.target].dead || Main.dayTime)
                {
                    if (despawn == 0)
                    {
                        despawn++;
                    }
                }
            }
            if (despawn >= 1 || andio)
            {
                despawn++;
                //ResetValues();
                npc.noTileCollide = true;
                npc.velocity.Y    = 8f;
                if (despawn >= 300)
                {
                    npc.active = false;
                }
            }

            Vector2 delta     = Main.player[npc.target].Center - npc.Center;
            float   magnitude = (float)Math.Sqrt(delta.X * delta.X + delta.Y * delta.Y);

            npc.netUpdate = true;

            npc.ai[0] -= 3.14f / 120;

            //Disabling if AnDio is on
            if (NPC.CountNPCS(ModContent.NPCType <AnDio3>()) > 0 || NPC.CountNPCS(ModContent.NPCType <AnDio2>()) > 0 || NPC.CountNPCS(ModContent.NPCType <AnDio1>()) > 0)
            {
                npc.active = false;
            }

            //Movement if only Dioritus
            //if (NPC.CountNPCS(ModContent.NPCType<Andesia>()) == 0)
            {
                //Checking if it should initiate phase 3 already
                if (LaugicalityWorld.downedAndesia && LaugicalityWorld.downedDioritus && NPC.CountNPCS(ModContent.NPCType <Andesia>()) == 0 && Main.netMode != 1)
                {
                    int and = NPC.NewNPC((int)npc.Center.X, (int)npc.position.Y + npc.height, ModContent.NPCType <Andesia>());
                    Main.npc[and].ai[3] = npc.whoAmI;
                }
                //Checking which direction to move when spawned
                if (dir == 0)
                {
                    if (delta.X < 0)
                    {
                        dir = 1;
                    }
                    else
                    {
                        dir = -1;
                    }
                }

                //Moving across top of screen
                if (moveType == 1)
                {
                    attacking = false;
                    //Horizontal Movement
                    npc.velocity.X = accel;
                    if (npc.position.X < Main.player[npc.target].position.X - 400 && hovDir == -1)
                    {
                        hovDir = 1;
                    }
                    if (npc.position.X > Main.player[npc.target].position.X + 400 && hovDir == 1)
                    {
                        hovDir = -1;
                    }
                    if (Math.Abs(accel) < maxAccel)
                    {
                        accel += (float)hovDir / 4f;
                    }
                    else
                    {
                        accel *= .9f;
                    }

                    //Vertical Movement
                    npc.velocity.Y = vaccel;
                    if (npc.position.Y - Main.player[npc.target].position.Y + 280 > 0)
                    {
                        vDir = -1;
                    }
                    if (npc.position.Y - Main.player[npc.target].position.Y + 280 < 0)
                    {
                        vDir = 1;
                    }
                    if (Math.Abs(vaccel) < maxVaccel / 4)
                    {
                        vaccel += (float)vDir / 3f;
                    }
                    else
                    {
                        vaccel *= .2f;
                    }
                    npc.velocity.Y = vaccel;
                    if (boosted == false)
                    {
                        if (Math.Abs(npc.position.Y - Main.player[npc.target].position.Y + 280) > 20)
                        {
                            if (npc.position.Y - Main.player[npc.target].position.Y + 280 < 0)
                            {
                                if (vaccel < maxVaccel)
                                {
                                    vaccel += .4f;
                                }
                            }
                            if (npc.position.Y - Main.player[npc.target].position.Y + 280 > 0)
                            {
                                if (vaccel < maxVaccel)
                                {
                                    vaccel -= .4f;
                                }
                            }
                        }
                        else
                        {
                            if (Math.Abs(vaccel) > .01f)
                            {
                                vaccel *= .5f;
                            }
                            else
                            {
                                vaccel = 0f;
                            }
                        }
                    }
                    else
                    {
                        vaccel = 0;
                    }

                    //Smash Attack
                    if (Math.Abs(delta.X) < 10 && attacks >= 8 && moveType == 1)
                    {
                        attacks        = 0;
                        moveType       = 2;
                        npc.velocity.X = 0;
                        npc.velocity.Y = 0;
                    }
                }

                if (moveType == 2)
                {
                    attacking      = true;
                    npc.velocity.Y = 14;
                    npc.velocity.X = 0;
                    vaccel         = 0;
                    accel          = 0;
                    if (npc.position.Y - Main.player[npc.target].position.Y > 280)
                    {
                        moveType = 1;
                    }
                }
            }

            /*else if(Main.player[npc.target].statLife > 0)
             * {
             *  reload = 320;
             *  int mag = 320;
             *  double targetX = Main.player[npc.target].position.X + mag * Math.Cos(npc.ai[0] + 3.14) - npc.width / 2;
             *  double targetY = Main.player[npc.target].position.Y + mag * Math.Sin(npc.ai[0] + 3.14);
             *  //npc.position.X = (float)targetX;
             *  //npc.position.Y = (float)targetY;
             *  distance = (float)Math.Sqrt((targetX - npc.position.X) * (targetX - npc.position.X) + (targetY - npc.position.Y) * (targetY - npc.position.Y));
             *  tVel = distance / 10;
             *
             *  if (vel < tVel)
             *  {
             *      vel += .1f;
             *      vel *= 1.05f;
             *  }
             *  if (vel > tVel)
             *  {
             *      vel = tVel;
             *  }
             *  npc.velocity.X = (float)Math.Abs((npc.position.X - targetX) / distance * vel);
             *  if (targetX < npc.position.X)
             *      npc.velocity.X *= -1;
             *  npc.velocity.Y = (float)Math.Abs((npc.position.Y - targetY) / distance * vel);
             *  if (targetY < npc.position.Y)
             *      npc.velocity.Y *= -1;
             * }*/


            //Attacks
            delay--;
            if (delay <= 0)
            {
                delay = reload;
                shoot = Main.rand.Next(1, 5);
            }
            if (shoot == 1 && Main.netMode != 1)//Homing Ball
            {
                shoot = 0;
                Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0, 0, ModContent.ProjectileType <DioEnergyHoming>(), damage / 2, 3, Main.myPlayer);
            }
            if (shoot == 2 && Main.netMode != 1)//Split Ball
            {
                shoot = 0;
                Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0, 0, ModContent.ProjectileType <DioEnergy>(), damage / 2, 3, Main.myPlayer);
            }
            if (shoot == 3 && Main.netMode != 1)
            {
                Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0, 0, ModContent.ProjectileType <DioBallShot>(), damage / 2, 3f, Main.myPlayer);
                shoot          = 0;
                attackDuration = 1;
            }

            if (attackDuration == 30 && Main.netMode != 1)
            {
                Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0, 0, ModContent.ProjectileType <DioBallShot>(), damage / 2, 3f, Main.myPlayer);
            }
            if (attackDuration == 60 && Main.netMode != 1)
            {
                Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0, 0, ModContent.ProjectileType <DioBallShot>(), damage / 2, 3f, Main.myPlayer);
            }
            if (attackDuration == 90 && Main.netMode != 1)
            {
                Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0, 0, ModContent.ProjectileType <DioBallShot>(), damage / 2, 3f, Main.myPlayer);
            }
            if (attackDuration > 0)
            {
                attackDuration++;
            }
            if (attackDuration > 90)
            {
                attackDuration = 0;
            }
            if (shoot == 4 && Main.netMode != 1)//Split Ball
            {
                int rng     = 480;
                int yHeight = 480;
                shoot = 0;
                Projectile.NewProjectile(Main.player[npc.target].position.X, Main.player[npc.target].position.Y - yHeight, 0, 0, ModContent.ProjectileType <DioShard>(), damage / 2, 3, Main.myPlayer);
                Projectile.NewProjectile(Main.player[npc.target].position.X - rng + Main.rand.Next(rng * 2), Main.player[npc.target].position.Y - yHeight, 0, 0, ModContent.ProjectileType <DioShard>(), damage / 2, 3, Main.myPlayer);
                Projectile.NewProjectile(Main.player[npc.target].position.X - rng + Main.rand.Next(rng * 2), Main.player[npc.target].position.Y - yHeight, 0, 0, ModContent.ProjectileType <DioShard>(), damage / 2, 3, Main.myPlayer);
                Projectile.NewProjectile(Main.player[npc.target].position.X - rng + Main.rand.Next(rng * 2), Main.player[npc.target].position.Y - yHeight, 0, 0, ModContent.ProjectileType <DioShard>(), damage / 2, 3, Main.myPlayer);
                Projectile.NewProjectile(Main.player[npc.target].position.X - rng + Main.rand.Next(rng * 2), Main.player[npc.target].position.Y - yHeight, 0, 0, ModContent.ProjectileType <DioShard>(), damage / 2, 3, Main.myPlayer);
                Projectile.NewProjectile(Main.player[npc.target].position.X - rng + Main.rand.Next(rng * 2), Main.player[npc.target].position.Y - yHeight, 0, 0, ModContent.ProjectileType <DioShard>(), damage / 2, 3, Main.myPlayer);
                Projectile.NewProjectile(Main.player[npc.target].position.X - rng + Main.rand.Next(rng * 2), Main.player[npc.target].position.Y - yHeight, 0, 0, ModContent.ProjectileType <DioShard>(), damage / 2, 3, Main.myPlayer);
                Projectile.NewProjectile(Main.player[npc.target].position.X - rng + Main.rand.Next(rng * 2), Main.player[npc.target].position.Y - yHeight, 0, 0, ModContent.ProjectileType <DioShard>(), damage / 2, 3, Main.myPlayer);
                Projectile.NewProjectile(Main.player[npc.target].position.X - rng + Main.rand.Next(rng * 2), Main.player[npc.target].position.Y - yHeight, 0, 0, ModContent.ProjectileType <DioShard>(), damage / 2, 3, Main.myPlayer);
                Projectile.NewProjectile(Main.player[npc.target].position.X - rng + Main.rand.Next(rng * 2), Main.player[npc.target].position.Y - yHeight, 0, 0, ModContent.ProjectileType <DioShard>(), damage / 2, 3, Main.myPlayer);
                Projectile.NewProjectile(Main.player[npc.target].position.X - rng + Main.rand.Next(rng * 2), Main.player[npc.target].position.Y - yHeight, 0, 0, ModContent.ProjectileType <DioShard>(), damage / 2, 3, Main.myPlayer);
                Projectile.NewProjectile(Main.player[npc.target].position.X - rng + Main.rand.Next(rng * 2), Main.player[npc.target].position.Y - yHeight, 0, 0, ModContent.ProjectileType <DioShard>(), damage / 2, 3, Main.myPlayer);
                Projectile.NewProjectile(Main.player[npc.target].position.X - rng + Main.rand.Next(rng * 2), Main.player[npc.target].position.Y - yHeight, 0, 0, ModContent.ProjectileType <DioShard>(), damage / 2, 3, Main.myPlayer);
                Projectile.NewProjectile(Main.player[npc.target].position.X - rng + Main.rand.Next(rng * 2), Main.player[npc.target].position.Y - yHeight, 0, 0, ModContent.ProjectileType <DioShard>(), damage / 2, 3, Main.myPlayer);
                Projectile.NewProjectile(Main.player[npc.target].position.X - rng + Main.rand.Next(rng * 2), Main.player[npc.target].position.Y - yHeight, 0, 0, ModContent.ProjectileType <DioShard>(), damage / 2, 3, Main.myPlayer);
                Projectile.NewProjectile(Main.player[npc.target].position.X - rng + Main.rand.Next(rng * 2), Main.player[npc.target].position.Y - yHeight, 0, 0, ModContent.ProjectileType <DioShard>(), damage / 2, 3, Main.myPlayer);
                Projectile.NewProjectile(Main.player[npc.target].position.X - rng + Main.rand.Next(rng * 2), Main.player[npc.target].position.Y - yHeight, 0, 0, ModContent.ProjectileType <DioShard>(), damage / 2, 3, Main.myPlayer);
                Projectile.NewProjectile(Main.player[npc.target].position.X - rng + Main.rand.Next(rng * 2), Main.player[npc.target].position.Y - yHeight, 0, 0, ModContent.ProjectileType <DioShard>(), damage / 2, 3, Main.myPlayer);
                Projectile.NewProjectile(Main.player[npc.target].position.X - rng + Main.rand.Next(rng * 2), Main.player[npc.target].position.Y - yHeight, 0, 0, ModContent.ProjectileType <DioShard>(), damage / 2, 3, Main.myPlayer);
                Projectile.NewProjectile(Main.player[npc.target].position.X - rng + Main.rand.Next(rng * 2), Main.player[npc.target].position.Y - yHeight, 0, 0, ModContent.ProjectileType <DioShard>(), damage / 2, 3, Main.myPlayer);
            }
            npc.netUpdate = true;
        }
Ejemplo n.º 16
0
        public override bool ShootRightClick(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
        {
            Projectile.NewProjectile(position.X - 8f, position.Y + 8f, speedX + Main.rand.Next(-30, 30) / 150f, speedY + Main.rand.Next(-30, 30) / 150f, ModContent.ProjectileType <AquaKiss>(), damage, knockBack, player.whoAmI, 0f, 0f);

            return(true);
        }
Ejemplo n.º 17
0
        public override void UpdateEffects(Player player)
        {
            MyPlayer modPlayer = player.GetSpiritPlayer();

            modPlayer.copterBrake = false;
            float tilt = player.fullRotation;

            if (player.wet || player.honeyWet || player.lavaWet)
            {
                player.mount.Dismount(player);
                return;
            }

            //Only keep flying, when the player is holding up
            if (player.controlUp || player.controlJump)
            {
                player.mount._abilityCharging = true;
                player.mount._flyTime         = 0;
                player.mount._fatigue         = -verticalSpeed;
            }
            else
            {
                player.mount._abilityCharging = false;
            }

            //Slow down the helicopter, if it's on the ground
            if (modPlayer.onGround)
            {
                if (player.controlUp || player.controlJump)
                {
                    player.position.Y -= mountData.acceleration;
                }
                else
                {
                    modPlayer.copterBrake = true;
                }
            }

            //tilt the helicopter
            tilt = player.velocity.X * (MathHelper.PiOver2 * 0.125f);
            tilt = (float)Math.Sin(tilt) * maxTilt;
            player.fullRotation       = tilt;
            player.fullRotationOrigin = new Vector2(10f, 14f);//If you change this, also change the x and y values below.


            //Scan for enemies and fire at them
            if (player.mount._abilityCooldown == 0)
            {
                //Don't change these values, unless you want to adjust the nozzle position.
                float   x      = 20f * player.direction;
                float   y      = 12f;
                float   sin    = (float)Math.Sin(tilt);
                float   cos    = (float)Math.Cos(tilt);
                Vector2 muzzle = new Vector2(x * cos - y * sin, x * sin + y * cos);
                muzzle = muzzle + player.fullRotationOrigin + player.position;

                //Readjust the scanning cone to the current position.
                float direction;
                if (player.direction == 1)
                {
                    direction = FOVHelper.POS_X_DIR + tilt;
                }
                else
                {
                    direction = FOVHelper.NEG_X_DIR - tilt;
                }
                helper.AdjustCone(muzzle, fov, direction);

                //Look for the nearest, unobscured enemy inside the cone
                NPC   nearest     = null;
                float distNearest = rangeSquare;
                for (int i = 0; i < 200; i++)
                {
                    NPC     npc       = Main.npc[i];
                    Vector2 npcCenter = npc.Center;
                    if (npc.CanBeChasedBy() && helper.IsInCone(npcCenter)) //first param of canBeChasedBy has no effect
                    {
                        float distCurrent = Vector2.DistanceSquared(muzzle, npcCenter);
                        if (distCurrent < distNearest && Collision.CanHitLine(muzzle, 0, 0, npc.position, npc.width, npc.height))
                        {
                            nearest     = npc;
                            distNearest = distCurrent;
                        }
                    }
                }
                //Shoot 'em dead
                if (nearest != null)
                {
                    if (player.whoAmI == Main.myPlayer)
                    {
                        Vector2 aim = nearest.Center - muzzle;
                        aim.Normalize();
                        aim *= velocity;
                        float vX = aim.X;
                        float vY = aim.Y;
                        //This precisely mimics the Gatligators spread
                        //Random rand = Main.rand; commenting this out because I changed the rand lines here and waiting on more experienced help- Jenosis
                        vX += Main.rand.Next(-50, 51) * 0.03f;
                        vY += Main.rand.Next(-50, 51) * 0.03f;
                        vX += Main.rand.Next(-40, 41) * 0.05f;
                        vY += Main.rand.Next(-40, 41) * 0.05f;
                        if (Main.rand.Next(3) == 0)
                        {
                            vX += Main.rand.Next(-30, 31) * 0.02f;
                            vY += Main.rand.Next(-30, 31) * 0.02f;
                        }
                        Terraria.Projectile.NewProjectile(muzzle.X, muzzle.Y, vX, vY, ModContent.ProjectileType <CandyCopterBullet>(), (int)(damage * player.minionDamage), knockback * player.minionKB, player.whoAmI); //CandyCopterBullet
                    }
                    Point point = player.Center.ToTileCoordinates();
                    Lighting.AddLight(point.X, point.Y, lightColor.X, lightColor.Y, lightColor.Z);
                    modPlayer.copterFiring        = true;
                    modPlayer.copterFireFrame     = 0;
                    player.mount._abilityCooldown = cooldown - 1;
                }
                else
                {
                    modPlayer.copterFiring = false;
                }
                return;
            }
            else if (player.mount._abilityCooldown > cooldown)
            {
                player.mount._abilityCooldown = cooldown;
            }
        }
Ejemplo n.º 18
0
        public override void AI()
        {
            Player player = Main.player[projectile.owner];

            if (player.active && !player.dead && player.GetModPlayer <FargoPlayer>().TwinsEX)
            {
                projectile.timeLeft = 2;
            }

            if (projectile.ai[0] >= 0 && projectile.ai[0] < 200) //has target
            {
                NPC minionAttackTargetNpc = projectile.OwnerMinionAttackTargetNPC;
                if (minionAttackTargetNpc != null && projectile.ai[0] != minionAttackTargetNpc.whoAmI && minionAttackTargetNpc.CanBeChasedBy(projectile))
                {
                    projectile.ai[0] = minionAttackTargetNpc.whoAmI;
                }

                NPC npc = Main.npc[(int)projectile.ai[0]];
                if (npc.CanBeChasedBy(projectile))
                {
                    Vector2 targetPos = npc.Center + projectile.DirectionFrom(npc.Center) * 300;
                    if (projectile.Distance(targetPos) > 50)
                    {
                        Movement(targetPos, 0.5f);
                    }
                    projectile.rotation = projectile.DirectionTo(npc.Center).ToRotation() - (float)Math.PI / 2;

                    if (++projectile.localAI[0] > 20)
                    {
                        projectile.localAI[0] = 0;
                        if (projectile.owner == Main.myPlayer)
                        {
                            Projectile.NewProjectile(projectile.Center + Vector2.UnitX.RotatedBy(projectile.rotation + Math.PI / 2) * 100,
                                                     projectile.DirectionTo(npc.Center) * 12, ModContent.ProjectileType <OpticLaser>(),
                                                     projectile.damage, projectile.knockBack, projectile.owner);
                        }
                    }
                }
                else //forget target
                {
                    projectile.ai[0]     = HomeOnTarget();
                    projectile.netUpdate = true;
                }
            }
            else //no target
            {
                Vector2 targetPos = player.Center;
                targetPos.Y -= 100;

                if (projectile.Distance(targetPos) > 3000)
                {
                    projectile.Center = player.Center;
                }
                else if (projectile.Distance(targetPos) > 200)
                {
                    Movement(targetPos, 0.5f);
                }

                projectile.rotation = projectile.velocity.ToRotation() - (float)Math.PI / 2;

                if (++projectile.localAI[1] > 6)
                {
                    projectile.localAI[1] = 0;
                    projectile.ai[0]      = HomeOnTarget();
                    if (projectile.ai[0] != -1)
                    {
                        projectile.netUpdate = true;
                    }
                }
            }

            if (++projectile.frameCounter > 4)
            {
                projectile.frameCounter = 0;
                if (++projectile.frame >= 6)
                {
                    projectile.frame = 3;
                }
            }
            if (projectile.frame < 3)
            {
                projectile.frame = 3;
            }
        }
Ejemplo n.º 19
0
        public override void Update(Player player, ref int buffIndex)
        {
            player.buffTime[buffIndex] = 18000;
            player.GetModPlayer <CalValEXPlayer>().mFolly = true;
            bool petProjectileNotSpawned = player.ownedProjectileCounts[ModContent.ProjectileType <Projectiles.Pets.FollyPet>()] <= 0;

            if (petProjectileNotSpawned && player.whoAmI == Main.myPlayer)
            {
                Projectile.NewProjectile(player.position.X + (float)(player.width / 2), player.position.Y + (float)(player.height / 2), 0f, 0f, ModContent.ProjectileType <Projectiles.Pets.FollyPet>(), 0, 0f, player.whoAmI, 0f, 0f);
            }
        }
Ejemplo n.º 20
0
        public override void Kill(int timeLeft)
        {
            Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y - 16f, Main.rand.Next(-7, 11) * .25f, Main.rand.Next(-3, 5) * .25f, ModContent.ProjectileType <NutProjectile>(), (int)(projectile.damage * .5f), 0, projectile.owner);
            Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y - 16f, Main.rand.Next(-10, 14) * .25f, Main.rand.Next(-6, 10) * .25f, ModContent.ProjectileType <NutProjectile>(), (int)(projectile.damage * .5f), 0, projectile.owner);
            Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y - 16f, Main.rand.Next(-15, 13) * .25f, Main.rand.Next(-10, -5) * .25f, ModContent.ProjectileType <NutProjectile>(), (int)(projectile.damage * .5f), 0, projectile.owner);

            Main.PlaySound(SoundID.Dig, projectile.position);
            for (int i = 0; i < 32; ++i)
            {
                float random = Main.rand.NextFloat(-6f, 6f);
                Dust  dust   = Dust.NewDustDirect(projectile.Center, 0, 0, 78, random, random);
                dust.scale = 0.8f;
            }
        }
Ejemplo n.º 21
0
        public override void Kill(int timeLeft)
        {
            Main.PlaySound(SoundID.Item92, projectile.Center);

            if (Main.netMode != NetmodeID.MultiplayerClient)
            {
                if (FargoSoulsWorld.MasochistMode)
                {
                    Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType <WillRitual>(), projectile.damage, 0f, Main.myPlayer, 0f, projectile.ai[1]);
                }

                if (EModeGlobalNPC.BossIsAlive(ref EModeGlobalNPC.championBoss, ModContent.NPCType <NPCs.Champions.WillChampion>()) &&
                    Main.npc[EModeGlobalNPC.championBoss].ai[0] > -1)
                {
                    if (Main.npc[EModeGlobalNPC.championBoss].localAI[2] == 1)
                    {
                        SpawnSphereRing(8, 8f, projectile.damage, 2f);
                        SpawnSphereRing(8, 8f, projectile.damage, -2f);
                    }

                    if (Main.npc[EModeGlobalNPC.championBoss].localAI[3] == 1)
                    {
                        SpawnSphereRing(8, 8f, projectile.damage, 0.5f);
                        SpawnSphereRing(8, 8f, projectile.damage, -0.5f);
                    }
                }

                for (int i = 0; i < 4; i++)
                {
                    Projectile.NewProjectile(projectile.Center, Vector2.UnitX.RotatedBy(Math.PI / 4 * 2 * i + Math.PI / 4),
                                             ModContent.ProjectileType <WillDeathray>(), projectile.damage, 0f, Main.myPlayer, 0f, projectile.ai[1]);
                }
            }

            projectile.position = projectile.Center;
            projectile.width    = 250;
            projectile.height   = 250;
            projectile.Center   = projectile.position;

            Main.PlaySound(SoundID.Item, (int)projectile.Center.X, (int)projectile.Center.Y, 14);

            for (int num615 = 0; num615 < 45; num615++)
            {
                int num616 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 31, 0f, 0f, 100, default(Color), 1.5f);
                Main.dust[num616].velocity *= 1.4f;
            }

            for (int num617 = 0; num617 < 30; num617++)
            {
                int num618 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 6, 0f, 0f, 100, default(Color), 3.5f);
                Main.dust[num618].noGravity = true;
                Main.dust[num618].velocity *= 7f;
                num618 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 6, 0f, 0f, 100, default(Color), 1.5f);
                Main.dust[num618].velocity *= 3f;
            }

            for (int num619 = 0; num619 < 3; num619++)
            {
                float scaleFactor9 = 0.4f;
                if (num619 == 1)
                {
                    scaleFactor9 = 0.8f;
                }
                int num620 = Gore.NewGore(projectile.Center, default(Vector2), Main.rand.Next(61, 64));
                Main.gore[num620].velocity *= scaleFactor9;
                Gore gore97 = Main.gore[num620];
                gore97.velocity.X = gore97.velocity.X + 1f;
                Gore gore98 = Main.gore[num620];
                gore98.velocity.Y           = gore98.velocity.Y + 1f;
                num620                      = Gore.NewGore(projectile.Center, default(Vector2), Main.rand.Next(61, 64));
                Main.gore[num620].velocity *= scaleFactor9;
                Gore gore99 = Main.gore[num620];
                gore99.velocity.X = gore99.velocity.X - 1f;
                Gore gore100 = Main.gore[num620];
                gore100.velocity.Y          = gore100.velocity.Y + 1f;
                num620                      = Gore.NewGore(projectile.Center, default(Vector2), Main.rand.Next(61, 64));
                Main.gore[num620].velocity *= scaleFactor9;
                Gore gore101 = Main.gore[num620];
                gore101.velocity.X = gore101.velocity.X + 1f;
                Gore gore102 = Main.gore[num620];
                gore102.velocity.Y          = gore102.velocity.Y - 1f;
                num620                      = Gore.NewGore(projectile.Center, default(Vector2), Main.rand.Next(61, 64));
                Main.gore[num620].velocity *= scaleFactor9;
                Gore gore103 = Main.gore[num620];
                gore103.velocity.X = gore103.velocity.X - 1f;
                Gore gore104 = Main.gore[num620];
                gore104.velocity.Y = gore104.velocity.Y - 1f;
            }
        }
Ejemplo n.º 22
0
 public override void TownNPCAttackProj(ref int projType, ref int attackDelay)
 {
     projType    = ModContent.ProjectileType <LustProj>();
     attackDelay = 30;
 }
Ejemplo n.º 23
0
        public override void AI()
        {
            if (Projectile.localAI[0] == 0)
            {
                Projectile.localAI[0] = Main.rand.NextBool() ? 1 : -1;
            }

            if (++Projectile.ai[0] < 130)
            {
                Projectile.alpha -= 2;
                if (Projectile.alpha < 0) //fade in
                {
                    Projectile.alpha = 0;
                }
            }
            else if (Projectile.ai[0] < 145)
            {
                if (Projectile.ai[0] == 130 && Main.netMode != NetmodeID.MultiplayerClient)
                {
                    Projectile.NewProjectile(Projectile.InheritSource(Projectile), Projectile.Center, Vector2.Zero, ModContent.ProjectileType <GlowRing>(), 0, 0f, Main.myPlayer, -1, -13);
                }

                if (Projectile.ai[0] % 6 == 0)
                {
                    //Vector2 spawnPos = Projectile.Center;
                    //spawnPos.X += Main.rand.NextFloat(-250, 250);
                    //spawnPos.Y += Main.rand.NextFloat(700, 800) * Projectile.localAI[0];
                    float   angle = MathHelper.ToRadians(15);
                    Vector2 spawnPos;
                    spawnPos.Y = (Projectile.localAI[0] > 0 ? Main.maxTilesY * 16 - 16 : Main.maxTilesY * 16 - 200 * 16) - Projectile.Center.Y;
                    spawnPos.X = spawnPos.Y * (float)Math.Tan(Main.rand.NextFloat(-angle, angle));
                    spawnPos  += Projectile.Center;

                    Vector2 vel = Main.rand.NextFloat(0.8f, 1.2f) * (Projectile.Center - spawnPos) / 90;
                    if (vel.Length() < 10f)
                    {
                        vel = Vector2.Normalize(vel) * Main.rand.NextFloat(10f, 15f);
                    }
                    if (Main.netMode != NetmodeID.MultiplayerClient)
                    {
                        Projectile.NewProjectile(Projectile.InheritSource(Projectile), spawnPos, vel, ModContent.ProjectileType <WOFChain>(), Projectile.damage, 0f, Main.myPlayer);
                    }

                    SoundEngine.PlaySound(SoundID.NPCDeath13 with {
                        Volume = 0.5f
                    }, Projectile.Center);

                    Projectile.localAI[0] *= -1;
                }
            }
            else
            {
                Projectile.alpha += 8;
                if (Projectile.alpha > 255) //fade out
                {
                    Projectile.alpha = 255;
                    Projectile.Kill();
                }
            }

            int modifier = Math.Min(110, (int)Projectile.ai[0]);

            Projectile.scale = 4f - 3f / 110 * modifier; //start big, shrink down

            /*Projectile.Center = Main.npc[ai0].Center;
             * Projectile.velocity = Main.player[Main.npc[ai0].target].Center - Projectile.Center;
             * Projectile.velocity = Projectile.velocity / 60 * modifier; //move from npc to player*/
            Projectile.rotation = (float)Math.PI * 2f / 55 * modifier * Projectile.localAI[0];
        }
Ejemplo n.º 24
0
        public override void AI()
        {
            npc.spriteDirection = npc.direction;
            Player player = Main.player[npc.target];

            if (npc.ai[1] == 0f)
            {
                npc.ai[3]++;
                if (npc.ai[3] >= 6)
                {
                    frame++;
                    npc.ai[3]     = 0;
                    npc.netUpdate = true;
                }
                if (frame >= 6)
                {
                    frame = 0;
                }
            }
            else
            {
                frame = 7;
            }

            npc.ai[2]++;
            if (npc.ai[2] > 300)
            {
                npc.ai[1]     = 1f;
                npc.netUpdate = true;
            }
            if (npc.ai[2] == 300)
            {
                if (Vector2.Distance(npc.Center, player.Center) < 480)
                {
                    Main.PlaySound(SoundLoader.customSoundType, npc.position, mod.GetSoundSlot(SoundType.Custom, "Sounds/ScreechOwlScreech"));
                }
                Vector2 direction = Main.player[npc.target].Center - npc.Center;
                direction.Normalize();
                direction.X *= 2.7f;
                direction.Y *= 2.7f;
                if (Main.netMode != NetmodeID.MultiplayerClient)
                {
                    float A = (float)Main.rand.Next(-150, 150) * 0.03f;
                    float B = (float)Main.rand.Next(-150, 150) * 0.03f;
                    int   p = Projectile.NewProjectile(npc.Center.X + (10 * npc.spriteDirection), npc.Center.Y - 12, direction.X, direction.Y, ModContent.ProjectileType <ScreechOwlNote>(), 9, 1, Main.myPlayer, 0, 0);
                    for (int i = 0; i < 10; i++)
                    {
                        float   angle      = Main.rand.NextFloat(MathHelper.PiOver4, -MathHelper.Pi - MathHelper.PiOver4);
                        Vector2 spawnPlace = Vector2.Normalize(new Vector2((float)Math.Cos(angle), (float)Math.Sin(angle))) * 20f;
                        int     dustIndex  = Dust.NewDust(new Vector2(npc.Center.X + (10 * npc.spriteDirection), npc.Center.Y - 12), 2, 2, 180, 0f, 0f, 0, default(Color), 1f);
                        Main.dust[dustIndex].noGravity = true;
                        Main.dust[dustIndex].velocity  = Vector2.Normalize(spawnPlace.RotatedBy(Main.rand.NextFloat(MathHelper.TwoPi))) * 1.6f;
                    }
                }
            }
            if (npc.ai[2] > 330)
            {
                npc.ai[2]     = 0f;
                npc.ai[1]     = 0f;
                npc.netUpdate = true;
            }
            if (npc.ai[1] == 1f)
            {
                npc.aiStyle     = 0;
                npc.velocity.X  = 0;
                npc.velocity.Y *= .5f;
                npc.rotation    = 0f;
                if (player.position.X > npc.position.X)
                {
                    npc.spriteDirection = 1;
                }
                else
                {
                    npc.spriteDirection = -1;
                }
            }
            else
            {
                if (player.position.X > npc.position.X)
                {
                    npc.spriteDirection = 1;
                }
                else
                {
                    npc.spriteDirection = -1;
                }
                npc.aiStyle = -1;
                float num1      = 4f;
                float moveSpeed = 0.09f;
                npc.TargetClosest(true);
                Vector2 vector2_1 = Main.player[npc.target].Center - npc.Center + new Vector2(0.0f, Main.rand.NextFloat(-250f, 0f));
                float   num2      = vector2_1.Length();
                Vector2 desiredVelocity;
                if ((double)num2 < 20.0)
                {
                    desiredVelocity = npc.velocity;
                }
                else if ((double)num2 < 40.0)
                {
                    vector2_1.Normalize();
                    desiredVelocity = vector2_1 * (num1 * 0.35f);
                }
                else if ((double)num2 < 80.0)
                {
                    vector2_1.Normalize();
                    desiredVelocity = vector2_1 * (num1 * 0.65f);
                }
                else
                {
                    vector2_1.Normalize();
                    desiredVelocity = vector2_1 * num1;
                }
                npc.SimpleFlyMovement(desiredVelocity, moveSpeed);
                npc.rotation = npc.velocity.X * 0.055f;
                if (npc.collideX)
                {
                    npc.velocity.X = npc.oldVelocity.X * -0.5f;
                    if (npc.direction == -1 && npc.velocity.X > 0f && npc.velocity.X < 2f)
                    {
                        npc.velocity.X = 2f;
                    }
                    if (npc.direction == 1 && npc.velocity.X < 0f && npc.velocity.X > -2f)
                    {
                        npc.velocity.X = -2f;
                    }
                }
                if (npc.collideY)
                {
                    npc.velocity.Y = npc.oldVelocity.Y * -0.5f;
                    if (npc.velocity.Y > 0f && npc.velocity.Y < 1f)
                    {
                        npc.velocity.Y = 1f;
                    }
                    if (npc.velocity.Y < 0f && npc.velocity.Y > -1f)
                    {
                        npc.velocity.Y = -1f;
                    }
                }
            }
        }
Ejemplo n.º 25
0
 public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
 {
     if (Main.myPlayer == projectile.owner)
     {
         Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0, 0, ModContent.ProjectileType <HadesGeyser>(), damage, 3f, Main.myPlayer);
     }
     projectile.Kill();
 }
Ejemplo n.º 26
0
        public override void AI()
        {
            if (Main.rand.Next(150) == 8)
            {
                Vector2 direction = Main.player[npc.target].Center - npc.Center;
                direction.Normalize();
                direction.X *= 2f;
                direction.Y *= 2f;

                int amountOfProjectiles = Main.rand.Next(1, 2);
                for (int i = 0; i < amountOfProjectiles; ++i)
                {
                    float A = (float)Main.rand.Next(-1, 1) * 0.03f;
                    float B = (float)Main.rand.Next(-1, 1) * 0.03f;
                    Projectile.NewProjectile(npc.Center.X, npc.Center.Y, direction.X + A, direction.Y + B, ModContent.ProjectileType <RuneHostile>(), 38, 1, Main.myPlayer, 0, 0);
                }
            }
            npc.spriteDirection = npc.direction;
            Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0f, 0.675f, 2.50f);
            timer++;
            npc.TargetClosest(true);
            Player player = Main.player[npc.target];

            if (timer == 25)
            {
                Vector2 direction = Main.player[npc.target].Center - npc.Center;
                direction.Normalize();
                npc.velocity.Y = direction.Y * 3f;
                npc.velocity.X = direction.X * 3f;
                timer          = 0;
            }
            if (timer == 32)
            {
                Vector2 direction = Main.player[npc.target].Center - npc.Center;
                direction.Normalize();
                npc.velocity.Y = direction.Y * 3f;
                npc.velocity.X = direction.X * 3f;
            }
        }
Ejemplo n.º 27
0
        public static void CobaltHurt(Player player, double damage)
        {
            if (player.GetToggleValue("Cobalt") && player.whoAmI == Main.myPlayer)
            {
                FargoSoulsPlayer modPlayer = player.GetModPlayer <FargoSoulsPlayer>();

                int baseDamage = 50;
                int multiplier = 2;
                int cap        = 150;

                if (modPlayer.EarthForce)
                {
                    baseDamage = 50;
                    multiplier = 4;
                    cap        = 250;
                }

                if (modPlayer.TerrariaSoul)
                {
                    baseDamage = 250;
                    multiplier = 5;
                    cap        = 500;
                }

                int explosionDamage = baseDamage + (int)damage * multiplier;
                if (explosionDamage > cap)
                {
                    explosionDamage = cap;
                }

                Projectile p = FargoSoulsUtil.NewProjectileDirectSafe(player.GetSource_Accessory(modPlayer.CobaltEnchantItem), player.Center, Vector2.Zero, ModContent.ProjectileType <Explosion>(), (int)(explosionDamage * player.ActualClassDamage(DamageClass.Melee)), 0f, Main.myPlayer);
                if (p != null)
                {
                    p.GetGlobalProjectile <FargoSoulsGlobalProjectile>().CanSplit = false;
                }
            }
        }
Ejemplo n.º 28
0
        public override bool CanUseItem(Player player)
        {
            if (player.ownedProjectileCounts[ModContent.ProjectileType <Retiglaive>()] > 0 || player.ownedProjectileCounts[ModContent.ProjectileType <Spazmaglaive>()] > 0)
            {
                return(false);
            }

            if (player.altFunctionUse == 2)
            {
                item.shoot      = ModContent.ProjectileType <Retiglaive>();
                item.shootSpeed = 15f;
            }
            else
            {
                item.shoot      = ModContent.ProjectileType <Spazmaglaive>();
                item.shootSpeed = 45f;
            }
            return(true);
        }
Ejemplo n.º 29
0
        public override void AI()
        {
            if (projectile.ai[0] < 0 || projectile.ai[0] >= Main.maxNPCs)
            {
                projectile.Kill();
                return;
            }

            NPC npc = Main.npc[(int)projectile.ai[0]];

            Vector2 target = npc.Center;

            target.X += (npc.localAI[3] > 1 ? 1200 : 2000) * (float)Math.Sin(2 * Math.PI / 720 * projectile.ai[1]++);
            target.Y -= 1100;

            Vector2 distance = target - projectile.Center;
            float   length   = distance.Length();

            if (length > 100f)
            {
                distance           /= 8f;
                projectile.velocity = (projectile.velocity * 23f + distance) / 24f;
            }
            else
            {
                if (projectile.velocity.Length() < 12f)
                {
                    projectile.velocity *= 1.05f;
                }
            }

            /*projectile.localAI[0]++;
             * if (projectile.localAI[0] > 45)
             * {
             *  projectile.localAI[0] = 0f;
             *  if (projectile.owner == Main.myPlayer)
             *  {
             *      Vector2 vel = distance;
             *      vel.Normalize();
             *      vel *= 9f;
             *      Projectile.NewProjectile(projectile.Center, vel, ModContent.ProjectileType<FrostWave>(),
             *          projectile.damage, projectile.knockBack, projectile.owner);
             *  }
             * }*/

            if (++projectile.localAI[0] > 90 && ++projectile.localAI[1] > (npc.localAI[3] > 1 ? 4 : 2)) //spray shards
            {
                Main.PlaySound(SoundID.Item27, projectile.position);
                projectile.localAI[1] = 0f;
                if (Main.netMode != NetmodeID.MultiplayerClient)
                {
                    if (Math.Abs(npc.Center.X - projectile.Center.X) > 400)
                    {
                        for (int i = 0; i < 2; i++)
                        {
                            Vector2 speed = new Vector2(Main.rand.Next(-1000, 1001), Main.rand.Next(-1000, 1001));
                            speed.Normalize();
                            speed *= 8f;
                            Projectile.NewProjectile(projectile.Center + speed * 4f, speed, ModContent.ProjectileType <AbomFrostShard>(), projectile.damage, projectile.knockBack, projectile.owner);
                        }
                    }
                    if (Main.player[npc.target].active && !Main.player[npc.target].dead && Main.player[npc.target].Center.Y < projectile.Center.Y)
                    {
                        Main.PlaySound(SoundID.Item120, projectile.position);
                        if (Main.netMode != NetmodeID.MultiplayerClient)
                        {
                            Vector2 vel = projectile.DirectionTo(Main.player[npc.target].Center + new Vector2(Main.rand.Next(-200, 201), Main.rand.Next(-200, 201))) * 12f;
                            Projectile.NewProjectile(projectile.Center, vel, ModContent.ProjectileType <AbomFrostWave>(), projectile.damage, projectile.knockBack, projectile.owner);
                        }
                    }
                }
            }

            projectile.rotation += projectile.velocity.Length() / 12f * (projectile.velocity.X > 0 ? -0.2f : 0.2f);
            if (++projectile.frameCounter > 3)
            {
                if (++projectile.frame >= 6)
                {
                    projectile.frame = 0;
                }
                projectile.frameCounter = 0;
            }
        }
Ejemplo n.º 30
0
        public override void AI()
        {
            if (projectile.alpha > 0)
            {
                projectile.alpha -= 40;
            }
            else
            {
                projectile.alpha = 0;
            }
            Player target = Main.player[Player.FindClosest(projectile.Center, 1, 1)];

            projectile.ai[0]++;

            if (projectile.ai[0] < 40)
            {
                projectile.rotation = (target.Center - projectile.Center).ToRotation();
                projectile.Center  -= projectile.rotation.ToRotationVector2() * 1f;

                if (projectile.ai[0] == 1)
                {
                    Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/DreamGhostAppear").WithVolume(2f).WithPitchVariance(.5f), Main.player[Player.FindClosest(projectile.Center, 1, 1)].Center);
                    for (int i = 0; i < 15; i++)
                    {
                        float r = projectile.rotation - MathHelper.Pi / 4 * 3 + MathHelper.Pi / 2 * Main.rand.NextFloat() + MathHelper.Pi * Main.rand.Next(2);
                        Projectile.NewProjectile(projectile.Center, r.ToRotationVector2() * (Main.rand.NextFloat() * 10 + 4), ModContent.ProjectileType <DreamParticle>(), 1, 0, default, Main.rand.Next(3));