Exemplo n.º 1
0
 public override void Kill(int timeLeft)
 {
     Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14);
     ProjectileExtras.Explode(projectile.whoAmI, 120, 120,
                              delegate {
         for (int i = 0; i < 2; ++i)
         {
             int randFire = Main.rand.Next(3);
             int newProj  = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y,
                                                     Main.rand.Next(-400, 400) / 100, Main.rand.Next(-4, 4),
                                                     ModContent.ProjectileType <BrimstoneEmber>(), 30, 0, projectile.owner);
         }
         for (int i = 0; i < 40; i++)
         {
             int num = Dust.NewDust(projectile.position, projectile.width, projectile.height, 235, 0f, -2f, 0, default(Color), 2f);
             Main.dust[num].noGravity = true;
             Dust expr_62_cp_0        = Main.dust[num];
             expr_62_cp_0.position.X  = expr_62_cp_0.position.X + ((float)(Main.rand.Next(-50, 51) / 20) - 1.5f);
             Dust expr_92_cp_0        = Main.dust[num];
             expr_92_cp_0.position.Y  = expr_92_cp_0.position.Y + ((float)(Main.rand.Next(-50, 51) / 20) - 1.5f);
             if (Main.dust[num].position != projectile.Center)
             {
                 Main.dust[num].velocity = projectile.DirectionTo(Main.dust[num].position) * 6f;
             }
         }
     });
 }
Exemplo n.º 2
0
 public override void Kill(int timeLeft)
 {
     Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 27);
     for (int num621 = 0; num621 < 40; num621++)
     {
         int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 68, 0f, 0f, 100, default(Color), 2f);
         Main.dust[num622].velocity *= 3f;
         Main.dust[num622].noGravity = true;
         Main.dust[num622].scale     = 0.5f;
     }
     Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 14);
     ProjectileExtras.Explode(projectile.whoAmI, 120, 120,
                              delegate {
         for (int i = 0; i < 40; i++)
         {
             int num = Dust.NewDust(projectile.position, projectile.width, projectile.height, 68, 0f, -2f, 0, default(Color), 1.1f);
             Main.dust[num].noGravity = true;
             Dust expr_62_cp_0        = Main.dust[num];
             expr_62_cp_0.position.X  = expr_62_cp_0.position.X + ((float)(Main.rand.Next(-30, 31) / 20) - 1.5f);
             Dust expr_92_cp_0        = Main.dust[num];
             expr_92_cp_0.position.Y  = expr_92_cp_0.position.Y + ((float)(Main.rand.Next(-30, 31) / 20) - 1.5f);
             if (Main.dust[num].position != projectile.Center)
             {
                 Main.dust[num].velocity = projectile.DirectionTo(Main.dust[num].position) * 6f;
             }
         }
     });
 }
Exemplo n.º 3
0
 public override void Kill(int timeLeft)
 {
     ProjectileExtras.Explode(projectile.whoAmI, 120, 120,
                              delegate {
         for (int i = 0; i < 40; i++)
         {
             int num = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.BlueCrystalShard, 0f, -2f, 0, default, 2f);
 public override void Kill(int timeLeft)
 {
     Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14);
     ProjectileExtras.Explode(projectile.whoAmI, 120, 120, delegate
     {
         for (int num621 = 0; num621 < 40; num621++)
         {
             int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 206, 0f, 0f, 100, default(Color), 2f);
             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 < 70; num623++)
         {
             int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 257, 0f, 0f, 100, default(Color), 1f);
             Main.dust[num624].noGravity = true;
             Main.dust[num624].velocity *= 1.5f;
             num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 206, 0f, 0f, 100, default(Color), 1f);
             Main.dust[num624].velocity *= 2f;
         }
     });
 }
        public override bool PreAI()
        {
            projectile.ai[1] += 1f;
            bool chasing = false;

            if (projectile.ai[1] >= 30f)
            {
                chasing = true;

                projectile.friendly = true;
                NPC target = null;
                if (projectile.ai[0] == -1f)
                {
                    target = ProjectileExtras.FindRandomNPC(projectile.Center, 960f, false);
                }
                else
                {
                    target = Main.npc[(int)projectile.ai[0]];
                    if (!target.active || !target.CanBeChasedBy())
                    {
                        target = ProjectileExtras.FindRandomNPC(projectile.Center, 960f, false);
                    }
                }

                if (target == null)
                {
                    chasing          = false;
                    projectile.ai[0] = -1f;
                }
                else
                {
                    projectile.ai[0] = (float)target.whoAmI;
                    ProjectileExtras.HomingAI(this, target, 10f, 5f);
                }
            }

            ProjectileExtras.LookAlongVelocity(this);
            if (!chasing)
            {
                Vector2 dir = projectile.velocity;
                float   vel = projectile.velocity.Length();
                if (vel != 0f)
                {
                    if (vel < 4f)
                    {
                        dir *= 1 / vel;
                        projectile.velocity += dir * 0.0625f;
                    }
                }
                else
                {
                    //Stops the projectiles from spazzing out
                    projectile.velocity.X += Main.rand.Next(2) == 0 ? 0.1f : -0.1f;
                }
            }
            {
                int dust = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 75, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f);
            }
            return(false);
        }
