From e631255f7ef5f9e02455f83eed3e39a6ee404060 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Thu, 4 Jan 2024 19:51:09 -0500 Subject: [PATCH 01/13] Add a startup message for the Gimme Swag plushie campaign. --- CalPlayer/CalamityPlayer.cs | 11 +++++++++-- CalPlayer/CalamityPlayerMiscEffects.cs | 4 ++++ Localization/en-US/Mods.CalamityMod.Misc.hjson | 1 + 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index e171f8123e..cdd577d58f 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -4813,8 +4813,15 @@ namespace CalamityMod.CalPlayer if (CalamityConfig.Instance.SpeedrunTimer) CalamityMod.SpeedrunTimer.Restart(); - // Set a random delay between 12 and 20 seconds. When this delay hits zero, the music mod and wiki reminder messages display - if ((CalamityMod.Instance.musicMod is null && CalamityConfig.Instance.MusicModReminderMessage) || CalamityConfig.Instance.WikiStatusMessage) + // + // 04JAN2024: Ozzatron: Added a temporary message for the Gimme Swag plushie campaign. + // This message should not exist indefinitely. It is being pushed as a silent public update just for itself. + // As this message always displays and is not configurable, the previous rules about startup messages have been replaced with always-true. + // + + // Set a random delay between 12 and 20 seconds. When this delay hits zero, startup messages display + bool plushieMessage = true; + if (plushieMessage || (CalamityMod.Instance.musicMod is null && CalamityConfig.Instance.MusicModReminderMessage) || CalamityConfig.Instance.WikiStatusMessage) { startMessageDisplayDelay = Main.rand.Next(CalamityUtils.SecondsToFrames(12), CalamityUtils.SecondsToFrames(20) + 1); } diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 9338322a15..d9481c8967 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -4118,10 +4118,14 @@ namespace CalamityMod.CalPlayer CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Misc.WikiStatus1"); CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Misc.WikiStatus2"); } + if (CalamityMod.Instance.musicMod is null && CalamityConfig.Instance.MusicModReminderMessage) { CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Misc.MusicModReminder"); } + + // 04JAN2024: Ozzatron: Plushie message always appears. + CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Misc.GimmeSwagPlushieCampaign"); } --startMessageDisplayDelay; diff --git a/Localization/en-US/Mods.CalamityMod.Misc.hjson b/Localization/en-US/Mods.CalamityMod.Misc.hjson index e67ca338e8..e7ab97cb58 100644 --- a/Localization/en-US/Mods.CalamityMod.Misc.hjson +++ b/Localization/en-US/Mods.CalamityMod.Misc.hjson @@ -22,6 +22,7 @@ RecipeGroup: { WikiStatus1: "[i:Book] [c/EE4939:Note: The Fandom wiki is no longer supported by Calamity.] [i:Book]" WikiStatus2: "[i:Book] [c/EE4939:Check out the Official Calamity Mod Wiki at ][c/3989FF:calamitymod.wiki.gg][c/EE4939:!] [i:Book]" MusicModReminder: "[i:MusicBoxMartians] [c/71DFF5:Remember to also install the Calamity Music Mod to experience our soundtrack!] [i:MusicBoxMartians]" +GimmeSwagPlushieCampaign: "\n[i:GreenPresent] [c/3BE022:LIMITED TIME! Sign up for the Calamitas Plushie Campaign!] [c/3989FF:calamitymod.com/plush] [i:GreenPresent]" // Recipe Conditions Tier1ArsenalRecipeCondition: View an unencrypted schematic from the lab near the Sunken Sea Tier2ArsenalRecipeCondition: Decrypt a schematic from the lab in the large planetoid in the sky From 4f5006203309af95f5450266539a133c9508d444 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Thu, 4 Jan 2024 20:34:31 -0500 Subject: [PATCH 02/13] Exorcism, Defective Sphere, Resurrection Butterfly --- Balancing/BalancingChangesManager.cs | 6 ++-- Items/Weapons/Rogue/DefectiveSphere.cs | 4 +-- Items/Weapons/Rogue/Exorcism.cs | 6 ++-- Items/Weapons/Summon/ResurrectionButterfly.cs | 2 +- ...Mods.CalamityMod.Items.Weapons.Rogue.hjson | 5 ++- Projectiles/Rogue/ExorcismProj.cs | 22 ++++-------- Projectiles/Rogue/ExorcismShockwave.cs | 35 +++++-------------- Projectiles/Rogue/ExorcismStar.cs | 5 +-- Projectiles/Rogue/SphereBladed.cs | 6 ++-- Projectiles/Rogue/SphereBlue.cs | 1 + Projectiles/Rogue/SphereSpiked.cs | 2 -- Projectiles/Summon/PinkButterfly.cs | 10 +++--- Projectiles/Summon/PurpleButterfly.cs | 9 ++--- Projectiles/Summon/SakuraBullet.cs | 2 +- 14 files changed, 41 insertions(+), 74 deletions(-) diff --git a/Balancing/BalancingChangesManager.cs b/Balancing/BalancingChangesManager.cs index 2430ded823..20e9fc81b2 100644 --- a/Balancing/BalancingChangesManager.cs +++ b/Balancing/BalancingChangesManager.cs @@ -193,14 +193,14 @@ namespace CalamityMod.Balancing #endregion #region Lunatic Cultist - // 25% resist to Resurrection Butterfly. - NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCID.CultistBoss, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType(), ProjectileType())))); - // 20% resist to Art Attack. NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCID.CultistBoss, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); // 20% resist to Nightglow. NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCID.CultistBoss, Do(new ProjectileResistBalancingRule(0.8f, ProjectileID.FairyQueenMagicItemShot)))); + + // 20% resist to Resurrection Butterfly. + NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCID.CultistBoss, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType(), ProjectileType())))); #endregion #region Astrum Deus diff --git a/Items/Weapons/Rogue/DefectiveSphere.cs b/Items/Weapons/Rogue/DefectiveSphere.cs index 45929c4479..0fa4644005 100644 --- a/Items/Weapons/Rogue/DefectiveSphere.cs +++ b/Items/Weapons/Rogue/DefectiveSphere.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Weapons.Rogue { public class DefectiveSphere : RogueWeapon { - public static int BaseDamage = 130; + public static int BaseDamage = 116; public static float Speed = 15f; public override void SetDefaults() @@ -52,7 +52,7 @@ namespace CalamityMod.Items.Weapons.Rogue } } - public override float StealthDamageMultiplier => 0.625f; + public override float StealthDamageMultiplier => 0.9f; public override void ModifyStatsExtra(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) { diff --git a/Items/Weapons/Rogue/Exorcism.cs b/Items/Weapons/Rogue/Exorcism.cs index 80e82aac1d..d1495f37ff 100644 --- a/Items/Weapons/Rogue/Exorcism.cs +++ b/Items/Weapons/Rogue/Exorcism.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 34; Item.height = 42; - Item.damage = 55; + Item.damage = 64; Item.noMelee = true; Item.noUseGraphic = true; Item.useAnimation = Item.useTime = 20; @@ -33,13 +33,13 @@ namespace CalamityMod.Items.Weapons.Rogue { if (player.Calamity().StealthStrikeAvailable()) { - int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 2f, damage); + int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 1f, damage); if (p.WithinBounds(Main.maxProjectiles)) Main.projectile[p].Calamity().stealthStrike = true; } else { - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 1f, damage); + Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0.25f, damage); } return false; } diff --git a/Items/Weapons/Summon/ResurrectionButterfly.cs b/Items/Weapons/Summon/ResurrectionButterfly.cs index 06510aeb3e..ebb384cbc0 100644 --- a/Items/Weapons/Summon/ResurrectionButterfly.cs +++ b/Items/Weapons/Summon/ResurrectionButterfly.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Summon { Item.width = 46; Item.height = 46; - Item.damage = 55; + Item.damage = 67; Item.mana = 10; Item.useTime = Item.useAnimation = 20; Item.useStyle = ItemUseStyleID.Swing; diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson index dacbcebe1f..07f73df839 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson @@ -391,9 +391,8 @@ Exorcism: { DisplayName: Exorcism Tooltip: ''' - Throws a hallowed cross which explodes into a flash of light that damages nearby enemies, closer enemies receiving more damage - As the cross travels downwards, the damage inflicted by both the cross and flash increases constantly - Stealth strikes cause the cross to be thrown with full damage immediately. Hallowed stars fall when the cross explodes + Throws a hallowed cross which explodes into a flash of light that damages nearby enemies + Stealth strikes create larger flashes and rain stars infused with holy light ''' } diff --git a/Projectiles/Rogue/ExorcismProj.cs b/Projectiles/Rogue/ExorcismProj.cs index 69484d0c19..d81552ce6f 100644 --- a/Projectiles/Rogue/ExorcismProj.cs +++ b/Projectiles/Rogue/ExorcismProj.cs @@ -31,18 +31,6 @@ namespace CalamityMod.Projectiles.Rogue Projectile.velocity.Y += 0.1f; Projectile.rotation += 0.05f * Projectile.direction; - // Damage Scaling - if (Projectile.velocity.Y > 0 && Projectile.ai[0] < 2f) - { - Projectile.ai[0] += 0.015f; - } - if (Projectile.ai[0] > 2f) - { - Projectile.ai[0] = 2f; - } - - Projectile.damage = (int)(Projectile.ai[1] * Projectile.ai[0]); - // Dust Effects Vector2 dustLeft = (new Vector2(-1, 0)).RotatedBy(Projectile.rotation); Vector2 dustRight = (new Vector2(1, 0)).RotatedBy(Projectile.rotation); @@ -55,7 +43,7 @@ namespace CalamityMod.Projectiles.Rogue float maxScale = 1.4f; int dustType = 175; - int dustCount = (int)(5 * (Projectile.ai[0] - 1f)); + int dustCount = (int)(5 * (Projectile.ai[0])); for (int i = 0; i < dustCount; i++) { @@ -105,17 +93,19 @@ namespace CalamityMod.Projectiles.Rogue //Crystal smash sound SoundEngine.PlaySound(SoundID.Item27, Projectile.Center); // Light burst - int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, 0, Projectile.owner, Projectile.ai[0] - 1f, 0); + int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.8f), 0, Projectile.owner, Projectile.ai[0], 0); Main.projectile[p].rotation = Projectile.rotation; + if (Projectile.Calamity().stealthStrike) + Main.projectile[p].Calamity().stealthStrike = true; // Stars if (Projectile.Calamity().stealthStrike) { - for (int i = 0; i < 9; i++) + for (int i = 0; i < 6; i++) { Vector2 pos = new Vector2(Projectile.Center.X + (float)Projectile.width * 0.5f + (float)Main.rand.Next(-201, 201), Main.screenPosition.Y - 600f - Main.rand.Next(50)); float speedX = (Projectile.Center.X - pos.X) / 20f; float speedY = (Projectile.Center.Y - pos.Y) / 20f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), pos.X, pos.Y, speedX, speedY, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack * 0.5f, Projectile.owner, Main.rand.NextFloat(-3f, 3f), 0f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), pos.X, pos.Y, speedX, speedY, ModContent.ProjectileType(), (int)(Projectile.damage * 0.75f), Projectile.knockBack * 0.5f, Projectile.owner, Main.rand.NextFloat(-3f, 3f), 0f); } } } diff --git a/Projectiles/Rogue/ExorcismShockwave.cs b/Projectiles/Rogue/ExorcismShockwave.cs index 0b254cd7f0..03b4e58e09 100644 --- a/Projectiles/Rogue/ExorcismShockwave.cs +++ b/Projectiles/Rogue/ExorcismShockwave.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; @@ -9,12 +9,13 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - public static float radius = 100; + public static float Radius = 100; + public static float RadiusStealth = 200; public override void SetDefaults() { - Projectile.width = (int)radius * 2; - Projectile.height = (int)radius * 2; + Projectile.width = (int)(Projectile.Calamity().stealthStrike ? RadiusStealth * 2 : Radius * 2); + Projectile.height = (int)(Projectile.Calamity().stealthStrike ? RadiusStealth * 2 : Radius * 2); Projectile.friendly = true; Projectile.penetrate = -1; Projectile.tileCollide = false; @@ -31,7 +32,7 @@ namespace CalamityMod.Projectiles.Rogue { Projectile.alpha = (int)((1 - Projectile.ai[0]) * 255f); - // Blast wave should be brighter the higher the charge of the projectile when it is killed + // Blast wave should be brighter on stealth strikes int numDust = (int)(40 * Projectile.ai[0]) + 10; for (int i = 0; i < numDust; i++) @@ -55,7 +56,7 @@ namespace CalamityMod.Projectiles.Rogue // Shockwave Vector2 circleVelocity = new Vector2(Main.rand.NextFloat(-1, 1), Main.rand.NextFloat(-1, 1)); circleVelocity.Normalize(); - circleVelocity *= radius / 10f; + circleVelocity *= (Projectile.Calamity().stealthStrike ? RadiusStealth : Radius) / 10f; int circle = Dust.NewDust(Projectile.Center, 1, 1, dustType, circleVelocity.X, circleVelocity.Y, 0, default, 1.5f); Main.dust[circle].noGravity = true; @@ -117,26 +118,6 @@ namespace CalamityMod.Projectiles.Rogue } } - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) - { - float dist1 = Vector2.Distance(Projectile.Center, target.Hitbox.TopLeft()); - float dist2 = Vector2.Distance(Projectile.Center, target.Hitbox.TopRight()); - float dist3 = Vector2.Distance(Projectile.Center, target.Hitbox.BottomLeft()); - float dist4 = Vector2.Distance(Projectile.Center, target.Hitbox.BottomRight()); - - float damageScale = dist1; - if (dist2 < damageScale) - damageScale = dist2; - if (dist3 < damageScale) - damageScale = dist3; - if (dist4 < damageScale) - damageScale = dist4; - damageScale /= radius; - damageScale = 1f - damageScale; - - modifiers.SourceDamage *= damageScale; - } - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, radius, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, (Projectile.Calamity().stealthStrike ? RadiusStealth : Radius), targetHitbox); } } diff --git a/Projectiles/Rogue/ExorcismStar.cs b/Projectiles/Rogue/ExorcismStar.cs index 4e4ea10eb8..0ee150d10c 100644 --- a/Projectiles/Rogue/ExorcismStar.cs +++ b/Projectiles/Rogue/ExorcismStar.cs @@ -28,6 +28,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.tileCollide = false; Projectile.ignoreWater = true; Projectile.timeLeft = 300; + Projectile.extraUpdates = 3; Projectile.DamageType = RogueDamageClass.Instance; } @@ -42,9 +43,9 @@ namespace CalamityMod.Projectiles.Rogue } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 180); + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 60); - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 180); + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 60); public override Color? GetAlpha(Color lightColor) => new Color(250, 200, 45, Projectile.alpha); diff --git a/Projectiles/Rogue/SphereBladed.cs b/Projectiles/Rogue/SphereBladed.cs index 586c82452a..2ff3d90a08 100644 --- a/Projectiles/Rogue/SphereBladed.cs +++ b/Projectiles/Rogue/SphereBladed.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using System; using Terraria; using Terraria.ID; @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.extraUpdates = 1; Projectile.DamageType = RogueDamageClass.Instance; Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 10; + Projectile.idStaticNPCHitCooldown = 15; Projectile.timeLeft = 300; Projectile.tileCollide = false; } @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Rogue if (Projectile.ai[0] == 0f) { Projectile.ai[1] += 1f; - if (Projectile.ai[1] >= 25f) + if (Projectile.ai[1] >= 30f) { Projectile.ai[0] = 1f; Projectile.ai[1] = 0f; diff --git a/Projectiles/Rogue/SphereBlue.cs b/Projectiles/Rogue/SphereBlue.cs index d2b3baab45..ed88e06f36 100644 --- a/Projectiles/Rogue/SphereBlue.cs +++ b/Projectiles/Rogue/SphereBlue.cs @@ -55,6 +55,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.penetrate = -1; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; + Projectile.damage /= 2; Projectile.Damage(); SoundEngine.PlaySound(SoundID.NPCDeath37, Projectile.position); if (Main.netMode != NetmodeID.Server) diff --git a/Projectiles/Rogue/SphereSpiked.cs b/Projectiles/Rogue/SphereSpiked.cs index a93b6d0875..26ed4e38db 100644 --- a/Projectiles/Rogue/SphereSpiked.cs +++ b/Projectiles/Rogue/SphereSpiked.cs @@ -45,8 +45,6 @@ namespace CalamityMod.Projectiles.Rogue public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { modifiers.SourceDamage *= 1.2f; - if (Main.rand.NextBool(10)) - modifiers.SetCrit(); } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) diff --git a/Projectiles/Summon/PinkButterfly.cs b/Projectiles/Summon/PinkButterfly.cs index 4fcfccd7bd..9a38adc77d 100644 --- a/Projectiles/Summon/PinkButterfly.cs +++ b/Projectiles/Summon/PinkButterfly.cs @@ -194,10 +194,10 @@ namespace CalamityMod.Projectiles.Summon // Projectile fire timer if (Projectile.ai[1] > 0f) - Projectile.ai[1] += (float)Main.rand.Next(1, 3); + Projectile.ai[1] += (float)Main.rand.Next(1, 2+1); // Reset timer - if (Projectile.ai[1] > 300f) + if (Projectile.ai[1] > 240f) { Projectile.ai[1] = 0f; Projectile.netUpdate = true; @@ -210,7 +210,7 @@ namespace CalamityMod.Projectiles.Summon // Fire projectiles if (Projectile.ai[0] == 0f) { - float velocity = 8f; + float velocity = 10f; int projectileType = ModContent.ProjectileType(); if (canAttack && Projectile.ai[1] == 0f && Projectile.localAI[0] >= 120f) { @@ -223,10 +223,10 @@ namespace CalamityMod.Projectiles.Summon projDirectionAgain *= velocity; int numProj = 2; float rotation = MathHelper.ToRadians(4); - for (int i = 0; i < numProj + 1; i++) + for (int i = 0; i < numProj; i++) { Vector2 perturbedSpeed = projDirectionAgain.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, perturbedSpeed, projectileType, Projectile.damage / 2, Projectile.knockBack * 0.5f, Projectile.owner, targetIndex, 0f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, perturbedSpeed, projectileType, (int)(Projectile.damage * 0.8f), Projectile.knockBack * 0.5f, Projectile.owner, targetIndex, 0f); } Projectile.netUpdate = true; } diff --git a/Projectiles/Summon/PurpleButterfly.cs b/Projectiles/Summon/PurpleButterfly.cs index fccd2d79a0..fd6bf17390 100644 --- a/Projectiles/Summon/PurpleButterfly.cs +++ b/Projectiles/Summon/PurpleButterfly.cs @@ -34,6 +34,8 @@ namespace CalamityMod.Projectiles.Summon Projectile.timeLeft *= 5; Projectile.minion = true; Projectile.DamageType = DamageClass.Summon; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 8; } public override void AI() @@ -69,7 +71,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.frame = 0; } Lighting.AddLight(Projectile.Center, 0.3f, 0f, 0.5f); - Projectile.ChargingMinionAI(1200f, 1500f, 2400f, 150f, 0, 30f, 18f, 9f, new Vector2(0f, -60f), 30f, 12f, true, true); + Projectile.ChargingMinionAI(1200f, 1500f, 2400f, 150f, 0, 25f, 20f, 9f, new Vector2(0f, -60f), 30f, 15f, true, true); bool isMinion = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (isMinion) @@ -94,10 +96,5 @@ namespace CalamityMod.Projectiles.Summon Main.EntitySpriteDraw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)framing / 2f), Projectile.scale, spriteEffects, 0); return false; } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.immune[Projectile.owner] = 8; - } } } diff --git a/Projectiles/Summon/SakuraBullet.cs b/Projectiles/Summon/SakuraBullet.cs index f6b29e3023..9770d93590 100644 --- a/Projectiles/Summon/SakuraBullet.cs +++ b/Projectiles/Summon/SakuraBullet.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.width = Projectile.height = 20; Projectile.friendly = true; Projectile.netImportant = true; - Projectile.timeLeft = 150; + Projectile.timeLeft = 210; Projectile.extraUpdates = 1; Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Summon; From e602f2245a25b32f4b2740dae075a8051a6fd025 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Thu, 4 Jan 2024 21:41:03 -0500 Subject: [PATCH 03/13] Culled global iframes from a few projectiles --- Localization/en-US/Mods.CalamityMod.Misc.hjson | 6 +++++- Projectiles/Magic/AnahitasArpeggioNote.cs | 8 +++----- Projectiles/Magic/BrimstoneTentacle.cs | 7 ++----- Projectiles/Magic/CosmicTentacle.cs | 9 +++------ Projectiles/Melee/EssenceScythe.cs | 5 +++-- 5 files changed, 16 insertions(+), 19 deletions(-) diff --git a/Localization/en-US/Mods.CalamityMod.Misc.hjson b/Localization/en-US/Mods.CalamityMod.Misc.hjson index e7ab97cb58..ea779ddde8 100644 --- a/Localization/en-US/Mods.CalamityMod.Misc.hjson +++ b/Localization/en-US/Mods.CalamityMod.Misc.hjson @@ -22,7 +22,11 @@ RecipeGroup: { WikiStatus1: "[i:Book] [c/EE4939:Note: The Fandom wiki is no longer supported by Calamity.] [i:Book]" WikiStatus2: "[i:Book] [c/EE4939:Check out the Official Calamity Mod Wiki at ][c/3989FF:calamitymod.wiki.gg][c/EE4939:!] [i:Book]" MusicModReminder: "[i:MusicBoxMartians] [c/71DFF5:Remember to also install the Calamity Music Mod to experience our soundtrack!] [i:MusicBoxMartians]" -GimmeSwagPlushieCampaign: "\n[i:GreenPresent] [c/3BE022:LIMITED TIME! Sign up for the Calamitas Plushie Campaign!] [c/3989FF:calamitymod.com/plush] [i:GreenPresent]" +GimmeSwagPlushieCampaign: + ''' + + [i:GreenPresent] [c/3BE022:LIMITED TIME! Sign up for the Calamitas Plushie Campaign!] [c/3989FF:calamitymod.com/plush] [i:GreenPresent] + ''' // Recipe Conditions Tier1ArsenalRecipeCondition: View an unencrypted schematic from the lab near the Sunken Sea Tier2ArsenalRecipeCondition: Decrypt a schematic from the lab in the large planetoid in the sky diff --git a/Projectiles/Magic/AnahitasArpeggioNote.cs b/Projectiles/Magic/AnahitasArpeggioNote.cs index 08a26cdde9..5f3e988d51 100644 --- a/Projectiles/Magic/AnahitasArpeggioNote.cs +++ b/Projectiles/Magic/AnahitasArpeggioNote.cs @@ -25,6 +25,8 @@ namespace CalamityMod.Projectiles.Magic Projectile.ignoreWater = true; Projectile.penetrate = 5; Projectile.timeLeft = 420; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 7; } public override void AI() @@ -88,10 +90,6 @@ namespace CalamityMod.Projectiles.Magic return false; } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.immune[Projectile.owner] = 7; - target.AddBuff(BuffID.Confused, 300); - } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Confused, 300); } } diff --git a/Projectiles/Magic/BrimstoneTentacle.cs b/Projectiles/Magic/BrimstoneTentacle.cs index 3e243f00b8..53c0347cb3 100644 --- a/Projectiles/Magic/BrimstoneTentacle.cs +++ b/Projectiles/Magic/BrimstoneTentacle.cs @@ -19,6 +19,8 @@ namespace CalamityMod.Projectiles.Magic Projectile.penetrate = 5; Projectile.MaxUpdates = 3; Projectile.DamageType = DamageClass.Magic; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 5; } public override void AI() @@ -89,10 +91,5 @@ namespace CalamityMod.Projectiles.Magic } } } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.immune[Projectile.owner] = 5; - } } } diff --git a/Projectiles/Magic/CosmicTentacle.cs b/Projectiles/Magic/CosmicTentacle.cs index ac18c8d0d9..a2f6830ccd 100644 --- a/Projectiles/Magic/CosmicTentacle.cs +++ b/Projectiles/Magic/CosmicTentacle.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using System; using Terraria; using Terraria.ModLoader; @@ -18,6 +18,8 @@ namespace CalamityMod.Projectiles.Magic Projectile.penetrate = 5; Projectile.MaxUpdates = 3; Projectile.DamageType = DamageClass.Magic; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 5; } public override void AI() @@ -88,10 +90,5 @@ namespace CalamityMod.Projectiles.Magic } } } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.immune[Projectile.owner] = 5; - } } } diff --git a/Projectiles/Melee/EssenceScythe.cs b/Projectiles/Melee/EssenceScythe.cs index 497d6b5826..eda5690661 100644 --- a/Projectiles/Melee/EssenceScythe.cs +++ b/Projectiles/Melee/EssenceScythe.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Projectiles.Healing; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -29,6 +29,8 @@ namespace CalamityMod.Projectiles.Melee Projectile.timeLeft = 300; Projectile.ignoreWater = true; AIType = ProjectileID.DeathSickle; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 2; } public override void AI() @@ -73,7 +75,6 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.immune[Projectile.owner] = 2; target.AddBuff(ModContent.BuffType(), 180); if (target.life <= 0) { From 2d868856ccb700cdfca06f1e2c83108b649875c5 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Fri, 5 Jan 2024 16:45:48 -0500 Subject: [PATCH 04/13] Hydrothermic armor and Corrosive Spine nerfs --- CalPlayer/CalamityPlayerOnHit.cs | 4 ++-- Items/CalamityGlobalItem.cs | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/CalPlayer/CalamityPlayerOnHit.cs b/CalPlayer/CalamityPlayerOnHit.cs index a6e99b607d..04c10a01a2 100644 --- a/CalPlayer/CalamityPlayerOnHit.cs +++ b/CalPlayer/CalamityPlayerOnHit.cs @@ -881,7 +881,7 @@ namespace CalamityMod.CalPlayer titanCooldown = 15; } - if (corrosiveSpine && modProj.stealthStrikeHitCount < 3) + if (corrosiveSpine && modProj.stealthStrikeHitCount < 3 && (Player.ownedProjectileCounts[ProjectileType()] + Player.ownedProjectileCounts[ProjectileType()] + Player.ownedProjectileCounts[ProjectileType()]) < 3) { for (int i = 0; i < 3; i++) { @@ -903,7 +903,7 @@ namespace CalamityMod.CalPlayer if (type != -1) { - int damage = (int)Player.GetTotalDamage().ApplyTo(24); + int damage = (int)Player.GetTotalDamage().ApplyTo(22); damage = Player.ApplyArmorAccDamageBonusesTo(damage); float speed = Main.rand.NextFloat(5f, 11f); diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 8699c788af..1186d1d5f6 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -437,20 +437,20 @@ namespace CalamityMod.Items modPlayer.canFireAtaxiaRogueProjectile = false; int flareID = ModContent.ProjectileType(); - // Ataxia Rogue Flares: 8 x 50%, soft cap starts at 120 base damage - int flareDamage = CalamityUtils.DamageSoftCap(damage * 0.5, 120); + // Ataxia Rogue Flares: 6 x 50%, soft cap starts at 90 base damage + int flareDamage = CalamityUtils.DamageSoftCap(damage * 0.5, 90); flareDamage = player.ApplyArmorAccDamageBonusesTo(flareDamage); if (player.whoAmI == Main.myPlayer) { SoundEngine.PlaySound(SoundID.Item20, player.Center); - float spread = 45f * 0.0174f; + float spread = 60f * 0.0174f; double startAngle = Math.Atan2(player.velocity.X, player.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; + double deltaAngle = spread / 6f; double offsetAngle; - for (int i = 0; i < 4; i++) + for (int i = 0; i < 3; i++) { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; + offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 30f * i; Projectile.NewProjectile(source, player.Center.X, player.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), flareID, flareDamage, 1f, player.whoAmI); Projectile.NewProjectile(source, player.Center.X, player.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), flareID, flareDamage, 1f, player.whoAmI); } From 6eed7f23952f1c173a067c31c38698446f4c8be4 Mon Sep 17 00:00:00 2001 From: Memes Date: Fri, 29 Dec 2023 16:23:12 +0100 Subject: [PATCH 05/13] BaseMinionProjectile Grounded Minion support. 1. Added a Grounded property. 2. Added a Gravity property. 3. Added a MaxGravity property. 4. Added a second check for target detection exclusive for pre-hardmode grounded minions. 5. Added many grounded minion method utilities, such as gravity and tile detection methods. --- .../BaseProjectiles/BaseMinionProjectile.cs | 185 +++++++++++++++++- 1 file changed, 182 insertions(+), 3 deletions(-) diff --git a/Projectiles/BaseProjectiles/BaseMinionProjectile.cs b/Projectiles/BaseProjectiles/BaseMinionProjectile.cs index 06aebb26f5..ed768bbf2d 100644 --- a/Projectiles/BaseProjectiles/BaseMinionProjectile.cs +++ b/Projectiles/BaseProjectiles/BaseMinionProjectile.cs @@ -1,4 +1,6 @@ -using CalamityMod.CalPlayer; +using System; +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -73,6 +75,38 @@ namespace CalamityMod.Projectiles.BaseProjectiles /// public virtual bool PreventTargettingUntilTargetHit => true; + /// + /// If , the minion will be considered grounded, this will turn on some features that are neccesary for grounded minions.
+ /// Defaults to . + ///
+ public virtual bool Grounded => false; + + /// + /// The speed at which the minion falls.
+ /// It'll take the absolute value of whatever you input, to ensure that it's on Terraria's coordinate system.
+ /// This is intended to use for grounded minions.
+ /// Defaults to 0.4f. + ///
+ public float Gravity + { + get => _gravity; + set => _gravity = MathF.Abs(value); + } + private float _gravity = 0.4f; + + /// + /// The max speed at which the minion falls.
+ /// It'll take the absolute value of whatever you input, to ensure that it's on Terraria's coordinate system.
+ /// This is intended to use for grounded minions.
+ /// Defaults to 20f. + ///
+ public float MaxGravity + { + get => _maxGravity; + set => _maxGravity = MathF.Abs(value); + } + private float _maxGravity = 20f; + /// /// The amount of animation frames this minion has.
/// Defaults to 1 frame. @@ -119,7 +153,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles Projectile.penetrate = -1; Projectile.friendly = true; - Projectile.tileCollide = false; + Projectile.tileCollide = Grounded; Projectile.ignoreWater = true; Projectile.minion = true; Projectile.usesLocalNPCImmunity = true; @@ -135,12 +169,14 @@ namespace CalamityMod.Projectiles.BaseProjectiles public override void AI() { Projectile.localNPCHitCooldown = IFrames * Projectile.MaxUpdates; - SetOwnerTarget(); CheckMinionExistence(); + SetOwnerTarget(); DoAnimation(); MinionAI(); } + public override bool OnTileCollide(Vector2 oldVelocity) => false; + #region AI Methods /// @@ -189,6 +225,149 @@ namespace CalamityMod.Projectiles.BaseProjectiles Owner = Main.player[Projectile.owner]; ModdedOwner = Owner.Calamity(); Target = Owner.Center.MinionHoming(AdaptiveEnemyDistanceDetection, Owner, !PreHardmodeMinionTileVision || CalamityPlayer.areThereAnyDamnBosses); + + // When minions are grounded, they are affected by tiles, meaning they have a much limited movement. + // Pre-Hardmode minions are affected the most since they can't see through walls. + // In consequence, some targets that may seem valid, aren't detected due to this. + // If the minion hasn't detected any targets with the center being the player, we give them a second chance with the center being the minion itself. + // If there are bosses on the world, we don't do this check because if there wasn't any targets with tile X-Ray, this won't do anything. + if (Grounded && Target is null && PreHardmodeMinionTileVision && !CalamityPlayer.areThereAnyDamnBosses) + Target = Projectile.Center.MinionHoming(AdaptiveEnemyDistanceDetection, Owner, false); + } + + #endregion + + #region Grounded Minion Utilities + + /// + /// A quick method to apply gravity to grounded minions.
+ /// You can choose to not use it and make your own if a simple one does not fit your need. + ///
+ public void DoGravity() + { + float speedY = Projectile.velocity.Y; + if (speedY < _maxGravity) + speedY = MathF.Min(speedY + _gravity, _maxGravity); + Projectile.velocity.Y = speedY; + } + + /// + /// Checks whether there's a tile between two vectors vertically.
+ /// This method has many shorthand variants.
+ /// Useful for grounded minion behavior. + ///
+ /// The starter vector. Its X component will be the one used, so put here the vector from where you want to check. + /// The ending vector. + /// Whether you want to check for platforms when is below + /// Returns if there's a tile between and , the X coordinate being the one from ; otherwise . + public bool IsTileBetweenTwoVectorsVertically(Vector2 startVector, Vector2 endVector, bool platformCheckDownwards = false) + { + Point startPoint = CalamityUtils.ToSafeTileCoordinates(startVector); + Point endPoint = CalamityUtils.ToSafeTileCoordinates(endVector); + + if (endVector.Y > startVector.Y) + { + for (int coordY = endPoint.Y; coordY >= startPoint.Y; coordY--) + { + if (Main.tile[startPoint.X, coordY].IsTileSolidGround()) + return true; + } + } + else + { + for (int coordY = endPoint.Y; coordY <= startPoint.Y; coordY++) + { + if (platformCheckDownwards) + { + if (Main.tile[startPoint.X, coordY].IsTileSolidGround()) + return true; + } + else if (Main.tile[startPoint.X, coordY].IsTileSolid()) + return true; + } + } + + return false; + } + + public bool IsTileBetweenOwnerAndVectorVertically(Vector2 vector, bool platformCheckDownwards = false) => IsTileBetweenTwoVectorsVertically(Owner.Center, vector, platformCheckDownwards); + + public bool IsTileBetweenTargetAndVectorVertically(Vector2 vector, bool platformCheckDownwards = false) => IsTileBetweenTwoVectorsVertically(Target.Center, vector, platformCheckDownwards); + + public bool IsTileBetweenVectorAndMinionVertically(Vector2 vector, bool platformCheckDownwards = false) => IsTileBetweenTwoVectorsVertically(vector, Projectile.Center, platformCheckDownwards); + + public bool IsTileBetweenOwnerAndMinionVertically(bool platformCheckDownwards = false) => IsTileBetweenTwoVectorsVertically(Owner.Center, Projectile.Center, platformCheckDownwards); + + public bool IsTileBetweenTargetAndMinionVertically(bool platformCheckDownwards = false) => IsTileBetweenTwoVectorsVertically(Target.Center, Projectile.Center, platformCheckDownwards); + + /// + /// Checks if the minion has a tile in front of him, at their left or right. + /// + /// The extra distance it'll check at the left, not all minions are perfectly sized 1 tile, so you'll need to tweak this. Defaults to 0. + /// The extra distance it'll check at the right, not all minions are perfectly sized 1 tile, so you'll need to tweak this. Defaults to 0. + /// if there's a tile at the left or right, otherwise + public bool IsMinionFacingTile(int leftFluff = 0, int rightFluff = 0) + { + Point topLeft = CalamityUtils.ToSafeTileCoordinates(Projectile.TopLeft); + Point bottomLeft = CalamityUtils.ToSafeTileCoordinates(Projectile.BottomLeft); + for (int coordY = topLeft.Y; coordY < bottomLeft.Y; coordY++) + { + if (Main.tile[topLeft.X - leftFluff, coordY].IsTileSolid()) + return true; + } + + Point topRight = CalamityUtils.ToSafeTileCoordinates(Projectile.TopRight); + Point bottomRight = CalamityUtils.ToSafeTileCoordinates(Projectile.BottomRight); + for (int coordY = topRight.Y; coordY <= bottomRight.Y; coordY++) + { + if (Main.tile[topRight.X + rightFluff, coordY].IsTileSolid()) + return true; + } + + return false; + } + + /// + /// Checks whether the minion is standing on a tile or not. + /// + /// if the minion's standing on a tile, otherwise + public bool IsMinionStandingOnTile() + { + Point minionPointLeft = CalamityUtils.ToSafeTileCoordinates(Projectile.BottomLeft); + Point minionPointRight = CalamityUtils.ToSafeTileCoordinates(Projectile.BottomRight); + for (int coordX = minionPointLeft.X; coordX <= minionPointRight.X; coordX++) + { + if (Main.tile[coordX, minionPointLeft.Y].IsTileSolidGround()) + return true; + } + + return false; + } + + /// + /// Checks whether the minion is inside a tile or not.
+ /// It checks if there's tiles in the diagonals of the minion's hitbox. + ///
+ /// if there's a tile inside the minion, otherwise + public bool IsMinionInsideTile() + { + Point topLeft = CalamityUtils.ToSafeTileCoordinates(Projectile.TopLeft); + Point bottomRight = CalamityUtils.ToSafeTileCoordinates(Projectile.BottomRight); + for (int coordX = topLeft.X; coordX <= bottomRight.X; coordX++) + { + if (Main.tile[coordX, (int)Utils.Remap(coordX, topLeft.X, bottomRight.X, topLeft.Y, bottomRight.Y)].IsTileSolid()) + return true; + } + + Point topRight = CalamityUtils.ToSafeTileCoordinates(Projectile.TopRight); + Point bottomLeft = CalamityUtils.ToSafeTileCoordinates(Projectile.BottomLeft); + for (int coordX = bottomLeft.X; coordX >= topRight.X; coordX--) + { + if (Main.tile[coordX, (int)Utils.Remap(coordX, bottomLeft.X, topRight.X, bottomLeft.Y, bottomRight.Y)].IsTileSolid()) + return true; + } + + return false; } #endregion From 034b9549a73c9c33d04130d8e645d320616228a2 Mon Sep 17 00:00:00 2001 From: GinYuH <72181395+GinYuH@users.noreply.github.com> Date: Fri, 29 Dec 2023 21:18:34 -0800 Subject: [PATCH 06/13] Added Chronomancer's Scythe --- Buffs/StatBuffs/Haste.cs | 25 ++++ Buffs/StatBuffs/Haste.png | Bin 0 -> 543 bytes CalPlayer/CalamityPlayer.cs | 10 +- CalPlayer/CalamityPlayerMiscEffects.cs | 31 +++- Items/Weapons/Melee/ChronomancersScythe.cs | 84 +++++++++++ Items/Weapons/Melee/ChronomancersScythe.png | Bin 0 -> 4000 bytes .../en-US/Mods.CalamityMod.Buffs.hjson | 5 + ...Mods.CalamityMod.Items.Weapons.Melee.hjson | 5 + .../Mods.CalamityMod.Projectiles.Melee.hjson | 3 + ...ods.CalamityMod.Projectiles.Typeless.hjson | 1 + Projectiles/Melee/ChronoIcicleLarge.cs | 128 +++++++++++++++++ Projectiles/Melee/ChronoIcicleLarge.png | Bin 0 -> 843 bytes Projectiles/Melee/ChronoIcicleSmall.cs | 47 ++++++ Projectiles/Melee/ChronoIcicleSmall.png | Bin 0 -> 397 bytes .../Melee/ChronomancersScytheHoldout.cs | 134 ++++++++++++++++++ Projectiles/Melee/ChronomancersScytheSwing.cs | 130 +++++++++++++++++ .../Melee/ChronomancersScytheSwing.png | Bin 0 -> 5564 bytes Projectiles/Typeless/ChronoClock.cs | 85 +++++++++++ Projectiles/Typeless/ChronoClock.png | Bin 0 -> 1147 bytes 19 files changed, 680 insertions(+), 8 deletions(-) create mode 100644 Buffs/StatBuffs/Haste.cs create mode 100644 Buffs/StatBuffs/Haste.png create mode 100644 Items/Weapons/Melee/ChronomancersScythe.cs create mode 100644 Items/Weapons/Melee/ChronomancersScythe.png create mode 100644 Projectiles/Melee/ChronoIcicleLarge.cs create mode 100644 Projectiles/Melee/ChronoIcicleLarge.png create mode 100644 Projectiles/Melee/ChronoIcicleSmall.cs create mode 100644 Projectiles/Melee/ChronoIcicleSmall.png create mode 100644 Projectiles/Melee/ChronomancersScytheHoldout.cs create mode 100644 Projectiles/Melee/ChronomancersScytheSwing.cs create mode 100644 Projectiles/Melee/ChronomancersScytheSwing.png create mode 100644 Projectiles/Typeless/ChronoClock.cs create mode 100644 Projectiles/Typeless/ChronoClock.png diff --git a/Buffs/StatBuffs/Haste.cs b/Buffs/StatBuffs/Haste.cs new file mode 100644 index 0000000000..e4fa6b578c --- /dev/null +++ b/Buffs/StatBuffs/Haste.cs @@ -0,0 +1,25 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.StatBuffs +{ + public class Haste : ModBuff + { + public override void SetStaticDefaults() + { + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + Main.buffNoTimeDisplay[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + // keep the buff active as long as the player's haste level is up + if (player.Calamity().hasteLevel > 0) + { + player.buffTime[buffIndex] = 60; + } + } + } +} diff --git a/Buffs/StatBuffs/Haste.png b/Buffs/StatBuffs/Haste.png new file mode 100644 index 0000000000000000000000000000000000000000..b0e7aebaac1463dfb62c8bb8da8a773717269d6c GIT binary patch literal 543 zcmV+)0^t3LP)RK$rL65_fier5@zE@lV)8LH zE6u{jUtlXG7Iz*x$Gu45$g{flocEm5^Soc@gknue0M1GWPy8TaP00{I#ZMmUhY;`t zus3r9Ksq-Kz(ZsKfJFQrfQD$qSa^F`1mNhn8i1t!$A^-!Ay#O@#bQ$(iroOKZa6o}deaPqF`CQEJ zOIHAlZS4ZElU^~#^)Dq}_9^56xIR1q-YOxuqky8_X8sXuB@)R50GZ;xX_zbj=geVu z6!j2dEWdN5HP*+nP=gZ@EJD8<7aK5#K8Fx<6i&(002ovPDHLkV1ngY`knv) literal 0 HcmV?d00001 diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index cdd577d58f..d05a267f4d 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -978,6 +978,8 @@ namespace CalamityMod.CalPlayer public bool avertorBonus = false; public bool divineBless = false; public bool infiniteFlight = false; + public int hasteCounter = 0; + public int hasteLevel = 0; #endregion #region Minion @@ -2469,6 +2471,8 @@ namespace CalamityMod.CalPlayer healingPotionMultiplier = 1f; avertorBonus = false; divineBless = false; + hasteLevel = 0; + hasteCounter = 0; #endregion #region Armor Set Bonuses @@ -3656,7 +3660,8 @@ namespace CalamityMod.CalPlayer (silvaSet ? 0.05f : 0f) + (blueCandle ? 0.05f : 0f) + (planarSpeedBoost > 0 ? (0.01f * planarSpeedBoost) : 0f) + - ((deepDiver && Player.IsUnderwater()) ? 0.15f : 0f); + ((deepDiver && Player.IsUnderwater()) ? 0.15f : 0f) + + (hasteLevel * 0.05f); float runSpeedMult = 1f + (lunicCorpsLegs ? 0.1f : 0f) + @@ -3670,7 +3675,8 @@ namespace CalamityMod.CalPlayer (CobaltSet ? CobaltArmorSetChange.SpeedBoostSetBonusPercentage * 0.01f : 0f) + (silvaSet ? 0.05f : 0f) + (planarSpeedBoost > 0 ? (0.01f * planarSpeedBoost) : 0f) + - ((deepDiver && Player.IsUnderwater()) ? 0.15f : 0f); + ((deepDiver && Player.IsUnderwater()) ? 0.15f : 0f) + + (hasteLevel * 0.05f); if ((Player.slippy || Player.slippy2) && Player.iceSkate) runAccMult *= 0.6f; diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index d9481c8967..9337f9509d 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -945,7 +945,7 @@ namespace CalamityMod.CalPlayer { if (!Main.rand.NextBool(3)) continue; - + Dust holyCinder = Dust.NewDustDirect(Player.position, Player.width, Player.height, (int)CalamityDusts.ProfanedFire); holyCinder.velocity = Main.rand.NextVector2Circular(3.5f, 3.5f); holyCinder.velocity.Y -= Main.rand.NextFloat(1f, 3f); @@ -1017,7 +1017,7 @@ namespace CalamityMod.CalPlayer Vector2 spawnPoint = new Vector2(Player.Center.X + Main.rand.Next(-1000, 1001), Player.Center.Y - Main.rand.Next(700, 801)); if (Player.miscCounter % slimeRainRate == 0f) - { + { if (DownedBossSystem.downedAquaticScourge && !DownedBossSystem.downedPolterghast && Main.rand.NextBool(12)) { NPC.NewNPC(new EntitySource_SpawnNPC(), (int)spawnPoint.X, (int)spawnPoint.Y, ModContent.NPCType()); @@ -1111,7 +1111,7 @@ namespace CalamityMod.CalPlayer { Player.velocity.Y += Player.gravity * Player.gravDir * (BalancingConstants.HoldingDownGravityMultiplier - 1f); if (Player.Calamity().gSabaton) - { + { Player.maxFallSpeed *= 1.5f; } if (Player.velocity.Y * Player.gravDir > Player.maxFallSpeed) @@ -1251,7 +1251,7 @@ namespace CalamityMod.CalPlayer } } - if (target > 0) + if (target > 0) { unstableSelectedTarget = Main.npc[target]; unstableSelectedTarget.Calamity().arcZapCooldown = 18; @@ -1471,7 +1471,7 @@ namespace CalamityMod.CalPlayer auralisAurora--; if (auralisAuroraCooldown > 0) auralisAuroraCooldown--; - + if (blazingCore) { if (blazingCoreSuccessfulParry > 0) @@ -1483,7 +1483,7 @@ namespace CalamityMod.CalPlayer { FlameLickedShell.HandleParryCountdown(Player); } - + // Silver Armor "Medkit" effect if (silverMedkitTimer > 0) { @@ -1863,6 +1863,25 @@ namespace CalamityMod.CalPlayer else if (polarisBoostCounter >= 10) polarisBoostTwo = true; + // Haste buff + if (hasteLevel > 0) + { + // capped out at 3 + if (hasteLevel > 3) + hasteLevel = 3; + // if the haste counter hits 5 seconds, subtract a haste level, and if there are none left afterwards, delete the buff + if (++hasteCounter == 300) + { + hasteLevel--; + if (hasteLevel <= 0) + { + if (Player.FindBuffIndex(ModContent.BuffType()) > -1) + Player.ClearBuff(ModContent.BuffType()); + } + hasteCounter = 0; + } + } + // Calcium Potion buff if (calcium) Player.noFallDmg = true; diff --git a/Items/Weapons/Melee/ChronomancersScythe.cs b/Items/Weapons/Melee/ChronomancersScythe.cs new file mode 100644 index 0000000000..cef4a697be --- /dev/null +++ b/Items/Weapons/Melee/ChronomancersScythe.cs @@ -0,0 +1,84 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Melee; +using CalamityMod.Rarities; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Melee +{ + public class ChronomancersScythe : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetStaticDefaults() + { + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true; + } + + public override void SetDefaults() + { + Item.width = 45; + Item.height = 45; + Item.DamageType = TrueMeleeNoSpeedDamageClass.Instance; // ironic how a weapon that increases use speed cant benefit from it + Item.noMelee = true; + Item.noUseGraphic = true; + Item.channel = true; + Item.damage = 100; + Item.knockBack = 4f; + Item.useAnimation = 25; + Item.useTime = 5; + Item.autoReuse = false; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = SoundID.Item71; + + Item.value = CalamityGlobalItem.Rarity11BuyPrice; + Item.rare = ItemRarityID.Purple; + Item.Calamity().donorItem = true; + + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 24f; + } + public override bool AltFunctionUse(Player player) => true; + + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + if (player.altFunctionUse == 2) + { + Projectile.NewProjectile(source, position, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, Main.myPlayer); + return false; + } + else + { + return true; + } + } + + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 2f) + { + Item.reuseDelay = 20; + Item.channel = false; + } + else + { + Item.reuseDelay = 0; + Item.channel = true; + } + return base.CanUseItem(player); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.IceSickle). + AddIngredient(ItemID.FastClock). + AddIngredient(ItemID.LunarBar, 10). + AddIngredient(6). + AddTile(TileID.LunarCraftingStation). + Register(); + } + } +} diff --git a/Items/Weapons/Melee/ChronomancersScythe.png b/Items/Weapons/Melee/ChronomancersScythe.png new file mode 100644 index 0000000000000000000000000000000000000000..60187a3259b21b55979d07e7e1de2c2546f4698c GIT binary patch literal 4000 zcmX9>c_7pMAOE6Ikw#QRxt|=7Tf~x*A~{CLIm|Iv&bg+NCzE+1=rk@$AqM)GE6=754Deu^6Bz*#EfmP<@PfTyeaSUjpihLm4V% zTH5ogl{S&@azc6XG>#`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2YzOi%Pn91EW`fqEE382#LX-E<%(U?21>1Th&$^dtCx3oTUG%9>*^Wx zdrxp?fuYm}-VId#HQQ31QM;xwOW2zgm*?y*C6@CEWOVs)&8ls=2bvwr+qo}|Q))(@ zjwAJn$Qr|B;bW{CwjdYNmTlMrmVVx3UhYKJzBWw}Yc$bK(TTO+Zkm#HNWh2ecl>fp z(%dCQZ{cG?Qg_w7d_y|0Fo%V{FQPwVF8qbdiyUnGbK*p{g)MLE3)Sq+uvY_6Z=PrO z%9yHpBVAs(%MJ+7VwKrF9kADfb_419q$ZIs9;THnkyNWAw^j_Pp)ciwF!vxOIz$$S aM_fVhJfj*SoSS*`28?e%Fsw9ie)d21Ap0Qz literal 0 HcmV?d00001 diff --git a/Localization/en-US/Mods.CalamityMod.Buffs.hjson b/Localization/en-US/Mods.CalamityMod.Buffs.hjson index 33803350fd..e8c09e9d2e 100644 --- a/Localization/en-US/Mods.CalamityMod.Buffs.hjson +++ b/Localization/en-US/Mods.CalamityMod.Buffs.hjson @@ -753,6 +753,11 @@ HallowedRuneRegeneration: { Description: Regenerating life } +Haste: { + DisplayName: Haste + Description: Increased movement speed and acceleration +} + IceShieldBuff: { DisplayName: Ice Shield Description: Absorbs 20% damage from the next hit you take, then shatters diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson index 5ad8896f88..c9bf7e4a9e 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson @@ -249,6 +249,11 @@ CelestialClaymore: { Tooltip: Spawns cosmic energy stars near the cursor that inflict several debuffs } +ChronomancersScythe: { + DisplayName: Chronomancer's Scythe + Tooltip: "" +} + ClamCrusher: { DisplayName: Clam Crusher Tooltip: diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson index 791af11470..bd6fe3dde3 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson @@ -56,6 +56,9 @@ BrokenBiomeBladeHoldout.DisplayName: Broken Biome Blade BurningMeteor.DisplayName: Meteor CatastropheClaymoreSparkle.DisplayName: Catastrophe Sparkle ChainedMeatHook.DisplayName: Enchanted Meat Hook +ChronoIcicleLarge.DisplayName: Chrono Icicle +ChronoIcicleSmall.DisplayName: Chrono Icicle +ChronomancersScytheHoldout.DisplayName: Chronomancer's Scythe ClamCrusherFlail.DisplayName: Clam Crusher CometQuasherMeteor.DisplayName: Comet Quasher Meteor CosmicBolt.DisplayName: Cosmic Bolt diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson index 51989ca220..6434ae16ca 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson @@ -30,6 +30,7 @@ BossRushTierAnimation.DisplayName: Boss Rush Tier Animation BrimstoneHellfireballFriendly2.DisplayName: Hellfire ChaoticGeyser.DisplayName: Chaotic Geyser ChlorophyteLifePulse.DisplayName: Life Pulse +ChronoClock.DisplayName: Chrono Clock CoralBubble.DisplayName: Bubble CoralBubbleSmall.DisplayName: Bubble CryonicShield.DisplayName: Cryonic Shield diff --git a/Projectiles/Melee/ChronoIcicleLarge.cs b/Projectiles/Melee/ChronoIcicleLarge.cs new file mode 100644 index 0000000000..8ec70cf8af --- /dev/null +++ b/Projectiles/Melee/ChronoIcicleLarge.cs @@ -0,0 +1,128 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Audio; +using CalamityMod.Buffs.StatDebuffs; +using System.Security.Policy; + +namespace CalamityMod.Projectiles.Melee +{ + public class ChronoIcicleLarge : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public static int HomingSpeed = 16; + public static int IdleSpeedMax = 7; + public override void SetDefaults() + { + Projectile.width = 12; + Projectile.height = 12; + Projectile.aiStyle = -1; + Projectile.coldDamage = true; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.DamageType = DamageClass.Melee; + Projectile.coldDamage = true; + Projectile.tileCollide = false; + Projectile.timeLeft = 180; + } + + public override void AI() + { + Projectile.ai[1]++; + switch (Projectile.ai[0]) + { + // stay in an evenly spaced circle around the player, resembling the 12 ticks on a clock + case 0: + if (Projectile.velocity.Length() > 0.01f) + { + Projectile.velocity *= 0.01f; + } + if (Main.player[Projectile.owner].active && !Main.player[Projectile.owner].dead) + { + Projectile.position = Main.player[Projectile.owner].Center + (2 * MathHelper.Pi / 12 * (Projectile.ai[2] - 1) - MathHelper.PiOver2).ToRotationVector2() * 160 - Projectile.Size / 2; + } + if (Projectile.ai[1] >= (12 - Projectile.ai[2]) * 5 + 10) + { + Projectile.ai[0] = 1; + Projectile.ai[1] = 0; + } + break; + // jet out + case 1: + if (Projectile.velocity.Length() < 5) + { + Projectile.velocity *= 3f; + } + if (Projectile.ai[1] > 20) + { + Projectile.ai[0] = 2; + } + break; + // home if possible + case 2: + // Set amount of extra updates. + if (Projectile.Calamity().defExtraUpdates == -1) + Projectile.Calamity().defExtraUpdates = Projectile.extraUpdates; + + Vector2 destination = Projectile.Center; + float maxDistance = 1400; + bool locatedTarget = false; + + // Find a target. + for (int i = 0; i < Main.maxNPCs; i++) + { + float extraDistance = (Main.npc[i].width / 2) + (Main.npc[i].height / 2); + if (!Main.npc[i].CanBeChasedBy(Projectile, false) || !Projectile.WithinRange(Main.npc[i].Center, maxDistance + extraDistance)) + continue; + destination = Main.npc[i].Center; + locatedTarget = true; + break; + } + + if (locatedTarget) + { + // Increase amount of extra updates to greatly increase homing velocity. + Projectile.extraUpdates = Projectile.Calamity().defExtraUpdates + 1; + + // Home in on the target. + Vector2 homeDirection = (destination - Projectile.Center).SafeNormalize(Vector2.UnitY); + Projectile.velocity = (Projectile.velocity * 0.2f + homeDirection * HomingSpeed) / (0.2f + 1f); + } + else + { + // Set amount of extra updates to default amount. + Projectile.extraUpdates = Projectile.Calamity().defExtraUpdates; + if (Projectile.velocity.Length() < IdleSpeedMax) + { + Projectile.velocity *= 3f; + } + } + break; + } + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + SoundEngine.PlaySound(SoundID.Item27, Projectile.position); + target.AddBuff(ModContent.BuffType(), 60); + } + + public override void OnKill(int timeLeft) + { + 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; + } + } + public override bool? CanHitNPC(NPC target) + { + // the icicles cannot hit while glued to the player + return Projectile.ai[0] > 0; + } + } +} diff --git a/Projectiles/Melee/ChronoIcicleLarge.png b/Projectiles/Melee/ChronoIcicleLarge.png new file mode 100644 index 0000000000000000000000000000000000000000..ca612eb64766580dceec58abc3023766d7313e04 GIT binary patch literal 843 zcmV-R1GM~!P)W+A0wl>f?TWAtayq5=&OgaB46~UyJ*Wc*i#-@!quQ+q}8&-23L6d%kneH&2~^VBv(f zSI@{tnVjAqY%9nDVEj%e0EG=#JYpnRj>jy33_DA;UDE(uYAphwr=!yX_~F}a=*fLX zJFGkaCe#!Ftvl-g=m<9h(9)!9t6Q?SWMAG;2~jZb|56#F+SfYJD(1#q@q>n2>UnaFA2e%9)iP8flOu^|9Pg82aa zoc(OXMQ3S?%ecx&l~>hSPK+X3q6#1qivSQTE(PG5m0hovgeJz=WDIY>DVZvQu+B z$6zAa@`uV?R<@i!*!~CG4~epC?Aj6}G7-1p9wTuTs~noaOd!>sS6re1rbaarS?^xf z5+FzB#_W2YJURH@j2;^v(6_y{PXu;(HI(D1bLl2fbmW%B!@)FUj2lK;+Aa1rTby z1;D+g9AiPneyyLQM-D20fyd9>Wwf$K!eqr~KfkRRgmw3j6Y|x|USVeF$$K41XBB6^ zFg9dCa$R}PXjRWQJU}v}PDkP$1>%!J2egi&FI?8qia(MQZ`GSD$Cq!3Ok6)9e*xF8 V0pf6mG8q5>002ovPDHLkV1i=)j0pe$ literal 0 HcmV?d00001 diff --git a/Projectiles/Melee/ChronoIcicleSmall.cs b/Projectiles/Melee/ChronoIcicleSmall.cs new file mode 100644 index 0000000000..b4a228d3f2 --- /dev/null +++ b/Projectiles/Melee/ChronoIcicleSmall.cs @@ -0,0 +1,47 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Audio; +using CalamityMod.Buffs.StatDebuffs; + +namespace CalamityMod.Projectiles.Melee +{ + public class ChronoIcicleSmall : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override void SetDefaults() + { + Projectile.width = 12; + Projectile.height = 12; + Projectile.aiStyle = ProjAIStyleID.Arrow; + Projectile.coldDamage = true; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.DamageType = DamageClass.Melee; + Projectile.coldDamage = true; + } + + public override void AI() + { + Projectile.velocity.Y += 0.05f; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + SoundEngine.PlaySound(SoundID.Item27 with { Volume = SoundID.Item12.Volume * 0.7f }, Projectile.position); + target.AddBuff(ModContent.BuffType(), 30); + } + + public override void OnKill(int timeLeft) + { + 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/Melee/ChronoIcicleSmall.png b/Projectiles/Melee/ChronoIcicleSmall.png new file mode 100644 index 0000000000000000000000000000000000000000..6e86a39a2ce96a66584bc9b19f5133ddc84aa54b GIT binary patch literal 397 zcmV;80doF{P)1uyW2r+2p=fHLi%KsziGrhxU5j9r4x)>TbnT{tB3K81fKw3^K^HfFh_r|o zyim;6p$JvbIHaF#LI&x{yPV7SCJ*P!;f-3qaT(O@jxAFuD1f>BOP?>skTQZKGhYC} zX*PUosS8=3C~}$&7hvPudvm>Py8uRNN)7s=BL "Projectiles.Melee"; + public Player Owner => Main.player[Projectile.owner]; + public override string Texture => "CalamityMod/Items/Weapons/Melee/ChronomancersScythe"; + public static int ClockChance = 30; + + public override void SetDefaults() + { + Projectile.width = 60; + Projectile.height = 60; + Projectile.friendly = true; + Projectile.DamageType = TrueMeleeNoSpeedDamageClass.Instance; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.ownerHitCheck = true; + Projectile.rotation = -MathHelper.PiOver2 + MathHelper.PiOver4; // this makes sure the projectile starts facing up without too much hassle + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + float collisionPoint = 0f; + float bladeLength = 130 * Projectile.scale; + float bladeWidth = 90 * Projectile.scale; + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + (Projectile.rotation.ToRotationVector2() * bladeLength), bladeWidth, ref collisionPoint); + } + + public override void AI() + { + Owner.ChangeDir(Math.Sign(Owner.Calamity().mouseWorld.X - Owner.position.X)); + + Projectile.velocity = Vector2.Zero; + + Projectile.rotation += 2 * MathHelper.Pi / 60; // this is intentionally only clockwise, but can be changed if it's too awkward + + UpdateOwnerVars(); + + Projectile.Center = Owner.MountedCenter + Projectile.rotation.ToRotationVector2() * 10f - Vector2.UnitX * 4 * Owner.direction; + + // once the scythe has completed a rotation, die + if (Projectile.rotation > 2 * MathHelper.Pi - MathHelper.PiOver2 + MathHelper.PiOver4) + { + Projectile.Kill(); + } + + // spawn 12 clock hand icicles + Projectile.ai[0]++; + float HandInterval = 60 / 12; + if (Projectile.ai[0] >= HandInterval) + { + if (Projectile.owner == Main.myPlayer) + { + Vector2 rotationVector = (Projectile.rotation - MathHelper.PiOver4 * 1.6666f).ToRotationVector2(); + Vector2 spawnPos = Main.player[Projectile.owner].Center + (2 * MathHelper.Pi / 12 * (Projectile.ai[1]) - MathHelper.PiOver2).ToRotationVector2() * 160; + int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnPos, rotationVector * 5, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, ai2: Projectile.ai[1] + 1); + Main.projectile[p].rotation = Main.projectile[p].velocity.ToRotation() + MathHelper.PiOver2; + } + Projectile.ai[1]++; + Projectile.ai[0] = 0; + } + } + + public void UpdateOwnerVars() + { + float armPointingDirection = ((Owner.Calamity().mouseWorld - Owner.MountedCenter).ToRotation()); + + //"crop" the rotation so the player only points their arm in a smaller range. (The back arm points in the throw direction) + if (armPointingDirection < MathHelper.PiOver2 && armPointingDirection >= -MathHelper.PiOver2) + armPointingDirection = -MathHelper.PiOver2 + MathHelper.PiOver4 / 2f + MathHelper.PiOver2 * 1.5f * Utils.GetLerpValue(0f, MathHelper.Pi, armPointingDirection + MathHelper.PiOver2, true); + else + { + if (armPointingDirection > 0) + armPointingDirection = MathHelper.PiOver2 + MathHelper.PiOver4 / 2f + MathHelper.PiOver4 * 1.5f * Utils.GetLerpValue(0f, MathHelper.PiOver2, armPointingDirection - MathHelper.PiOver2, true); + else + armPointingDirection = -MathHelper.Pi + MathHelper.PiOver4 * 1.5f * Utils.GetLerpValue(-MathHelper.Pi, -MathHelper.PiOver4, armPointingDirection, true); + } + + + Owner.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, armPointingDirection - MathHelper.PiOver2); + Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, Projectile.rotation - MathHelper.PiOver2); + Owner.heldProj = Projectile.whoAmI; + Owner.itemTime = 2; + Owner.itemAnimation = 2; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 60); + if (Main.rand.NextBool(ClockChance)) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center, Main.rand.NextVector2Circular(-2, 2), ModContent.ProjectileType(), 0, 0, Projectile.owner); + } + } + + //If we don't do that, the hit enemies get knocked back towards you if you hit them from the right?? + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + // This would knock enemies away consistently, but i'm choosing to go with the other option + //hitDirection = Math.Sign(target.Center.X - Owner.Center.X); + + //Doing it this way lets the player choose if they want to knockback enemies towards them by pointing away from them + modifiers.HitDirectionOverride = Owner.direction; + } + + public override bool PreDraw(ref Color lightColor) + { + Owner.ChangeDir(Math.Sign(Owner.Calamity().mouseWorld.X - Owner.position.X)); + + Texture2D scytheTexture = ModContent.Request(Texture).Value; + + Vector2 handleOrigin = new Vector2(0, scytheTexture.Height); + float scytheRotation = Projectile.rotation; + Main.EntitySpriteDraw(scytheTexture, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), scytheRotation, handleOrigin, Projectile.scale, SpriteEffects.None, 0); + + return false; + } + } +} diff --git a/Projectiles/Melee/ChronomancersScytheSwing.cs b/Projectiles/Melee/ChronomancersScytheSwing.cs new file mode 100644 index 0000000000..13e6a6a4c6 --- /dev/null +++ b/Projectiles/Melee/ChronomancersScytheSwing.cs @@ -0,0 +1,130 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class ChronomancersScytheSwing : ModProjectile + { + public override LocalizedText DisplayName => CalamityUtils.GetItemName(); + public static int IcicleSpeed = 24; + public static int IcicleVariance = 4; + public static int IcicleFrequency = 5; + public static float IcicleDamageMultiplier = 0.3f; + public static int ClockChance = 30; + public override void SetStaticDefaults() + { + Main.projFrames[Projectile.type] = 6; + } + + public override void SetDefaults() + { + Projectile.width = 148; + Projectile.height = 68; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.DamageType = TrueMeleeNoSpeedDamageClass.Instance; + Projectile.ownerHitCheck = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 5; + Projectile.coldDamage = true; + } + + public override void AI() + { + Player Owner = Main.player[Projectile.owner]; + Projectile.damage = (int)(Owner.GetTotalDamage(Projectile.DamageType).ApplyTo(Projectile.originalDamage) * (1f + Utils.GetLerpValue(0f, 300f, Projectile.ai[1], true))); + + Projectile.frameCounter++; + if (Projectile.frameCounter >= 1) + { + Projectile.frame++; + Projectile.frameCounter = 0; + } + if (Projectile.frame >= Main.projFrames[Projectile.type]) + Projectile.frame = 0; + + Projectile.soundDelay--; + if (Projectile.soundDelay <= 0) + { + SoundEngine.PlaySound(SoundID.Item71, Projectile.Center); + Projectile.soundDelay = 24; + } + + if (Main.myPlayer == Projectile.owner) + { + if (Owner.channel && !Owner.noItems && !Owner.CCed) + { + float scaleFactor6 = 1f; + + if (Owner.ActiveItem().shoot == Projectile.type) + scaleFactor6 = Owner.ActiveItem().shootSpeed * Projectile.scale; + + Vector2 slashDirection = Main.MouseWorld - Owner.RotatedRelativePoint(Owner.MountedCenter, true); + slashDirection.Normalize(); + if (slashDirection.HasNaNs()) + slashDirection = Vector2.UnitX * (float)Owner.direction; + + slashDirection *= scaleFactor6; + if (slashDirection.X != Projectile.velocity.X || slashDirection.Y != Projectile.velocity.Y) + Projectile.netUpdate = true; + + Projectile.velocity = slashDirection; + } + else + Projectile.Kill(); + } + + Projectile.ai[0]++; + // rapidly fire icicles + if (Projectile.ai[0] % IcicleFrequency == 0) + { + if (Main.myPlayer == Projectile.owner) + { + Vector2 velocity = Projectile.Center.DirectionTo(Main.MouseWorld) * IcicleSpeed + new Vector2(Main.rand.NextFloat(-IcicleVariance, IcicleVariance), Main.rand.NextFloat(-IcicleVariance, IcicleVariance)); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * IcicleDamageMultiplier), Projectile.knockBack, Projectile.owner); + } + } + + Vector2 dustSpawn = Projectile.Center + Projectile.velocity * 3f; + Lighting.AddLight(dustSpawn, Color.LightBlue.R * 0.001f, Color.LightBlue.G * 0.001f, Color.LightBlue.B * 0.001f); + + if (Main.rand.NextBool(3)) + { + int dust = Dust.NewDust(dustSpawn - Projectile.Size * 0.5f, Projectile.width, Projectile.height, DustID.IceRod, Projectile.velocity.X, Projectile.velocity.Y, 100); + Main.dust[dust].noGravity = true; + Main.dust[dust].position -= Projectile.velocity; + } + + Projectile.position = Owner.RotatedRelativePoint(Owner.MountedCenter, true) - Projectile.Size * 0.5f + Vector2.UnitX * 8 + Vector2.UnitY * 4; + Projectile.rotation = Projectile.velocity.ToRotation(); + if (Projectile.spriteDirection == 1) + Projectile.rotation += MathHelper.Pi; + Projectile.spriteDirection = Projectile.direction; + Projectile.timeLeft = 2; + Owner.ChangeDir(Projectile.direction); + Owner.heldProj = Projectile.whoAmI; + Owner.itemTime = 2; + Owner.itemAnimation = 2; + Owner.itemRotation = (Projectile.velocity * Projectile.direction).ToRotation(); + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 60); + if (Main.rand.NextBool(ClockChance)) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center, Main.rand.NextVector2Circular(-2, 2), ModContent.ProjectileType(), 0, 0, Projectile.owner); + } + } + } +} diff --git a/Projectiles/Melee/ChronomancersScytheSwing.png b/Projectiles/Melee/ChronomancersScytheSwing.png new file mode 100644 index 0000000000000000000000000000000000000000..134f00bf65c8a30a75664c3a433e7cda4038e069 GIT binary patch literal 5564 zcmb7IXIN9)w%tLGVnJ+x5G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^+6Nhvs!;Hj^739&4B;K5x8MfT$N((Mt@;CmFL|zk+Pb+mL)sTFy-Pq zW|Z|SNLV!l+$TuUL5E!!vKW>*4($^pv8sc9oCBN?=&k#6@t`DqY4AQ%PPi)%oY^;} zW{K6I;tQ6%1kwvX!%;qc++4dz$!bFhuF|>L9gD%NR4;LgC3tGP6)0|5dr2A!9c^k} z3$}uFn{&F~NkO}zsiNRgMn?WV?c$-M)s?okk4 z-!UWmdc2U0@>7gUnHY*;qh{Cep}=Xw@ZSmue_0ClmhOsf<0cHN@AIHzMI1$l-=Y4U zwK=WbGfNNu7NchOIq;@$3vUw-rugY#^D3Qtq(g&)5>s{c1c$Y?{J9Dy2)X+;IOP$zL3&7%h$bPXf-+CLvO9iE&U+~iukdO-!$ zyI+@cDeJOP<>ea3qBeRt73%gx7TCRk)a0P^N=xlc+rMuZM7J<*XG7!}*0V!3p7#&t zW?NaSi&K}h#hXvpm+rz?RWgK%8|z*o;b7P1pLiB$QaNoR$vs!asp@R~1iU?wSBmu&C8-`1y$UgV3}-mjB;1g;QHC^&wn3ywVPcbU6UOk-Wmql??}Fg@MUV{ zc#d{>oPaQu9zyYm76b`9W!=1wcm5K&=DJmw!PMS3aKlB3gDDf878zC8ZD5lO;x1eLZoBJATeFz2*yA@%Esh+|98OEIcI{7M%dJN3Hlu^yP<1t&yVSR5?diWzV zl=o#OT&{G2b_-OBuHaa7Xu{l0^%#n;!6C(5FumKcCD@?;_+yDXcKW{rMzkADuBE#d z5;g0M6+mK`{C%2GpUF4rjAqT3+M!GQx%%dxy042F_wXE3kY4lc8AR!OEhlu;B|pW< zIFJsi%k&tDr7P "Projectiles.Typeless"; + + public override void SetStaticDefaults() + { + Main.projFrames[Projectile.type] = 8; + + } + + public override void SetDefaults() + { + Projectile.width = 28; + Projectile.height = 42; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 600; + Projectile.tileCollide = false; + } + + public override void AI() + { + Projectile.velocity *= 0.98f; + Player player = Main.player[Projectile.owner]; + // if the player touches a clock, they get the Haste buff and their haste level increases to a maximum of 3 + // this kills the clock + if (player.getRect().Intersects(Projectile.getRect())) + { + if (player.whoAmI == Main.myPlayer) + { + player.AddBuff(ModContent.BuffType(), 60); + if (player.Calamity().hasteLevel < 3) + { + player.Calamity().hasteLevel++; + player.Calamity().hasteCounter = 0; // reset the haste countdown + } + Projectile.Kill(); + } + } + Projectile.frameCounter++; + if (Projectile.frameCounter > 5) + { + Projectile.frame++; + Projectile.frameCounter = 0; + if (Projectile.frame % 2 == 0) + Projectile.netUpdate = true; + } + if (Projectile.frame > 7) + { + Projectile.frame = 0; + } + if (Main.rand.NextBool(5)) + { + 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; + } + } + public override void OnKill(int timeLeft) + { + 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; + } + } + public override bool? CanHitNPC(NPC target) + { + return false; + } + } +} diff --git a/Projectiles/Typeless/ChronoClock.png b/Projectiles/Typeless/ChronoClock.png new file mode 100644 index 0000000000000000000000000000000000000000..1eded5eaf8799939adc54d029e7105ebba6f6956 GIT binary patch literal 1147 zcmeAS@N?(olHy`uVBq!ia0vp^N(>B)3LI=e*2NzSYk?GFage(c!@6@aFBuqEOg&v3 zLn`LHonx30n<~*ZU;46%s)S(X#cdBJEo^RHpwu_l$@}2S03H_g?^YGJE z?CqskBG9E4d@Lx+yPZ#RlSovQma9~!+tFi+_n+H7|9jrkK+Ll0e)`XMd!O%rZvXx4 z|M|b?w-;ZY9e*#4zbbI~BDtL-7U-ImIv?^^R{iN7b;zRD^p$g zr1E(czVP|$_4)R#-B+0XR*WG(CgzvKgLj8+>NBeO?}>e#khZRV*Ft>>wH=(YUQ5jP z@0t6&^ZKHFTpRXT{E&OFH+VC{o`2_NGsOJNVc-!CG@4jE{~P0u^3Qw>*Y`&=0yX~+ zGpQB%s#u~iv9K*!`MmIDUtZHretmt@cOPE!pSyM|eUWIg^ezsqDz<(Y6}b2-f}qZVwkNov1Z=w;%iT4oV+>Z_xzc! z_e;mhH1w%XVmD^nVEEIHVYB*nhKSDRo_X^V)EjN~&#|dz)Hv>LNBRT*TVFTzl*_!WF0(iLzDoa} z=PPDj`G31#V(Ckppe>zQ?P=}PZY)$S%SdPsOKM+sW1(hQ#;M}sjNG1e&e@y0$}%AE z#=@Hmr`}k&HL*SI0N>gpe7+lQ;*O@7lVI|~fK_5wYUdt;&G24`(_2Tr;7=hL@~6*V%TG_m;B zg0l->-nU!dS$gfo)`FnIjPDDbJKx-1_;hRj?Khro#}}&Z<3G!HmXFuk#CnTWSw@%a ztfcm|Z-)@Rg?s#d`?4R~=YSPJf)9zArjH&-Ky5d_*Jk{z`geY{im=4q-xsbd+*(@% o3P_NBP#cA;x0t=Tz;j^!)QG*o*Z1}M080}FPgg&ebxsLQ00#LlbN~PV literal 0 HcmV?d00001 From d2cd435607f2d33d99658f5f8bf7b03701dcdc2a Mon Sep 17 00:00:00 2001 From: GinYuH <72181395+GinYuH@users.noreply.github.com> Date: Sat, 30 Dec 2023 01:09:13 -0800 Subject: [PATCH 07/13] the scythe can now go counterclockwise --- Items/Weapons/Melee/ChronomancersScythe.cs | 8 +++- Projectiles/Melee/ChronoIcicleLarge.cs | 25 +++++++++-- .../Melee/ChronomancersScytheHoldout.cs | 41 +++++++------------ 3 files changed, 41 insertions(+), 33 deletions(-) diff --git a/Items/Weapons/Melee/ChronomancersScythe.cs b/Items/Weapons/Melee/ChronomancersScythe.cs index cef4a697be..7776bbd935 100644 --- a/Items/Weapons/Melee/ChronomancersScythe.cs +++ b/Items/Weapons/Melee/ChronomancersScythe.cs @@ -46,7 +46,9 @@ namespace CalamityMod.Items.Weapons.Melee { if (player.altFunctionUse == 2) { - Projectile.NewProjectile(source, position, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, Main.myPlayer); + int p = Projectile.NewProjectile(source, position, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, Main.myPlayer, ai2: player.direction); + float rot = -MathHelper.PiOver2 + MathHelper.PiOver4; + Main.projectile[p].rotation = player.direction * rot; return false; } else @@ -59,13 +61,15 @@ namespace CalamityMod.Items.Weapons.Melee { if (player.altFunctionUse == 2f) { - Item.reuseDelay = 20; + Item.reuseDelay = 10; Item.channel = false; + Item.useTurn = false; } else { Item.reuseDelay = 0; Item.channel = true; + Item.useTurn = true; } return base.CanUseItem(player); } diff --git a/Projectiles/Melee/ChronoIcicleLarge.cs b/Projectiles/Melee/ChronoIcicleLarge.cs index 8ec70cf8af..9c77320d53 100644 --- a/Projectiles/Melee/ChronoIcicleLarge.cs +++ b/Projectiles/Melee/ChronoIcicleLarge.cs @@ -5,6 +5,8 @@ using Terraria.ModLoader; using Terraria.Audio; using CalamityMod.Buffs.StatDebuffs; using System.Security.Policy; +using System; +using System.Diagnostics.Metrics; namespace CalamityMod.Projectiles.Melee { @@ -36,21 +38,36 @@ namespace CalamityMod.Projectiles.Melee case 0: if (Projectile.velocity.Length() > 0.01f) { - Projectile.velocity *= 0.01f; + Projectile.velocity *= 0.001f; } + bool isCounter = Projectile.ai[2] < 0; if (Main.player[Projectile.owner].active && !Main.player[Projectile.owner].dead) { - Projectile.position = Main.player[Projectile.owner].Center + (2 * MathHelper.Pi / 12 * (Projectile.ai[2] - 1) - MathHelper.PiOver2).ToRotationVector2() * 160 - Projectile.Size / 2; + float shardNum = Math.Abs(Projectile.ai[2]) - 1; + float aivar = isCounter ? 1 - shardNum - 1 : shardNum; + Projectile.position = Main.player[Projectile.owner].Center + (2 * MathHelper.Pi / 12 * aivar - MathHelper.PiOver2).ToRotationVector2() * 160 - Projectile.Size / 2; } - if (Projectile.ai[1] >= (12 - Projectile.ai[2]) * 5 + 10) + if (Projectile.ai[1] >= (12 - Math.Abs(Projectile.ai[2])) * 5 + 2) { + SoundEngine.PlaySound(SoundID.NPCHit5, Projectile.Center); + for (int i = 0; i < 10; i++) + { + int dusttype = Main.rand.NextBool() ? 68 : 67; + if (Main.rand.NextBool(4)) + { + dusttype = 80; + } + Vector2 dspeed = new Vector2(Main.rand.NextFloat(-7f, 7f), Main.rand.NextFloat(-7f, 7f)); + int dust = Dust.NewDust(Projectile.Center, 1, 1, dusttype, dspeed.X, dspeed.Y, 50, default, 1.1f); + Main.dust[dust].noGravity = true; + } Projectile.ai[0] = 1; Projectile.ai[1] = 0; } break; // jet out case 1: - if (Projectile.velocity.Length() < 5) + if (Projectile.velocity.Length() < IdleSpeedMax) { Projectile.velocity *= 3f; } diff --git a/Projectiles/Melee/ChronomancersScytheHoldout.cs b/Projectiles/Melee/ChronomancersScytheHoldout.cs index 371df7a22a..839091cd73 100644 --- a/Projectiles/Melee/ChronomancersScytheHoldout.cs +++ b/Projectiles/Melee/ChronomancersScytheHoldout.cs @@ -30,7 +30,6 @@ namespace CalamityMod.Projectiles.Melee Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; Projectile.ownerHitCheck = true; - Projectile.rotation = -MathHelper.PiOver2 + MathHelper.PiOver4; // this makes sure the projectile starts facing up without too much hassle } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) @@ -43,18 +42,18 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - Owner.ChangeDir(Math.Sign(Owner.Calamity().mouseWorld.X - Owner.position.X)); + Owner.ChangeDir((int)Projectile.ai[2]); Projectile.velocity = Vector2.Zero; - Projectile.rotation += 2 * MathHelper.Pi / 60; // this is intentionally only clockwise, but can be changed if it's too awkward + Projectile.rotation += (2 * MathHelper.Pi / 60) * Projectile.ai[2]; // this is intentionally only clockwise, but can be changed if it's too awkward UpdateOwnerVars(); Projectile.Center = Owner.MountedCenter + Projectile.rotation.ToRotationVector2() * 10f - Vector2.UnitX * 4 * Owner.direction; // once the scythe has completed a rotation, die - if (Projectile.rotation > 2 * MathHelper.Pi - MathHelper.PiOver2 + MathHelper.PiOver4) + if ((Projectile.rotation > 2 * MathHelper.Pi - MathHelper.PiOver2 + MathHelper.PiOver4 && Projectile.ai[2] == 1) || (Projectile.rotation < -(2 * MathHelper.Pi - MathHelper.PiOver2 + MathHelper.PiOver4) && Projectile.ai[2] == -1)) { Projectile.Kill(); } @@ -66,10 +65,12 @@ namespace CalamityMod.Projectiles.Melee { if (Projectile.owner == Main.myPlayer) { - Vector2 rotationVector = (Projectile.rotation - MathHelper.PiOver4 * 1.6666f).ToRotationVector2(); - Vector2 spawnPos = Main.player[Projectile.owner].Center + (2 * MathHelper.Pi / 12 * (Projectile.ai[1]) - MathHelper.PiOver2).ToRotationVector2() * 160; - int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnPos, rotationVector * 5, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, ai2: Projectile.ai[1] + 1); - Main.projectile[p].rotation = Main.projectile[p].velocity.ToRotation() + MathHelper.PiOver2; + // Math is beautiful + float aivar = Projectile.ai[2] == -1 ? 1 - Projectile.ai[1] - 1 : Projectile.ai[1]; + Vector2 spawnPos = Main.player[Projectile.owner].Center + (2 * MathHelper.Pi / 12 * aivar - MathHelper.PiOver2).ToRotationVector2() * 160; + Vector2 rotationVector = spawnPos - Main.player[Projectile.owner].Center; + int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnPos, rotationVector * 5, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, ai2: Projectile.ai[2] * (Projectile.ai[1] + 1)); + Main.projectile[p].rotation = (spawnPos - Main.player[Projectile.owner].Center).ToRotation() + MathHelper.PiOver2; } Projectile.ai[1]++; Projectile.ai[0] = 0; @@ -78,22 +79,8 @@ namespace CalamityMod.Projectiles.Melee public void UpdateOwnerVars() { - float armPointingDirection = ((Owner.Calamity().mouseWorld - Owner.MountedCenter).ToRotation()); - - //"crop" the rotation so the player only points their arm in a smaller range. (The back arm points in the throw direction) - if (armPointingDirection < MathHelper.PiOver2 && armPointingDirection >= -MathHelper.PiOver2) - armPointingDirection = -MathHelper.PiOver2 + MathHelper.PiOver4 / 2f + MathHelper.PiOver2 * 1.5f * Utils.GetLerpValue(0f, MathHelper.Pi, armPointingDirection + MathHelper.PiOver2, true); - else - { - if (armPointingDirection > 0) - armPointingDirection = MathHelper.PiOver2 + MathHelper.PiOver4 / 2f + MathHelper.PiOver4 * 1.5f * Utils.GetLerpValue(0f, MathHelper.PiOver2, armPointingDirection - MathHelper.PiOver2, true); - else - armPointingDirection = -MathHelper.Pi + MathHelper.PiOver4 * 1.5f * Utils.GetLerpValue(-MathHelper.Pi, -MathHelper.PiOver4, armPointingDirection, true); - } - - - Owner.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, armPointingDirection - MathHelper.PiOver2); - Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, Projectile.rotation - MathHelper.PiOver2); + float rotOffset = Projectile.ai[2] == -1 ? 3 * MathHelper.Pi : MathHelper.PiOver2; + Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, Projectile.rotation - rotOffset); Owner.heldProj = Projectile.whoAmI; Owner.itemTime = 2; Owner.itemAnimation = 2; @@ -120,13 +107,13 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - Owner.ChangeDir(Math.Sign(Owner.Calamity().mouseWorld.X - Owner.position.X)); + Owner.ChangeDir((int)Projectile.ai[2]); Texture2D scytheTexture = ModContent.Request(Texture).Value; - Vector2 handleOrigin = new Vector2(0, scytheTexture.Height); + Vector2 handleOrigin = Projectile.ai[2] == -1 ? new Vector2(scytheTexture.Width, scytheTexture.Height) : new Vector2(0, scytheTexture.Height); float scytheRotation = Projectile.rotation; - Main.EntitySpriteDraw(scytheTexture, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), scytheRotation, handleOrigin, Projectile.scale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(scytheTexture, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), scytheRotation, handleOrigin, Projectile.scale, Projectile.ai[2] == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); return false; } From 12d71d2cf9b36599f7b46eff6a9d1e2e6d864132 Mon Sep 17 00:00:00 2001 From: GinYuH <72181395+GinYuH@users.noreply.github.com> Date: Sat, 30 Dec 2023 01:28:08 -0800 Subject: [PATCH 08/13] clock pickup effect --- Projectiles/Typeless/ChronoClock.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Projectiles/Typeless/ChronoClock.cs b/Projectiles/Typeless/ChronoClock.cs index ec3618c388..9cb856799d 100644 --- a/Projectiles/Typeless/ChronoClock.cs +++ b/Projectiles/Typeless/ChronoClock.cs @@ -1,8 +1,10 @@ using CalamityMod.Buffs.StatBuffs; using CalamityMod.CalPlayer; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using System.IO; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -43,6 +45,23 @@ namespace CalamityMod.Projectiles.Typeless { player.Calamity().hasteLevel++; player.Calamity().hasteCounter = 0; // reset the haste countdown + SoundEngine.PlaySound(SoundID.DD2_DarkMageHealImpact with { Volume = 2 }, Projectile.Center); + for (int i = 0; i < 20; i++) + { + Particle sparkle = new SnowflakeSparkle(Projectile.Center, (Main.rand.NextVector2CircularEdge(100, 100)).SafeNormalize(Vector2.Zero) * 4, Color.LightBlue, Color.LightSkyBlue, Main.rand.NextFloat(0.1f, 0.6f), 60); + GeneralParticleHandler.SpawnParticle(sparkle); + } + } + else + { + // reset the haste countdown if haste level is maxed out + player.Calamity().hasteCounter = 0; + SoundEngine.PlaySound(SoundID.DD2_DarkMageHealImpact with { Volume = 0.2f, Pitch = 1.4f }, Projectile.Center); + for (int i = 0; i < 20; i++) + { + Particle sparkle = new SnowflakeSparkle(Projectile.Center, (Main.rand.NextVector2CircularEdge(100, 100)).SafeNormalize(Vector2.Zero) * 2, Color.LightBlue, Color.LightSkyBlue, Main.rand.NextFloat(0.04f, 0.3f), 30); + GeneralParticleHandler.SpawnParticle(sparkle); + } } Projectile.Kill(); } From 3d4cc8c1d10bc30371313cddf34ddbd05d8bf48b Mon Sep 17 00:00:00 2001 From: GinYuH <72181395+GinYuH@users.noreply.github.com> Date: Sat, 30 Dec 2023 01:40:47 -0800 Subject: [PATCH 09/13] tooltip --- .../en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson index c9bf7e4a9e..49977f73c6 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson @@ -251,7 +251,14 @@ CelestialClaymore: { ChronomancersScythe: { DisplayName: Chronomancer's Scythe - Tooltip: "" + Tooltip: + ''' + Rapidly fires icicles + Press to swing the scythe around you creating a clock pattern of homing icicles + Direct hits with the scythe have a chance to spawn clocks + Collecting the clocks increases movement speed and acceleration by 5% for each clock collected + This stacks up to 3 times and each level wears off after 5 seconds + ''' } ClamCrusher: { From 79b3907fe42a5493582ba22908721d74b616b3d3 Mon Sep 17 00:00:00 2001 From: Cameron Ewell Date: Fri, 5 Jan 2024 17:38:53 -0500 Subject: [PATCH 10/13] Remove two inaccurate comments --- Items/Weapons/Melee/ChronomancersScythe.cs | 2 +- Projectiles/Melee/ChronomancersScytheHoldout.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Items/Weapons/Melee/ChronomancersScythe.cs b/Items/Weapons/Melee/ChronomancersScythe.cs index 7776bbd935..90ee4114a1 100644 --- a/Items/Weapons/Melee/ChronomancersScythe.cs +++ b/Items/Weapons/Melee/ChronomancersScythe.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 45; Item.height = 45; - Item.DamageType = TrueMeleeNoSpeedDamageClass.Instance; // ironic how a weapon that increases use speed cant benefit from it + Item.DamageType = TrueMeleeNoSpeedDamageClass.Instance; Item.noMelee = true; Item.noUseGraphic = true; Item.channel = true; diff --git a/Projectiles/Melee/ChronomancersScytheHoldout.cs b/Projectiles/Melee/ChronomancersScytheHoldout.cs index 839091cd73..521dc164e5 100644 --- a/Projectiles/Melee/ChronomancersScytheHoldout.cs +++ b/Projectiles/Melee/ChronomancersScytheHoldout.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.velocity = Vector2.Zero; - Projectile.rotation += (2 * MathHelper.Pi / 60) * Projectile.ai[2]; // this is intentionally only clockwise, but can be changed if it's too awkward + Projectile.rotation += (2 * MathHelper.Pi / 60) * Projectile.ai[2]; UpdateOwnerVars(); From 5a10e3121042d6376a1a4c603279c63749d98b36 Mon Sep 17 00:00:00 2001 From: GinYuH <72181395+GinYuH@users.noreply.github.com> Date: Thu, 4 Jan 2024 20:21:46 -0800 Subject: [PATCH 11/13] snowstorm staff touchups --- ...Mods.CalamityMod.Items.Weapons.Magic.hjson | 6 +- .../Mods.CalamityMod.Projectiles.Magic.hjson | 1 + Projectiles/Magic/Snowflake.cs | 153 +++++++++++++++++- Projectiles/Magic/SnowflakeIceStar.cs | 112 +++++++++++++ 4 files changed, 267 insertions(+), 5 deletions(-) create mode 100644 Projectiles/Magic/SnowflakeIceStar.cs diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson index 822eecb526..a2a7c9ffd6 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson @@ -718,7 +718,11 @@ SlitheringEels: { SnowstormStaff: { DisplayName: Snowstorm Staff - Tooltip: Fires a snowflake that follows the mouse cursor + Tooltip: + ''' + Fires snowflakes that follows the mouse cursor + Snowflakes split into ice stars on enemy hits + ''' } SoulPiercer: { diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson index 8b116b409a..d6e55fe2b8 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson @@ -200,6 +200,7 @@ SlitheringEelProjectile.DisplayName: Slithering Eel SmallSpirit.DisplayName: Small Angry Spirit Snowball.DisplayName: Snowball Snowflake.DisplayName: Snowflake +SnowflakeIceStar.DisplayName: Ice Star SolarElementalBeam.DisplayName: Solar Beam SoulPiercerBeam.DisplayName: Soul Piercer SoulPiercerBolt.DisplayName: Soul Piercer diff --git a/Projectiles/Magic/Snowflake.cs b/Projectiles/Magic/Snowflake.cs index 91c4648baf..1b37813242 100644 --- a/Projectiles/Magic/Snowflake.cs +++ b/Projectiles/Magic/Snowflake.cs @@ -3,6 +3,8 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; +using System; +using CalamityMod.Items.Weapons.Magic; namespace CalamityMod.Projectiles.Magic { @@ -19,24 +21,147 @@ namespace CalamityMod.Projectiles.Magic { Projectile.width = 20; Projectile.height = 20; - Projectile.aiStyle = ProjAIStyleID.MagicMissile; Projectile.friendly = true; Projectile.tileCollide = false; Projectile.alpha = 70; Projectile.penetrate = -1; Projectile.timeLeft = 600; Projectile.DamageType = DamageClass.Magic; - AIType = ProjectileID.FlyingKnife; Projectile.coldDamage = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; } public override void AI() { - Projectile.rotation += 0.15f; + Player player = Main.player[Projectile.owner]; + if (player == null) + return; + if (!(player.channel && !player.noItems && !player.CCed)) + Projectile.Kill(); + if (Projectile.type != ModContent.ProjectileType() || + Main.player[Projectile.owner].HeldItem.type != ModContent.ItemType() || !Main.player[Projectile.owner].channel) + { + Projectile.Kill(); + return; + } + if (Projectile.ai[2] > 0) + { + Projectile.ai[2]--; + } + + // This code uses player-specific fields (such as the mouse), and does not need to be run for anyone + // other than its owner. + if (Main.myPlayer != Projectile.owner) + return; + + Projectile.rotation += 0.2f; + if (Projectile.localAI[0] < 1f) + { + Projectile.localAI[0] += 0.002f; + } + else + { + Projectile.width = Projectile.height = 50; + } + Vector2 projPos = player.RotatedRelativePoint(player.MountedCenter, true); + float projX = (float)Main.mouseX + Main.screenPosition.X - projPos.X; + float projY = (float)Main.mouseY + Main.screenPosition.Y - projPos.Y; + if (player.gravDir == -1f) + { + projY = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - projPos.Y; + } + if ((float.IsNaN(projX) && float.IsNaN(projY)) || (projX == 0f && projY == 0f)) + { + projX = (float)player.direction; + projY = 0f; + } + projPos += new Vector2(projX, projY); + float speed = 30f; + float speedScale = 3f; + Vector2 vectorPos = Projectile.Center; + if (Vector2.Distance(projPos, vectorPos) < 90f) + { + speed = 10f; + speedScale = 1f; + } + if (Vector2.Distance(projPos, vectorPos) < 30f) + { + speed = 3f; + speedScale = 0.3f; + } + if (Vector2.Distance(projPos, vectorPos) < 10f) + { + speed = 1f; + speedScale = 0.1f; + } + float projectileX = projPos.X - vectorPos.X; + float projectileY = projPos.Y - vectorPos.Y; + float projectileAdjust = (float)Math.Sqrt((double)(projectileX * projectileX + projectileY * projectileY)); + projectileAdjust = speed / projectileAdjust; + projectileX *= projectileAdjust; + projectileY *= projectileAdjust; + if (Projectile.velocity.X < projectileX) + { + Projectile.velocity.X = Projectile.velocity.X + speedScale; + if (Projectile.velocity.X < 0f && projectileX > 0f) + { + Projectile.velocity.X = Projectile.velocity.X + speedScale; + } + } + else if (Projectile.velocity.X > projectileX) + { + Projectile.velocity.X = Projectile.velocity.X - speedScale; + if (Projectile.velocity.X > 0f && projectileX < 0f) + { + Projectile.velocity.X = Projectile.velocity.X - speedScale; + } + } + if (Projectile.velocity.Y < projectileY) + { + Projectile.velocity.Y = Projectile.velocity.Y + speedScale; + if (Projectile.velocity.Y < 0f && projectileY > 0f) + { + Projectile.velocity.Y = Projectile.velocity.Y + speedScale; + } + } + else if (Projectile.velocity.Y > projectileY) + { + Projectile.velocity.Y = Projectile.velocity.Y - speedScale; + if (Projectile.velocity.Y > 0f && projectileY < 0f) + { + Projectile.velocity.Y = Projectile.velocity.Y - speedScale; + } + } if (Main.rand.NextBool(5)) { Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 67, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } + float pushForce = 0.15f; + for (int k = 0; k < Main.maxProjectiles; k++) + { + Projectile otherProj = Main.projectile[k]; + // Short circuits to make the loop as fast as possible. + if (!otherProj.active || k == Projectile.whoAmI) + continue; + + // If the other projectile is indeed the same owned by the same player and they're too close, nudge them away. + bool sameProjType = otherProj.type == Projectile.type; + float taxicabDist = Vector2.Distance(Projectile.Center, otherProj.Center); + float distancegate = 100f; + if (sameProjType && taxicabDist < distancegate) + { + if (Projectile.position.X < otherProj.position.X) + Projectile.velocity.X -= pushForce; + else + Projectile.velocity.X += pushForce; + + if (Projectile.position.Y < otherProj.position.Y) + Projectile.velocity.Y -= pushForce; + else + Projectile.velocity.Y += pushForce; + } + } } public override bool PreDraw(ref Color lightColor) @@ -52,12 +177,32 @@ namespace CalamityMod.Projectiles.Magic { Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 67, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } + if (Projectile.owner == Main.myPlayer) + { + for (int x = 1; x <= 2; x++) + { + Gore.NewGore(Projectile.GetSource_Death(), Projectile.Center, Projectile.velocity * 0.5f + Main.rand.NextVector2Square(-4, 4), Mod.Find("CryoShieldGore" + Main.rand.Next(1, 5)).Type, 0.7f); + } + } } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.immune[Projectile.owner] = 7; target.AddBuff(BuffID.Frostburn2, 180); + float randOffset = Main.rand.NextFloat(0, 2 * MathHelper.Pi); + // spawn mini stars on hit with a 5 second cooldown + if (Projectile.owner == Main.myPlayer && Projectile.ai[2] <= 0) + { + for (int i = 0; i < 3; i++) + { + Vector2 velocity = (MathHelper.TwoPi * i / 3f + randOffset).ToRotationVector2() * 4f; + int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack * 0.5f, Projectile.owner); + Main.projectile[p].DamageType = DamageClass.Magic; + } + SoundEngine.PlaySound(SoundID.Item30, Projectile.Center); + // set the 5 second cooldown + Projectile.ai[2] = 300; + } } } } diff --git a/Projectiles/Magic/SnowflakeIceStar.cs b/Projectiles/Magic/SnowflakeIceStar.cs new file mode 100644 index 0000000000..43627c432c --- /dev/null +++ b/Projectiles/Magic/SnowflakeIceStar.cs @@ -0,0 +1,112 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Audio; + +namespace CalamityMod.Projectiles.Magic +{ + public class SnowflakeIceStar : ModProjectile, ILocalizedModType + { + public override string Texture => "CalamityMod/Projectiles/Typeless/KelvinCatalystStar"; + public new string LocalizationCategory => "Projectiles.Magic"; + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + } + + public override void SetDefaults() + { + Projectile.width = 16; + Projectile.height = 16; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Magic; + Projectile.coldDamage = true; + } + + public override void AI() + { + if (Projectile.ai[0] < 90f) + { + Projectile.ai[0] += 1f; + Projectile.velocity.X *= 0.98f; + Projectile.velocity.Y *= 0.98f; + } + else + { + Projectile.extraUpdates = 1; + + Vector2 center = Projectile.Center; + float maxDistance = 500f; + bool homeIn = false; + + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].CanBeChasedBy(Projectile, false)) + { + float extraDistance = (float)(Main.npc[i].width / 2) + (float)(Main.npc[i].height / 2); + + if (Vector2.Distance(Main.npc[i].Center, Projectile.Center) < (maxDistance + extraDistance) && Collision.CanHit(Projectile.Center, 1, 1, Main.npc[i].Center, 1, 1)) + { + center = Main.npc[i].Center; + homeIn = true; + break; + } + } + } + + if (homeIn) + { + Vector2 moveDirection = Projectile.SafeDirectionTo(center, Vector2.UnitY); + Projectile.velocity = (Projectile.velocity * 20f + moveDirection * 12f) / (21f); + } + else + Projectile.Kill(); + } + + Lighting.AddLight(Projectile.Center, Main.DiscoR * 0.075f / 255f, Main.DiscoR * 0.1f / 255f, Main.DiscoR * 0.125f / 255f); + + if (Main.rand.NextBool(6)) + { + int dust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 67, 0f, 0f, 100, default, 0.4f); + Main.dust[dust].velocity *= 0.3f; + Main.dust[dust].noGravity = true; + } + + Projectile.rotation += 0.25f; + } + + public override bool? CanDamage() + { + return Projectile.ai[0] >= 90f ? null : false; + } + + public override bool PreDraw(ref Color lightColor) + { + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + return false; + } + + public override void OnKill(int timeLeft) + { + SoundEngine.PlaySound(SoundID.Item27, Projectile.position); + Projectile.ExpandHitboxBy(24); + int dustAmt = 36; + for (int j = 0; j < dustAmt; j++) + { + Vector2 rotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; + rotate = rotate.RotatedBy((double)((float)(j - (dustAmt / 2 - 1)) * 6.28318548f / (float)dustAmt), default) + Projectile.Center; + Vector2 faceDirection = rotate - Projectile.Center; + int icyDust = Dust.NewDust(rotate + faceDirection, 0, 0, 67, faceDirection.X * 0.5f, faceDirection.Y * 0.5f, 100, default, 0.75f); + Main.dust[icyDust].noGravity = true; + } + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Frostburn2, 60); + + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.Frostburn2, 60); + } +} From 028cc465c19f08c250d2521eedb819aaa096633a Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <142704082+CongratsIsTrash@users.noreply.github.com> Date: Fri, 5 Jan 2024 17:53:08 -0500 Subject: [PATCH 12/13] Made Snowstorm Staff's ice stars use HomeInOnNPC for consistency --- Projectiles/Magic/SnowflakeIceStar.cs | 29 +-------------------------- 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/Projectiles/Magic/SnowflakeIceStar.cs b/Projectiles/Magic/SnowflakeIceStar.cs index 43627c432c..162864fe30 100644 --- a/Projectiles/Magic/SnowflakeIceStar.cs +++ b/Projectiles/Magic/SnowflakeIceStar.cs @@ -37,34 +37,7 @@ namespace CalamityMod.Projectiles.Magic } else { - Projectile.extraUpdates = 1; - - Vector2 center = Projectile.Center; - float maxDistance = 500f; - bool homeIn = false; - - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].CanBeChasedBy(Projectile, false)) - { - float extraDistance = (float)(Main.npc[i].width / 2) + (float)(Main.npc[i].height / 2); - - if (Vector2.Distance(Main.npc[i].Center, Projectile.Center) < (maxDistance + extraDistance) && Collision.CanHit(Projectile.Center, 1, 1, Main.npc[i].Center, 1, 1)) - { - center = Main.npc[i].Center; - homeIn = true; - break; - } - } - } - - if (homeIn) - { - Vector2 moveDirection = Projectile.SafeDirectionTo(center, Vector2.UnitY); - Projectile.velocity = (Projectile.velocity * 20f + moveDirection * 12f) / (21f); - } - else - Projectile.Kill(); + CalamityUtils.HomeInOnNPC(Projectile, true, 500f, 12f, 20f); } Lighting.AddLight(Projectile.Center, Main.DiscoR * 0.075f / 255f, Main.DiscoR * 0.1f / 255f, Main.DiscoR * 0.125f / 255f); From 3db2b2c371d84fbd03a83c9e7842db50bc2bd85d Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Fri, 5 Jan 2024 18:55:50 -0500 Subject: [PATCH 13/13] Ashen Altar and Basin only decraft post-mech --- Items/Placeables/Furniture/CraftingStations/AshenAltar.cs | 4 +++- Items/Placeables/FurnitureAshen/AshenBasin.cs | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Items/Placeables/Furniture/CraftingStations/AshenAltar.cs b/Items/Placeables/Furniture/CraftingStations/AshenAltar.cs index a09bb66da5..e0d84b0c4f 100644 --- a/Items/Placeables/Furniture/CraftingStations/AshenAltar.cs +++ b/Items/Placeables/Furniture/CraftingStations/AshenAltar.cs @@ -1,5 +1,6 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.FurnitureAshen; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture.CraftingStations @@ -34,6 +35,7 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations AddIngredient(10). AddIngredient(10). AddTile(TileID.Anvils). + AddDecraftCondition(Condition.DownedMechBossAny). Register(); } } diff --git a/Items/Placeables/FurnitureAshen/AshenBasin.cs b/Items/Placeables/FurnitureAshen/AshenBasin.cs index ae11cf0880..f600afabb4 100644 --- a/Items/Placeables/FurnitureAshen/AshenBasin.cs +++ b/Items/Placeables/FurnitureAshen/AshenBasin.cs @@ -1,7 +1,8 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria.ModLoader; +using Terraria; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.FurnitureAshen { @@ -29,6 +30,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAshen AddIngredient(10). AddIngredient(5). AddTile(). + AddDecraftCondition(Condition.DownedMechBossAny). Register(); } }