diff --git a/Buffs/CalamityGlobalBuff.cs b/Buffs/CalamityGlobalBuff.cs index 87c8f2f8d0..0d504b4f9f 100644 --- a/Buffs/CalamityGlobalBuff.cs +++ b/Buffs/CalamityGlobalBuff.cs @@ -56,6 +56,15 @@ namespace CalamityMod.Buffs npc.DelBuff(buffIndex); buffIndex--; } + else if (type == BuffID.Slow) + { + if (npc.Calamity().slowed < npc.buffTime[buffIndex]) + { + npc.Calamity().slowed = npc.buffTime[buffIndex]; + } + npc.DelBuff(buffIndex); + buffIndex--; + } } public override void ModifyBuffTip(int type, ref string tip, ref int rare) diff --git a/Items/Weapons/Rogue/NightsGaze.cs b/Items/Weapons/Rogue/NightsGaze.cs new file mode 100644 index 0000000000..e7761c9a8d --- /dev/null +++ b/Items/Weapons/Rogue/NightsGaze.cs @@ -0,0 +1,67 @@ +using CalamityMod.Projectiles.Rogue; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Ores; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Rogue +{ + public class NightsGaze : RogueWeapon + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Night's Gaze"); + Tooltip.SetDefault("Throws a spear that shatters when it hits an enemy\n" + + "Stealth strikes cause the spear to summon homing stars as it flies\n" + + "Strike your foes with this spear of the night"); + } + + public override void SafeSetDefaults() + { + item.width = 80; + item.damage = 800; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 20; + item.useStyle = 1; + item.useTime = 20; + item.knockBack = 1f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.height = 80; + item.maxStack = 1; + item.value = Item.buyPrice(1, 40, 0, 0); + item.rare = 10; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 30f; + item.Calamity().postMoonLordRarity = 13; + item.Calamity().rogue = true; + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.Calamity().StealthStrikeAvailable()) + { + int p = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[p].Calamity().stealthStrike = true; + return false; + } + return true; + } + + /* + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.AddIngredient(ModContent.ItemType(), 12); + recipe.AddIngredient(ItemID.DayBreak); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this, 1); + recipe.AddRecipe(); + } + */ + } +} diff --git a/Items/Weapons/Rogue/NightsGaze.png b/Items/Weapons/Rogue/NightsGaze.png new file mode 100644 index 0000000000..70193b68e5 Binary files /dev/null and b/Items/Weapons/Rogue/NightsGaze.png differ diff --git a/Items/Weapons/Rogue/SludgeSplotch.cs b/Items/Weapons/Rogue/SludgeSplotch.cs new file mode 100644 index 0000000000..f7e08a190b --- /dev/null +++ b/Items/Weapons/Rogue/SludgeSplotch.cs @@ -0,0 +1,62 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Rogue; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Rogue +{ + public class SludgeSplotch : RogueWeapon + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sludge Splotch"); + Tooltip.SetDefault("Slows non-boss enemies slightly\n" + + "Stealth strikes cause the main ball of sludge to split on hit, inflicting more damage"); + } + + public override void SafeSetDefaults() + { + item.width = 32; + item.damage = 15; + item.noMelee = true; + item.noUseGraphic = true; + item.consumable = true; + item.useAnimation = 18; + item.useStyle = 1; + item.useTime = 18; + item.knockBack = 1f; + item.autoReuse = true; + item.height = 30; + item.maxStack = 999; + item.value = Item.buyPrice(0, 1, 0, 0); + item.rare = 0; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 7.5f; + item.Calamity().rogue = true; + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Main.PlaySound(4, (int)player.position.X, (int)player.position.Y, 9, 2, 0); + + if (player.Calamity().StealthStrikeAvailable()) + { + int p = Projectile.NewProjectile(position.X, position.Y, speedX * 1.2f, speedY * 1.2f, type, damage, knockBack * 3, player.whoAmI, 0f, 1f); + Main.projectile[p].Calamity().stealthStrike = true; + return false; + } + return true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 2); + recipe.AddIngredient(ModContent.ItemType()); + recipe.SetResult(this, 20); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Rogue/SludgeSplotch.png b/Items/Weapons/Rogue/SludgeSplotch.png new file mode 100644 index 0000000000..9b73c06564 Binary files /dev/null and b/Items/Weapons/Rogue/SludgeSplotch.png differ diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 3a75681139..2ca8d42ed8 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -97,6 +97,7 @@ namespace CalamityMod.NPCs public int eFreeze = 0; public int silvaStun = 0; public int webbed = 0; + public int slowed = 0; public int yellowCandle = 0; public int pearlAura = 0; public int wCleave = 0; @@ -609,6 +610,7 @@ namespace CalamityMod.NPCs npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[BuffID.Webbed] = true; + npc.buffImmune[BuffID.Slow] = true; } if (DestroyerIDs.Contains(npc.type) || npc.type == NPCID.DD2EterniaCrystal || npc.townNPC) @@ -2117,7 +2119,9 @@ namespace CalamityMod.NPCs silvaStun--; if (webbed > 0) webbed--; - if (yellowCandle > 0) + if (slowed > 0) + slowed--; + if (yellowCandle > 0) yellowCandle--; if (pearlAura > 0) pearlAura--; @@ -2182,6 +2186,8 @@ namespace CalamityMod.NPCs npc.velocity = Vector2.Zero; else if (timeSlow > 0 || webbed > 0) npc.velocity *= 0.85f; + else if (slowed > 0) + npc.velocity *= 0.9f; } } #endregion @@ -3163,6 +3169,21 @@ namespace CalamityMod.NPCs } } } + if (slowed > 0) + { + if (Main.rand.Next(5) < 4) + { + int dust = Dust.NewDust(npc.position - new Vector2(2f, 2f), npc.width + 4, npc.height + 4, 191, npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 225, default, 3f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 1.1f; + Main.dust[dust].velocity.Y += 0.25f; + if (Main.rand.NextBool(2)) + { + Main.dust[dust].noGravity = false; + Main.dust[dust].scale *= 0.5f; + } + } + } if (gState > 0 || eFreeze > 0) { diff --git a/Projectiles/Rogue/NightsGazeProjectile.cs b/Projectiles/Rogue/NightsGazeProjectile.cs new file mode 100644 index 0000000000..2ea0a66fcc --- /dev/null +++ b/Projectiles/Rogue/NightsGazeProjectile.cs @@ -0,0 +1,123 @@ + +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class NightsGazeProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Night's Gaze"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.timeLeft = 300; + projectile.Calamity().rogue = true; + } + + public override void AI() + { + if (projectile.ai[0] == 0f) + { + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; + } + + if (projectile.Calamity().stealthStrike) + { + if (Main.rand.Next(10) == 0) + { + int projectileDamage = (int)(projectile.damage * 0.25f); + int projectileType = ModContent.ProjectileType(); + Vector2 velocity = projectile.velocity; + + int p = Projectile.NewProjectile(projectile.Center, velocity, projectileType, projectileDamage, 5f, projectile.owner, 1f, 0f); + Main.projectile[p].penetrate = 1; + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), projectile.timeLeft); + + int starCount = 6; + int starFrequency = 3; + float spread = 20f; + for (int i = 0; i < starCount; i++) + { + int projectileDamage = (int)(projectile.damage * 0.75f); + int projectileType = ModContent.ProjectileType(); + if (Main.rand.Next(starCount) < starFrequency) + { + projectileType = ModContent.ProjectileType(); + } + Vector2 velocity = projectile.oldVelocity.RotateRandom(MathHelper.ToRadians(spread)); + float speed = Main.rand.NextFloat(1.5f, 2f); + float moveDuration = Main.rand.Next(5, 15); + + Projectile.NewProjectile(projectile.Center, velocity * speed, projectileType, projectileDamage, 5f, projectile.owner, 0f, moveDuration); + } + + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 62, 0.6f); + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 68, 0.2f); + Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 122, 0.4f); + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + Collision.HitTiles(projectile.position + projectile.velocity, projectile.velocity, projectile.width, projectile.height); + Main.PlaySound(0, projectile.position); + projectile.Kill(); + return false; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 3); + return false; + } + + public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) + { + Vector2 origin = new Vector2(projectile.width / 2, projectile.height / 2); + spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Rogue/NightsGazeProjectileGlow"), projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, origin, 1f, SpriteEffects.None, 0f); + } + + public override void Kill(int timeLeft) + { + for (int i = 0; i < 5; i++) + { + int dustToUse = Main.rand.Next(0, 3); + int dustType = 0; + switch (dustToUse) + { + case 0: + dustType = 109; + break; + case 1: + dustType = 111; + break; + case 2: + dustType = 132; + break; + } + + int dust = Dust.NewDust(projectile.Center, 1, 1, dustType, projectile.velocity.X / 3f, projectile.velocity.Y / 3f, 0, default, 1.5f); + Main.dust[dust].noGravity = true; + } + } + } +} diff --git a/Projectiles/Rogue/NightsGazeProjectile.png b/Projectiles/Rogue/NightsGazeProjectile.png new file mode 100644 index 0000000000..80fbd96afe Binary files /dev/null and b/Projectiles/Rogue/NightsGazeProjectile.png differ diff --git a/Projectiles/Rogue/NightsGazeProjectileGlow.png b/Projectiles/Rogue/NightsGazeProjectileGlow.png new file mode 100644 index 0000000000..3328e6a6bc Binary files /dev/null and b/Projectiles/Rogue/NightsGazeProjectileGlow.png differ diff --git a/Projectiles/Rogue/NightsGazeSpark.cs b/Projectiles/Rogue/NightsGazeSpark.cs new file mode 100644 index 0000000000..9d9d449286 --- /dev/null +++ b/Projectiles/Rogue/NightsGazeSpark.cs @@ -0,0 +1,106 @@ + +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class NightsGazeSpark : ModProjectile + { + public static int lifetime = 150; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Night's Gaze Spark"); + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.friendly = true; + projectile.penetrate = 5; + projectile.timeLeft = lifetime; + projectile.Calamity().rogue = true; + projectile.localAI[0] = 10f; + } + + public override void AI() + { + projectile.rotation += projectile.direction * projectile.ai[0]; + + if (projectile.timeLeft < (lifetime - projectile.ai[1]) && projectile.localAI[0] >= 0) + { + projectile.velocity.Normalize(); + projectile.velocity *= projectile.localAI[0]; + projectile.localAI[0]--; + } + + if (projectile.localAI[0] == 0) + { + projectile.Kill(); + } + + for (int i = 0; i < 3; i++) + { + float dustVelocity = Main.rand.NextFloat(0f, 0.5f); + int dustToUse = Main.rand.Next(0, 3); + int dustType = 0; + switch (dustToUse) + { + case 0: + dustType = 109; + break; + case 1: + dustType = 111; + break; + case 2: + dustType = 132; + break; + } + + int dust = Dust.NewDust(projectile.Center, 1, 1, dustType, projectile.velocity.X, projectile.velocity.Y, 0, default, 1.5f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= dustVelocity; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 120); + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + Collision.HitTiles(projectile.position + projectile.velocity, projectile.velocity, projectile.width, projectile.height); + projectile.Kill(); + return false; + } + + public override void Kill(int timeLeft) + { + for (int i = 0; i < 5; i++) + { + int dustToUse = Main.rand.Next(0, 3); + int dustType = 0; + switch (dustToUse) + { + case 0: + dustType = 109; + break; + case 1: + dustType = 111; + break; + case 2: + dustType = 132; + break; + } + + int dust = Dust.NewDust(projectile.Center, 1, 1, dustType, projectile.velocity.X, projectile.velocity.Y, 0, default, 1.5f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.75f; + } + } + } +} diff --git a/Projectiles/Rogue/NightsGazeSpark.png b/Projectiles/Rogue/NightsGazeSpark.png new file mode 100644 index 0000000000..4a2fe20cc9 Binary files /dev/null and b/Projectiles/Rogue/NightsGazeSpark.png differ diff --git a/Projectiles/Rogue/NightsGazeStar.cs b/Projectiles/Rogue/NightsGazeStar.cs new file mode 100644 index 0000000000..efd5239624 --- /dev/null +++ b/Projectiles/Rogue/NightsGazeStar.cs @@ -0,0 +1,141 @@ + +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class NightsGazeStar : ModProjectile + { + public static int lifetime = 150; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Night's Gaze Star"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 8; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.penetrate = 5; + projectile.timeLeft = lifetime; + projectile.Calamity().rogue = true; + projectile.localAI[0] = 10f; + } + + public override void AI() + { + projectile.rotation += projectile.direction * 0.05f; + + if (projectile.ai[0] == 0f) + { + if (projectile.timeLeft < (lifetime - projectile.ai[1]) && projectile.localAI[0] >= 0) + { + projectile.velocity.Normalize(); + projectile.velocity *= projectile.localAI[0]; + projectile.localAI[0]--; + } + else if (projectile.timeLeft >= (lifetime - projectile.ai[1])) + { + for (int i = 0; i < 3; i++) + { + float dustVelocity = Main.rand.NextFloat(0f, 0.5f); + int dustToUse = Main.rand.Next(0, 3); + int dustType = 0; + switch (dustToUse) + { + case 0: + dustType = 109; + break; + case 1: + dustType = 111; + break; + case 2: + dustType = 132; + break; + } + + int dust = Dust.NewDust(projectile.Center, 1, 1, dustType, projectile.velocity.X, projectile.velocity.Y, 0, default, 1.5f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= dustVelocity; + } + } + } + else if (projectile.ai[0] == 1f) + { + float minDist = 999f; + int index = 0; + for (int i = 0; i < Main.npc.Length; i++) + { + NPC npc = Main.npc[i]; + if (!npc.friendly && !npc.townNPC && npc.active && !npc.dontTakeDamage && npc.chaseable) + { + float dist = (projectile.Center - npc.Center).Length(); + if (dist < minDist) + { + minDist = dist; + index = i; + } + } + } + + if (minDist < 999f) + { + Vector2 velocityNew = Main.npc[index].Center - projectile.Center; + float speed = 10f; + velocityNew.Normalize(); + projectile.velocity = velocityNew * speed; + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 120); + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + Collision.HitTiles(projectile.position + projectile.velocity, projectile.velocity, projectile.width, projectile.height); + projectile.Kill(); + return false; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, Color.White, ProjectileID.Sets.TrailingMode[projectile.type], 3); + return false; + } + + public override void Kill(int timeLeft) + { + for (int i = 0; i < 5; i++) + { + int dustToUse = Main.rand.Next(0, 3); + int dustType = 0; + switch (dustToUse) + { + case 0: + dustType = 109; + break; + case 1: + dustType = 111; + break; + case 2: + dustType = 132; + break; + } + + int dust = Dust.NewDust(projectile.Center, 1, 1, dustType, projectile.velocity.X, projectile.velocity.Y, 0, default, 1.5f); + Main.dust[dust].noGravity = true; + } + } + } +} diff --git a/Projectiles/Rogue/NightsGazeStar.png b/Projectiles/Rogue/NightsGazeStar.png new file mode 100644 index 0000000000..2edc75ddf5 Binary files /dev/null and b/Projectiles/Rogue/NightsGazeStar.png differ diff --git a/Projectiles/Rogue/NychthemeronOrb.cs b/Projectiles/Rogue/NychthemeronOrb.cs index 8f426053fa..64de33a875 100644 --- a/Projectiles/Rogue/NychthemeronOrb.cs +++ b/Projectiles/Rogue/NychthemeronOrb.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { bool isActive = false; - for (int i = 0; i < 200; i++) + for (int i = 0; i < Main.projectile.Length; i++) { Projectile p = Main.projectile[i]; if (p.identity == projectile.ai[1] && p.active) diff --git a/Projectiles/Rogue/SludgeSplotchProj1.cs b/Projectiles/Rogue/SludgeSplotchProj1.cs new file mode 100644 index 0000000000..ae9a2e64be --- /dev/null +++ b/Projectiles/Rogue/SludgeSplotchProj1.cs @@ -0,0 +1,128 @@ +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class SludgeSplotchProj1 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sludge Splotch"); + } + + public override void SetDefaults() + { + projectile.width = 10; + projectile.height = 10; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.timeLeft = 300; + projectile.Calamity().rogue = true; + } + + public override void AI() + { + projectile.velocity.Y += 0.1f; + if (projectile.velocity.Y >= 16f) + { + projectile.velocity.Y = 16f; + } + + projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); + + int numDust = 2; + for (int i = 0; i < numDust; i++) + { + int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, 191, 0f, 0f, 225, new Color(255, 255, 255), 3); + Main.dust[dust].noGravity = true; + Main.dust[dust].noLight = true; + Main.dust[dust].velocity = Main.dust[dust].velocity * 0.25f; + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (projectile.Calamity().stealthStrike) + { + projectile.ai[0] = 0; + projectile.ai[1] = 0; + + if (projectile.velocity.X != oldVelocity.X) + { + if (oldVelocity.X < 0) + { + projectile.ai[0] = 1; + } + if (oldVelocity.X > 0) + { + projectile.ai[0] = -1; + } + } + if (projectile.velocity.Y != oldVelocity.Y) + { + if (oldVelocity.Y < 0) + { + projectile.ai[1] = 1; + } + if (oldVelocity.Y > 0) + { + projectile.ai[1] = -1; + } + } + } + + Collision.HitTiles(projectile.position + projectile.velocity, projectile.velocity, projectile.width, projectile.height); + Main.PlaySound(0, projectile.position); + Main.PlaySound(4, (int)projectile.position.X, (int)projectile.position.Y, 9, 2, 0); + projectile.Kill(); + return false; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Slow, 240); + Main.PlaySound(4, (int)projectile.position.X, (int)projectile.position.Y, 9, 2, 0); + } + + public override void Kill(int timeLeft) + { + if (projectile.Calamity().stealthStrike) + { + int sparkCount = Main.rand.Next(3, 6); + for (int i = 0; i < sparkCount; i++) + { + int sparkScatter = 1; + Vector2 sparkVelocity = new Vector2(Main.rand.NextFloat(-sparkScatter, sparkScatter), Main.rand.NextFloat(-sparkScatter - 2, sparkScatter + 2)); + + sparkVelocity.Normalize(); + sparkVelocity *= 7; + + Projectile.NewProjectile(projectile.Center, sparkVelocity, ModContent.ProjectileType(), 7, 0, projectile.owner, 0, 0); + } + } + + int numDust = 20; + int dustType = 191; + float spread = 3f; + for (int i = 0; i < numDust; i++) + { + Vector2 velocity = projectile.velocity + new Vector2(Main.rand.NextFloat(-spread, spread), Main.rand.NextFloat(-spread, spread)); + + int dust = Dust.NewDust(projectile.Center, 1, 1, dustType, velocity.X, velocity.Y, 175, default, 3f); + Main.dust[dust].noGravity = true; + } + } + } +} diff --git a/Projectiles/Rogue/SludgeSplotchProj1.png b/Projectiles/Rogue/SludgeSplotchProj1.png new file mode 100644 index 0000000000..7d4731aed9 Binary files /dev/null and b/Projectiles/Rogue/SludgeSplotchProj1.png differ diff --git a/Projectiles/Rogue/SludgeSplotchProj2.cs b/Projectiles/Rogue/SludgeSplotchProj2.cs new file mode 100644 index 0000000000..d7685afeb0 --- /dev/null +++ b/Projectiles/Rogue/SludgeSplotchProj2.cs @@ -0,0 +1,81 @@ +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class SludgeSplotchProj2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Sludge Splotch"); + } + + public override void SetDefaults() + { + projectile.width = 6; + projectile.height = 6; + projectile.friendly = true; + projectile.penetrate = 2; + projectile.timeLeft = 150; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = -1; + projectile.Calamity().rogue = true; + } + + public override void AI() + { + projectile.velocity.Y += 0.1f; + if (projectile.velocity.Y >= 16f) + { + projectile.velocity.Y = 16f; + } + + projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); + + int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, 191, 0f, 0f, 225, new Color(255, 255, 255), 2); + Main.dust[dust].noGravity = true; + Main.dust[dust].noLight = true; + Main.dust[dust].velocity = Main.dust[dust].velocity * 0.25f; + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + Collision.HitTiles(projectile.position + projectile.velocity, projectile.velocity, projectile.width, projectile.height); + Main.PlaySound(0, projectile.position); + Main.PlaySound(4, (int)projectile.position.X, (int)projectile.position.Y, 28, 0.3f, 0); + projectile.Kill(); + return false; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D tex = Main.projectileTexture[projectile.type]; + spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + return false; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(BuffID.Slow, 120); + } + + public override void Kill(int timeLeft) + { + int numDust = 10; + int dustType = 191; + float spread = 2f; + for (int i = 0; i < numDust; i++) + { + Vector2 velocity = projectile.velocity + new Vector2(Main.rand.NextFloat(-spread, spread), Main.rand.NextFloat(-spread, spread)); + + int dust = Dust.NewDust(projectile.Center, 1, 1, dustType, velocity.X, velocity.Y, 175, default, 2f); + Main.dust[dust].noGravity = true; + } + } + } +} diff --git a/Projectiles/Rogue/SludgeSplotchProj2.png b/Projectiles/Rogue/SludgeSplotchProj2.png new file mode 100644 index 0000000000..1d5c771e9d Binary files /dev/null and b/Projectiles/Rogue/SludgeSplotchProj2.png differ