Exemplo n.º 6
0
 public override void Kill(int timeLeft)
 {
     Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 74);
     ProjectileExtras.Explode(projectile.whoAmI, 80, 80,
                              delegate {
         for (int i = 0; i < 40; i++)
         {
             int num = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Fire, 0f, -2f, 0, default, 1.2f);
Exemplo n.º 7
0
 public override void Kill(int timeLeft)
 {
     Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 14);
     ProjectileExtras.Explode(projectile.whoAmI, 120, 120,
                              delegate {
         for (int num621 = 0; num621 < 40; num621++)
         {
             int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, DustID.UnusedWhiteBluePurple, 0f, 0f, 100, default, 2f);
Exemplo n.º 8
0
        public override void Kill(int timeLeft)
        {
            Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14);
            ProjectileExtras.Explode(projectile.whoAmI, 120, 120,
                                     delegate {
                for (int i = 0; i < 40; i++)
                {
                    int num = Dust.NewDust(projectile.position, projectile.width, projectile.height, 167, 0f, -2f, 0, default(Color), 2f);
                    Main.dust[num].noGravity = true;
                    Dust expr_62_cp_0        = Main.dust[num];
                    expr_62_cp_0.position.X  = expr_62_cp_0.position.X + ((float)(Main.rand.Next(-50, 51) / 20) - 1.5f);
                    Dust expr_92_cp_0        = Main.dust[num];
                    expr_92_cp_0.position.Y  = expr_92_cp_0.position.Y + ((float)(Main.rand.Next(-50, 51) / 20) - 1.5f);
                    if (Main.dust[num].position != projectile.Center)
                    {
                        Main.dust[num].velocity = projectile.DirectionTo(Main.dust[num].position) * 6f;
                    }
                }
            });
            for (int num625 = 0; num625 < 3; num625++)
            {
                float scaleFactor10 = 0.33f;
                if (num625 == 1)
                {
                    scaleFactor10 = 0.66f;
                }

                if (num625 == 2)
                {
                    scaleFactor10 = 1f;
                }

                int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default(Vector2), Main.rand.Next(61, 64), 1f);
                Main.gore[num626].velocity *= scaleFactor10;
                Gore expr_13AB6_cp_0 = Main.gore[num626];
                expr_13AB6_cp_0.velocity.X = expr_13AB6_cp_0.velocity.X + 1f;
                Gore expr_13AD6_cp_0 = Main.gore[num626];
                expr_13AD6_cp_0.velocity.Y = expr_13AD6_cp_0.velocity.Y + 1f;
                num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default(Vector2), Main.rand.Next(61, 64), 1f);
                Main.gore[num626].velocity *= scaleFactor10;
                Gore expr_13B79_cp_0 = Main.gore[num626];
                expr_13B79_cp_0.velocity.X = expr_13B79_cp_0.velocity.X - 1f;
                Gore expr_13B99_cp_0 = Main.gore[num626];
                expr_13B99_cp_0.velocity.Y = expr_13B99_cp_0.velocity.Y + 1f;
                num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default(Vector2), Main.rand.Next(61, 64), 1f);
                Main.gore[num626].velocity *= scaleFactor10;
                Gore expr_13C3C_cp_0 = Main.gore[num626];
                expr_13C3C_cp_0.velocity.X = expr_13C3C_cp_0.velocity.X + 1f;
                Gore expr_13C5C_cp_0 = Main.gore[num626];
                expr_13C5C_cp_0.velocity.Y = expr_13C5C_cp_0.velocity.Y - 1f;
                num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default(Vector2), Main.rand.Next(61, 64), 1f);
                Main.gore[num626].velocity *= scaleFactor10;
                Gore expr_13CFF_cp_0 = Main.gore[num626];
                expr_13CFF_cp_0.velocity.X = expr_13CFF_cp_0.velocity.X - 1f;
                Gore expr_13D1F_cp_0 = Main.gore[num626];
                expr_13D1F_cp_0.velocity.Y = expr_13D1F_cp_0.velocity.Y - 1f;
            }
        }
