diff --git a/Projectiles/Magic/BrimstoneHellfireballFriendly.cs b/Projectiles/Magic/BrimstoneHellfireballFriendly.cs index f4086523e5..23721e7d31 100644 --- a/Projectiles/Magic/BrimstoneHellfireballFriendly.cs +++ b/Projectiles/Magic/BrimstoneHellfireballFriendly.cs @@ -49,12 +49,6 @@ namespace CalamityMod.Projectiles.Magic if (projectile.owner == Main.myPlayer) { int fire = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - // protection against projectile cap - if (projectile.minion && fire < Main.maxProjectiles) - { - Main.projectile[fire].Calamity().forceMinion = true; - ProjectileID.Sets.MinionShot[Main.projectile[fire].type] = true; - } } } diff --git a/Projectiles/Magic/FlareBoltProjectile.cs b/Projectiles/Magic/FlareBoltProjectile.cs index c5b9ca275e..a274b117aa 100644 --- a/Projectiles/Magic/FlareBoltProjectile.cs +++ b/Projectiles/Magic/FlareBoltProjectile.cs @@ -40,21 +40,20 @@ namespace CalamityMod.Projectiles.Magic float num93 = projectile.velocity.X / 3f * (float)num92; float num94 = projectile.velocity.Y / 3f * (float)num92; int num95 = 4; - int num96 = Dust.NewDust(new Vector2(projectile.position.X + (float)num95, projectile.position.Y + (float)num95), projectile.width - num95 * 2, projectile.height - num95 * 2, 174, 0f, 0f, 100, default, 1.2f); - Main.dust[num96].noGravity = true; - Main.dust[num96].velocity *= 0.1f; - Main.dust[num96].velocity += projectile.velocity * 0.1f; - Dust expr_47FA_cp_0 = Main.dust[num96]; - expr_47FA_cp_0.position.X -= num93; - Dust expr_4815_cp_0 = Main.dust[num96]; - expr_4815_cp_0.position.Y -= num94; + int fireDust = Dust.NewDust(new Vector2(projectile.position.X + (float)num95, projectile.position.Y + (float)num95), projectile.width - num95 * 2, projectile.height - num95 * 2, 174, 0f, 0f, 100, default, 1.2f); + Dust dust = Main.dust[fireDust]; + dust.noGravity = true; + dust.velocity *= 0.1f; + dust.velocity += projectile.velocity * 0.1f; + dust.position.X -= num93; + dust.position.Y -= num94; } if (Main.rand.NextBool(10)) { int num97 = 4; - int num98 = Dust.NewDust(new Vector2(projectile.position.X + (float)num97, projectile.position.Y + (float)num97), projectile.width - num97 * 2, projectile.height - num97 * 2, 174, 0f, 0f, 100, default, 0.6f); - Main.dust[num98].velocity *= 0.25f; - Main.dust[num98].velocity += projectile.velocity * 0.5f; + int fireDustSmol = Dust.NewDust(new Vector2(projectile.position.X + (float)num97, projectile.position.Y + (float)num97), projectile.width - num97 * 2, projectile.height - num97 * 2, 174, 0f, 0f, 100, default, 0.6f); + Main.dust[fireDustSmol].velocity *= 0.25f; + Main.dust[fireDustSmol].velocity += projectile.velocity * 0.5f; } projectile.rotation += 0.3f * (float)projectile.direction; } diff --git a/Projectiles/Magic/FrigidflashBoltProjectile.cs b/Projectiles/Magic/FrigidflashBoltProjectile.cs index 64bd18c0ff..bb7a46ad26 100644 --- a/Projectiles/Magic/FrigidflashBoltProjectile.cs +++ b/Projectiles/Magic/FrigidflashBoltProjectile.cs @@ -40,42 +40,40 @@ namespace CalamityMod.Projectiles.Magic float num93 = projectile.velocity.X / 3f * (float)num92; float num94 = projectile.velocity.Y / 3f * (float)num92; int num95 = 4; - int num96 = Dust.NewDust(new Vector2(projectile.position.X + (float)num95, projectile.position.Y + (float)num95), projectile.width - num95 * 2, projectile.height - num95 * 2, 174, 0f, 0f, 100, default, 1.2f); - Main.dust[num96].noGravity = true; - Main.dust[num96].velocity *= 0.1f; - Main.dust[num96].velocity += projectile.velocity * 0.1f; - Dust expr_47FA_cp_0 = Main.dust[num96]; - expr_47FA_cp_0.position.X -= num93; - Dust expr_4815_cp_0 = Main.dust[num96]; - expr_4815_cp_0.position.Y -= num94; + int fireDust = Dust.NewDust(new Vector2(projectile.position.X + (float)num95, projectile.position.Y + (float)num95), projectile.width - num95 * 2, projectile.height - num95 * 2, 174, 0f, 0f, 100, default, 1.2f); + Dust dust = Main.dust[fireDust]; + dust.noGravity = true; + dust.velocity *= 0.1f; + dust.velocity += projectile.velocity * 0.1f; + dust.position.X -= num93; + dust.position.Y -= num94; } if (Main.rand.NextBool(10)) { int num97 = 4; - int num98 = Dust.NewDust(new Vector2(projectile.position.X + (float)num97, projectile.position.Y + (float)num97), projectile.width - num97 * 2, projectile.height - num97 * 2, 174, 0f, 0f, 100, default, 0.6f); - Main.dust[num98].velocity *= 0.25f; - Main.dust[num98].velocity += projectile.velocity * 0.5f; + int fireDustSmol = Dust.NewDust(new Vector2(projectile.position.X + (float)num97, projectile.position.Y + (float)num97), projectile.width - num97 * 2, projectile.height - num97 * 2, 174, 0f, 0f, 100, default, 0.6f); + Main.dust[fireDustSmol].velocity *= 0.25f; + Main.dust[fireDustSmol].velocity += projectile.velocity * 0.5f; } for (int num105 = 0; num105 < 2; num105++) { float num99 = projectile.velocity.X / 3f * (float)num105; float num100 = projectile.velocity.Y / 3f * (float)num105; int num101 = 4; - int num102 = Dust.NewDust(new Vector2(projectile.position.X + (float)num101, projectile.position.Y + (float)num101), projectile.width - num101 * 2, projectile.height - num101 * 2, 92, 0f, 0f, 100, default, 1.2f); - Main.dust[num102].noGravity = true; - Main.dust[num102].velocity *= 0.1f; - Main.dust[num102].velocity += projectile.velocity * 0.1f; - Dust expr_47FA_cp_0 = Main.dust[num102]; - expr_47FA_cp_0.position.X -= num99; - Dust expr_4815_cp_0 = Main.dust[num102]; - expr_4815_cp_0.position.Y -= num100; + int frostDust = Dust.NewDust(new Vector2(projectile.position.X + (float)num101, projectile.position.Y + (float)num101), projectile.width - num101 * 2, projectile.height - num101 * 2, 92, 0f, 0f, 100, default, 1.2f); + Dust dust = Main.dust[frostDust]; + dust.noGravity = true; + dust.velocity *= 0.1f; + dust.velocity += projectile.velocity * 0.1f; + dust.position.X -= num99; + dust.position.Y -= num100; } if (Main.rand.NextBool(10)) { int num103 = 4; - int num104 = Dust.NewDust(new Vector2(projectile.position.X + (float)num103, projectile.position.Y + (float)num103), projectile.width - num103 * 2, projectile.height - num103 * 2, 92, 0f, 0f, 100, default, 0.6f); - Main.dust[num104].velocity *= 0.25f; - Main.dust[num104].velocity += projectile.velocity * 0.5f; + int frostDustSmol = Dust.NewDust(new Vector2(projectile.position.X + (float)num103, projectile.position.Y + (float)num103), projectile.width - num103 * 2, projectile.height - num103 * 2, 92, 0f, 0f, 100, default, 0.6f); + Main.dust[frostDustSmol].velocity *= 0.25f; + Main.dust[frostDustSmol].velocity += projectile.velocity * 0.5f; } projectile.rotation += 0.3f * (float)projectile.direction; } diff --git a/Projectiles/Magic/FrostBoltProjectile.cs b/Projectiles/Magic/FrostBoltProjectile.cs index f47617a3a2..c34ac48be7 100644 --- a/Projectiles/Magic/FrostBoltProjectile.cs +++ b/Projectiles/Magic/FrostBoltProjectile.cs @@ -41,21 +41,20 @@ namespace CalamityMod.Projectiles.Magic float num99 = projectile.velocity.X / 3f * (float)num105; float num100 = projectile.velocity.Y / 3f * (float)num105; int num101 = 4; - int num102 = Dust.NewDust(new Vector2(projectile.position.X + (float)num101, projectile.position.Y + (float)num101), projectile.width - num101 * 2, projectile.height - num101 * 2, 92, 0f, 0f, 100, default, 1.2f); - Main.dust[num102].noGravity = true; - Main.dust[num102].velocity *= 0.1f; - Main.dust[num102].velocity += projectile.velocity * 0.1f; - Dust expr_47FA_cp_0 = Main.dust[num102]; - expr_47FA_cp_0.position.X -= num99; - Dust expr_4815_cp_0 = Main.dust[num102]; - expr_4815_cp_0.position.Y -= num100; + int frostDust = Dust.NewDust(new Vector2(projectile.position.X + (float)num101, projectile.position.Y + (float)num101), projectile.width - num101 * 2, projectile.height - num101 * 2, 92, 0f, 0f, 100, default, 1.2f); + Dust dust = Main.dust[frostDust]; + dust.noGravity = true; + dust.velocity *= 0.1f; + dust.velocity += projectile.velocity * 0.1f; + dust.position.X -= num99; + dust.position.Y -= num100; } if (Main.rand.NextBool(10)) { int num103 = 4; - int num104 = Dust.NewDust(new Vector2(projectile.position.X + (float)num103, projectile.position.Y + (float)num103), projectile.width - num103 * 2, projectile.height - num103 * 2, 92, 0f, 0f, 100, default, 0.6f); - Main.dust[num104].velocity *= 0.25f; - Main.dust[num104].velocity += projectile.velocity * 0.5f; + int frostDustSmol = Dust.NewDust(new Vector2(projectile.position.X + (float)num103, projectile.position.Y + (float)num103), projectile.width - num103 * 2, projectile.height - num103 * 2, 92, 0f, 0f, 100, default, 0.6f); + Main.dust[frostDustSmol].velocity *= 0.25f; + Main.dust[frostDustSmol].velocity += projectile.velocity * 0.5f; } projectile.rotation += 0.3f * (float)projectile.direction; } diff --git a/Projectiles/Rogue/FrostShardFriendly.cs b/Projectiles/Rogue/FrostShardFriendly.cs index de6c763aa2..fd43227505 100644 --- a/Projectiles/Rogue/FrostShardFriendly.cs +++ b/Projectiles/Rogue/FrostShardFriendly.cs @@ -14,7 +14,6 @@ namespace CalamityMod.Projectiles.Rogue projectile.aiStyle = 1; projectile.coldDamage = true; projectile.friendly = true; - projectile.minion = true; projectile.penetrate = 1; projectile.Calamity().rogue = true; projectile.coldDamage = true; diff --git a/Projectiles/Rogue/FrostyFlareProj.cs b/Projectiles/Rogue/FrostyFlareProj.cs index 08d8ada1e7..9f22638ce9 100644 --- a/Projectiles/Rogue/FrostyFlareProj.cs +++ b/Projectiles/Rogue/FrostyFlareProj.cs @@ -49,8 +49,7 @@ namespace CalamityMod.Projectiles.Rogue vel.X += Main.rand.Next(-50, 51); vel.Normalize(); vel *= 30f; - int p = Projectile.NewProjectile(pos, vel + projectile.velocity / 4f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); - Main.projectile[p].minion = false; + Projectile.NewProjectile(pos, vel + projectile.velocity / 4f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); } int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 172); @@ -73,8 +72,7 @@ namespace CalamityMod.Projectiles.Rogue vel.X += Main.rand.Next(-50, 51); vel.Normalize(); vel *= 30f; - int p = Projectile.NewProjectile(pos, vel + Main.npc[id].velocity, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); - Main.projectile[p].minion = false; + Projectile.NewProjectile(pos, vel + Main.npc[id].velocity, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); } } else diff --git a/Projectiles/Summon/BrimstoneElementalMinion.cs b/Projectiles/Summon/BrimstoneElementalMinion.cs index ed62c3fc64..612a21234c 100644 --- a/Projectiles/Summon/BrimstoneElementalMinion.cs +++ b/Projectiles/Summon/BrimstoneElementalMinion.cs @@ -1,6 +1,5 @@ using CalamityMod.CalPlayer; using CalamityMod.Dusts; -using CalamityMod.Projectiles.Magic; using CalamityMod.World; using Microsoft.Xna.Framework; using System; @@ -224,7 +223,7 @@ namespace CalamityMod.Projectiles.Summon if (projectile.ai[0] == 0f) { float scaleFactor3 = 14f; - int num658 = ModContent.ProjectileType(); + int num658 = ModContent.ProjectileType(); if (flag25 && projectile.ai[1] == 0f) { projectile.ai[1] += 1f; @@ -233,14 +232,7 @@ namespace CalamityMod.Projectiles.Summon Vector2 value19 = vector46 - projectile.Center; value19.Normalize(); value19 *= scaleFactor3; - int fire = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value19.X, value19.Y, num658, projectile.damage, 0f, Main.myPlayer, 0f, 0f); - // protection against projectile cap - if (fire < Main.maxProjectiles) - { - Main.projectile[fire].timeLeft = 200; - Main.projectile[fire].Calamity().forceMinion = true; - ProjectileID.Sets.MinionShot[Main.projectile[fire].type] = true; - } + int fire = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value19.X, value19.Y, num658, projectile.damage, 0f, projectile.owner, 0f, 0f); projectile.netUpdate = true; } } diff --git a/Projectiles/Summon/BrimstoneExplosionMinion.cs b/Projectiles/Summon/BrimstoneExplosionMinion.cs new file mode 100644 index 0000000000..58fad20d40 --- /dev/null +++ b/Projectiles/Summon/BrimstoneExplosionMinion.cs @@ -0,0 +1,80 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Summon +{ + public class BrimstoneExplosionMinion : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosion"); + ProjectileID.Sets.MinionShot[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 130; + projectile.height = 130; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.tileCollide = false; + projectile.penetrate = -1; + projectile.timeLeft = 180; + projectile.minion = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, 0.9f, 0f, 0f); + if (projectile.localAI[0] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + projectile.localAI[0] += 1f; + } + float num461 = 25f; + if (projectile.ai[0] > 180f) + { + num461 -= (projectile.ai[0] - 180f) / 2f; + } + if (num461 <= 0f) + { + num461 = 0f; + projectile.Kill(); + } + num461 *= 0.7f; + projectile.ai[0] += 4f; + int num462 = 0; + while ((float)num462 < num461) + { + float num463 = (float)Main.rand.Next(-10, 11); + float num464 = (float)Main.rand.Next(-10, 11); + float num465 = (float)Main.rand.Next(3, 9); + float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + num466 = num465 / num466; + num463 *= num466; + num464 *= num466; + int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1.5f); + Dust dust = Main.dust[num467]; + dust.noGravity = true; + dust.position.X = projectile.Center.X; + dust.position.Y = projectile.Center.Y; + dust.position.X += (float)Main.rand.Next(-10, 11); + dust.position.Y += (float)Main.rand.Next(-10, 11); + dust.velocity.X = num463; + dust.velocity.Y = num464; + num462++; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 600); + } + } +} diff --git a/Projectiles/Summon/BrimstoneExplosionMinion.png b/Projectiles/Summon/BrimstoneExplosionMinion.png new file mode 100644 index 0000000000..59d45407ff Binary files /dev/null and b/Projectiles/Summon/BrimstoneExplosionMinion.png differ diff --git a/Projectiles/Summon/BrimstoneFireballMinion.cs b/Projectiles/Summon/BrimstoneFireballMinion.cs new file mode 100644 index 0000000000..0d33e06164 --- /dev/null +++ b/Projectiles/Summon/BrimstoneFireballMinion.cs @@ -0,0 +1,61 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Summon +{ + public class BrimstoneFireballMinion : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Brimfire"); + ProjectileID.Sets.MinionShot[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.friendly = true; + projectile.ignoreWater = true; + projectile.timeLeft = 200; + projectile.penetrate = 2; + projectile.extraUpdates = 1; + projectile.minion = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + } + + public override void AI() + { + Lighting.AddLight(projectile.Center, 0.6f, 0f, 0f); + if (projectile.localAI[0] == 0f) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20); + projectile.localAI[0] += 1f; + } + for (int num457 = 0; num457 < 3; num457++) + { + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1.5f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0.5f; + Main.dust[num458].velocity += projectile.velocity * 0.1f; + } + } + + public override void Kill(int timeLeft) + { + if (projectile.owner == Main.myPlayer) + { + int fire = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 600); + } + } +} diff --git a/Projectiles/Summon/BrimstoneFireballMinion.png b/Projectiles/Summon/BrimstoneFireballMinion.png new file mode 100644 index 0000000000..831f72cfc8 Binary files /dev/null and b/Projectiles/Summon/BrimstoneFireballMinion.png differ diff --git a/Projectiles/Summon/IceSentry.cs b/Projectiles/Summon/IceSentry.cs index 2d69fb0592..1fca4c68b6 100644 --- a/Projectiles/Summon/IceSentry.cs +++ b/Projectiles/Summon/IceSentry.cs @@ -1,5 +1,3 @@ -using CalamityMod.Projectiles.Magic; -using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -76,8 +74,7 @@ namespace CalamityMod.Projectiles.Summon Vector2 speed = new Vector2(Main.rand.Next(-1000, 1001), Main.rand.Next(-1000, 1001)); speed.Normalize(); speed *= 15f; - int shard = Projectile.NewProjectile(projectile.Center + speed, speed, ModContent.ProjectileType(), projectile.damage / 2, projectile.knockBack / 2, projectile.owner); - ProjectileID.Sets.SentryShot[Main.projectile[shard].type] = true; + int shard = Projectile.NewProjectile(projectile.Center + speed, speed, ModContent.ProjectileType(), projectile.damage / 2, projectile.knockBack / 2, projectile.owner); } } } @@ -119,13 +116,7 @@ namespace CalamityMod.Projectiles.Summon speed *= 8f; if (projectile.ai[1] >= 300f) speed = speed.RotatedBy(MathHelper.ToRadians(Main.rand.Next(-5, 6))) * 1.5f + npc.velocity / 2f; - int p = Projectile.NewProjectile(projectile.Center, speed + npc.velocity / 2f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); - if (p != 1000) - { - Main.projectile[p].magic = false; - Main.projectile[p].minion = true; - ProjectileID.Sets.SentryShot[Main.projectile[p].type] = true; - } + Projectile.NewProjectile(projectile.Center, speed + npc.velocity / 2f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); } //if (!rememberTarget) Main.NewText("couldn't hit target"); diff --git a/Projectiles/Summon/IceSentryFrostBolt.cs b/Projectiles/Summon/IceSentryFrostBolt.cs new file mode 100644 index 0000000000..39f88c650e --- /dev/null +++ b/Projectiles/Summon/IceSentryFrostBolt.cs @@ -0,0 +1,105 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class IceSentryFrostBolt : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ball"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 2; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.SentryShot[projectile.type] = true; + } + + public override void SetDefaults() + { + projectile.width = 16; + projectile.height = 16; + projectile.friendly = true; + projectile.alpha = 255; + projectile.penetrate = 2; + projectile.timeLeft = 480; + projectile.minion = true; + projectile.coldDamage = true; + } + + public override void AI() + { + if (projectile.alpha > 0) + { + projectile.alpha -= 25; + if (projectile.alpha < 0) + projectile.alpha = 0; + } + Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.01f / 255f, (255 - projectile.alpha) * 0.3f / 255f, (255 - projectile.alpha) * 0.45f / 255f); + for (int num105 = 0; num105 < 2; num105++) + { + float num99 = projectile.velocity.X / 3f * (float)num105; + float num100 = projectile.velocity.Y / 3f * (float)num105; + int num101 = 4; + int num102 = Dust.NewDust(new Vector2(projectile.position.X + (float)num101, projectile.position.Y + (float)num101), projectile.width - num101 * 2, projectile.height - num101 * 2, 92, 0f, 0f, 100, default, 1.2f); + Dust dust = Main.dust[num102]; + dust.noGravity = true; + dust.velocity *= 0.1f; + dust.velocity += projectile.velocity * 0.1f; + dust.position.X -= num99; + dust.position.Y -= num100; + } + if (Main.rand.NextBool(10)) + { + int num103 = 4; + int num104 = Dust.NewDust(new Vector2(projectile.position.X + (float)num103, projectile.position.Y + (float)num103), projectile.width - num103 * 2, projectile.height - num103 * 2, 92, 0f, 0f, 100, default, 0.6f); + Main.dust[num104].velocity *= 0.25f; + Main.dust[num104].velocity += projectile.velocity * 0.5f; + } + projectile.rotation += 0.3f * (float)projectile.direction; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); + return false; + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + projectile.penetrate--; + if (projectile.penetrate <= 0) + { + projectile.Kill(); + } + else + { + if (projectile.velocity.X != oldVelocity.X) + { + projectile.velocity.X = -oldVelocity.X; + } + if (projectile.velocity.Y != oldVelocity.Y) + { + projectile.velocity.Y = -oldVelocity.Y; + } + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10); + } + return false; + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 27); + for (int k = 0; k < 5; k++) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 92, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Frostburn, 60); + } + } +} diff --git a/Projectiles/Summon/IceSentryFrostBolt.png b/Projectiles/Summon/IceSentryFrostBolt.png new file mode 100644 index 0000000000..701164b9ac Binary files /dev/null and b/Projectiles/Summon/IceSentryFrostBolt.png differ diff --git a/Projectiles/Summon/IceSentryShard.cs b/Projectiles/Summon/IceSentryShard.cs new file mode 100644 index 0000000000..379392a9e5 --- /dev/null +++ b/Projectiles/Summon/IceSentryShard.cs @@ -0,0 +1,81 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Summon +{ + public class IceSentryShard : ModProjectile + { + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.aiStyle = 1; + projectile.coldDamage = true; + projectile.friendly = true; + projectile.minion = true; + projectile.penetrate = 1; + projectile.coldDamage = true; + } + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Frost Shard"); + Main.projFrames[projectile.type] = 5; + ProjectileID.Sets.SentryShot[projectile.type] = true; + } + + public override void AI() + { + projectile.frameCounter++; + if (projectile.frameCounter > 4) + { + projectile.frameCounter = 0; + projectile.frame++; + } + + if (projectile.frame >= 5) + projectile.frame = 0; + + projectile.velocity.Y += 0.2f; + if (projectile.localAI[0] == 0f || projectile.localAI[0] == 2f) + { + projectile.scale += 0.01f; + projectile.alpha -= 50; + if (projectile.alpha <= 0) + { + projectile.localAI[0] = 1f; + projectile.alpha = 0; + } + } + else if (projectile.localAI[0] == 1.0) + { + projectile.scale -= 0.01f; + projectile.alpha += 50; + if (projectile.alpha >= byte.MaxValue) + { + projectile.localAI[0] = 2f; + projectile.alpha = byte.MaxValue; + } + } + } + + public override Color? GetAlpha(Color lightColor) + { + return new Color(200, 200, 200, projectile.alpha); + } + + public override void Kill(int timeLeft) + { + Main.PlaySound(SoundID.Item27, projectile.position); + for (int index1 = 0; index1 < 3; ++index1) + { + int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 76); + Main.dust[index2].noGravity = true; + Main.dust[index2].noLight = true; + Main.dust[index2].scale = 0.7f; + } + } + } +} diff --git a/Projectiles/Summon/IceSentryShard.png b/Projectiles/Summon/IceSentryShard.png new file mode 100644 index 0000000000..14ddad107b Binary files /dev/null and b/Projectiles/Summon/IceSentryShard.png differ