예제 #1
0
 public override void AI()
 {
     Lighting.AddLight(projectile.Center, Color.White.ToVector3() * .25f);
     if (Main.rand.NextBool(3))
     {
         KeyUtils.NewDustConverge(out int Debris, projectile.Center + new Vector2(4), Vector2.Zero, Main.rand.NextFloat(50f, 300f), Main.rand.NextBool() ? DustID.Dirt : DustID.Stone);
         Main.dust[Debris].scale    *= Main.rand.NextFloat(1.5f, 2.5f);
         Main.dust[Debris].velocity *= .8f;
     }
     for (int k = 0; k < Main.maxItems; k++)
     {
         Item i = Main.item[k];
         if (i.active)
         {
             if (Vector2.Distance(i.Center, projectile.Center) < 10f && KeyUtils.HasItemSpace(Main.player[projectile.owner]))
             {
                 i.Center      = Main.player[projectile.owner].Center;
                 i.velocity    = Vector2.Zero;
                 i.noGrabDelay = 0;
             }
             if (Vector2.Distance(i.Center, projectile.Center) < 300f)
             {
                 Vector2 vTo = KeyUtils.VectorTo(i.Center, projectile.Center);
                 KeyUtils.AdjustMagnitude(ref vTo, 30f);
                 i.velocity = (10 * i.velocity + vTo) / 11f;
                 KeyUtils.AdjustMagnitude(ref i.velocity, 30f);
             }
         }
     }
     for (int k = 0; k < Main.maxNPCs; k++)
     {
         NPC i = Main.npc[k];
         if (i.active && !i.boss && !i.dontTakeDamage && !i.friendly && i.lifeMax > 5 && i.knockBackResist > 0)
         {
             if (Vector2.Distance(i.Center, projectile.Center) < 300f)
             {
                 Vector2 vTo = KeyUtils.VectorTo(i.Center, projectile.Center);
                 KeyUtils.AdjustMagnitude(ref vTo, 30f * (i.knockBackResist < .5f ? .5f : i.knockBackResist));
                 i.velocity = (10 * i.velocity + vTo) / 11f;
                 KeyUtils.AdjustMagnitude(ref i.velocity, 30f * (i.knockBackResist < .5f ? .5f : i.knockBackResist));
             }
         }
     }
     for (int k = 0; k < Main.maxPlayers; k++)
     {
         Player i = Main.player[k];
         if (i.active && i != Main.player[projectile.owner] && i.hostile && (i.team != Main.player[projectile.owner].team || i.team == 0))
         {
             if (Vector2.Distance(i.Center, projectile.Center) < 300f)
             {
                 Vector2 vTo = KeyUtils.VectorTo(i.Center, projectile.Center);
                 KeyUtils.AdjustMagnitude(ref vTo, 30f);
                 i.velocity = (10 * i.velocity + vTo) / 11f;
                 KeyUtils.AdjustMagnitude(ref i.velocity, 30f);
             }
         }
     }
 }
 public override void AI()
 {
     if (projectile.timeLeft == 10)
     {
         for (int k = 0; k < Main.maxNPCs; k++)
         {
             NPC i = Main.npc[k];
             if (i.active && !i.boss && !i.dontTakeDamage && !i.friendly && Collision.CanHit(i.Center, 0, 0, projectile.Center, 0, 0))
             {
                 if (Vector2.Distance(i.Center, projectile.Center) < 200f)
                 {
                     i.immune[projectile.owner] = 0;
                     i.AddBuff(ModContent.BuffType <Buffs.DragonRot>(), 1800);
                 }
             }
         }
         Main.PlaySound(SoundID.Item62, projectile.position);
         projectile.Size      = new Vector2(400);
         projectile.position -= new Vector2(50);
         float RandRotate = Main.rand.NextFloat(0, 9);
         for (int i = 0; i < 40; i++)
         {
             Projectile.NewProjectile(projectile.Center, new Vector2(0, 10f).RotatedBy(MathHelper.ToRadians(9) * i).RotatedBy(MathHelper.ToRadians(RandRotate)), ModContent.ProjectileType <DraconicFireball>(), projectile.damage / 2, projectile.knockBack, projectile.owner);
         }
         for (int k = 0; k < 50; k++)
         {
             KeyUtils.NewDustCircular(out int Flame, projectile.Center, Vector2.Zero, ModContent.DustType <Dusts.DraconicFlame>(), 20, perfect: true);
             Main.dust[Flame].scale *= 3.75f;
         }
     }
     else if (projectile.timeLeft > 10)
     {
         KeyUtils.NewDustCircular(out int Flame, projectile.Center, Vector2.Zero, ModContent.DustType <Dusts.DraconicFlame>(), Main.rand.NextFloat(2.5f, 5f));
         Main.dust[Flame].scale *= .75f;
         if (Main.rand.NextBool())
         {
             Main.dust[Flame].velocity *= 1.5f;
         }
         for (int k = 0; k < Main.rand.Next(5, 10); k++)
         {
             if (!Main.rand.NextBool(3))
             {
                 KeyUtils.NewDustConverge(out Flame, projectile.Center, Vector2.Zero, 150, ModContent.DustType <Dusts.DraconicFlame>(), scale: 2f);
             }
             else
             {
                 KeyUtils.NewDustConverge(out int Debris, projectile.Center, Vector2.Zero, Main.rand.NextFloat(150f, 300f), ModContent.DustType <Dusts.DraconicFlame>(), scale: Main.rand.NextFloat(1.5f, 2.5f));
             }
         }
         for (int k = 0; k < Main.maxNPCs; k++)
         {
             NPC i = Main.npc[k];
             if (i.active && !i.boss && !i.dontTakeDamage && !i.friendly && Collision.CanHit(i.Center, 0, 0, projectile.Center, 0, 0))
             {
                 if (Vector2.Distance(i.Center, projectile.Center) < 300f && i.knockBackResist > 0)
                 {
                     Vector2 vTo = KeyUtils.VectorTo(i.Center, projectile.Center);
                     KeyUtils.AdjustMagnitude(ref vTo, 30f * (i.knockBackResist < .5f ? .5f : i.knockBackResist));
                     i.velocity = (10 * i.velocity + vTo) / 11f;
                     KeyUtils.AdjustMagnitude(ref i.velocity, 30f * (i.knockBackResist < .5f ? .5f : i.knockBackResist));
                 }
                 if (Vector2.Distance(i.Center, projectile.Center) < 150f)
                 {
                     i.AddBuff(ModContent.BuffType <Buffs.DragonRot>(), 10);
                 }
             }
         }
     }
 }