Exemplo n.º 9
0
 public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
 {
     if (activated)
     {
         ProjectileExtras.DrawChain(projectile.whoAmI, groundpos - new Vector2(30, 0),
                                    "SpiritMod/Projectiles/BrambleTrap_Chain");
         ProjectileExtras.DrawChain(projectile.whoAmI, groundpos + new Vector2(30, 0),
                                    "SpiritMod/Projectiles/BrambleTrap_Chain");
     }
     return(false);
 }
Exemplo n.º 10
0
 public override void AI()
 {
     if (projectile.localAI[0] == 0f)
     {
         ProjectileExtras.LookAlongVelocity(this);
         projectile.localAI[0] = 1f;
     }
     if (Main.rand.NextDouble() < 0.5)
     {
         Dust dust = Dust.NewDustDirect(projectile.position - new Vector2(4, 4), projectile.width + 8, projectile.height + 8, ModContent.DustType <Wind>());
         dust.velocity   = projectile.velocity * 0.2f;
         dust.customData = new WindAnchor(projectile.Center, projectile.velocity, dust.position);
     }
 }
Exemplo n.º 11
0
 public override void Kill(int timeLeft)
 {
     ProjectileExtras.Explode(projectile.whoAmI, 120, 120, delegate
     {
         for (int i = 0; i < 40; i++)
         {
             int num = Dust.NewDust(projectile.position, projectile.width, projectile.height, 68, 0f, -2f, 0, default(Color), 2f);
             Main.dust[num].noGravity = true;
             Dust expr_62_cp_0        = Main.dust[num];
             expr_62_cp_0.position.X  = expr_62_cp_0.position.X + ((float)(Main.rand.Next(-50, 51) / 20) - 1.5f);
             Dust expr_92_cp_0        = Main.dust[num];
             expr_92_cp_0.position.Y  = expr_92_cp_0.position.Y + ((float)(Main.rand.Next(-50, 51) / 20) - 1.5f);
             if (Main.dust[num].position != projectile.Center)
             {
                 Main.dust[num].velocity = projectile.DirectionTo(Main.dust[num].position) * 6f;
             }
         }
     });
 }
Exemplo n.º 12
0
 public override void Kill(int timeLeft)
 {
     Main.PlaySound(SoundID.Zombie, (int)projectile.position.X, (int)projectile.position.Y, 53);
     ProjectileExtras.Explode(projectile.whoAmI, 40, 40,
                              delegate {
         for (int i = 0; i < 40; i++)
         {
             int num = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Ultrabright, 0f, -2f, 117, new Color(0, 255, 142), .6f);
             Main.dust[num].noGravity = true;
             Dust dust        = Main.dust[num];
             dust.position.X += ((Main.rand.Next(-50, 51) / 20) - 1.5f);
             dust.position.Y += ((Main.rand.Next(-50, 51) / 20) - 1.5f);
             if (Main.dust[num].position != projectile.Center)
             {
                 Main.dust[num].velocity = projectile.DirectionTo(Main.dust[num].position) * 6f;
             }
         }
     });
 }
