diff --git a/Dusts/LemonNadeExplodeDust.cs b/Dusts/LemonNadeExplodeDust.cs index 6f93352faa..691f4de2ff 100644 --- a/Dusts/LemonNadeExplodeDust.cs +++ b/Dusts/LemonNadeExplodeDust.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Dusts public class LemonNadeExplodeDust : ModDust { public override string Texture => "CalamityMod/Particles/LemonNadeExplode"; - Color RandomColor + Color RandomColor { get { @@ -27,7 +27,8 @@ namespace CalamityMod.Dusts } public override void OnSpawn(Dust dust) { - dust.color = RandomColor; + if (dust.color == Color.Transparent) + dust.color = RandomColor; dust.dataAsFloat = 0.75f; dust.rotation = Main.rand.NextFloat(0, MathHelper.TwoPi); } @@ -41,7 +42,7 @@ namespace CalamityMod.Dusts dust.dataAsFloat *= 0.96f; dust.position += dust.velocity; dust.velocity *= 0.925f; - dust.rotation += MathF.Sin(dust.dustIndex * 0.1f)*0.2f * dust.dataAsFloat; + dust.rotation += MathF.Sin(dust.dustIndex * 0.1f) * 0.2f * dust.dataAsFloat; if (dust.dataAsFloat <= 0.01f) dust.active = false; return false; diff --git a/Items/Weapons/Rogue/DuststormInABottle.cs b/Items/Weapons/Rogue/DuststormInABottle.cs index 612a1f66f7..fe189b9845 100644 --- a/Items/Weapons/Rogue/DuststormInABottle.cs +++ b/Items/Weapons/Rogue/DuststormInABottle.cs @@ -25,38 +25,21 @@ namespace CalamityMod.Items.Weapons.Rogue Item.autoReuse = true; Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 14f; Item.DamageType = RogueDamageClass.Instance; + Item.channel = true; } - - public override float StealthDamageMultiplier => 0.6f; - - public static int CloudLifetime = 200; - public static float DustRadius = 11f; - - //Cloud hitbox size manipulation - public static float MaxSize = 3.2f; - public static float MaxSizeStealth = 3.6f; - public static float GrowthRate = 0.025f; - public static float StealthGrowthRate = 0.035f; - - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + public override void HoldItem(Player player) { - if (player.Calamity().StealthStrikeAvailable()) - { - int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); - if (stealth.WithinBounds(Main.maxProjectiles)) - Main.projectile[stealth].Calamity().stealthStrike = true; - return false; - } - return true; + if (player.ownedProjectileCounts[Item.shoot] <= 0) + player.Calamity().rogueStealth = 0; } public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.SandstorminaBottle). + AddIngredient(). AddIngredient(ItemID.AncientCloth,5). AddIngredient(). AddTile(TileID.MythrilAnvil). diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson index 28014b917f..16c707b5c7 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson @@ -339,8 +339,10 @@ DuststormInABottle: { DisplayName: Duststorm in a Bottle Tooltip: ''' - Explodes into a dust cloud - Stealth strikes form a more intense and longer lasting dust cloud + Disables normal stealth generation + Throws a bottle filled with high-pressure dust that shatters on impact with a target or after a short fuse + Hold to generate stealth, but burn through the bottle's fuse + Stealth strikes cause the bottle to leak dust clouds instead of shattering ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson index b850bdf19c..9b1c3ad652 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson @@ -78,9 +78,10 @@ DragonScalesInfernado.DisplayName: Infernado DragonShit.DisplayName: Fire DukesDecapitatorBubble.DisplayName: Duke Bubble DukesDecapitatorProj.DisplayName: Duke's Decapitator -DuststormCloud.DisplayName: Dust Cloud -DuststormCloudHitbox.DisplayName: Duststorm Cloud +DuststormCloud.DisplayName: Dust Storm DuststormInABottleProj.DisplayName: Duststorm Bottle +DuststormCloudExplosion.DisplayName: Dust Explosion +DuststormInABottleHoldout.DisplayName: Duststorm Bottle DynamicPursuerElectricity.DisplayName: Dynamic Electricity DynamicPursuerLaser.DisplayName: Dynamic Laser DynamicPursuerProjectile.DisplayName: Dynamic Pursuer diff --git a/Projectiles/Rogue/DuststormCloud.cs b/Projectiles/Rogue/DuststormCloud.cs index 40e64aea72..b6f694ece4 100644 --- a/Projectiles/Rogue/DuststormCloud.cs +++ b/Projectiles/Rogue/DuststormCloud.cs @@ -1,62 +1,67 @@ -using Terraria; +using System; +using System.Net.Http.Headers; +using CalamityMod.Dusts; +using CalamityMod.NPCs; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.GameContent; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { + [PierceResistExceptionAttribute] public class DuststormCloud : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; - public override void SetStaticDefaults() => Main.projFrames[Type] = 4; public override void SetDefaults() { - Projectile.width = 38; - Projectile.height = 14; + Projectile.width = 128; + Projectile.height = 128; Projectile.friendly = true; Projectile.alpha = 255; Projectile.tileCollide = false; Projectile.ignoreWater = true; - Projectile.timeLeft = 600; - Projectile.DamageType = DamageClass.Generic; + Projectile.timeLeft = 180; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; + Projectile.penetrate = -1; } + Color color = Color.White; + + public static Color RandomColor + { + get + { + switch (Main.rand.Next(4)) + { + case 0: return Color.SandyBrown; + case 1: return new Color(164, 118, 78); + case 2: return new Color(210, 183, 126); + case 3: return new Color(151, 130, 103); + } + return Color.White; + } + } public override void AI() { - Projectile.frameCounter++; - if (Projectile.frameCounter > 6) + if (color == Color.White) { - Projectile.frame++; - Projectile.frameCounter = 0; - } - if (Projectile.frame >= Main.projFrames[Type]) - { - Projectile.frame = 0; - } - Projectile.velocity *= 0.995f; - Projectile.ai[1] += 1f; - if (Projectile.ai[1] >= 120f) - { - if (Projectile.alpha < 255) - { - Projectile.alpha += 5; - if (Projectile.alpha > 255) - { - Projectile.alpha = 255; - } - } - else if (Projectile.owner == Main.myPlayer) - { - Projectile.Kill(); - } - } - else if (Projectile.alpha > 80) - { - Projectile.alpha -= 30; - if (Projectile.alpha < 80) - { - Projectile.alpha = 80; - } + color = RandomColor; } + Projectile.velocity *= 0.97f; + Projectile.rotation += 0.05f; + Projectile.Opacity = (1- MathF.Pow(1-Projectile.timeLeft / 180f,2)) * 0.5f; + if (Projectile.timeLeft % 5 == 0) + Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2CircularEdge(32,32), ModContent.DustType(),newColor: RandomColor, Scale: 0.75f).customData = Projectile.Opacity; + } + public override bool PreDraw(ref Color lightColor) + { + lightColor = color; + Main.EntitySpriteDraw(TextureAssets.Projectile[Type].Value, Projectile.Center-Main.screenPosition, null, lightColor * Projectile.Opacity, Projectile.rotation, TextureAssets.Projectile[Type].Size() * 0.5f, 0.08f * Projectile.scale, 0); + return false; } } } diff --git a/Projectiles/Rogue/DuststormCloud.png b/Projectiles/Rogue/DuststormCloud.png index b3ef97ca5a..f238522679 100644 Binary files a/Projectiles/Rogue/DuststormCloud.png and b/Projectiles/Rogue/DuststormCloud.png differ diff --git a/Projectiles/Rogue/DuststormCloudExplosion.cs b/Projectiles/Rogue/DuststormCloudExplosion.cs new file mode 100644 index 0000000000..b560153a04 --- /dev/null +++ b/Projectiles/Rogue/DuststormCloudExplosion.cs @@ -0,0 +1,54 @@ +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.NPCs; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class DuststormCloudExplosion : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + + public override string Texture => "CalamityMod/Projectiles/Rogue/DuststormCloud"; + public override void SetDefaults() + { + Projectile.width = 150; + Projectile.height = 150; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 1; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 12; + } + + Color color = Color.White; + public override void AI() + { + if (color == Color.White) + { + color = DuststormCloud.RandomColor; + } + SoundEngine.PlaySound(SoundID.DD2_CrystalCartImpact); + for (var i = 0; i < 80; i++) { + var d = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), Main.rand.NextVector2CircularEdge(8, 8) * Main.rand.NextFloat(0.2f,1.2f), newColor: DuststormCloud.RandomColor, Scale: 0.75f); + d.customData = 0.75f; + } + } + + public override bool PreDraw(ref Color lightColor) + { + Main.EntitySpriteDraw(TextureAssets.Projectile[Type].Value, Projectile.Center - Main.screenPosition, null, color * Projectile.Opacity, Projectile.rotation, TextureAssets.Projectile[Type].Size() * 0.5f, 0.08f * Projectile.scale, 0); + return false; + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width, targetHitbox); + } +} diff --git a/Projectiles/Rogue/DuststormCloudHitbox.cs b/Projectiles/Rogue/DuststormCloudHitbox.cs deleted file mode 100644 index a8e02d7678..0000000000 --- a/Projectiles/Rogue/DuststormCloudHitbox.cs +++ /dev/null @@ -1,39 +0,0 @@ -using CalamityMod.Items.Weapons.Rogue; -using CalamityMod.NPCs; -using Microsoft.Xna.Framework; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - [PierceResistExceptionAttribute(true)] - public class DuststormCloudHitbox : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Rogue"; - - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - public override void SetDefaults() - { - Projectile.width = 50; - Projectile.height = 50; - Projectile.friendly = true; - Projectile.penetrate = -1; - Projectile.tileCollide = false; - Projectile.ignoreWater = true; - Projectile.timeLeft = DuststormInABottle.CloudLifetime; - Projectile.DamageType = RogueDamageClass.Instance; - Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 12; - } - - public override void AI() - { - if (Projectile.scale < (Projectile.ai[1] == 1 ? DuststormInABottle.MaxSizeStealth : DuststormInABottle.MaxSize)) - { - Projectile.scale += Projectile.ai[1] == 1 ? DuststormInABottle.StealthGrowthRate : DuststormInABottle.GrowthRate; - Projectile.ExpandHitboxBy(1 + (Projectile.ai[1] == 1 ? DuststormInABottle.StealthGrowthRate : DuststormInABottle.GrowthRate)); - } - } - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width, targetHitbox); - } -} diff --git a/Projectiles/Rogue/DuststormInABottleHoldout.cs b/Projectiles/Rogue/DuststormInABottleHoldout.cs new file mode 100644 index 0000000000..9fa22c55b3 --- /dev/null +++ b/Projectiles/Rogue/DuststormInABottleHoldout.cs @@ -0,0 +1,127 @@ +using System; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class DuststormInABottleHoldout : BaseSwordHoldoutProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + public override string Texture => "CalamityMod/Items/Weapons/Rogue/DuststormInABottle"; + public override bool useMeleeSpeed => false; + public override bool useMeleeSize => false; + public override int swingWidth => 180; + public override Item BaseItem => ModContent.GetModItem(ModContent.ItemType()).Item; + public override int AfterImageLength => 0; + + public override int StartupTime { get; set; } + public override int CooldownTime { get; set; } + + bool isChannelable = false; + + int explodeTimer = 0; + + public override void Defaults() + { + Projectile.width = 22; Projectile.height = 28; + Projectile.MaxUpdates = 4; + Projectile.noEnchantmentVisuals = true; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.ContinuouslyUpdateDamageStats = true; + } + public override void Spawn() + { + var player = Main.player[Projectile.owner]; + var modplayer = player.GetModPlayer(); + StartupTime = 10; + CooldownTime = 10; + swingTime -= StartupTime + CooldownTime; + OffsetDistance = 24; + modplayer.swingNum = 0; + RotateInStartup = 1; + } + + public override void AdditionalAI() + { + Lighting.AddLight(Projectile.Center, new Vector3(1, 1, 1)); + var player = Main.player[Projectile.owner]; + var cplayer = player.Calamity(); + if (Projectile.Opacity > 0) + { + cplayer.temporaryStealthMax = 0.1f; + cplayer.temporaryStealthTimer = 2; + } + + var avgStealth = 0.8f * cplayer.stealthGenMoving + 0.2f * cplayer.stealthGenStandstill; + var explodeTimeGoal = CalamityUtils.SecondsToFrames(2) / avgStealth + 30; + var stealthTime = explodeTimeGoal - 30; + + if (Projectile.FinalExtraUpdate() && inStartup) + if (explodeTimer < explodeTimeGoal) + explodeTimer++; + else + { + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, explodeTimer, explodeTimeGoal, -1).hostile = true; + Projectile.Opacity = 0; + return; + } + + cplayer.rogueStealth = Projectile.Opacity <= 0 ? 0 : Math.Max(cplayer.temporaryStealthMax, cplayer.rogueStealthMax) * MathHelper.Clamp(explodeTimer / stealthTime, 0f, 1f); + + //When channeling, the internal timer will not progress + if (player.channel && inStartup) + { + if (timer >= StartupTime - 1) + { + timer--; + Projectile.timeLeft++; + } + } + if (explodeTimer >= explodeTimeGoal && inCooldown && !Projectile.FinalExtraUpdate()) + { + timer--; + Projectile.timeLeft++; + } + + if (inSwing) + { + if (swingTimer == (int)(swingTime * 0.75f)) + { + if (Projectile.owner == Main.myPlayer && Projectile.Opacity > 0) + { + var p = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, angle * -12.5f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, explodeTimer, explodeTimeGoal); + if (player.Calamity().StealthStrikeAvailable()) + { + p.Calamity().stealthStrike = true; + } + } + Projectile.Opacity = 0; + } + } + } + + public override float SwingFunction() + { + if (inStartup) + { + return MathHelper.ToRadians(MathHelper.SmoothStep(swingWidth * -0.2f, swingWidth * -0.5f, StartupCompletion)); + } + if (inCooldown) + return MathHelper.ToRadians(MathHelper.Lerp(swingWidth * 0.2f, swingWidth * 0.33f, 1 - MathF.Pow(1 - CooldownCompletion, 3f))); + return MathHelper.ToRadians(MathHelper.SmoothStep(swingWidth * -0.7f, swingWidth * 0.2f, SwingCompletion)); + } + + public override bool? CanHitNPC(NPC target) + { + return false; + } + + public override bool CanHitPlayer(Player target) + { + return false; + } + } +} diff --git a/Projectiles/Rogue/DuststormInABottleProj.cs b/Projectiles/Rogue/DuststormInABottleProj.cs index 61d51c1462..91f085219f 100644 --- a/Projectiles/Rogue/DuststormInABottleProj.cs +++ b/Projectiles/Rogue/DuststormInABottleProj.cs @@ -1,9 +1,11 @@ using System; +using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue @@ -13,64 +15,115 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Items/Weapons/Rogue/DuststormInABottle"; - public override void SetDefaults() + int lifetime => AIState == 1 ? 300 : 150; + public override void SetStaticDefaults() { - Projectile.width = 20; - Projectile.height = 20; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.penetrate = 1; - Projectile.aiStyle = ProjAIStyleID.ThrownProjectile; - Projectile.timeLeft = 180; - AIType = ProjectileID.ThrowingKnife; - Projectile.DamageType = RogueDamageClass.Instance; + ProjectileID.Sets.TrailCacheLength[Type] = 3; + ProjectileID.Sets.TrailingMode[Type] = 0; } - public override void OnKill(int timeLeft) + public override void SetDefaults() { - bool stealth = Projectile.Calamity().stealthStrike; - SoundEngine.PlaySound(SoundID.Item107, Projectile.Center); - double cloudAmt = Main.rand.Next(40, 50); - if (stealth) + Projectile.width = 24; + Projectile.height = 24; + Projectile.friendly = true; + Projectile.tileCollide = true; + Projectile.penetrate = -1; + Projectile.MaxUpdates = 2; + Projectile.timeLeft = lifetime; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + int targetID = -1; + + NPC target => Main.npc[targetID]; + ref float Timer => ref Projectile.ai[0]; + ref float TimerMax => ref Projectile.ai[1]; + ref float AIState => ref Projectile.ai[2]; + + int gravTimer = 0; + + bool Stealth => Projectile.Calamity().stealthStrike; + + public override void AI() + { + Lighting.AddLight(Projectile.Center, new Vector3(1, 1, 1)); + Timer++; + gravTimer++; + bounceCooldown--; + + Projectile.rotation += 0.175f * Projectile.direction * Projectile.velocity.Length(); + if (gravTimer > 20) { - //DUST STORM - for (int dustexplode = 0; dustexplode < 180; dustexplode++) - { - Vector2 dustd = new Vector2(DuststormInABottle.DustRadius, DuststormInABottle.DustRadius).RotatedBy(MathHelper.ToRadians(dustexplode * 2)); - - Particle dust = new SandyDustParticle(Projectile.Center, dustd * Main.rand.NextFloat(0.25f, 1f), Color.Beige, Main.rand.NextFloat(0.7f, 1.2f), Main.rand.Next(30, 50)); - GeneralParticleHandler.SpawnParticle(dust); - - int d = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, Main.rand.NextBool(5) ? 32 : 85, dustd.X, dustd.Y, 50, default, 2f); - Main.dust[d].noGravity = true; - Main.dust[d].velocity *= Main.rand.NextFloat(0.25f, 1f); - Main.dust[d].scale *= Main.rand.NextFloat(0.5f, 0.8f); - } - cloudAmt *= 2.75; - cloudAmt = Math.Round(cloudAmt); + Projectile.velocity.Y += 0.22f; } - else - { - //DUST STORM but smaller - for (int dustexplode = 0; dustexplode < 120; dustexplode++) - { - Vector2 dustd = new Vector2(DuststormInABottle.DustRadius, DuststormInABottle.DustRadius - 2).RotatedBy(MathHelper.ToRadians(dustexplode * 3)); - Particle dust = new SandyDustParticle(Projectile.Center, dustd * Main.rand.NextFloat(0.25f, 1f), Color.Beige, Main.rand.NextFloat(0.7f, 1.2f), Main.rand.Next(30, 50)); - GeneralParticleHandler.SpawnParticle(dust); + if (AIState == 1) + { + if (Timer % 10 == 0) + { + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Main.rand.NextVector2Circular(5, 5), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } } - if (Projectile.owner == Main.myPlayer) + if (Timer > TimerMax && AIState == 0) { - for (int index = 0; index < cloudAmt; index++) + if (!Stealth) { - Vector2 velocity = CalamityUtils.RandomVelocity(100f, 10f, 200f, 0.01f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, stealth ? velocity * 1.2f : velocity, ModContent.ProjectileType(), 0, 0, Projectile.owner, stealth ? 1f : 0f, (float)Main.rand.Next(-45, 1)); + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Projectile.Kill(); + return; } - int hitbox = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack * 0.5f, Projectile.owner); - if (hitbox.WithinBounds(Main.maxProjectiles) && Projectile.Calamity().stealthStrike) //Inherit stealth flag - Main.projectile[hitbox].ai[1] = 1; + AIState = 1; + Timer = 0; + Projectile.timeLeft = lifetime; } } + public override bool PreDraw(ref Color lightColor) + { + Main.EntitySpriteDraw(TextureAssets.Projectile[Type].Value, Projectile.Center - Main.screenPosition, null, Color.White, Projectile.rotation, TextureAssets.Projectile[Type].Size() * 0.5f, Projectile.scale, 0); + return false; + } + + public override bool? CanHitNPC(NPC target) + { + return Projectile.velocity.Length() > 1f; + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if (!Stealth) + { + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Projectile.Kill(); + return; + } + if (Projectile.numHits == 0) + { + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + } + return; + } + + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + return base.Colliding(projHitbox, targetHitbox); + } + + public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac) + { + if (AIState != 0 || Projectile.timeLeft < lifetime - 20) + fallThrough = false; + return base.TileCollideStyle(ref width, ref height, ref fallThrough, ref hitboxCenterFrac); + } + public override bool OnTileCollide(Vector2 oldVelocity) + { + Projectile.velocity *= 0.95f; + return false; + } } } diff --git a/Projectiles/Rogue/LemonNadeHoldout.cs b/Projectiles/Rogue/LemonNadeHoldout.cs index 21bbc932d7..daee97c3e1 100644 --- a/Projectiles/Rogue/LemonNadeHoldout.cs +++ b/Projectiles/Rogue/LemonNadeHoldout.cs @@ -62,10 +62,9 @@ namespace CalamityMod.Projectiles.Rogue cplayer.temporaryStealthTimer = 2; } - //MOVE SECONDS TO LemonNade.cs ITEM var avgStealth = 0.8f * cplayer.stealthGenMoving + 0.2f * cplayer.stealthGenStandstill; - var explodeTimeGoal = CalamityUtils.SecondsToFrames(2) / avgStealth; - var stealthTime = explodeTimeGoal * 0.9f; + var stealthTime = CalamityUtils.SecondsToFrames(2) / avgStealth; + var explodeTimeGoal = stealthTime + 30; if (Projectile.FinalExtraUpdate() && inStartup) if (explodeTimer < explodeTimeGoal) diff --git a/Projectiles/Rogue/SealedSingularityProjectile.cs b/Projectiles/Rogue/SealedSingularityProjectile.cs index 5963983034..3193dbb6cb 100644 --- a/Projectiles/Rogue/SealedSingularityProjectile.cs +++ b/Projectiles/Rogue/SealedSingularityProjectile.cs @@ -23,6 +23,21 @@ namespace CalamityMod.Projectiles.Rogue //Trans flag colors with name containing "girlswag" or having a gender change pot in inventory at donor request public static Color BorderColor => Main.LocalPlayer.name.Contains("girlswag") || Main.LocalPlayer.HasItemInAnyInventory(ItemID.GenderChangePotion) ? Color.Lerp(Color.Pink, Color.LightBlue, (MathF.Sin(Main.GlobalTimeWrappedHourly * 3) + 1) * 0.5f) : new Color(59, 2, 120); + + public static Color RandomColor + { + get + { + switch (Main.rand.Next(4)) + { + case 0: return new Color(91, 47, 113); + case 1: return new Color(119, 74, 165); + case 2: return new Color(58, 58, 58); + case 3: return new Color(123, 115, 142); + } + return Color.White; + } + } public override void SetStaticDefaults() { ProjectileID.Sets.TrailCacheLength[Type] = 3; @@ -49,7 +64,6 @@ namespace CalamityMod.Projectiles.Rogue ref float Timer => ref Projectile.ai[0]; ref float TimerMax => ref Projectile.ai[1]; ref float AIState => ref Projectile.ai[2]; - bool Stealth => Projectile.Calamity().stealthStrike; int bounceCooldown = 0; @@ -71,6 +85,7 @@ namespace CalamityMod.Projectiles.Rogue if (AIState == 1) { Projectile.timeLeft++; + Projectile.rotation += 0.175f * Projectile.direction; Projectile.velocity = new Vector2( MathF.Sin(Timer), MathF.Sin(Timer * 0.7f) @@ -136,9 +151,9 @@ namespace CalamityMod.Projectiles.Rogue Projectile.ResetLocalNPCHitImmunity(); Projectile.Damage(); - for (var i = 0; i < 20; i++) + for (var i = 0; i < (Stealth? 80 : 40); i++) { - var d = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), Main.rand.NextVector2CircularEdge(15, 15) * Main.rand.NextFloat(0.25f, 1f), Scale: Main.rand.NextFloat(0.5f, 1f)); + var d = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), Main.rand.NextVector2CircularEdge(15, 15) * Main.rand.NextFloat(0.25f, Stealth? 1.5f : 1f), Scale: Main.rand.NextFloat(0.5f, 1.5f), newColor: RandomColor); } SoundEngine.PlaySound(SoundID.Item62 with { pitch = 1f }, Projectile.Center); SoundEngine.PlaySound(SoundID.Item111 with { pitch = 0.5f }, Projectile.Center);