Exemplo n.º 13
0
 public override void Kill(int timeLeft)
 {
     Main.PlaySound(29, (int)projectile.position.X, (int)projectile.position.Y, 53);
     ProjectileExtras.Explode(projectile.whoAmI, 40, 40,
                              delegate {
         for (int i = 0; i < 40; i++)
         {
             int num = Dust.NewDust(projectile.position, projectile.width, projectile.height, 156, 0f, -2f, 117, new Color(0, 255, 142), .6f);
             Main.dust[num].noGravity = true;
             Dust expr_62_cp_0        = Main.dust[num];
             expr_62_cp_0.position.X  = expr_62_cp_0.position.X + ((float)(Main.rand.Next(-50, 51) / 20) - 1.5f);
             Dust expr_92_cp_0        = Main.dust[num];
             expr_92_cp_0.position.Y  = expr_92_cp_0.position.Y + ((float)(Main.rand.Next(-50, 51) / 20) - 1.5f);
             if (Main.dust[num].position != projectile.Center)
             {
                 Main.dust[num].velocity = projectile.DirectionTo(Main.dust[num].position) * 6f;
             }
         }
     });
 }
Exemplo n.º 14
0
        public override void AI()
        {
            Player player = Main.player[projectile.owner];

            if (player.active && Offset >= 0)
            {
                projectile.penetrate = 1;
                MyPlayer modPlayer = player.GetModPlayer <MyPlayer>();
                if (player.whoAmI == Main.myPlayer && modPlayer.glyph != GlyphType.Frost)
                {
                    projectile.Kill();
                    return;
                }

                projectile.timeLeft = 300;
                modPlayer.frostTally++;
                int   count    = modPlayer.frostCount;
                float sector   = MathHelper.TwoPi / (count > 0 ? count : 1);
                float rotation = modPlayer.frostRotation + Offset * sector;
                if (rotation > MathHelper.TwoPi)
                {
                    rotation -= MathHelper.TwoPi;
                }
                float delta = projectile.rotation;
                if (delta > MathHelper.Pi)
                {
                    delta -= MathHelper.TwoPi;
                }
                else if (delta < -MathHelper.Pi)
                {
                    delta += MathHelper.TwoPi;
                }
                delta = rotation - delta;
                if (delta > MathHelper.Pi)
                {
                    delta -= MathHelper.TwoPi;
                }
                else if (delta < -MathHelper.Pi)
                {
                    delta += MathHelper.TwoPi;
                }
                if (delta > 1.5 * TURNRATE)
                {
                    projectile.rotation += 1.5f * TURNRATE;
                }
                else if (delta < .5 * TURNRATE)
                {
                    projectile.rotation += 0.5f * TURNRATE;
                }
                else
                {
                    projectile.rotation = rotation;
                }
                projectile.Center = player.MountedCenter + new Vector2(0, -OFFSET).RotatedBy(projectile.rotation);
                return;
            }
            //else if (Offset < 0)
            //{
            //	if (!projectile.velocity.Nearing(Target - projectile.Center))
            //	{
            //		projectile.position = Target;
            //		projectile.Kill();
            //		return;
            //	}
            //}

            if (projectile.localAI[1] == 0)
            {
                projectile.localAI[1] = 1;
                ProjectileExtras.LookAlongVelocity(this);
                projectile.penetrate    = -1;
                projectile.extraUpdates = 1;
                projectile.tileCollide  = true;
            }
        }
Exemplo n.º 15
0
        public override void AI()
        {
            if (projectile.ai[1] == 0)
            {
                projectile.ai[0] = -1;
            }

            projectile.ai[1] += 1f;
            bool chasing = false;

            if (projectile.ai[1] >= 30f)
            {
                chasing = true;

                projectile.friendly = true;
                NPC target = null;
                if (projectile.ai[0] < 0 || projectile.ai[0] >= Main.maxNPCs)
                {
                    target = ProjectileExtras.FindRandomNPC(projectile.Center, 960f, false);
                }
                else
                {
                    target = Main.npc[(int)projectile.ai[0]];
                    if (!target.active || !target.CanBeChasedBy())
                    {
                        target = ProjectileExtras.FindRandomNPC(projectile.Center, 960f, false);
                    }
                }

                if (target == null)
                {
                    chasing          = false;
                    projectile.ai[0] = -1f;
                }
                else
                {
                    projectile.ai[0] = (float)target.whoAmI;
                    ProjectileExtras.HomingAI(this, target, 10f, .5f);
                }
            }

            ProjectileExtras.LookAlongVelocity(this);
            if (!chasing)
            {
                Vector2 dir = projectile.velocity;
                float   vel = projectile.velocity.Length();
                if (vel != 0f)
                {
                    if (vel < 8f)
                    {
                        dir *= 1 / vel;
                        projectile.velocity += dir * 0.0625f;
                    }
                }
                else
                {
                    //Stops the projectile from spazzing out
                    projectile.velocity.X += Main.rand.Next(2) == 0 ? 0.1f : -0.1f;
                }
            }

            for (int i = 0; i < 10; i++)
            {
                Vector2 pos = projectile.Center - projectile.velocity * ((float)i / 10f);
                int     num = Dust.NewDust(pos, 2, 2, DustID.SilverCoin);
                Main.dust[num].alpha = projectile.alpha;
                //Main.dust[num].position = pos;
                Main.dust[num].velocity  = Vector2.Zero;
                Main.dust[num].noGravity = true;
            }
        }
Exemplo n.º 16
0
        public override bool PreAI()
        {
            projectile.ai[1] += 1f;
            bool chasing = false;

            if (projectile.ai[1] >= 30f)
            {
                chasing = true;

                projectile.friendly = true;
                NPC target = null;
                if (projectile.ai[0] == -1f)
                {
                    target = ProjectileExtras.FindRandomNPC(projectile.Center, 960f, false);
                }
                else
                {
                    target = Main.npc[(int)projectile.ai[0]];
                    if (!target.active || !target.CanBeChasedBy())
                    {
                        target = ProjectileExtras.FindRandomNPC(projectile.Center, 960f, false);
                    }
                }

                if (target == null)
                {
                    chasing          = false;
                    projectile.ai[0] = -1f;
                }
                else
                {
                    projectile.ai[0] = (float)target.whoAmI;
                    ProjectileExtras.HomingAI(this, target, 10f, 5f);
                }
            }

            ProjectileExtras.LookAlongVelocity(this);
            if (!chasing)
            {
                Vector2 dir = projectile.velocity;
                float   vel = projectile.velocity.Length();
                if (vel != 0f)
                {
                    if (vel < 4f)
                    {
                        dir *= 1 / vel;
                        projectile.velocity += dir * 0.0625f;
                    }
                }
                else
                {
                    //Stops the projectiles from spazzing out
                    projectile.velocity.X += Main.rand.Next(2) == 0 ? 0.1f : -0.1f;
                }
            }

            int num = 5;

            for (int k = 0; k < 3; k++)
            {
                int index2 = Dust.NewDust(projectile.position, 1, 1, DustID.DungeonWater, 0.0f, 0.0f, 0, new Color(), 1f);
                Main.dust[index2].position  = projectile.Center - projectile.velocity / num * (float)k;
                Main.dust[index2].scale     = .5f;
                Main.dust[index2].velocity *= 0f;
                Main.dust[index2].noGravity = true;
                Main.dust[index2].noLight   = false;
            }

            return(false);
        }
Exemplo n.º 17
0
 public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
 {
     ProjectileExtras.DrawAroundOrigin(projectile.whoAmI, lightColor);
     return(false);
 }