From a6dfb5a6eeca08aab6202cd1adbac40488ad98eb Mon Sep 17 00:00:00 2001 From: IbanPlay <56191483+IbanPlay@users.noreply.github.com> Date: Thu, 16 Dec 2021 23:26:19 +0100 Subject: [PATCH 01/35] Basic attempt Probably aint gonna work --- Items/Weapons/Ranged/RCCAnihilator.cs | 75 ++++++++ Projectiles/Ranged/RCCHoldout.cs | 247 ++++++++++++++++++++++++++ 2 files changed, 322 insertions(+) create mode 100644 Items/Weapons/Ranged/RCCAnihilator.cs create mode 100644 Projectiles/Ranged/RCCHoldout.cs diff --git a/Items/Weapons/Ranged/RCCAnihilator.cs b/Items/Weapons/Ranged/RCCAnihilator.cs new file mode 100644 index 0000000000..3c813cd8a1 --- /dev/null +++ b/Items/Weapons/Ranged/RCCAnihilator.cs @@ -0,0 +1,75 @@ +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Graphics.Effects; +using System.Collections.Generic; +using Terraria.Graphics.Shaders; +using Microsoft.Xna.Framework.Graphics; +using CalamityMod.Projectiles.Ranged; + +namespace CalamityMod.Items.Weapons.Ranged +{ + public class RCCAnihilator : ModItem + { + public const int MaxBolts = 6; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Rending Greatbow of the Six Northen Winds: Anihilator of Right Click Channel Restrictions"); + Tooltip.SetDefault("Hold RIGHT click to load up to six precision bolts\n" + + "The more precision bolts are loaded, the harder they hit"); + } + + public override void SetDefaults() + { + item.damage = 10000000; + item.ranged = true; + item.width = 48; + item.height = 96; + item.useTime = 60; + item.useAnimation = 30; + item.useStyle = ItemUseStyleID.HoldingOut; + item.noMelee = true; + item.knockBack = 4.25f; + item.value = CalamityGlobalItem.Rarity10BuyPrice; + item.rare = ItemRarityID.Red; + item.UseSound = SoundID.Item5; + item.autoReuse = true; + item.shoot = ProjectileID.PurificationPowder; + item.shootSpeed = 15f; + item.useAmmo = AmmoID.Arrow; + } + + public override string Texture => "CalamityMod/Items/Weapons/Ranged/ClockworkBow"; + public override bool AltFunctionUse(Player player) + { + return true; + } + + public override bool CanUseItem(Player player) + { + item.noUseGraphic = true; + item.UseSound = SoundID.Item20; + item.channel = true; + return player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0; + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.altFunctionUse == 2) + { + Vector2 shootVelocity = new Vector2(speedX, speedY); + Vector2 shootDirection = shootVelocity.SafeNormalize(Vector2.UnitX * player.direction); + // Charge-up. Done via a holdout projectile. + Projectile.NewProjectile(position, shootDirection, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + return false; + } + else //This is just a test thing + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 1f, 0f); + return false; + } + } + } +} diff --git a/Projectiles/Ranged/RCCHoldout.cs b/Projectiles/Ranged/RCCHoldout.cs new file mode 100644 index 0000000000..4e9ae8c363 --- /dev/null +++ b/Projectiles/Ranged/RCCHoldout.cs @@ -0,0 +1,247 @@ +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Graphics.Shaders; +using Microsoft.Xna.Framework.Graphics; +using CalamityMod.Items.Weapons.Ranged; + + +namespace CalamityMod.Projectiles.Ranged +{ + public class RCCHoldout : ModProjectile + { + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Rending Bolt"); + //Main.projFrames[projectile.type] = 9; might animate the bow's string getting drawn but not rn + } + + private Player Owner => Main.player[projectile.owner]; + + private bool OwnerCanShoot => Owner.channel && Owner.HasAmmo(Owner.ActiveItem(), true) && !Owner.noItems && !Owner.CCed; + private ref float CurrentChargingFrames => ref projectile.ai[0]; + private ref float LoadedBolts => ref projectile.ai[1]; + private ref float FramesToLoadBolt => ref projectile.localAI[0]; + + //private ref float Overfilled => ref projectile.localAI[1]; Until i implement the bow animation there is no need for that + private float angularSpread = MathHelper.ToRadians(16); + + //public override string Texture => "CalamityMod/Projectiles/Ranged/ClockworkBowHoldout"; + public override string Texture => "CalamityMod/Items/Weapons/Ranged/ClockworkBow"; + + public override void SetDefaults() + { + projectile.width = 48; + projectile.height = 96; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.ranged = true; + projectile.ignoreWater = true; + } + + public override void AI() + { + Vector2 armPosition = Owner.RotatedRelativePoint(Owner.MountedCenter, true); + Vector2 tipPosition = armPosition + projectile.velocity * projectile.width * 0.5f; + + // If the player releases left click, shoot out the arrows + if (!OwnerCanShoot) + { + + if (LoadedBolts <= 0f) //If theres no arrows to shoot + { + projectile.Kill(); + return; + } + // Fire the spread of arrows + else + UnloadBolts(tipPosition); + } + + else + { + // Frame 1 effects: Initialize the shoot speed + if (FramesToLoadBolt == 0f) + { + FramesToLoadBolt = Owner.ActiveItem().useAnimation; + } + + ++CurrentChargingFrames; + + if (CurrentChargingFrames - FramesToLoadBolt / 2 <= 0.01) + Main.PlaySound(SoundID.Item17); //Click + + if (CurrentChargingFrames >= FramesToLoadBolt && LoadedBolts < RCCAnihilator.MaxBolts) + { + CurrentChargingFrames = 0f; + ++LoadedBolts; + + if (LoadedBolts % 2 == 0) + CombatText.NewText(Owner.Hitbox, new Color(155, 255, 255), "Tock", true); + else + CombatText.NewText(Owner.Hitbox, new Color(255, 200, 100), "Tick", true); + + FramesToLoadBolt *= 0.950f; + + if (LoadedBolts >= RCCAnihilator.MaxBolts) + Main.PlaySound(SoundID.Item23); + else + { + var loadSound = Main.PlaySound(SoundID.Item108); + if (loadSound != null) + loadSound.Volume *= 0.3f; + } + } + } + + UpdateProjectileHeldVariables(armPosition); + ManipulatePlayerVariables(); + } + + public void UnloadBolts(Vector2 tipPosition) + { + //If the max amount of bolts is already loaded we can ignore the extra spread from the bolt currently loading + if (LoadedBolts == RCCAnihilator.MaxBolts) + { + for (int i = 0; i < LoadedBolts; i++) + { + //Version that doesnt inclue the chargingframes bit , since its fully charged + float increment = angularSpread * (LoadedBolts - 1) / 2; + float spreadForThisProjectile = MathHelper.Lerp(-increment, increment, i / (float)(LoadedBolts - 1)); + ShootProjectiles(tipPosition, spreadForThisProjectile); + + } + Main.PlaySound(SoundID.Item38);//play the sound + } + else if (LoadedBolts != 0) + { + for (int i = 0; i < LoadedBolts + 1; i++) + { + if (i == LoadedBolts) //We don't actually shoot the arrow that's currently loading + continue; + + //Version that takes into account the progress of the arrow currently loading. It takes half the time it takes for the arrow to load for the range to adjust to its next position + float increment = angularSpread * (LoadedBolts - 1 + MathHelper.Clamp((CurrentChargingFrames / FramesToLoadBolt) * 2, 0f, 1f)) / 2; + float spreadForThisProjectile = MathHelper.Lerp(-increment, increment, i / (float)(MathHelper.Lerp(LoadedBolts - 1, LoadedBolts, MathHelper.Clamp((CurrentChargingFrames * 2 / FramesToLoadBolt), 0f, 1f)))); + ShootProjectiles(tipPosition, spreadForThisProjectile); + } + Main.PlaySound(SoundID.Item38);//play the sound + } + + FramesToLoadBolt = Owner.ActiveItem().useAnimation; //reset the reload time + LoadedBolts = 0; //Unload the bow + } + + public void ShootProjectiles(Vector2 tipPosition, float projectileRotation) + { + if (Main.myPlayer != projectile.owner) + return; + + Item heldItem = Owner.ActiveItem(); + int BoltDamage = (int)(heldItem.damage * Owner.RangedDamage() * (LoadedBolts + 1) / (float)(RCCAnihilator.MaxBolts + 1)); + float shootSpeed = heldItem.shootSpeed * 1f; + float knockback = heldItem.knockBack; + bool uselessFuckYou = OwnerCanShoot; //Not a very nice thing to say :/ + int projectileType = 0; + + Owner.PickAmmo(heldItem, ref projectileType, ref shootSpeed, ref uselessFuckYou, ref BoltDamage, ref knockback, false); + projectileType = ModContent.ProjectileType(); + + knockback = Owner.GetWeaponKnockback(heldItem, knockback); + Vector2 shootVelocity = projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(projectileRotation) * shootSpeed; + + Projectile.NewProjectile(tipPosition, shootVelocity, projectileType, BoltDamage, knockback, projectile.owner, 0f, 0f); + } + + private void UpdateProjectileHeldVariables(Vector2 armPosition) + { + if (Main.myPlayer == projectile.owner) + { + float interpolant = Utils.InverseLerp(5f, 25f, projectile.Distance(Main.MouseWorld), true); + Vector2 oldVelocity = projectile.velocity; + projectile.velocity = Vector2.Lerp(projectile.velocity, projectile.SafeDirectionTo(Main.MouseWorld), interpolant); + if (projectile.velocity != oldVelocity) + { + projectile.netSpam = 0; + projectile.netUpdate = true; + } + } + projectile.position = armPosition - projectile.Size * 0.5f + projectile.velocity.SafeNormalize(Vector2.Zero) * 35f; + projectile.rotation = projectile.velocity.ToRotation(); + if (projectile.spriteDirection == -1) + projectile.rotation += MathHelper.Pi; + projectile.spriteDirection = projectile.direction; + projectile.timeLeft = 3; + } + + private void ManipulatePlayerVariables() + { + Owner.ChangeDir(projectile.direction); + Owner.heldProj = projectile.whoAmI; + Owner.itemTime = 2; + Owner.itemAnimation = 2; + Owner.itemRotation = (projectile.velocity * projectile.direction).ToRotation(); + } + + + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + + float loops = LoadedBolts + 1; + if (LoadedBolts == RCCAnihilator.MaxBolts) //If the bow is fully loaded, shave off the part where you draw the arrow that's charging currently + loops = LoadedBolts; + + for (int i = 0; i < loops; i++) + { + float BoltAngle; + float Shift = 0; + + if (LoadedBolts == 0) //We calculating angles YEAH! + { + BoltAngle = 0; + } + else if (LoadedBolts == RCCAnihilator.MaxBolts) + { + float increment = angularSpread * (LoadedBolts - 1) / 2; + BoltAngle = MathHelper.Lerp(-increment, increment, i / (float)(LoadedBolts - 1)); + } + else + { + float increment = angularSpread * (LoadedBolts - 1 + MathHelper.Clamp((CurrentChargingFrames * 2 / FramesToLoadBolt), 0f, 1f)) / 2; + BoltAngle = MathHelper.Lerp(-increment, increment, i / (float)(MathHelper.Lerp(LoadedBolts - 1, LoadedBolts, MathHelper.Clamp((CurrentChargingFrames * 2 / FramesToLoadBolt), 0f, 1f)))); + } + + if (i == LoadedBolts) //If the arrow we are looking at is the one being loaded, we give it some shift (used for position & alpha) + Shift = 1 - (CurrentChargingFrames / FramesToLoadBolt); + + if (i == LoadedBolts - 1 || LoadedBolts == RCCAnihilator.MaxBolts) //If the arrow we are looking at is the one that just got loaded, OR all arrows got loaded, we apply some flashiness + { + spriteBatch.EnterShaderRegion(); + GameShaders.Misc["CalamityMod:BasicTint"].UseOpacity(1f - MathHelper.Clamp((CurrentChargingFrames * 2 / FramesToLoadBolt), 0f, 1f)); + GameShaders.Misc["CalamityMod:BasicTint"].UseColor(Main.hslToRgb(1f - (LoadedBolts / RCCAnihilator.MaxBolts), 0.8f, 0.85f)); + GameShaders.Misc["CalamityMod:BasicTint"].Apply(); + } + + Color Transparency = Color.White * (1 - Shift); + var BoltTexture = ModContent.GetTexture("CalamityMod/Projectiles/Ranged/PrecisionBolt"); + Vector2 PointingTo = new Vector2((float)Math.Cos(projectile.rotation + BoltAngle), (float)Math.Sin(projectile.rotation + BoltAngle)); //It's called trigonometry we do a little trigonometry + Vector2 ShiftDown = PointingTo.RotatedBy(-MathHelper.PiOver2); + float FlipFactor = projectile.direction == -1 ? MathHelper.Pi : 0f; + Vector2 drawPosition = Owner.Center + PointingTo.RotatedBy(FlipFactor) * (20f + (Shift * 40)) - ShiftDown.RotatedBy(FlipFactor) * (BoltTexture.Width / 2) - Main.screenPosition; + + spriteBatch.Draw(BoltTexture, drawPosition, null, Transparency, projectile.rotation + BoltAngle + MathHelper.PiOver2 + FlipFactor, BoltTexture.Size(), 1f, 0, 0); + + if (i == LoadedBolts - 1 || LoadedBolts == RCCAnihilator.MaxBolts) //Don't forget to exit the shader region + spriteBatch.ExitShaderRegion(); + } + return true; + } + + public override bool CanDamage() => false; + } +} \ No newline at end of file From 831740e2363f71f54ff4725b54a8a4e668defe52 Mon Sep 17 00:00:00 2001 From: IbanPlay <56191483+IbanPlay@users.noreply.github.com> Date: Fri, 17 Dec 2021 01:21:34 +0100 Subject: [PATCH 02/35] Blasted right click channeling limitations into the core of the earth --- Items/Weapons/Ranged/RCCAnihilator.cs | 31 +++++++++++++++++++++----- Projectiles/Ranged/RCCHoldout.cs | 18 +++++++++------ Projectiles/Ranged/RCCHoldout.png | Bin 0 -> 2101 bytes Projectiles/Ranged/RendingBolt.png | Bin 0 -> 724 bytes 4 files changed, 37 insertions(+), 12 deletions(-) create mode 100644 Projectiles/Ranged/RCCHoldout.png create mode 100644 Projectiles/Ranged/RendingBolt.png diff --git a/Items/Weapons/Ranged/RCCAnihilator.cs b/Items/Weapons/Ranged/RCCAnihilator.cs index 3c813cd8a1..a57f4f1fe9 100644 --- a/Items/Weapons/Ranged/RCCAnihilator.cs +++ b/Items/Weapons/Ranged/RCCAnihilator.cs @@ -8,11 +8,14 @@ using System.Collections.Generic; using Terraria.Graphics.Shaders; using Microsoft.Xna.Framework.Graphics; using CalamityMod.Projectiles.Ranged; +using static Terraria.ModLoader.ModContent; namespace CalamityMod.Items.Weapons.Ranged { public class RCCAnihilator : ModItem - { + { + public override bool CloneNewInstances => true; + public bool RCChannel = false; public const int MaxBolts = 6; public override void SetStaticDefaults() { @@ -40,12 +43,24 @@ namespace CalamityMod.Items.Weapons.Ranged item.shootSpeed = 15f; item.useAmmo = AmmoID.Arrow; } + public override ModItem Clone(Item item) + { + var clone = base.Clone(item); - public override string Texture => "CalamityMod/Items/Weapons/Ranged/ClockworkBow"; + if (Main.mouseItem.type == ItemType()) + item.modItem.HoldItem(Main.player[Main.myPlayer]); + + (clone as RCCAnihilator).RCChannel = (item.modItem as RCCAnihilator).RCChannel; + + return clone; + } + + public override string Texture => "CalamityMod/Projectiles/Ranged/RCCHoldout"; //What. Huh. HUH? you got a problem with my file organization in my proof of concept HUH???? HUH???? public override bool AltFunctionUse(Player player) { return true; } + public override bool CanUseItem(Player player) { @@ -57,19 +72,25 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - if (player.altFunctionUse == 2) + + if (player.altFunctionUse == 2 && !RCChannel) { Vector2 shootVelocity = new Vector2(speedX, speedY); Vector2 shootDirection = shootVelocity.SafeNormalize(Vector2.UnitX * player.direction); // Charge-up. Done via a holdout projectile. Projectile.NewProjectile(position, shootDirection, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + RCChannel = true; return false; } else //This is just a test thing { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 1f, 0f); + Vector2 shootVelocity = new Vector2(speedX, speedY); + Vector2 shootDirection = shootVelocity.SafeNormalize(Vector2.UnitX * player.direction); + // Charge-up. Done via a holdout projectile. + Projectile.NewProjectile(position, shootDirection, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + RCChannel = false; return false; - } + } } } } diff --git a/Projectiles/Ranged/RCCHoldout.cs b/Projectiles/Ranged/RCCHoldout.cs index 4e9ae8c363..d00838a6e6 100644 --- a/Projectiles/Ranged/RCCHoldout.cs +++ b/Projectiles/Ranged/RCCHoldout.cs @@ -6,7 +6,7 @@ using Terraria.ModLoader; using Terraria.Graphics.Shaders; using Microsoft.Xna.Framework.Graphics; using CalamityMod.Items.Weapons.Ranged; - +using static Terraria.ModLoader.ModContent; namespace CalamityMod.Projectiles.Ranged { @@ -15,13 +15,13 @@ namespace CalamityMod.Projectiles.Ranged public override void SetStaticDefaults() { - DisplayName.SetDefault("Rending Bolt"); + DisplayName.SetDefault("Rending Bow"); //Main.projFrames[projectile.type] = 9; might animate the bow's string getting drawn but not rn } private Player Owner => Main.player[projectile.owner]; - private bool OwnerCanShoot => Owner.channel && Owner.HasAmmo(Owner.ActiveItem(), true) && !Owner.noItems && !Owner.CCed; + private bool OwnerCanShoot => Owner.HasAmmo(Owner.ActiveItem(), true) && !Owner.noItems && !Owner.CCed && Owner.HeldItem.type == ItemType() && (Owner.HeldItem.modItem as RCCAnihilator).RCChannel; private ref float CurrentChargingFrames => ref projectile.ai[0]; private ref float LoadedBolts => ref projectile.ai[1]; private ref float FramesToLoadBolt => ref projectile.localAI[0]; @@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Ranged private float angularSpread = MathHelper.ToRadians(16); //public override string Texture => "CalamityMod/Projectiles/Ranged/ClockworkBowHoldout"; - public override string Texture => "CalamityMod/Items/Weapons/Ranged/ClockworkBow"; + public override string Texture => "CalamityMod/Projectiles/Ranged/RCCHoldout"; public override void SetDefaults() { @@ -55,6 +55,7 @@ namespace CalamityMod.Projectiles.Ranged if (LoadedBolts <= 0f) //If theres no arrows to shoot { projectile.Kill(); + (Owner.HeldItem.modItem as RCCAnihilator).RCChannel = false; return; } // Fire the spread of arrows @@ -81,9 +82,9 @@ namespace CalamityMod.Projectiles.Ranged ++LoadedBolts; if (LoadedBolts % 2 == 0) - CombatText.NewText(Owner.Hitbox, new Color(155, 255, 255), "Tock", true); + CombatText.NewText(Owner.Hitbox, new Color(163, 90, 237), "H34Ds", true); else - CombatText.NewText(Owner.Hitbox, new Color(255, 200, 100), "Tick", true); + CombatText.NewText(Owner.Hitbox, new Color(255, 235, 155), "8R8K", true); FramesToLoadBolt *= 0.950f; @@ -100,6 +101,9 @@ namespace CalamityMod.Projectiles.Ranged UpdateProjectileHeldVariables(armPosition); ManipulatePlayerVariables(); + + if (!Main.mouseRight) + (Owner.HeldItem.modItem as RCCAnihilator).RCChannel = false; } public void UnloadBolts(Vector2 tipPosition) @@ -228,7 +232,7 @@ namespace CalamityMod.Projectiles.Ranged } Color Transparency = Color.White * (1 - Shift); - var BoltTexture = ModContent.GetTexture("CalamityMod/Projectiles/Ranged/PrecisionBolt"); + var BoltTexture = ModContent.GetTexture("CalamityMod/Projectiles/Ranged/RendingBolt"); Vector2 PointingTo = new Vector2((float)Math.Cos(projectile.rotation + BoltAngle), (float)Math.Sin(projectile.rotation + BoltAngle)); //It's called trigonometry we do a little trigonometry Vector2 ShiftDown = PointingTo.RotatedBy(-MathHelper.PiOver2); float FlipFactor = projectile.direction == -1 ? MathHelper.Pi : 0f; diff --git a/Projectiles/Ranged/RCCHoldout.png b/Projectiles/Ranged/RCCHoldout.png new file mode 100644 index 0000000000000000000000000000000000000000..7e87dcb941b3f96aa0e66eada9aabed163fc08fb GIT binary patch literal 2101 zcmV-52+H?~P)Px+?@2^KRCt{2oLy{_*BQruZ|ua0lLiu;AV>&cSYbpoQrJWXjGLBCMO)D-b(QFP zv5U4+)d>x;-K=-r9TQchX;M>FXxdhF)3mOjRjbxsv`ab=gb6Arv{g#J`VnY|(%6oj zIBzc=KQ`y&eVv%5M6dDx#yQ8w@5l2$=lMF%iBsR+>2edC&^mnJ089=3+wc2jLDh0U zz}H1s|5(@gZ2-C(4jKbaob9>2PgEj;&p>sg+5s58_`a-#&X)lgxjY5Hin>MzU?MTR zEDyL40?&X`+tTI&gd!`Y!_q=-RwN%=y~zPcrsn`ieK~84TQ2QXJ`8N={+{Q6)ioUe ze4ZHs3Ts0ViH012bTVu7-!4YVhk!{CFDieWcAdC}s0J7-`7ofGi0f4cb zu&z+8<;{t5jzFV}}R(YPwZ~Wc!1p?22bJyxP05fyx90MZRvBU@f^)=$HCNeVsR98hj z$15f#g}ER7;$5TvwU_n+@Zb-AX!QSoRJ4~er#N@&$^0`yIWwSING18Ln4z}m8_dT6 z#ut%L9RTTU>Xw+$2+)Qyp$sG^XB~i{|NYZ*eEBf2d%b9f16`)i^Xn6DN)_2Urc-cP}cz90_nDMyB1 z@Mi`j!c+Tjt7{?f4CJ%ZO?Sz=^j~*!ZO_nk9-5=;9e~q=e=?X*i~h{35-$*I^8CF@ zKGphjp!Bs6cm@h<;OVITX}tO2-+OBxg|3CUxh??u20{jPvAQY;;CgD#h52^D_Lc0l zpjnN?@LA9M2cCiO!b6JVFK$CTMK!+Flk;-*Mbw0Sh}T2 zWIX0}0`s*|g#pFT)zhB+jm=wb>3WaszaM~CP986+jRMcW*VaNdIyUSy+R2psJ~NZ? z^j7`w#jKU}&h6EOBdY+Yj)?37&%lzc0YyjirvMC%uWpQhd(aP>ZbD3Ed%TtJwp<2$IdN zFkqvlVZv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PATCH 03/35] Netcode attempts and failure hggh --- Items/Weapons/Ranged/RCCAnihilator.cs | 33 ++++++++++++++++++--------- Projectiles/Ranged/RCCHoldout.cs | 11 ++++----- 2 files changed, 26 insertions(+), 18 deletions(-) diff --git a/Items/Weapons/Ranged/RCCAnihilator.cs b/Items/Weapons/Ranged/RCCAnihilator.cs index a57f4f1fe9..4f988875f5 100644 --- a/Items/Weapons/Ranged/RCCAnihilator.cs +++ b/Items/Weapons/Ranged/RCCAnihilator.cs @@ -9,6 +9,7 @@ using Terraria.Graphics.Shaders; using Microsoft.Xna.Framework.Graphics; using CalamityMod.Projectiles.Ranged; using static Terraria.ModLoader.ModContent; +using System.IO; namespace CalamityMod.Items.Weapons.Ranged { @@ -54,32 +55,43 @@ namespace CalamityMod.Items.Weapons.Ranged return clone; } + public override void NetSend(BinaryWriter writer) + { + writer.Write(RCChannel); + } + + public override void NetRecieve(BinaryReader reader) + { + RCChannel = reader.ReadBoolean(); + } + public override string Texture => "CalamityMod/Projectiles/Ranged/RCCHoldout"; //What. Huh. HUH? you got a problem with my file organization in my proof of concept HUH???? HUH???? public override bool AltFunctionUse(Player player) { return true; - } - - + } public override bool CanUseItem(Player player) { item.noUseGraphic = true; item.UseSound = SoundID.Item20; item.channel = true; - return player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0; + return (player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0 && player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0); } public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { - if (player.altFunctionUse == 2 && !RCChannel) + if (player.altFunctionUse == 2) { - Vector2 shootVelocity = new Vector2(speedX, speedY); - Vector2 shootDirection = shootVelocity.SafeNormalize(Vector2.UnitX * player.direction); - // Charge-up. Done via a holdout projectile. - Projectile.NewProjectile(position, shootDirection, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); - RCChannel = true; + if (!RCChannel) //Important separation of the RCChannel check. Idk how imporant it really is since CanUseItem is already a thing + { + Vector2 shootVelocity = new Vector2(speedX, speedY); + Vector2 shootDirection = shootVelocity.SafeNormalize(Vector2.UnitX * player.direction); + // Charge-up. Done via a holdout projectile. + Projectile.NewProjectile(position, shootDirection, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + RCChannel = true; + } return false; } else //This is just a test thing @@ -88,7 +100,6 @@ namespace CalamityMod.Items.Weapons.Ranged Vector2 shootDirection = shootVelocity.SafeNormalize(Vector2.UnitX * player.direction); // Charge-up. Done via a holdout projectile. Projectile.NewProjectile(position, shootDirection, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); - RCChannel = false; return false; } } diff --git a/Projectiles/Ranged/RCCHoldout.cs b/Projectiles/Ranged/RCCHoldout.cs index d00838a6e6..dfdc72e9e1 100644 --- a/Projectiles/Ranged/RCCHoldout.cs +++ b/Projectiles/Ranged/RCCHoldout.cs @@ -103,7 +103,7 @@ namespace CalamityMod.Projectiles.Ranged ManipulatePlayerVariables(); if (!Main.mouseRight) - (Owner.HeldItem.modItem as RCCAnihilator).RCChannel = false; + (Owner.HeldItem.modItem as RCCAnihilator).RCChannel = false; //Is it sperging out in mp becuase "Main.mouseRight" doesnt correspond to the right players mouse? how does that work in mp. } public void UnloadBolts(Vector2 tipPosition) @@ -166,13 +166,10 @@ namespace CalamityMod.Projectiles.Ranged if (Main.myPlayer == projectile.owner) { float interpolant = Utils.InverseLerp(5f, 25f, projectile.Distance(Main.MouseWorld), true); - Vector2 oldVelocity = projectile.velocity; projectile.velocity = Vector2.Lerp(projectile.velocity, projectile.SafeDirectionTo(Main.MouseWorld), interpolant); - if (projectile.velocity != oldVelocity) - { - projectile.netSpam = 0; - projectile.netUpdate = true; - } + projectile.netSpam = 0; + projectile.netUpdate = true; + } projectile.position = armPosition - projectile.Size * 0.5f + projectile.velocity.SafeNormalize(Vector2.Zero) * 35f; projectile.rotation = projectile.velocity.ToRotation(); From c1b8550714bb23f122c1d4d300421a1288261ce0 Mon Sep 17 00:00:00 2001 From: IbanPlay <56191483+IbanPlay@users.noreply.github.com> Date: Fri, 17 Dec 2021 18:35:49 +0100 Subject: [PATCH 04/35] Untested extra check grr --- Projectiles/Ranged/RCCHoldout.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Projectiles/Ranged/RCCHoldout.cs b/Projectiles/Ranged/RCCHoldout.cs index dfdc72e9e1..f3c807929c 100644 --- a/Projectiles/Ranged/RCCHoldout.cs +++ b/Projectiles/Ranged/RCCHoldout.cs @@ -102,8 +102,8 @@ namespace CalamityMod.Projectiles.Ranged UpdateProjectileHeldVariables(armPosition); ManipulatePlayerVariables(); - if (!Main.mouseRight) - (Owner.HeldItem.modItem as RCCAnihilator).RCChannel = false; //Is it sperging out in mp becuase "Main.mouseRight" doesnt correspond to the right players mouse? how does that work in mp. + if (!Main.mouseRight && Main.myPlayer == projectile.owner) + (Owner.HeldItem.modItem as RCCAnihilator).RCChannel = false; } public void UnloadBolts(Vector2 tipPosition) From 40a64432456c0aec13cc07445cd2591e2e027e9b Mon Sep 17 00:00:00 2001 From: IbanPlay <56191483+IbanPlay@users.noreply.github.com> Date: Sun, 19 Dec 2021 20:07:14 +0100 Subject: [PATCH 05/35] Syncing Mouse variables --- CalPlayer/CalamityPlayer.cs | 58 ++++++++++++++++++++++++-- CalPlayer/CalamityPlayerMiscEffects.cs | 9 +++- CalPlayer/CalamityPlayerNetcode.cs | 37 ++++++++++++++++ CalamityNetcode.cs | 29 ++++++++++--- Items/Weapons/Ranged/RCCAnihilator.cs | 25 +++-------- Projectiles/Ranged/RCCHoldout.cs | 15 +++++-- 6 files changed, 139 insertions(+), 34 deletions(-) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index bcac3459bf..ac9c310e0d 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -1148,6 +1148,31 @@ namespace CalamityMod.CalPlayer public bool AbleToSelectExoMech = false; #endregion Draedon Summoning + #region Mouse Controls Syncing + public bool mouseRight = false; + private bool oldMouseRight = false; + public Vector2 mouseWorld; + private Vector2 oldMouseWorld; + + /// + /// Set this to true if you need to recieve updates on right clicks from players and sync them in mp. + /// Automatically resets itself after sending an update + /// <\summary> + public bool rightClickListener = false; + /// + /// Set this to true if you need to recieve updates on the position of the player's mouse and sync them in mp. + /// Automatically resets itself after sending an update + /// <\summary> + public bool mouseWorldListener = false; + /// + /// Set this to true if you need to recieve updates on the rotation of the mouse to the player. This sends updates less frequently than the more tight tolerance mouseWorldListener + /// Automatically resets itself after sending an update + /// <\summary> + public bool mouseRotationListener = false; + + public bool syncMouseControls = false; + #endregion + #endregion #region Saving And Loading @@ -2127,6 +2152,8 @@ namespace CalamityMod.CalPlayer AbleToSelectExoMech = false; + mouseRight = false; + CalamityPlayerMiscEffects.EnchantHeldItemEffects(player, player.Calamity(), player.ActiveItem()); } #endregion @@ -3867,10 +3894,10 @@ namespace CalamityMod.CalPlayer player.AddBuff(ModContent.BuffType(), 60, true); } } - #endregion + #endregion - #region PreUpdate - public override void PreUpdate() + #region PreUpdate + public override void PreUpdate() { tailFrameUp++; if (tailFrameUp == 8) @@ -3906,7 +3933,30 @@ namespace CalamityMod.CalPlayer GameShaders.Armor.GetSecondaryShader(player.dye[i].dye, player)?.UseColor(CalamityPlayerDrawEffects.GetCurrentMoonlightDyeColor()); } } - } + //Syncing mouse controls + if (Main.myPlayer == player.whoAmI) + { + mouseRight = PlayerInput.Triggers.Current.MouseRight; + if (rightClickListener && mouseRight != oldMouseRight) + { + oldMouseRight = mouseRight; + syncMouseControls = true; + rightClickListener = false; + } + if (mouseWorldListener && Vector2.Distance(mouseWorld, oldMouseWorld) > 10f) + { + oldMouseWorld = mouseWorld; + syncMouseControls = true; + mouseWorldListener = false; + } + if (mouseRotationListener && Math.Abs((mouseWorld - player.MountedCenter).ToRotation() - (oldMouseWorld - player.MountedCenter).ToRotation()) > 0.15f) + { + oldMouseWorld = mouseWorld; + syncMouseControls = true; + mouseRotationListener = false; + } + } + } #endregion #region PreUpdateBuffs diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index f49483f406..7427318ac1 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -135,7 +135,7 @@ namespace CalamityMod.CalPlayer // Update the gem tech armor set. modPlayer.GemTechState.Update(); - // Regularly sync player stats during multiplayer + // Regularly sync player stats & mouse control info during multiplayer if (player.whoAmI == Main.myPlayer && Main.netMode == NetmodeID.MultiplayerClient) { modPlayer.packetTimer++; @@ -144,8 +144,15 @@ namespace CalamityMod.CalPlayer modPlayer.packetTimer = 0; modPlayer.StandardSync(); } + + if (modPlayer.syncMouseControls) + { + modPlayer.syncMouseControls = false; + modPlayer.MouseControlsSync(); + } } + // After everything else, if Daawnlight Spirit Origin is equipped, set ranged crit to the base 4%. // Store all the crit so it can be used in damage calculations. if (modPlayer.spiritOrigin) diff --git a/CalPlayer/CalamityPlayerNetcode.cs b/CalPlayer/CalamityPlayerNetcode.cs index 278d7a0729..a8b64631f2 100644 --- a/CalPlayer/CalamityPlayerNetcode.cs +++ b/CalPlayer/CalamityPlayerNetcode.cs @@ -35,6 +35,12 @@ namespace CalamityMod.CalPlayer SyncLevel(false, 3); SyncLevel(false, 4); } + + internal void MouseControlsSync() + { + SyncRightClick(false); + SyncMousePosition(false); + } #endregion #region Creating and Sending Packets @@ -198,6 +204,24 @@ namespace CalamityMod.CalPlayer packet.Write(reforgeTierSafety); player.SendPacket(packet, server); } + + public void SyncRightClick(bool server) + { + ModPacket packet = mod.GetPacket(256); + packet.Write((byte)CalamityModMessageType.RightClickSync); + packet.Write(player.whoAmI); + packet.Write(mouseRight); + player.SendPacket(packet, server); + } + public void SyncMousePosition(bool server) + { + ModPacket packet = mod.GetPacket(256); + packet.Write((byte)CalamityModMessageType.MousePositionSync); + packet.Write(player.whoAmI); + packet.WriteVector2(mouseWorld); + player.SendPacket(packet, server); + } + #endregion #region Reading and Handling Packets @@ -323,6 +347,19 @@ namespace CalamityMod.CalPlayer if (Main.netMode == NetmodeID.Server) SyncDodgeCooldown(true); } + + internal void HandleRightClick(BinaryReader reader) + { + mouseRight = reader.ReadBoolean(); + if (Main.netMode == NetmodeID.Server) + SyncRightClick(true); + } + internal void HandleMousePosition(BinaryReader reader) + { + mouseWorld = reader.ReadVector2(); + if (Main.netMode == NetmodeID.Server) + SyncMousePosition(true); + } #endregion } } diff --git a/CalamityNetcode.cs b/CalamityNetcode.cs index 64f1b013b6..6183c30f20 100644 --- a/CalamityNetcode.cs +++ b/CalamityNetcode.cs @@ -280,11 +280,24 @@ namespace CalamityMod Main.player[reader.ReadInt32()].Calamity().HandleReforgeTierSafety(reader); break; - // - // Default case: with no idea how long the packet is, we can't safely read data. - // Throw an exception now instead of allowing the network stream to corrupt. - // - default: + // + // Mouse control syncs + // + + case CalamityModMessageType.RightClickSync: + Main.player[reader.ReadInt32()].Calamity().HandleRightClick(reader); + break; + case CalamityModMessageType.MousePositionSync: + Main.player[reader.ReadInt32()].Calamity().HandleMousePosition(reader); + break; + + + + // + // Default case: with no idea how long the packet is, we can't safely read data. + // Throw an exception now instead of allowing the network stream to corrupt. + // + default: CalamityMod.Instance.Logger.Error($"Failed to parse Calamity packet: No Calamity packet exists with ID {msgType}."); throw new Exception("Failed to parse Calamity packet: Invalid Calamity packet ID."); } @@ -399,6 +412,10 @@ namespace CalamityMod // Reforge syncs ItemTypeLastReforgedSync, // TODO -- there has to be a better way to do this, but I don't know what it is - ReforgeTierSafetySync + ReforgeTierSafetySync, + + // Mouse Controls syncs + RightClickSync, + MousePositionSync } } diff --git a/Items/Weapons/Ranged/RCCAnihilator.cs b/Items/Weapons/Ranged/RCCAnihilator.cs index 4f988875f5..5a33d2f5bf 100644 --- a/Items/Weapons/Ranged/RCCAnihilator.cs +++ b/Items/Weapons/Ranged/RCCAnihilator.cs @@ -38,7 +38,9 @@ namespace CalamityMod.Items.Weapons.Ranged item.knockBack = 4.25f; item.value = CalamityGlobalItem.Rarity10BuyPrice; item.rare = ItemRarityID.Red; - item.UseSound = SoundID.Item5; + item.noUseGraphic = true; + item.UseSound = SoundID.Item20; + item.channel = true; item.autoReuse = true; item.shoot = ProjectileID.PurificationPowder; item.shootSpeed = 15f; @@ -55,29 +57,13 @@ namespace CalamityMod.Items.Weapons.Ranged return clone; } - public override void NetSend(BinaryWriter writer) - { - writer.Write(RCChannel); - } - - public override void NetRecieve(BinaryReader reader) - { - RCChannel = reader.ReadBoolean(); - } - public override string Texture => "CalamityMod/Projectiles/Ranged/RCCHoldout"; //What. Huh. HUH? you got a problem with my file organization in my proof of concept HUH???? HUH???? public override bool AltFunctionUse(Player player) { return true; } - public override bool CanUseItem(Player player) - { - item.noUseGraphic = true; - item.UseSound = SoundID.Item20; - item.channel = true; - return (player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0 && player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0); - } + public override bool CanUseItem(Player player) =>(player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0 && player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0); public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { @@ -89,8 +75,7 @@ namespace CalamityMod.Items.Weapons.Ranged Vector2 shootVelocity = new Vector2(speedX, speedY); Vector2 shootDirection = shootVelocity.SafeNormalize(Vector2.UnitX * player.direction); // Charge-up. Done via a holdout projectile. - Projectile.NewProjectile(position, shootDirection, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); - RCChannel = true; + Projectile.NewProjectile(position, shootDirection, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); } return false; } diff --git a/Projectiles/Ranged/RCCHoldout.cs b/Projectiles/Ranged/RCCHoldout.cs index f3c807929c..90ad4ffb6f 100644 --- a/Projectiles/Ranged/RCCHoldout.cs +++ b/Projectiles/Ranged/RCCHoldout.cs @@ -7,6 +7,7 @@ using Terraria.Graphics.Shaders; using Microsoft.Xna.Framework.Graphics; using CalamityMod.Items.Weapons.Ranged; using static Terraria.ModLoader.ModContent; +using CalamityMod.CalPlayer; namespace CalamityMod.Projectiles.Ranged { @@ -45,11 +46,18 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { + + CalamityPlayer controlsSync = Owner.GetModPlayer(); + if (Main.myPlayer == projectile.owner) + { + controlsSync.rightClickListener = true; + } + Vector2 armPosition = Owner.RotatedRelativePoint(Owner.MountedCenter, true); Vector2 tipPosition = armPosition + projectile.velocity * projectile.width * 0.5f; - // If the player releases left click, shoot out the arrows - if (!OwnerCanShoot) + // If the player releases left click, shoot out the arrows (also if its not the very first frame to avoid it killing itself before it sets the RCChannel variable to true + if (!OwnerCanShoot && FramesToLoadBolt != 0f) { if (LoadedBolts <= 0f) //If theres no arrows to shoot @@ -68,6 +76,7 @@ namespace CalamityMod.Projectiles.Ranged // Frame 1 effects: Initialize the shoot speed if (FramesToLoadBolt == 0f) { + (Owner.HeldItem.modItem as RCCAnihilator).RCChannel = true; FramesToLoadBolt = Owner.ActiveItem().useAnimation; } @@ -102,7 +111,7 @@ namespace CalamityMod.Projectiles.Ranged UpdateProjectileHeldVariables(armPosition); ManipulatePlayerVariables(); - if (!Main.mouseRight && Main.myPlayer == projectile.owner) + if (!controlsSync.mouseRight) (Owner.HeldItem.modItem as RCCAnihilator).RCChannel = false; } From b161fc5ec891cb423e6fcc292b4263415ff1edfe Mon Sep 17 00:00:00 2001 From: IbanPlay <56191483+IbanPlay@users.noreply.github.com> Date: Sun, 19 Dec 2021 20:18:01 +0100 Subject: [PATCH 06/35] CanUseItem -> HoldItem change for channeled items --- Items/Tools/CrystylCrusher.cs | 7 +++---- Items/Weapons/Ranged/ClockworkBow.cs | 13 +++++-------- Items/Weapons/Ranged/Condemnation.cs | 11 +++++++++-- Items/Weapons/Ranged/Pumpler.cs | 12 ++++-------- Items/Weapons/Ranged/SurgeDriver.cs | 11 +++++++++-- 5 files changed, 30 insertions(+), 24 deletions(-) diff --git a/Items/Tools/CrystylCrusher.cs b/Items/Tools/CrystylCrusher.cs index 2f2b86a899..191228ec83 100644 --- a/Items/Tools/CrystylCrusher.cs +++ b/Items/Tools/CrystylCrusher.cs @@ -58,8 +58,8 @@ namespace CalamityMod.Items.Tools public override bool AltFunctionUse(Player player) => true; - public override bool CanUseItem(Player player) - { + public override void HoldItem(Player player) + { if (player.altFunctionUse == 2) { item.shoot = ProjectileID.None; @@ -84,8 +84,7 @@ namespace CalamityMod.Items.Tools item.noMelee = true; item.channel = true; } - return base.CanUseItem(player); - } + } public override void ModifyTooltips(List list) { diff --git a/Items/Weapons/Ranged/ClockworkBow.cs b/Items/Weapons/Ranged/ClockworkBow.cs index 0cca9fa55e..5d12035a67 100644 --- a/Items/Weapons/Ranged/ClockworkBow.cs +++ b/Items/Weapons/Ranged/ClockworkBow.cs @@ -31,10 +31,12 @@ namespace CalamityMod.Items.Weapons.Ranged item.useAnimation = 30; item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; + item.channel = true; item.knockBack = 4.25f; item.value = CalamityGlobalItem.Rarity10BuyPrice; item.rare = ItemRarityID.Red; - item.UseSound = SoundID.Item5; + item.noUseGraphic = true; + item.UseSound = SoundID.Item20; item.autoReuse = true; item.shoot = ProjectileID.PurificationPowder; item.shootSpeed = 15f; @@ -50,13 +52,8 @@ namespace CalamityMod.Items.Weapons.Ranged recipe.SetResult(this); recipe.AddRecipe(); } - public override bool CanUseItem(Player player) - { - item.noUseGraphic = true; - item.UseSound = SoundID.Item20; - item.channel = true; - return player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0; - } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0; + public override float UseTimeMultiplier(Player player) { return 1f; diff --git a/Items/Weapons/Ranged/Condemnation.cs b/Items/Weapons/Ranged/Condemnation.cs index 2a572a8534..70604bdb1e 100644 --- a/Items/Weapons/Ranged/Condemnation.cs +++ b/Items/Weapons/Ranged/Condemnation.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool AltFunctionUse(Player player) => true; - public override bool CanUseItem(Player player) + public override void HoldItem(Player player) { if (player.altFunctionUse == 2) { @@ -54,7 +54,14 @@ namespace CalamityMod.Items.Weapons.Ranged { item.noUseGraphic = true; item.UseSound = SoundID.Item20; - item.channel = true; + item.channel = true; + } + } + + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse != 2) + { return player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0; } return base.CanUseItem(player); diff --git a/Items/Weapons/Ranged/Pumpler.cs b/Items/Weapons/Ranged/Pumpler.cs index 1f35eb7dc1..aa15758f76 100644 --- a/Items/Weapons/Ranged/Pumpler.cs +++ b/Items/Weapons/Ranged/Pumpler.cs @@ -29,8 +29,10 @@ namespace CalamityMod.Items.Weapons.Ranged item.knockBack = 1.25f; item.value = Item.buyPrice(0, 2, 0, 0); item.rare = ItemRarityID.Green; - item.UseSound = SoundID.Item11; + item.noUseGraphic = true; + item.UseSound = SoundID.Item20; item.autoReuse = true; + item.channel = true; item.shoot = ProjectileID.PurificationPowder; item.shootSpeed = 11f; item.Calamity().canFirePointBlankShots = true; @@ -38,13 +40,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override Vector2? HoldoutOffset() => new Vector2(-30f, 0f); - public override bool CanUseItem(Player player) - { - item.noUseGraphic = true; - item.UseSound = SoundID.Item20; - item.channel = true; - return player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0; - } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0; public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { diff --git a/Items/Weapons/Ranged/SurgeDriver.cs b/Items/Weapons/Ranged/SurgeDriver.cs index 94b23d9a56..277a3bd154 100644 --- a/Items/Weapons/Ranged/SurgeDriver.cs +++ b/Items/Weapons/Ranged/SurgeDriver.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool AltFunctionUse(Player player) => true; - public override bool CanUseItem(Player player) + public override void HoldItem(Player player) { if (player.altFunctionUse == 2) { @@ -52,7 +52,14 @@ namespace CalamityMod.Items.Weapons.Ranged item.noUseGraphic = true; item.reuseDelay = 28; item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"); - item.channel = true; + item.channel = true; + } + } + + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse != 2) + { return player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0; } return base.CanUseItem(player); From 345e528e455d1118f78dba3d86756f1bc172becc Mon Sep 17 00:00:00 2001 From: IbanPlay <56191483+IbanPlay@users.noreply.github.com> Date: Mon, 27 Dec 2021 22:56:03 +0100 Subject: [PATCH 07/35] Properly fixed Condemnation --- CalPlayer/CalamityPlayer.cs | 2 -- Items/Weapons/Ranged/Condemnation.cs | 27 +++++++++-------------- Projectiles/Ranged/CondemnationArrow.cs | 5 +++++ Projectiles/Ranged/CondemnationHoldout.cs | 4 +++- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index ac9c310e0d..518ad4658e 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -2152,8 +2152,6 @@ namespace CalamityMod.CalPlayer AbleToSelectExoMech = false; - mouseRight = false; - CalamityPlayerMiscEffects.EnchantHeldItemEffects(player, player.Calamity(), player.ActiveItem()); } #endregion diff --git a/Items/Weapons/Ranged/Condemnation.cs b/Items/Weapons/Ranged/Condemnation.cs index 70604bdb1e..971e7d86bc 100644 --- a/Items/Weapons/Ranged/Condemnation.cs +++ b/Items/Weapons/Ranged/Condemnation.cs @@ -26,6 +26,7 @@ namespace CalamityMod.Items.Weapons.Ranged item.height = 42; item.useTime = item.useAnimation = 23; item.useStyle = ItemUseStyleID.HoldingOut; + item.channel = true; item.noMelee = true; item.knockBack = 5f; item.value = CalamityGlobalItem.RarityVioletBuyPrice; @@ -44,36 +45,30 @@ namespace CalamityMod.Items.Weapons.Ranged public override void HoldItem(Player player) { - if (player.altFunctionUse == 2) + if (Main.myPlayer == player.whoAmI) + player.Calamity().rightClickListener = true; + + if (!player.Calamity().mouseRight) { - item.noUseGraphic = false; - item.UseSound = SoundID.DD2_BallistaTowerShot; - item.channel = false; + item.noUseGraphic = true; } else { - item.noUseGraphic = true; - item.UseSound = SoundID.Item20; - item.channel = true; + item.noUseGraphic = false; } } - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse != 2) - { - return player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0; - } - return base.CanUseItem(player); - } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0; public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { Vector2 shootVelocity = new Vector2(speedX, speedY); Vector2 shootDirection = shootVelocity.SafeNormalize(Vector2.UnitX * player.direction); + + // Single arrow firing. - if (player.altFunctionUse == 2) + if (player.Calamity().mouseRight) { Vector2 tipPosition = position + shootDirection * 110f; Projectile.NewProjectile(tipPosition, shootVelocity, item.shoot, damage, knockBack, player.whoAmI); diff --git a/Projectiles/Ranged/CondemnationArrow.cs b/Projectiles/Ranged/CondemnationArrow.cs index a0dc182db4..46f937111f 100644 --- a/Projectiles/Ranged/CondemnationArrow.cs +++ b/Projectiles/Ranged/CondemnationArrow.cs @@ -33,6 +33,11 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { + //Sound is played in the first frame instead of in the weapon shoot for proper mp sync + if (projectile.timeLeft == 300) + Main.PlaySound(SoundID.DD2_BallistaTowerShot, projectile.Center); + + Lighting.AddLight(projectile.Center, Color.Violet.ToVector3()); projectile.Opacity = Utils.InverseLerp(0f, 20f, Time, true); projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; diff --git a/Projectiles/Ranged/CondemnationHoldout.cs b/Projectiles/Ranged/CondemnationHoldout.cs index 3377e0049f..290f67a304 100644 --- a/Projectiles/Ranged/CondemnationHoldout.cs +++ b/Projectiles/Ranged/CondemnationHoldout.cs @@ -46,14 +46,16 @@ namespace CalamityMod.Projectiles.Ranged // Fire one charged arrow every frame until you're out of arrows. ShootProjectiles(tipPosition); --ArrowsLoaded; - Main.PlaySound(SoundID.DD2_BallistaTowerShot); } else { // Frame 1 effects: Record how fast the Condemnation item being used is, to determine how fast to load arrows. if (FramesToLoadNextArrow == 0f) + { + Main.PlaySound(SoundID.Item20, projectile.Center); FramesToLoadNextArrow = Owner.ActiveItem().useAnimation; + } // Actually make progress towards loading more arrows. ++CurrentChargingFrames; From a2e067528196f621c06c6e0c25af0ecf8f5de62c Mon Sep 17 00:00:00 2001 From: IbanPlay <56191483+IbanPlay@users.noreply.github.com> Date: Mon, 27 Dec 2021 23:37:13 +0100 Subject: [PATCH 08/35] Properly fixed Surge Driver --- Items/Weapons/Ranged/Condemnation.cs | 6 +++--- Items/Weapons/Ranged/SurgeDriver.cs | 24 +++++++++--------------- Projectiles/Ranged/PrismEnergyBullet.cs | 4 ++++ 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/Items/Weapons/Ranged/Condemnation.cs b/Items/Weapons/Ranged/Condemnation.cs index 971e7d86bc..f7cbbdd097 100644 --- a/Items/Weapons/Ranged/Condemnation.cs +++ b/Items/Weapons/Ranged/Condemnation.cs @@ -48,13 +48,13 @@ namespace CalamityMod.Items.Weapons.Ranged if (Main.myPlayer == player.whoAmI) player.Calamity().rightClickListener = true; - if (!player.Calamity().mouseRight) + if (player.Calamity().mouseRight && player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0) { - item.noUseGraphic = true; + item.noUseGraphic = false; } else { - item.noUseGraphic = false; + item.noUseGraphic = true; } } diff --git a/Items/Weapons/Ranged/SurgeDriver.cs b/Items/Weapons/Ranged/SurgeDriver.cs index 277a3bd154..d99a80afcc 100644 --- a/Items/Weapons/Ranged/SurgeDriver.cs +++ b/Items/Weapons/Ranged/SurgeDriver.cs @@ -24,6 +24,7 @@ namespace CalamityMod.Items.Weapons.Ranged item.useTime = item.useAnimation = 56; item.useStyle = ItemUseStyleID.HoldingOut; item.noMelee = true; + item.channel = true; item.knockBack = 8f; item.value = CalamityGlobalItem.RarityVioletBuyPrice; item.rare = ItemRarityID.Purple; @@ -40,32 +41,25 @@ namespace CalamityMod.Items.Weapons.Ranged public override void HoldItem(Player player) { - if (player.altFunctionUse == 2) + if (Main.myPlayer == player.whoAmI) + player.Calamity().rightClickListener = true; + + + if (player.Calamity().mouseRight && player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0) { item.noUseGraphic = false; item.reuseDelay = 0; - item.UseSound = SoundID.Item14; - item.channel = false; } else { item.noUseGraphic = true; item.reuseDelay = 28; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"); - item.channel = true; } } - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse != 2) - { - return player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0; - } - return base.CanUseItem(player); - } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0; - public override float UseTimeMultiplier(Player player) => player.altFunctionUse == 2 ? 5f : 1f; + public override float UseTimeMultiplier(Player player) => player.Calamity().mouseRight ? 5f : 1f; public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { @@ -75,7 +69,7 @@ namespace CalamityMod.Items.Weapons.Ranged gunTip.Y -= 6f; // Large bullet/rocket releasing. - if (player.altFunctionUse == 2) + if (player.Calamity().mouseRight) { for (int i = 0; i < 2; i++) { diff --git a/Projectiles/Ranged/PrismEnergyBullet.cs b/Projectiles/Ranged/PrismEnergyBullet.cs index cf1920bd67..dbd228c778 100644 --- a/Projectiles/Ranged/PrismEnergyBullet.cs +++ b/Projectiles/Ranged/PrismEnergyBullet.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged @@ -30,6 +31,9 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { + if (projectile.timeLeft == 300) + Main.PlaySound(SoundID.Item14, projectile.Center); + CurrentLaserLength = (int)MathHelper.Lerp(1f, 70f, Utils.InverseLerp(0f, 15f, Time, true) * Utils.InverseLerp(0f, 15f, projectile.timeLeft, true)); projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; Time++; From ae3f8f2eff39a4c75a6dc886a62a2b456763d40e Mon Sep 17 00:00:00 2001 From: IbanPlay <56191483+IbanPlay@users.noreply.github.com> Date: Mon, 27 Dec 2021 23:49:49 +0100 Subject: [PATCH 09/35] Properly fixed crystyl crusher --- Items/Tools/CrystylCrusher.cs | 9 +++++---- Projectiles/Melee/CrystylCrusherRay.cs | 2 ++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Items/Tools/CrystylCrusher.cs b/Items/Tools/CrystylCrusher.cs index 191228ec83..5928726c5d 100644 --- a/Items/Tools/CrystylCrusher.cs +++ b/Items/Tools/CrystylCrusher.cs @@ -60,7 +60,10 @@ namespace CalamityMod.Items.Tools public override void HoldItem(Player player) { - if (player.altFunctionUse == 2) + if (Main.myPlayer == player.whoAmI) + player.Calamity().rightClickListener = true; + + if (player.Calamity().mouseRight && player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0) { item.shoot = ProjectileID.None; item.shootSpeed = 0f; @@ -70,19 +73,17 @@ namespace CalamityMod.Items.Tools item.useTurn = true; item.autoReuse = true; item.noMelee = false; - item.channel = false; } else { item.shoot = ModContent.ProjectileType(); item.shootSpeed = LaserSpeed; item.tileBoost = -6; - item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/CrystylCharge"); + item.UseSound = null; item.useStyle = ItemUseStyleID.HoldingOut; item.useTurn = false; item.autoReuse = false; item.noMelee = true; - item.channel = true; } } diff --git a/Projectiles/Melee/CrystylCrusherRay.cs b/Projectiles/Melee/CrystylCrusherRay.cs index af343a5bf9..4fb83d3a42 100644 --- a/Projectiles/Melee/CrystylCrusherRay.cs +++ b/Projectiles/Melee/CrystylCrusherRay.cs @@ -114,6 +114,8 @@ namespace CalamityMod.Projectiles.Melee // The AI of the projectile public override void AI() { + if (projectile.timeLeft == 300) + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/CrystylCharge"), projectile.Center); Player player = Main.player[projectile.owner]; projectile.position = player.Center + projectile.velocity * MOVE_DISTANCE; projectile.timeLeft = 2; From 2dbb0c3869ffdea8c8117d6fe219eeac02b7c30a Mon Sep 17 00:00:00 2001 From: IbanPlay <56191483+IbanPlay@users.noreply.github.com> Date: Tue, 28 Dec 2021 00:12:52 +0100 Subject: [PATCH 10/35] Why even did that exist --- Projectiles/Melee/CrystylCrusherRay.cs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Projectiles/Melee/CrystylCrusherRay.cs b/Projectiles/Melee/CrystylCrusherRay.cs index 4fb83d3a42..e0939e54c2 100644 --- a/Projectiles/Melee/CrystylCrusherRay.cs +++ b/Projectiles/Melee/CrystylCrusherRay.cs @@ -114,9 +114,11 @@ namespace CalamityMod.Projectiles.Melee // The AI of the projectile public override void AI() { - if (projectile.timeLeft == 300) - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/CrystylCharge"), projectile.Center); Player player = Main.player[projectile.owner]; + + if (projectile.timeLeft == 300) + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/CrystylCharge"), player.Center); + projectile.position = player.Center + projectile.velocity * MOVE_DISTANCE; projectile.timeLeft = 2; @@ -285,10 +287,6 @@ namespace CalamityMod.Projectiles.Melee } } AchievementsHelper.CurrentlyMining = false; - if (Main.netMode != NetmodeID.SinglePlayer) - { - NetMessage.SendData(MessageID.KillProjectile, -1, -1, null, projectile.identity, projectile.owner, 0f, 0f, 0, 0, 0); - } } } From 8b1c0077f48e0b57beaaa41f8510424361bb1eb2 Mon Sep 17 00:00:00 2001 From: IbanPlay <56191483+IbanPlay@users.noreply.github.com> Date: Fri, 31 Dec 2021 23:13:57 +0100 Subject: [PATCH 11/35] Removed the example item --- Items/Weapons/Ranged/RCCAnihilator.cs | 92 --------- Projectiles/Ranged/RCCHoldout.cs | 257 -------------------------- Projectiles/Ranged/RCCHoldout.png | Bin 2101 -> 0 bytes Projectiles/Ranged/RendingBolt.png | Bin 724 -> 0 bytes 4 files changed, 349 deletions(-) delete mode 100644 Items/Weapons/Ranged/RCCAnihilator.cs delete mode 100644 Projectiles/Ranged/RCCHoldout.cs delete mode 100644 Projectiles/Ranged/RCCHoldout.png delete mode 100644 Projectiles/Ranged/RendingBolt.png diff --git a/Items/Weapons/Ranged/RCCAnihilator.cs b/Items/Weapons/Ranged/RCCAnihilator.cs deleted file mode 100644 index 5a33d2f5bf..0000000000 --- a/Items/Weapons/Ranged/RCCAnihilator.cs +++ /dev/null @@ -1,92 +0,0 @@ -using Microsoft.Xna.Framework; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Graphics.Effects; -using System.Collections.Generic; -using Terraria.Graphics.Shaders; -using Microsoft.Xna.Framework.Graphics; -using CalamityMod.Projectiles.Ranged; -using static Terraria.ModLoader.ModContent; -using System.IO; - -namespace CalamityMod.Items.Weapons.Ranged -{ - public class RCCAnihilator : ModItem - { - public override bool CloneNewInstances => true; - public bool RCChannel = false; - public const int MaxBolts = 6; - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Rending Greatbow of the Six Northen Winds: Anihilator of Right Click Channel Restrictions"); - Tooltip.SetDefault("Hold RIGHT click to load up to six precision bolts\n" + - "The more precision bolts are loaded, the harder they hit"); - } - - public override void SetDefaults() - { - item.damage = 10000000; - item.ranged = true; - item.width = 48; - item.height = 96; - item.useTime = 60; - item.useAnimation = 30; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 4.25f; - item.value = CalamityGlobalItem.Rarity10BuyPrice; - item.rare = ItemRarityID.Red; - item.noUseGraphic = true; - item.UseSound = SoundID.Item20; - item.channel = true; - item.autoReuse = true; - item.shoot = ProjectileID.PurificationPowder; - item.shootSpeed = 15f; - item.useAmmo = AmmoID.Arrow; - } - public override ModItem Clone(Item item) - { - var clone = base.Clone(item); - - if (Main.mouseItem.type == ItemType()) - item.modItem.HoldItem(Main.player[Main.myPlayer]); - - (clone as RCCAnihilator).RCChannel = (item.modItem as RCCAnihilator).RCChannel; - - return clone; - } - - public override string Texture => "CalamityMod/Projectiles/Ranged/RCCHoldout"; //What. Huh. HUH? you got a problem with my file organization in my proof of concept HUH???? HUH???? - public override bool AltFunctionUse(Player player) - { - return true; - } - public override bool CanUseItem(Player player) =>(player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0 && player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0); - - public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) - { - - if (player.altFunctionUse == 2) - { - if (!RCChannel) //Important separation of the RCChannel check. Idk how imporant it really is since CanUseItem is already a thing - { - Vector2 shootVelocity = new Vector2(speedX, speedY); - Vector2 shootDirection = shootVelocity.SafeNormalize(Vector2.UnitX * player.direction); - // Charge-up. Done via a holdout projectile. - Projectile.NewProjectile(position, shootDirection, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); - } - return false; - } - else //This is just a test thing - { - Vector2 shootVelocity = new Vector2(speedX, speedY); - Vector2 shootDirection = shootVelocity.SafeNormalize(Vector2.UnitX * player.direction); - // Charge-up. Done via a holdout projectile. - Projectile.NewProjectile(position, shootDirection, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); - return false; - } - } - } -} diff --git a/Projectiles/Ranged/RCCHoldout.cs b/Projectiles/Ranged/RCCHoldout.cs deleted file mode 100644 index 90ad4ffb6f..0000000000 --- a/Projectiles/Ranged/RCCHoldout.cs +++ /dev/null @@ -1,257 +0,0 @@ -using Microsoft.Xna.Framework; -using System; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.Graphics.Shaders; -using Microsoft.Xna.Framework.Graphics; -using CalamityMod.Items.Weapons.Ranged; -using static Terraria.ModLoader.ModContent; -using CalamityMod.CalPlayer; - -namespace CalamityMod.Projectiles.Ranged -{ - public class RCCHoldout : ModProjectile - { - - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Rending Bow"); - //Main.projFrames[projectile.type] = 9; might animate the bow's string getting drawn but not rn - } - - private Player Owner => Main.player[projectile.owner]; - - private bool OwnerCanShoot => Owner.HasAmmo(Owner.ActiveItem(), true) && !Owner.noItems && !Owner.CCed && Owner.HeldItem.type == ItemType() && (Owner.HeldItem.modItem as RCCAnihilator).RCChannel; - private ref float CurrentChargingFrames => ref projectile.ai[0]; - private ref float LoadedBolts => ref projectile.ai[1]; - private ref float FramesToLoadBolt => ref projectile.localAI[0]; - - //private ref float Overfilled => ref projectile.localAI[1]; Until i implement the bow animation there is no need for that - private float angularSpread = MathHelper.ToRadians(16); - - //public override string Texture => "CalamityMod/Projectiles/Ranged/ClockworkBowHoldout"; - public override string Texture => "CalamityMod/Projectiles/Ranged/RCCHoldout"; - - public override void SetDefaults() - { - projectile.width = 48; - projectile.height = 96; - projectile.friendly = true; - projectile.penetrate = -1; - projectile.tileCollide = false; - projectile.ranged = true; - projectile.ignoreWater = true; - } - - public override void AI() - { - - CalamityPlayer controlsSync = Owner.GetModPlayer(); - if (Main.myPlayer == projectile.owner) - { - controlsSync.rightClickListener = true; - } - - Vector2 armPosition = Owner.RotatedRelativePoint(Owner.MountedCenter, true); - Vector2 tipPosition = armPosition + projectile.velocity * projectile.width * 0.5f; - - // If the player releases left click, shoot out the arrows (also if its not the very first frame to avoid it killing itself before it sets the RCChannel variable to true - if (!OwnerCanShoot && FramesToLoadBolt != 0f) - { - - if (LoadedBolts <= 0f) //If theres no arrows to shoot - { - projectile.Kill(); - (Owner.HeldItem.modItem as RCCAnihilator).RCChannel = false; - return; - } - // Fire the spread of arrows - else - UnloadBolts(tipPosition); - } - - else - { - // Frame 1 effects: Initialize the shoot speed - if (FramesToLoadBolt == 0f) - { - (Owner.HeldItem.modItem as RCCAnihilator).RCChannel = true; - FramesToLoadBolt = Owner.ActiveItem().useAnimation; - } - - ++CurrentChargingFrames; - - if (CurrentChargingFrames - FramesToLoadBolt / 2 <= 0.01) - Main.PlaySound(SoundID.Item17); //Click - - if (CurrentChargingFrames >= FramesToLoadBolt && LoadedBolts < RCCAnihilator.MaxBolts) - { - CurrentChargingFrames = 0f; - ++LoadedBolts; - - if (LoadedBolts % 2 == 0) - CombatText.NewText(Owner.Hitbox, new Color(163, 90, 237), "H34Ds", true); - else - CombatText.NewText(Owner.Hitbox, new Color(255, 235, 155), "8R8K", true); - - FramesToLoadBolt *= 0.950f; - - if (LoadedBolts >= RCCAnihilator.MaxBolts) - Main.PlaySound(SoundID.Item23); - else - { - var loadSound = Main.PlaySound(SoundID.Item108); - if (loadSound != null) - loadSound.Volume *= 0.3f; - } - } - } - - UpdateProjectileHeldVariables(armPosition); - ManipulatePlayerVariables(); - - if (!controlsSync.mouseRight) - (Owner.HeldItem.modItem as RCCAnihilator).RCChannel = false; - } - - public void UnloadBolts(Vector2 tipPosition) - { - //If the max amount of bolts is already loaded we can ignore the extra spread from the bolt currently loading - if (LoadedBolts == RCCAnihilator.MaxBolts) - { - for (int i = 0; i < LoadedBolts; i++) - { - //Version that doesnt inclue the chargingframes bit , since its fully charged - float increment = angularSpread * (LoadedBolts - 1) / 2; - float spreadForThisProjectile = MathHelper.Lerp(-increment, increment, i / (float)(LoadedBolts - 1)); - ShootProjectiles(tipPosition, spreadForThisProjectile); - - } - Main.PlaySound(SoundID.Item38);//play the sound - } - else if (LoadedBolts != 0) - { - for (int i = 0; i < LoadedBolts + 1; i++) - { - if (i == LoadedBolts) //We don't actually shoot the arrow that's currently loading - continue; - - //Version that takes into account the progress of the arrow currently loading. It takes half the time it takes for the arrow to load for the range to adjust to its next position - float increment = angularSpread * (LoadedBolts - 1 + MathHelper.Clamp((CurrentChargingFrames / FramesToLoadBolt) * 2, 0f, 1f)) / 2; - float spreadForThisProjectile = MathHelper.Lerp(-increment, increment, i / (float)(MathHelper.Lerp(LoadedBolts - 1, LoadedBolts, MathHelper.Clamp((CurrentChargingFrames * 2 / FramesToLoadBolt), 0f, 1f)))); - ShootProjectiles(tipPosition, spreadForThisProjectile); - } - Main.PlaySound(SoundID.Item38);//play the sound - } - - FramesToLoadBolt = Owner.ActiveItem().useAnimation; //reset the reload time - LoadedBolts = 0; //Unload the bow - } - - public void ShootProjectiles(Vector2 tipPosition, float projectileRotation) - { - if (Main.myPlayer != projectile.owner) - return; - - Item heldItem = Owner.ActiveItem(); - int BoltDamage = (int)(heldItem.damage * Owner.RangedDamage() * (LoadedBolts + 1) / (float)(RCCAnihilator.MaxBolts + 1)); - float shootSpeed = heldItem.shootSpeed * 1f; - float knockback = heldItem.knockBack; - bool uselessFuckYou = OwnerCanShoot; //Not a very nice thing to say :/ - int projectileType = 0; - - Owner.PickAmmo(heldItem, ref projectileType, ref shootSpeed, ref uselessFuckYou, ref BoltDamage, ref knockback, false); - projectileType = ModContent.ProjectileType(); - - knockback = Owner.GetWeaponKnockback(heldItem, knockback); - Vector2 shootVelocity = projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(projectileRotation) * shootSpeed; - - Projectile.NewProjectile(tipPosition, shootVelocity, projectileType, BoltDamage, knockback, projectile.owner, 0f, 0f); - } - - private void UpdateProjectileHeldVariables(Vector2 armPosition) - { - if (Main.myPlayer == projectile.owner) - { - float interpolant = Utils.InverseLerp(5f, 25f, projectile.Distance(Main.MouseWorld), true); - projectile.velocity = Vector2.Lerp(projectile.velocity, projectile.SafeDirectionTo(Main.MouseWorld), interpolant); - projectile.netSpam = 0; - projectile.netUpdate = true; - - } - projectile.position = armPosition - projectile.Size * 0.5f + projectile.velocity.SafeNormalize(Vector2.Zero) * 35f; - projectile.rotation = projectile.velocity.ToRotation(); - if (projectile.spriteDirection == -1) - projectile.rotation += MathHelper.Pi; - projectile.spriteDirection = projectile.direction; - projectile.timeLeft = 3; - } - - private void ManipulatePlayerVariables() - { - Owner.ChangeDir(projectile.direction); - Owner.heldProj = projectile.whoAmI; - Owner.itemTime = 2; - Owner.itemAnimation = 2; - Owner.itemRotation = (projectile.velocity * projectile.direction).ToRotation(); - } - - - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - - float loops = LoadedBolts + 1; - if (LoadedBolts == RCCAnihilator.MaxBolts) //If the bow is fully loaded, shave off the part where you draw the arrow that's charging currently - loops = LoadedBolts; - - for (int i = 0; i < loops; i++) - { - float BoltAngle; - float Shift = 0; - - if (LoadedBolts == 0) //We calculating angles YEAH! - { - BoltAngle = 0; - } - else if (LoadedBolts == RCCAnihilator.MaxBolts) - { - float increment = angularSpread * (LoadedBolts - 1) / 2; - BoltAngle = MathHelper.Lerp(-increment, increment, i / (float)(LoadedBolts - 1)); - } - else - { - float increment = angularSpread * (LoadedBolts - 1 + MathHelper.Clamp((CurrentChargingFrames * 2 / FramesToLoadBolt), 0f, 1f)) / 2; - BoltAngle = MathHelper.Lerp(-increment, increment, i / (float)(MathHelper.Lerp(LoadedBolts - 1, LoadedBolts, MathHelper.Clamp((CurrentChargingFrames * 2 / FramesToLoadBolt), 0f, 1f)))); - } - - if (i == LoadedBolts) //If the arrow we are looking at is the one being loaded, we give it some shift (used for position & alpha) - Shift = 1 - (CurrentChargingFrames / FramesToLoadBolt); - - if (i == LoadedBolts - 1 || LoadedBolts == RCCAnihilator.MaxBolts) //If the arrow we are looking at is the one that just got loaded, OR all arrows got loaded, we apply some flashiness - { - spriteBatch.EnterShaderRegion(); - GameShaders.Misc["CalamityMod:BasicTint"].UseOpacity(1f - MathHelper.Clamp((CurrentChargingFrames * 2 / FramesToLoadBolt), 0f, 1f)); - GameShaders.Misc["CalamityMod:BasicTint"].UseColor(Main.hslToRgb(1f - (LoadedBolts / RCCAnihilator.MaxBolts), 0.8f, 0.85f)); - GameShaders.Misc["CalamityMod:BasicTint"].Apply(); - } - - Color Transparency = Color.White * (1 - Shift); - var BoltTexture = ModContent.GetTexture("CalamityMod/Projectiles/Ranged/RendingBolt"); - Vector2 PointingTo = new Vector2((float)Math.Cos(projectile.rotation + BoltAngle), (float)Math.Sin(projectile.rotation + BoltAngle)); //It's called trigonometry we do a little trigonometry - Vector2 ShiftDown = PointingTo.RotatedBy(-MathHelper.PiOver2); - float FlipFactor = projectile.direction == -1 ? MathHelper.Pi : 0f; - Vector2 drawPosition = Owner.Center + PointingTo.RotatedBy(FlipFactor) * (20f + (Shift * 40)) - ShiftDown.RotatedBy(FlipFactor) * (BoltTexture.Width / 2) - Main.screenPosition; - - spriteBatch.Draw(BoltTexture, drawPosition, null, Transparency, projectile.rotation + BoltAngle + MathHelper.PiOver2 + FlipFactor, BoltTexture.Size(), 1f, 0, 0); - - if (i == LoadedBolts - 1 || LoadedBolts == RCCAnihilator.MaxBolts) //Don't forget to exit the shader region - spriteBatch.ExitShaderRegion(); - } - return true; - } - - public override bool CanDamage() => false; - } -} \ No newline at end of file diff --git a/Projectiles/Ranged/RCCHoldout.png b/Projectiles/Ranged/RCCHoldout.png deleted file mode 100644 index 7e87dcb941b3f96aa0e66eada9aabed163fc08fb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2101 zcmV-52+H?~P)Px+?@2^KRCt{2oLy{_*BQruZ|ua0lLiu;AV>&cSYbpoQrJWXjGLBCMO)D-b(QFP zv5U4+)d>x;-K=-r9TQchX;M>FXxdhF)3mOjRjbxsv`ab=gb6Arv{g#J`VnY|(%6oj zIBzc=KQ`y&eVv%5M6dDx#yQ8w@5l2$=lMF%iBsR+>2edC&^mnJ089=3+wc2jLDh0U zz}H1s|5(@gZ2-C(4jKbaob9>2PgEj;&p>sg+5s58_`a-#&X)lgxjY5Hin>MzU?MTR zEDyL40?&X`+tTI&gd!`Y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wXEgQY*H?A(2!%>n(Y;xceS>*yvZudsJ*0^`%;|HRbJ$mJtK0 zC2T#OuOF>$1WK=!Q(s46OJ1S5&h7@OsXjL)r>T;Y=2;yZ!Dpbl%C3#}tK5|hU8hRy zMmn3gCCU3$?(U9jN=__4xuit2v3ST5d5srOFz+Pas&IobKzB;EZQbYqT>VV?D<`^_2;tgB(Z4fk z@pYnGBoazq5evF$O_Kv~>GH=w>008OM(`O>$!mm^*ZaB8BS+sZshPx%j!8s8R7i>K*3WNLWfaEo&)W=AT1g7DO$#NlE`*`c;3RBJ3k!lqY*F1?wN>ZqCO-edLUmwlW?N0+i_qi87vj5kuvA-^xAFm&us@KRHyEU8XN^Qn}y9c<}*9N^AO zLq1~27XAG@!0x_VHJ{_ZILXCDUGyKkmKw{mYzM@Qo`{oKUW!qvjn!l&8)zQ@VQ1yC$DRro7LEYF-TzlenH zt~j}e&R*)Bp0L`u4`G_GS z5_jbOw|}cC{Qig6$~C!&g>~!KgT?uI(7tpIl-BM66H6nhbO2=f94D)mHjr%T!t&lf zCSH5`;&toaMeuUNKlzBExwR*OclUo#k?38F{)4`Oiuloik$lAR*U>chDwfYV$4_ho zhYrWxs Date: Tue, 28 Dec 2021 08:57:00 -0500 Subject: [PATCH 12/35] Basher resprite --- Items/Weapons/Melee/Basher.cs | 6 +++--- Items/Weapons/Melee/Basher.png | Bin 858 -> 734 bytes 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Items/Weapons/Melee/Basher.cs b/Items/Weapons/Melee/Basher.cs index e018d99f9e..f43b058532 100644 --- a/Items/Weapons/Melee/Basher.cs +++ b/Items/Weapons/Melee/Basher.cs @@ -17,10 +17,10 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 40; - item.height = 42; + item.width = 56; + item.height = 60; item.damage = 30; - item.scale = 1.5f; + item.scale = 1.05f; item.melee = true; item.useAnimation = item.useTime = 26; item.useStyle = ItemUseStyleID.SwingThrow; diff --git a/Items/Weapons/Melee/Basher.png b/Items/Weapons/Melee/Basher.png index f16271533bbbc23b131d4b222d8fd14d6b4c9c56..5bc9946313e3e3e4dee854fdbdf10d1b043d0570 100644 GIT binary patch literal 734 zcmV<40wMj0P)dS`snc2X1sHZc6b2N0RnosJ1f7nkN1aCn=$hxq@A)( zMg$BX>ac(;CpfUmG2`ab)4lyt+w2twj1CXDyK`QCwg?sh^*QzW zbWv)vj#G4Y2Yn? z^aVORpo}h#uS#vp#r=0{0RrY2H9xBH*&O^gfVQSg%e)$+9ORUB`p=)sQkyOBeiAvG z3RFPp0DV0GhF)aE@}!*NJs8aozLOV07*qoM6N<$f*XWLr2qf` literal 858 zcmV-g1Eu_lP)Px#AY({UO#lFTCIA3{ga82g0001h=l}q9FaQARU;qF* zm;eA5aGbhPJOBUy24YJ`L;(K){{a7>y{D4^000SaNLh0L01m?d01m?e$8V@)0007$ zNklE@oJCV4Bhna^3^Xlni!%@7IWrf%>e!v3XLIL#%sq2{Jn#FSGZ8AR zQ%8rrwe6{Q4rGiM+B;XV4#TF)B^Q}$oS|P0G8610BC7@RCfMi<~IP(U#tLC zKybqzbn}^?l;TbxeJI=^LC=dF3I4Rt_~ zn6y=LQs@bmc+iiW!6LdRNDYA1>;NOvxLQgOv54zgvX!TR*3H}A4MEB2Mt4QJi000tnMObu2 kSV=}YPjYExZggREX>V=-F@#v`?*IS*07*qoM6N<$f Date: Tue, 28 Dec 2021 08:57:36 -0500 Subject: [PATCH 13/35] Alluvion resprite --- Items/Weapons/Ranged/Alluvion.cs | 2 +- Items/Weapons/Ranged/Alluvion.png | Bin 2115 -> 2386 bytes 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/Items/Weapons/Ranged/Alluvion.cs b/Items/Weapons/Ranged/Alluvion.cs index c019c06319..4d55801a60 100644 --- a/Items/Weapons/Ranged/Alluvion.cs +++ b/Items/Weapons/Ranged/Alluvion.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Ranged { item.damage = 165; item.ranged = true; - item.width = 60; + item.width = 62; item.height = 90; item.useTime = 15; item.useAnimation = 30; diff --git a/Items/Weapons/Ranged/Alluvion.png b/Items/Weapons/Ranged/Alluvion.png index 6e3023d0001c9a012384f991068411c6709c6713..23240a9d0504a9e4e8324474d7c12f373094a48c 100644 GIT binary patch literal 2386 zcmV-Y39a^tP)004R> z004l5008;`004mK004C_008P=0026d000+od=Nkl5@) zvZ_jz)jruu8db_eVmnO?RzmDpV1o?~HZiaZ?DDlNFnu_4cK6=hfd%6jb?5&AJ2Mw% z=YQ|{_@8sf!9%G0OZuzJGKf69&jCm#X8=fa|7*F+H!Mo-^$pxBg#1q2|C8_LJ$~cN zITxU`wA=xxX#Oey3uAHlnS5`ZZ}ILRU|dnV>plmd_xMQ{GR!wV-(g&*%q!F318ok# zTyzTnOY;k4pWkRRp=cR*>;r1uYj@oTK;rr*%Q8Q5x)XpKXU-YNXM2VKs6X_m12FUH zsBwNVE?(hY&5VF?8-C1J?r#BL=TlDrnHlh>CmuD%|NPts0Cc_d%Ca}0Ged1l;`%4R z-Df^v+z-lpq`nk@8h6$O7>bEQ&>5g;|NVHW%Qh4}IA<|LUc8mmROy`!Q{M1&t3h64cKMJ)RniOKx!U zKP!EOyeMAAvy_*-XxSpMv@&jEo+Sq$7M}(nR3gu^p{Cje7?=<%Z`%fY23#mx1Tt3M zo(T#)A8H5(jIRaR`MANTYHKqwVP;}3<^W7Z!T{V}a$JD2*?9ma$706##*&moVAkLL z{;7ZDy%A;DR(^C%E7O}I)#B&9Y;LUx7+2^MSB0hS@eT)|-;0=<4?PaR&Xhc}*p)sR zI5=XAR|QA^#j)7iKyG%Y@XPX!{!)J4AkDlBnV25LMy)oRD_X|WRy};64S-ZC=|U!Q z%F3r5fTO?t82~+HB`!etgFXk~ofEGExr&Xg%-9i`A99)hi}CleVtiTi0po?iS6A03 z{6AShZ@8$$1nC9 z4B1MFANnqdRaa}B^dh*LwibhVKNa@L-Jb(85ndv^-595^8NX8$FXI)Ph4Dp?d3~~K z&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35] Added Exo Plating and Exo Prism Panel Walls --- Items/Placeables/FurnitureExo/ExoPlating.cs | 6 ++ .../Placeables/FurnitureExo/ExoPrismPanel.cs | 6 ++ Items/Placeables/Walls/ExoPlatingWallItem.cs | 38 +++++++++ Items/Placeables/Walls/ExoPlatingWallItem.png | Bin 0 -> 465 bytes .../Placeables/Walls/ExoPrismPanelWallItem.cs | 38 +++++++++ .../Walls/ExoPrismPanelWallItem.png | Bin 0 -> 321 bytes Walls/ExoPlatingWall.cs | 25 ++++++ Walls/ExoPlatingWall.png | Bin 0 -> 7457 bytes Walls/ExoPrismPanelWall.cs | 77 ++++++++++++++++++ Walls/ExoPrismPanelWall.png | Bin 0 -> 7973 bytes 10 files changed, 190 insertions(+) create mode 100644 Items/Placeables/Walls/ExoPlatingWallItem.cs create mode 100644 Items/Placeables/Walls/ExoPlatingWallItem.png create mode 100644 Items/Placeables/Walls/ExoPrismPanelWallItem.cs create mode 100644 Items/Placeables/Walls/ExoPrismPanelWallItem.png create mode 100644 Walls/ExoPlatingWall.cs create mode 100644 Walls/ExoPlatingWall.png create mode 100644 Walls/ExoPrismPanelWall.cs create mode 100644 Walls/ExoPrismPanelWall.png diff --git a/Items/Placeables/FurnitureExo/ExoPlating.cs b/Items/Placeables/FurnitureExo/ExoPlating.cs index b7c99a362e..14075ce581 100644 --- a/Items/Placeables/FurnitureExo/ExoPlating.cs +++ b/Items/Placeables/FurnitureExo/ExoPlating.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; +using CalamityMod.Items.Placeables.Walls; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria.ID; @@ -45,6 +46,11 @@ namespace CalamityMod.Items.Placeables.FurnitureExo recipe.AddIngredient(ModContent.ItemType(), 2); recipe.SetResult(this); recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.AddTile(TileID.WorkBenches); + recipe.SetResult(this); + recipe.AddRecipe(); } } } diff --git a/Items/Placeables/FurnitureExo/ExoPrismPanel.cs b/Items/Placeables/FurnitureExo/ExoPrismPanel.cs index d37594c5f0..be4f1d5e99 100644 --- a/Items/Placeables/FurnitureExo/ExoPrismPanel.cs +++ b/Items/Placeables/FurnitureExo/ExoPrismPanel.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.FurnitureExo; +using CalamityMod.Items.Placeables.Walls; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria.ID; @@ -45,6 +46,11 @@ namespace CalamityMod.Items.Placeables.FurnitureExo recipe.AddIngredient(ModContent.ItemType(), 2); recipe.SetResult(this); recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.AddTile(TileID.WorkBenches); + recipe.SetResult(this); + recipe.AddRecipe(); } } } diff --git a/Items/Placeables/Walls/ExoPlatingWallItem.cs b/Items/Placeables/Walls/ExoPlatingWallItem.cs new file mode 100644 index 0000000000..f78d7c7071 --- /dev/null +++ b/Items/Placeables/Walls/ExoPlatingWallItem.cs @@ -0,0 +1,38 @@ +using CalamityMod.Items.Placeables.FurnitureExo; +using CalamityMod.Walls; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Walls +{ + public class ExoPlatingWallItem : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Exo Plating Wall"); + } + + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = ItemUseStyleID.SwingThrow; + item.consumable = true; + item.createWall = ModContent.WallType(); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType()); + recipe.SetResult(this, 4); + recipe.AddTile(TileID.WorkBenches); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/Walls/ExoPlatingWallItem.png b/Items/Placeables/Walls/ExoPlatingWallItem.png new file mode 100644 index 0000000000000000000000000000000000000000..cfdbcc59932e03e6b2ef820c4a7718c0e214d69b GIT binary patch literal 465 zcmV;?0WSWDP)Px$i%CR5R7i={mcdH`Q4q#|8`fb>kzBzNWDCMm;zj8HKM7vMP7>rIWI?Nlm4^zp z!}_tk!4M%<`!36yof+OY^UZtDYlJNTe7^|5YW1D~EEh2V-F91j6 zjDlqrhL-?DQR<*|JTC(foK>9!)^6jXXq-UCG=GMcSv;Qsa9U1xe%`!x0_@t_6|b*l znma?URH-JAsY=YIlLvm{^9q2s<n?FOa2abUMruSSHuk+c zfo&&^pt!q14>*9^!fS-BjW@nvPkq}PYZo&id+Vf{$iIgt#{~~yIOrz;?M~O(k)0=fRE3wKYe+tg7M2Uum^_U^)&A|cqe$%00000NkvXX Hu0mjfQGeNz literal 0 HcmV?d00001 diff --git a/Items/Placeables/Walls/ExoPrismPanelWallItem.cs b/Items/Placeables/Walls/ExoPrismPanelWallItem.cs new file mode 100644 index 0000000000..e7601ec56f --- /dev/null +++ b/Items/Placeables/Walls/ExoPrismPanelWallItem.cs @@ -0,0 +1,38 @@ +using CalamityMod.Items.Placeables.FurnitureExo; +using CalamityMod.Walls; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Walls +{ + public class ExoPrismPanelWallItem : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Exo Prism Panel Wall"); + } + + public override void SetDefaults() + { + item.width = 12; + item.height = 12; + item.maxStack = 999; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 7; + item.useStyle = ItemUseStyleID.SwingThrow; + item.consumable = true; + item.createWall = ModContent.WallType(); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType()); + recipe.SetResult(this, 4); + recipe.AddTile(TileID.WorkBenches); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Placeables/Walls/ExoPrismPanelWallItem.png b/Items/Placeables/Walls/ExoPrismPanelWallItem.png new file mode 100644 index 0000000000000000000000000000000000000000..62a2b83eff3133bdb6f34c4ffab63e29d3a6c8d0 GIT binary patch literal 321 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM3?#3wJbMaAF%}28J29*~C-V}>aSiYZaRt)y zGTLz(w(UknD}BsYHfXF|>9ca>N}#x@vvF~{g0=)5S4FW8&5e2l);wa5N+y z>@rL;Y5n!D-|FqHGu+WtH|j6zOI)>_E>s+uly~+lk4LA*^Qgz6YnQ(HtsoqATC(A0 zydm=xrKH2v26~-e*8Sp5`cl`r^B1p+V$NcLj(@D@^S*w0%CL%|NQ-!_VMV5(= t15|hM&$|9r_9B~k24B6C&34@i#>ouAso_T1T0kc;c)I$ztaD0e0swSng4O^4 literal 0 HcmV?d00001 diff --git a/Walls/ExoPlatingWall.cs b/Walls/ExoPlatingWall.cs new file mode 100644 index 0000000000..19f818f37e --- /dev/null +++ b/Walls/ExoPlatingWall.cs @@ -0,0 +1,25 @@ +using CalamityMod.Items.Placeables.Walls; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class ExoPlatingWall : ModWall + { + public override void SetDefaults() + { + Main.wallHouse[Type] = true; + drop = ModContent.ItemType(); + AddMapEntry(new Color(41, 55, 65)); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; + } +} diff --git a/Walls/ExoPlatingWall.png b/Walls/ExoPlatingWall.png new file mode 100644 index 0000000000000000000000000000000000000000..d8da19a0d524c35b3c6fd0adafa0361cc2ca294e GIT binary patch literal 7457 zcmbuEdmz*M|Hs$qTb+~2=^~djotjiCg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ro#I zZ`loM3ja5e^w=JlfBXn+(qBTYq&<7TYFmbbxgw6}5_05RbwwhvwW{^lgGZB!L;{G+ z<DAsA(TYo0&01`H#LFU?J}S|i7p2OREKU03`Kx3oK2 Jarn%i{{@{gL398B literal 0 HcmV?d00001 diff --git a/Walls/ExoPrismPanelWall.cs b/Walls/ExoPrismPanelWall.cs new file mode 100644 index 0000000000..2444afe884 --- /dev/null +++ b/Walls/ExoPrismPanelWall.cs @@ -0,0 +1,77 @@ +using CalamityMod.Items.Placeables.Walls; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class ExoPrismPanelWall : ModWall + { + public override void SetDefaults() + { + Main.wallHouse[Type] = true; + drop = ModContent.ItemType(); + AddMapEntry(new Color(41, 55, 65)); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 107, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; + + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) + { + Texture2D sprite = Main.wallTexture[Type]; + Color lightColor = GetWallColour(i, j); + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + zero -= new Vector2(8, 8); + Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; + int[] sheetOffset = CreatePattern(i, j); + spriteBatch.Draw + ( + sprite, + drawOffset, + new Rectangle(sheetOffset[0] + Main.tile[i, j].wallFrameX(), sheetOffset[1] + Main.tile[i, j].wallFrameY(), 32, 32), + lightColor, + 0, + new Vector2(0f, 0f), + 1, + SpriteEffects.None, + 0f + ); + return false; + } + + private int[] CreatePattern(int i, int j) + { + int[] sheetOffset = new int[2] { 0, (i + j) % 6 }; + sheetOffset[1] = sheetOffset[1] * 180; + return sheetOffset; + } + + private Color GetWallColour(int i, int j) + { + int colType = Main.tile[i, j].wallColor(); + Color paintCol = WorldGen.paintColor(colType); + if (colType < 13) + { + paintCol.R = (byte)((paintCol.R / 2f) + 128); + paintCol.G = (byte)((paintCol.G / 2f) + 128); + paintCol.B = (byte)((paintCol.B / 2f) + 128); + } + if (colType == 29) + { + paintCol = Color.Black; + } + Color col = Lighting.GetColor(i, j); + col.R = (byte)(paintCol.R / 255f * col.R); + col.G = (byte)(paintCol.G / 255f * col.G); + col.B = (byte)(paintCol.B / 255f * col.B); + return col; + } + } +} diff --git a/Walls/ExoPrismPanelWall.png b/Walls/ExoPrismPanelWall.png new file mode 100644 index 0000000000000000000000000000000000000000..40ea79558c4badc5fdec059329a4c374e1346e7d GIT binary patch literal 7973 zcmeI1dmvQl-@r#oRw-RnM3hvEp&iLB*TOK0P7}FA$&59jkjiyXDn$kvmt0b#I+AN{ zEox=mnT?Scsn#u|*0qN4d(Mn%#@ct^-#_m^@A~76d7ke%^E_wH^Laks?}VBkFcKCL z7eb*>!p7Kr5DLY|K%o|^3G#!M%SNxj5yj^T8R?@k8zuU|8v}Dwya9NXl90FCp>-L9 zflXE6z#TAb3d1mHSJ|uV>7=GeFxsf2t!zzj2(dg18)0<(49KUA-~=6Yh@ekMcJ_iV zo;$eg;0JKR`ZLghL#WvW|FW-nzDA)ooiyI3hd-YCe(%Wa%w>9?_1SYbMtYF8-@ABcf@Zzz`@WQX|4sJcrOH~@ z2j8TdHS20AKkTp`sH!;Uc}`SL%5CGV_WXN%2;rG6(NJdKA3V8P3XL zT2>7XvLZYu*MF$5pBeW^jH78jAP^fO_N6v836(2==+VJ5ewwn{mnZEq8IA??D%=&k zQ+|C0D{=?k+FCD8R{3N==Q7vWOsN2Of8SFU+f+gazJCTyBi2IX621>yi!xwqt+xS6 z!pRHT=nvF4yW@C6al{v2upNKoIu@9v*#uH~KjCRml+h_WTWy~UXDQ+$#XSnYuYmY- z#~j?S7Z?wTJ)5SC!~`c3b56VCoV*Mad6ltrZL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>s_^HtfjHvlS;8q9f*iT<#^c(886Kns9j2b8&P$As z-kz5jqp$EL#^1FMDI9W4Fm{V=lNv|*UUhcuPMwoJ8Rbo->YV237MV_Rh;hTW5@ZK; z3|~MzIhDa(m<$=Cj@jm(IXPA0-o!3fZl25a*L9EYn{@nDzN>knr-$V`-R*45Y0?(k&GcQc|6);jW>FfP$^9i2mijy7l?b{2#w){ty5F literal 0 HcmV?d00001 From 889ec093ea6ec726bdbdd98d5e28c0738cca3758 Mon Sep 17 00:00:00 2001 From: ben-tk <45545085+ben-tk@users.noreply.github.com> Date: Fri, 31 Dec 2021 10:08:04 -0500 Subject: [PATCH 15/35] channeled weapons (violence, yoyos, etc) no longer can receive ephemeral enchantment --- UI/CalamitasEnchantments/EnchantmentManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UI/CalamitasEnchantments/EnchantmentManager.cs b/UI/CalamitasEnchantments/EnchantmentManager.cs index e1c2744853..cad57c64ee 100644 --- a/UI/CalamitasEnchantments/EnchantmentManager.cs +++ b/UI/CalamitasEnchantments/EnchantmentManager.cs @@ -195,7 +195,7 @@ namespace CalamityMod.UI.CalamitasEnchants "CalamityMod/ExtraTextures/UI/EnchantmentSymbols/CurseIcon_Ephemeral", null, player => player.Calamity().dischargingItemEnchant = true, - item => item.IsEnchantable() && item.damage > 0 && !item.summon), + item => item.IsEnchantable() && item.damage > 0 && !item.summon && !item.channel), new Enchantment("Hellbound", "Causes minions to be created with a 40 second timer.\nOnce it runs out, they explode violently. Minions do more damage the longer they live and idly explode as well.", 700, From ff6ced6816d9f9d0546207c7665e8e0accd70e8f Mon Sep 17 00:00:00 2001 From: ben-tk <45545085+ben-tk@users.noreply.github.com> Date: Fri, 31 Dec 2021 10:27:56 -0500 Subject: [PATCH 16/35] fixed betsy's wing tooltip --- Items/CalamityGlobalItemTooltip.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Items/CalamityGlobalItemTooltip.cs b/Items/CalamityGlobalItemTooltip.cs index 0bc9e8b133..355fed3661 100644 --- a/Items/CalamityGlobalItemTooltip.cs +++ b/Items/CalamityGlobalItemTooltip.cs @@ -768,6 +768,7 @@ namespace CalamityMod.Items // This function is shorthand for appending a stat sheet to a pair of wings. void AddWingStats(float h, float a, int v, int f, string s = null) => EditTooltipByNum(0, (line) => line.text += WingStatsTooltip(h, a, v, f, s)); + void AddWingStats2(float h, float a, int v, int f, string s = null, string lineName = null) => EditTooltipByName(lineName, (line) => line.text += WingStatsTooltip(h, a, v, f, s)); if (item.type == ItemID.AngelWings) AddWingStats(6.25f, 1f, 0, 100, "+20 max life, +10 defense and +2 life regen"); @@ -872,8 +873,9 @@ namespace CalamityMod.Items AddWingStats(6.5f, 1.5f, 1, 160, "+20 max mana, 5% increased magic damage and critical strike chance,\n" + "and 5% decreased mana usage while wearing the Nebula Armor"); + // Betsy's Wings (and dev wings) are the only wings without "Allows flight and free fall" if (item.type == ItemID.BetsyWings) - AddWingStats(6f, 2.5f, 1, 150); + AddWingStats2(6f, 2.5f, 1, 150, null, "Equipable"); #endregion // Provide the full stats of every vanilla grappling hook From 65a6ef3b47b956f994768d53035f2aa157b73b1b Mon Sep 17 00:00:00 2001 From: ben-tk <45545085+ben-tk@users.noreply.github.com> Date: Fri, 31 Dec 2021 10:28:06 -0500 Subject: [PATCH 17/35] removed expert tags on a few mounts --- Items/Mounts/Brimrose.cs | 1 - Items/Mounts/Fabsol.cs | 1 - Items/Mounts/SquishyBeanMount.cs | 1 - 3 files changed, 3 deletions(-) diff --git a/Items/Mounts/Brimrose.cs b/Items/Mounts/Brimrose.cs index 654f4b5f95..2679ac078f 100644 --- a/Items/Mounts/Brimrose.cs +++ b/Items/Mounts/Brimrose.cs @@ -19,7 +19,6 @@ namespace CalamityMod.Items.Mounts item.useTime = 20; item.useAnimation = 20; item.useStyle = ItemUseStyleID.SwingThrow; - item.expert = true; item.UseSound = SoundID.Item3; item.noMelee = true; item.mountType = ModContent.MountType(); diff --git a/Items/Mounts/Fabsol.cs b/Items/Mounts/Fabsol.cs index b580f6025b..30549091b9 100644 --- a/Items/Mounts/Fabsol.cs +++ b/Items/Mounts/Fabsol.cs @@ -20,7 +20,6 @@ namespace CalamityMod.Items.Mounts item.useTime = 20; item.useAnimation = 20; item.useStyle = ItemUseStyleID.SwingThrow; - item.expert = true; item.UseSound = SoundID.Item3; item.noMelee = true; item.mountType = ModContent.MountType(); diff --git a/Items/Mounts/SquishyBeanMount.cs b/Items/Mounts/SquishyBeanMount.cs index 052afbdfa7..b63c30e790 100644 --- a/Items/Mounts/SquishyBeanMount.cs +++ b/Items/Mounts/SquishyBeanMount.cs @@ -19,7 +19,6 @@ namespace CalamityMod.Items.Mounts item.useTime = 20; item.useAnimation = 20; item.useStyle = ItemUseStyleID.SwingThrow; - item.expert = true; item.UseSound = SoundID.Item3; item.noMelee = true; item.mountType = ModContent.MountType(); From 8288925dc7bf4f17f98cc80e02d30b73b4bef5f4 Mon Sep 17 00:00:00 2001 From: ben-tk <45545085+ben-tk@users.noreply.github.com> Date: Fri, 31 Dec 2021 10:30:07 -0500 Subject: [PATCH 18/35] this is literally the definition of nitpicky and biased????? --- Items/Weapons/Melee/ElementalExcalibur.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Items/Weapons/Melee/ElementalExcalibur.cs b/Items/Weapons/Melee/ElementalExcalibur.cs index 8120dea02e..c28615424d 100644 --- a/Items/Weapons/Melee/ElementalExcalibur.cs +++ b/Items/Weapons/Melee/ElementalExcalibur.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Melee item.width = 92; item.height = 92; item.value = Item.buyPrice(5, 0, 0, 0); - item.rare = ItemRarityID.Red; + item.rare = ItemRarityID.Purple; item.shoot = ModContent.ProjectileType(); item.shootSpeed = 6f; item.Calamity().customRarity = CalamityRarity.Rainbow; From 9713ea1bcac8d9f60d2707a436b61d0b76ed4e33 Mon Sep 17 00:00:00 2001 From: ben-tk <45545085+ben-tk@users.noreply.github.com> Date: Fri, 31 Dec 2021 10:51:58 -0500 Subject: [PATCH 19/35] updated scal's summon info in boss checklist --- Items/Placeables/{ => Furniture}/SCalAltarItem.cs | 4 ++-- Items/Placeables/{ => Furniture}/SCalAltarItem.png | Bin ModSupport/WeakReferenceSupport.cs | 9 ++++++--- Tiles/CalamityGlobalTile.cs | 1 + Tiles/{ => Furniture}/SCalAltar.cs | 4 ++-- Tiles/{ => Furniture}/SCalAltar.png | Bin 6 files changed, 11 insertions(+), 7 deletions(-) rename Items/Placeables/{ => Furniture}/SCalAltarItem.cs (94%) rename Items/Placeables/{ => Furniture}/SCalAltarItem.png (100%) rename Tiles/{ => Furniture}/SCalAltar.cs (98%) rename Tiles/{ => Furniture}/SCalAltar.png (100%) diff --git a/Items/Placeables/SCalAltarItem.cs b/Items/Placeables/Furniture/SCalAltarItem.cs similarity index 94% rename from Items/Placeables/SCalAltarItem.cs rename to Items/Placeables/Furniture/SCalAltarItem.cs index 325efe2987..6c4384fb4d 100644 --- a/Items/Placeables/SCalAltarItem.cs +++ b/Items/Placeables/Furniture/SCalAltarItem.cs @@ -1,10 +1,10 @@ using CalamityMod.Items.Materials; -using CalamityMod.Tiles; +using CalamityMod.Tiles.Furniture; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables +namespace CalamityMod.Items.Placeables.Furniture { public class SCalAltarItem : ModItem { diff --git a/Items/Placeables/SCalAltarItem.png b/Items/Placeables/Furniture/SCalAltarItem.png similarity index 100% rename from Items/Placeables/SCalAltarItem.png rename to Items/Placeables/Furniture/SCalAltarItem.png diff --git a/ModSupport/WeakReferenceSupport.cs b/ModSupport/WeakReferenceSupport.cs index 841a387884..a593a631da 100644 --- a/ModSupport/WeakReferenceSupport.cs +++ b/ModSupport/WeakReferenceSupport.cs @@ -596,12 +596,15 @@ namespace CalamityMod { BossDifficulty.TryGetValue("SupremeCalamitas", out float order); int type = NPCType(); - int summon = ItemType(); + int summon1 = ItemType(); + int summon2 = ItemType(); + int altar = ItemType(); + List summons = new List() { summon1, summon2 }; List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; - string instructions = $"Use an [i:{summon}]"; + string instructions = $"Use [i:{summon1}] or a [i:{summon2}] as offering at an [i:{altar}]"; string despawn = CalamityUtils.ColorMessage("Please don't waste my time.", new Color(0xFF, 0xA5, 0x00)); - AddBoss(bossChecklist, calamity, "Supreme Calamitas", order, type, DownedSCal, summon, loot, collection, instructions, despawn); + AddBoss(bossChecklist, calamity, "Supreme Calamitas", order, type, DownedSCal, summons, loot, collection, instructions, despawn); } // Adult Eidolon Wyrm diff --git a/Tiles/CalamityGlobalTile.cs b/Tiles/CalamityGlobalTile.cs index e52274a8e1..0c4a2fb3e9 100644 --- a/Tiles/CalamityGlobalTile.cs +++ b/Tiles/CalamityGlobalTile.cs @@ -9,6 +9,7 @@ using CalamityMod.Tiles.AstralDesert; using CalamityMod.Tiles.Crags; using CalamityMod.Tiles.DraedonStructures; using CalamityMod.Tiles.DraedonSummoner; +using CalamityMod.Tiles.Furniture; using CalamityMod.Tiles.FurnitureExo; using CalamityMod.Tiles.Ores; using CalamityMod.Tiles.SunkenSea; diff --git a/Tiles/SCalAltar.cs b/Tiles/Furniture/SCalAltar.cs similarity index 98% rename from Tiles/SCalAltar.cs rename to Tiles/Furniture/SCalAltar.cs index 74239da3d5..31d062999f 100644 --- a/Tiles/SCalAltar.cs +++ b/Tiles/Furniture/SCalAltar.cs @@ -1,6 +1,6 @@ using CalamityMod.Events; using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Furniture; using CalamityMod.Items.SummonItems; using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.Projectiles.Boss; @@ -13,7 +13,7 @@ using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; -namespace CalamityMod.Tiles +namespace CalamityMod.Tiles.Furniture { public class SCalAltar : ModTile { diff --git a/Tiles/SCalAltar.png b/Tiles/Furniture/SCalAltar.png similarity index 100% rename from Tiles/SCalAltar.png rename to Tiles/Furniture/SCalAltar.png From 30b0cba21d1cf760cd027ade042d066c75dada49 Mon Sep 17 00:00:00 2001 From: ben-tk <45545085+ben-tk@users.noreply.github.com> Date: Fri, 31 Dec 2021 11:01:25 -0500 Subject: [PATCH 20/35] fixed Lihzahrd typos --- NPCs/TownNPCs/SEAHOE.cs | 2 +- TileEntities/TECodebreaker.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/NPCs/TownNPCs/SEAHOE.cs b/NPCs/TownNPCs/SEAHOE.cs index 50d6ec4d05..062c47d2f1 100644 --- a/NPCs/TownNPCs/SEAHOE.cs +++ b/NPCs/TownNPCs/SEAHOE.cs @@ -269,7 +269,7 @@ namespace CalamityMod.NPCs.TownNPCs displayThisText = "Be careful when defeating Plantera and the Golem. You might accidentally unleash a new threat in the jungle that needs to be quelled."; break; case 7f: - displayThisText = "When exploring the jungle temple be careful. You may not wish to disturb the Lihzard's idol, the Golem. It's quite the destructive force."; + displayThisText = "When exploring the jungle temple be careful. You may not wish to disturb the Lihzahrd's idol, the Golem. It's quite the destructive force."; break; } } diff --git a/TileEntities/TECodebreaker.cs b/TileEntities/TECodebreaker.cs index 1c0be15821..090e95ed1a 100644 --- a/TileEntities/TECodebreaker.cs +++ b/TileEntities/TECodebreaker.cs @@ -97,7 +97,7 @@ namespace CalamityMod.TileEntities int schematicType = CalamityLists.EncryptedSchematicIDRelationship[HeldSchematicID]; if (schematicType == ModContent.ItemType()) return "Within an army, as weapons do, the soldiers serve different purposes. That distinction is crucial, as the wrong tool in the wrong hands—no matter how potent—may as well be a wooden club.\n" + - "Addendum: Seek out my base of operations closest to the Lihzard’s home. I wish you the best of luck with all sincerity, for it has been a long time since I have had a worthy test subject. "; + "Addendum: Seek out my base of operations closest to the Lihzahrd’s home. I wish you the best of luck with all sincerity, for it has been a long time since I have had a worthy test subject. "; if (schematicType == ModContent.ItemType()) return "As rank progresses, so often does the lethality of equipment. In the hands of competent soldiers, the weapons have the ability to make change. However, competent soldiers take no action but orders from above.\n" + "Addendum: If you read this, you have come far. Do not disappoint. Go now to Hell, for the next component stored in what were once my forges."; From 78766755c9617ea000d7ebb8605c5ea7f79903d8 Mon Sep 17 00:00:00 2001 From: ben-tk <45545085+ben-tk@users.noreply.github.com> Date: Fri, 31 Dec 2021 11:15:20 -0500 Subject: [PATCH 21/35] removed weird oddity in code (nothing actually changes) --- NPCs/Yharon/Yharon.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NPCs/Yharon/Yharon.cs b/NPCs/Yharon/Yharon.cs index a24c4cc619..77b713a214 100644 --- a/NPCs/Yharon/Yharon.cs +++ b/NPCs/Yharon/Yharon.cs @@ -2852,7 +2852,7 @@ namespace CalamityMod.NPCs.Yharon DropHelper.DropItem(npc, ModContent.ItemType(), true, soulFragMin, soulFragMax); // Equipment - DropHelper.DropItem(npc, ModContent.ItemType(), Main.expertMode); + DropHelper.DropItem(npc, ModContent.ItemType()); } // Vanity From 0163b9922d9b058e7458f841fd33f8f61d994072 Mon Sep 17 00:00:00 2001 From: ben-tk <45545085+ben-tk@users.noreply.github.com> Date: Fri, 31 Dec 2021 11:20:27 -0500 Subject: [PATCH 22/35] umbraphile armor now spawns more than one dust lol --- Projectiles/Rogue/UmbraphileBoom.cs | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/Projectiles/Rogue/UmbraphileBoom.cs b/Projectiles/Rogue/UmbraphileBoom.cs index 249b682b03..972b3d8891 100644 --- a/Projectiles/Rogue/UmbraphileBoom.cs +++ b/Projectiles/Rogue/UmbraphileBoom.cs @@ -30,16 +30,19 @@ namespace CalamityMod.Projectiles.Rogue public override void Kill(int timeLeft) { - int dustType = Main.rand.NextBool() ? 246 : 176; - float dustSpeed = Main.rand.NextFloat(3f, 9f); - Vector2 dustVel = CalamityUtils.RandomVelocity(10f, dustSpeed, dustSpeed, 1f); - int boom = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 1f); - Dust dust = Main.dust[boom]; - dust.noGravity = true; - dust.position = projectile.Center; - dust.position.X += (float)Main.rand.Next(-10, 11); - dust.position.Y += (float)Main.rand.Next(-10, 11); - dust.velocity = dustVel; + for (int s = 0; s < 20; s++) + { + int dustType = Main.rand.NextBool() ? 246 : 176; + float dustSpeed = Main.rand.NextFloat(3f, 9f); + Vector2 dustVel = CalamityUtils.RandomVelocity(10f, dustSpeed, dustSpeed, 1f); + int boom = Dust.NewDust(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 100, default, 1f); + Dust dust = Main.dust[boom]; + dust.noGravity = true; + dust.position = projectile.Center; + dust.position.X += (float)Main.rand.Next(-10, 11); + dust.position.Y += (float)Main.rand.Next(-10, 11); + dust.velocity = dustVel; + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) From d2d677d9aad74538f044c12813e9cb3eb8244f09 Mon Sep 17 00:00:00 2001 From: ben-tk <45545085+ben-tk@users.noreply.github.com> Date: Fri, 31 Dec 2021 11:23:04 -0500 Subject: [PATCH 23/35] rewrote an Amidias quote --- NPCs/TownNPCs/SEAHOE.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NPCs/TownNPCs/SEAHOE.cs b/NPCs/TownNPCs/SEAHOE.cs index 062c47d2f1..829e2d853f 100644 --- a/NPCs/TownNPCs/SEAHOE.cs +++ b/NPCs/TownNPCs/SEAHOE.cs @@ -296,7 +296,7 @@ namespace CalamityMod.NPCs.TownNPCs displayThisText = "Be careful what you attack in the " + worldEvil + ". You might just unveil a greater threat than what was there before."; break; case 6f: - displayThisText = "Scattered across the lands are shrines dedicated to the gods. You can take whatever is in them, but a few items you may not be able to use until much later."; + displayThisText = "Scattered across the lands are shrines dedicated to the gods. They contain powerful gear that may help you on your adventures."; break; case 7f: displayThisText = "I'm assuming you've heard the legends that speak of the ninja, Statis? There are some who say that if you were able to defeat the gods which his clan once worshipped you would be able to harness some of his powers."; From b78d75949c9ce13a95af2d95058f0b7457ffc978 Mon Sep 17 00:00:00 2001 From: ben-tk <45545085+ben-tk@users.noreply.github.com> Date: Fri, 31 Dec 2021 11:24:15 -0500 Subject: [PATCH 24/35] removed the enforcer's shootspeed stat literally who cares and why --- Items/Weapons/Melee/TheEnforcer.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/Items/Weapons/Melee/TheEnforcer.cs b/Items/Weapons/Melee/TheEnforcer.cs index 2809fa81d2..a97f820084 100644 --- a/Items/Weapons/Melee/TheEnforcer.cs +++ b/Items/Weapons/Melee/TheEnforcer.cs @@ -34,7 +34,6 @@ namespace CalamityMod.Items.Weapons.Melee item.autoReuse = true; item.value = Item.buyPrice(1, 80, 0, 0); item.rare = ItemRarityID.Red; - item.shootSpeed = 24f; item.Calamity().customRarity = CalamityRarity.DarkBlue; } From c408573b6975cd977f23f862fb5496de23342625 Mon Sep 17 00:00:00 2001 From: ben-tk <45545085+ben-tk@users.noreply.github.com> Date: Fri, 31 Dec 2021 11:34:21 -0500 Subject: [PATCH 25/35] fixed silva wings revive abuse --- CalPlayer/CalamityPlayer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index d46abfb569..98995d5a32 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -4470,7 +4470,7 @@ namespace CalamityMod.CalPlayer if (silvaSet && silvaCountdown > 0) { - if (player.FindBuffIndex(ModContent.BuffType()) == -1) + if (player.FindBuffIndex(ModContent.BuffType()) == -1 && !hasSilvaEffect) { Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SilvaActivation"), (int)player.position.X, (int)player.position.Y); From b30f357496577c02f98e0138e8594ae669372357 Mon Sep 17 00:00:00 2001 From: ben-tk <45545085+ben-tk@users.noreply.github.com> Date: Fri, 31 Dec 2021 11:39:09 -0500 Subject: [PATCH 26/35] I think this is better --- CalPlayer/CalamityPlayer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 98995d5a32..6ae1ad6f68 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -4470,7 +4470,7 @@ namespace CalamityMod.CalPlayer if (silvaSet && silvaCountdown > 0) { - if (player.FindBuffIndex(ModContent.BuffType()) == -1 && !hasSilvaEffect) + if (silvaCountdown == 480 && !hasSilvaEffect) { Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SilvaActivation"), (int)player.position.X, (int)player.position.Y); From 424cb4f7ee809c6f0b8a1219ecd88794be94079f Mon Sep 17 00:00:00 2001 From: ben-tk <45545085+ben-tk@users.noreply.github.com> Date: Fri, 31 Dec 2021 12:09:34 -0500 Subject: [PATCH 27/35] moved firefly statue IL edits to the IL Changes files --- ILEditing/ILChangesLoading.cs | 1 + ILEditing/MechanicILChanges.cs | 87 ++++++++++++++++++++++++++++++++ NPCs/Astral/Twinkler.cs | 90 ---------------------------------- 3 files changed, 88 insertions(+), 90 deletions(-) diff --git a/ILEditing/ILChangesLoading.cs b/ILEditing/ILChangesLoading.cs index 222f8d54cb..ce55c7ec3a 100644 --- a/ILEditing/ILChangesLoading.cs +++ b/ILEditing/ILChangesLoading.cs @@ -51,6 +51,7 @@ namespace CalamityMod.ILEditing IL.Terraria.Main.oldDrawWater += DrawCustomLava3; IL.Terraria.WaterfallManager.DrawWaterfall += DrawCustomLavafalls; On.Terraria.NPC.Collision_DecideFallThroughPlatforms += EnableCalamityBossPlatformCollision; + IL.Terraria.Wiring.HitWireSingle += AddTwinklersToStatue; // Damage and health balance IL.Terraria.Main.DamageVar += AdjustDamageVariance; diff --git a/ILEditing/MechanicILChanges.cs b/ILEditing/MechanicILChanges.cs index 41fc99867d..9c89c713e7 100644 --- a/ILEditing/MechanicILChanges.cs +++ b/ILEditing/MechanicILChanges.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.CalPlayer; +using CalamityMod.NPCs.Astral; using CalamityMod.NPCs.AstrumAureus; using CalamityMod.NPCs.Crabulon; using CalamityMod.NPCs.Ravager; @@ -647,5 +648,91 @@ namespace CalamityMod.ILEditing cursor.Emit(OpCodes.Stloc, 51); } #endregion Custom Lava Visuals + + #region Statue Additions + /// + /// Change the following code sequence in Wiring.HitWireSingle + /// num8 = (int) Utils.SelectRandom(Main.rand, new short[2] + /// { + /// 355, + /// 358 + /// }); + /// + /// to + /// + /// var arr = new short[2] + /// { + /// 355, + /// 358 + /// }); + /// arr = arr.ToList().Add(id).ToArray(); + /// num8 = Utils.SelectRandom(Main.rand, arr); + /// + /// + /// + private static void AddTwinklersToStatue(ILContext il) + { + // obtain a cursor positioned before the first instruction of the method + // the cursor is used for navigating and modifying the il + var c = new ILCursor(il); + + // the exact location for this hook is very complex to search for due to the hook instructions not being unique, and buried deep in control flow + // switch statements are sometimes compiled to if-else chains, and debug builds litter the code with no-ops and redundant locals + + // in general you want to search using structure and function rather than numerical constants which may change across different versions or compile settings + // using local variable indices is almost always a bad idea + + // we can search for + // switch (*) + // case 54: + // Utils.SelectRandom * + + // in general you'd want to look for a specific switch variable, or perhaps the containing switch (type) { case 105: + // but the generated IL is really variable and hard to match in this case + + // we'll just use the fact that there are no other switch statements with case 54, followed by a SelectRandom + + ILLabel[] targets = null; + while (c.TryGotoNext(i => i.MatchSwitch(out targets))) + { + // some optimising compilers generate a sub so that all the switch cases start at 0 + // ldc.i4.s 51 + // sub + // switch + int offset = 0; + if (c.Prev.MatchSub() && c.Prev.Previous.MatchLdcI4(out offset)) + { + ; + } + + // get the label for case 54: if it exists + int case54Index = 54 - offset; + if (case54Index < 0 || case54Index >= targets.Length || !(targets[case54Index] is ILLabel target)) + { + continue; + } + + // move the cursor to case 54: + c.GotoLabel(target); + // there's lots of extra checks we could add here to make sure we're at the right spot, such as not encountering any branching instructions + c.GotoNext(i => i.MatchCall(typeof(Utils), nameof(Utils.SelectRandom))); + + // goto next positions us before the instruction we searched for, so we can insert our array modifying code right here + c.EmitDelegate>(arr => + { + // resize the array and add our custom firefly + Array.Resize(ref arr, arr.Length+1); + arr[arr.Length-1] = (short)ModContent.NPCType(); + return arr; + }); + + // hook applied successfully + return; + } + + // couldn't find the right place to insert + throw new Exception("Hook location not found, switch(*) { case 54: ..."); + } + #endregion Statue Additions } } diff --git a/NPCs/Astral/Twinkler.cs b/NPCs/Astral/Twinkler.cs index 1cc77dad77..44b5f588bf 100644 --- a/NPCs/Astral/Twinkler.cs +++ b/NPCs/Astral/Twinkler.cs @@ -76,95 +76,5 @@ namespace CalamityMod.NPCs.Astral return; } } - - public override bool Autoload(ref string name) - { - IL.Terraria.Wiring.HitWireSingle += HookStatue; - return base.Autoload(ref name); - } - - /// - /// Change the following code sequence in Wiring.HitWireSingle - /// num8 = (int) Utils.SelectRandom(Main.rand, new short[2] - /// { - /// 355, - /// 358 - /// }); - /// - /// to - /// - /// var arr = new short[2] - /// { - /// 355, - /// 358 - /// }); - /// arr = arr.ToList().Add(id).ToArray(); - /// num8 = Utils.SelectRandom(Main.rand, arr); - /// - /// - /// - private void HookStatue(ILContext il) - { - // obtain a cursor positioned before the first instruction of the method - // the cursor is used for navigating and modifying the il - var c = new ILCursor(il); - - // the exact location for this hook is very complex to search for due to the hook instructions not being unique, and buried deep in control flow - // switch statements are sometimes compiled to if-else chains, and debug builds litter the code with no-ops and redundant locals - - // in general you want to search using structure and function rather than numerical constants which may change across different versions or compile settings - // using local variable indices is almost always a bad idea - - // we can search for - // switch (*) - // case 54: - // Utils.SelectRandom * - - // in general you'd want to look for a specific switch variable, or perhaps the containing switch (type) { case 105: - // but the generated IL is really variable and hard to match in this case - - // we'll just use the fact that there are no other switch statements with case 54, followed by a SelectRandom - - ILLabel[] targets = null; - while (c.TryGotoNext(i => i.MatchSwitch(out targets))) - { - // some optimising compilers generate a sub so that all the switch cases start at 0 - // ldc.i4.s 51 - // sub - // switch - int offset = 0; - if (c.Prev.MatchSub() && c.Prev.Previous.MatchLdcI4(out offset)) - { - ; - } - - // get the label for case 54: if it exists - int case54Index = 54 - offset; - if (case54Index < 0 || case54Index >= targets.Length || !(targets[case54Index] is ILLabel target)) - { - continue; - } - - // move the cursor to case 54: - c.GotoLabel(target); - // there's lots of extra checks we could add here to make sure we're at the right spot, such as not encountering any branching instructions - c.GotoNext(i => i.MatchCall(typeof(Utils), nameof(Utils.SelectRandom))); - - // goto next positions us before the instruction we searched for, so we can insert our array modifying code right here - c.EmitDelegate>(arr => - { - // resize the array and add our custom firefly - Array.Resize(ref arr, arr.Length+1); - arr[arr.Length-1] = (short)ModContent.NPCType(); - return arr; - }); - - // hook applied successfully - return; - } - - // couldn't find the right place to insert - throw new Exception("Hook location not found, switch(*) { case 54: ..."); - } } } From 3adb7d7ca946f1c06f7b85fb9508a99d66bd4f63 Mon Sep 17 00:00:00 2001 From: ben-tk <45545085+ben-tk@users.noreply.github.com> Date: Fri, 31 Dec 2021 12:47:12 -0500 Subject: [PATCH 28/35] draconic elixir resprite --- Items/Potions/DraconicElixir.cs | 18 ++++++++++++++++++ Items/Potions/DraconicElixir.png | Bin 893 -> 476 bytes Items/Potions/DraconicElixir_Animated.png | Bin 0 -> 5112 bytes 3 files changed, 18 insertions(+) create mode 100644 Items/Potions/DraconicElixir_Animated.png diff --git a/Items/Potions/DraconicElixir.cs b/Items/Potions/DraconicElixir.cs index 2a87dfaa3c..1749fd7577 100644 --- a/Items/Potions/DraconicElixir.cs +++ b/Items/Potions/DraconicElixir.cs @@ -1,5 +1,7 @@ using CalamityMod.Buffs.Potions; using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,6 +10,8 @@ namespace CalamityMod.Items.Potions { public class DraconicElixir : ModItem { + public int frameCounter = 0; + public int frame = 0; public override void SetStaticDefaults() { DisplayName.SetDefault("Draconic Elixir"); @@ -35,6 +39,20 @@ namespace CalamityMod.Items.Potions public override bool CanUseItem(Player player) => !player.Calamity().draconicSurgeCooldown; + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frameI, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Potions/DraconicElixir_Animated"); + spriteBatch.Draw(texture, position, item.GetCurrentFrame(ref frame, ref frameCounter, 8, 10), Color.White, 0f, origin, scale, SpriteEffects.None, 0); + return false; + } + + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) + { + Texture2D texture = ModContent.GetTexture("CalamityMod/Items/Potions/DraconicElixir_Animated"); + spriteBatch.Draw(texture, item.position - Main.screenPosition, item.GetCurrentFrame(ref frame, ref frameCounter, 8, 10), lightColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0); + return false; + } + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); diff --git a/Items/Potions/DraconicElixir.png b/Items/Potions/DraconicElixir.png index cf908b428a438a9b5474943f1912b4f93bda4069..86797c6f8e3de1ee61477908b338a80a07ae9244 100644 GIT binary patch literal 476 zcmeAS@N?(olHy`uVBq!ia0vp^MnJ5?!3-n?Y^5`R6k~CayA#8@b22Z19F}xPUq=Rp zjs4tz5?O(K%K)DcS8YFTr(!na!>my%qGy)HPpNeKd^WAjLrspIty)kkmWStkvBYE} zqi-8(kE-RL_EG!)|Njr2|3KY`eD>Z2Qo{g;Z4(}HjE$csTxSB);PV|Wc4CE#bV0B9L~=7 zyT9*P$HTf#GswlH<@ep40t*E8mLC*ddZ4G#>BcsJZ!E=mdn6W$aDF`gSf?lG1B=p$ zSMz&J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U&O#+0L=lR?8kBi7Rr%6Q=1~ki<4I`x$ z8nwf3@JBz6ci9E7T2%e<46rXpMOovM0T&492+NXZAI;Z3tO%bv_c>jc)u$U}pf3dX zc0|nm-qzG{_#dM6u>o+KTnz+s6905ZOw40(1r9TARRypYD z+N1bn{ka{It@h+7K2P?C7=UN21Zq?Dj)k>;P%t?|L6WdkC8sF9xf%9m{dRu#6wz-K z;DG2Bj)bDplxNQ%8Vc<0g5L!h~6bnF<_uT+3(yQuX)R<^j<(FB#c|$wz>hk z;{yP#KXWPW?=`EK7f=3Kuo8*)Y*(xH*vQCj1&$GXoH6bT825Mg^IkigSpjMFyKKrD+ASj8Lcg^$Q8 z>wLQvng20tZ2_+GRqlbnTDpaMFrFziyK{UiN!yN*bhg^m&0JXbHpnHc@gyG5q#PBa zt{p`c`6031r4pj8E1y#qv~tg%B>Kf!i-w3uAaXUF2-}T}uPJa3maHmTo#|Kn?E}!Q z>?DbmJA3egj=SnzVtN};X~$T*a)WBDf`LhMPRRdwO+MF#ZGRT_6Vt>RC`ikIDVw|Z*cJmM<9+uOKjY&zN4?bH zyXbyjy|vR3xueo}3dmZAw1hYdM}EmqNFhZ{XUds`Z;J>FYeN0 zBg$Hx)Cxb^_6L3Rr(B(By@~eE{XHvhm0FDRX!1(O;R#bfm^gVpqE&=|KNYDI?CJN4Q80|{i}zBLSVrp-@qRyw9oO$R~(QP^)T7r z|1RMF@uQRfuq{7%0@!i_@}Jpq8V*mL`}R)6U!*TbLpBbzY0ky4)ElTtzK2RP9f)1; z>I^lACFvn-yG@q^&OPwOY?EQ3J(B?Q-n@3;nL&w`#fa9dI46m{cg>SiF?{-bB zP`jJl_veyq1QYSNNKdRJB6c># literal 0 HcmV?d00001 From 4f3e2bcf543c2018efda3b8d5fc551ffdf348b4a Mon Sep 17 00:00:00 2001 From: ben-tk <45545085+ben-tk@users.noreply.github.com> Date: Sat, 1 Jan 2022 00:24:05 -0500 Subject: [PATCH 29/35] seared pan tooltip tweak --- Items/Weapons/Rogue/SearedPan.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Items/Weapons/Rogue/SearedPan.cs b/Items/Weapons/Rogue/SearedPan.cs index 281bee2dd7..bca1c5c2a6 100644 --- a/Items/Weapons/Rogue/SearedPan.cs +++ b/Items/Weapons/Rogue/SearedPan.cs @@ -19,8 +19,8 @@ namespace CalamityMod.Items.Weapons.Rogue "Fires a frying pan at high velocity\n" + "Enemy hits summon fireballs that linger around the target\n" + "Landing three consecutive hits grants full stealth\n" + - "Stealth strikes explode into golden sparks and after hitting an enemy,\n" + - "cause all fireballs to aggressively home in on their target"); + "Stealth strikes explode into golden sparks, and after hitting an enemy,\n" + + "they cause all fireballs to aggressively home in on their target"); } public override void SafeSetDefaults() From e0822fe09fd34a888ff7e65a5f08e6f7f3119ec8 Mon Sep 17 00:00:00 2001 From: ben-tk <45545085+ben-tk@users.noreply.github.com> Date: Sun, 2 Jan 2022 23:51:28 -0500 Subject: [PATCH 30/35] increased endo hydra aggression range --- Projectiles/Summon/EndoHydraBody.cs | 2 +- Projectiles/Summon/EndoHydraHead.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Projectiles/Summon/EndoHydraBody.cs b/Projectiles/Summon/EndoHydraBody.cs index 399ffed384..a994ea7fec 100644 --- a/Projectiles/Summon/EndoHydraBody.cs +++ b/Projectiles/Summon/EndoHydraBody.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Projectiles.Summon get => (int)projectile.ai[0]; set => projectile.ai[0] = value; } - public const float DistanceToCheck = 1600f; + public const float DistanceToCheck = 2800f; public override void SetStaticDefaults() { DisplayName.SetDefault("Hydra Body"); diff --git a/Projectiles/Summon/EndoHydraHead.cs b/Projectiles/Summon/EndoHydraHead.cs index 84a73682f6..b04daf0058 100644 --- a/Projectiles/Summon/EndoHydraHead.cs +++ b/Projectiles/Summon/EndoHydraHead.cs @@ -112,7 +112,7 @@ namespace CalamityMod.Projectiles.Summon Vector2 returnPosition = body.Center + new Vector2(body.spriteDirection == 1 ? 12 : -14, -50f) + DeltaPositionMoving; // Beam shooting - if (body.ai[0] >= 0 && body.ai[0] < Main.npc.Length) + if (body.ai[0] >= 0 && body.ai[0] < Main.maxNPCs) { NPC target = Main.npc[(int)body.ai[0]]; bool targetAliveAndInLineOfSight = target.active && projectile.Distance(target.Center) < EndoHydraBody.DistanceToCheck; From 06fd66cce0649958d802b343af4b6dd6e38ab19d Mon Sep 17 00:00:00 2001 From: ben-tk <45545085+ben-tk@users.noreply.github.com> Date: Sun, 2 Jan 2022 23:53:05 -0500 Subject: [PATCH 31/35] fixed cryogenic staff rarity --- Items/Weapons/Summon/CryogenicStaff.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Items/Weapons/Summon/CryogenicStaff.cs b/Items/Weapons/Summon/CryogenicStaff.cs index 447ad6c66d..ce9f23f9a3 100644 --- a/Items/Weapons/Summon/CryogenicStaff.cs +++ b/Items/Weapons/Summon/CryogenicStaff.cs @@ -30,7 +30,7 @@ Fire rate and range increase the longer it targets an enemy"); item.knockBack = 4f; item.value = CalamityGlobalItem.Rarity6BuyPrice; - item.rare = ItemRarityID.Purple; + item.rare = ItemRarityID.LightPurple; item.Calamity().devItem = true; item.UseSound = SoundID.Item78; From 38c7be38c61d594eaa740dff87134d733b861d4c Mon Sep 17 00:00:00 2001 From: Dominic Date: Sat, 1 Jan 2022 17:56:44 -0600 Subject: [PATCH 32/35] Ash dissipation death effect --- Buffs/RancorBurn.cs | 26 ++ Buffs/RancorBurn.png | Bin 0 -> 358 bytes CalamityMod.cs | 16 +- ILEditing/ILChangesLoading.cs | 2 + ILEditing/MechanicILChanges.cs | 15 ++ NPCs/CalamityGlobalNPC.cs | 12 +- NPCs/SupremeCalamitas/SupremeCataclysm.cs | 23 +- NPCs/SupremeCalamitas/SupremeCatastrophe.cs | 23 +- NPCs/Yharon/Yharon.cs | 5 + Particles/BaseFusableParticleSet.cs | 2 +- Particles/DeathAshParticle.cs | 250 ++++++++++++++++++++ Projectiles/Magic/RancorLaserbeam.cs | 12 +- 12 files changed, 359 insertions(+), 27 deletions(-) create mode 100644 Buffs/RancorBurn.cs create mode 100644 Buffs/RancorBurn.png create mode 100644 Particles/DeathAshParticle.cs diff --git a/Buffs/RancorBurn.cs b/Buffs/RancorBurn.cs new file mode 100644 index 0000000000..0d4b6ba9b4 --- /dev/null +++ b/Buffs/RancorBurn.cs @@ -0,0 +1,26 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs +{ + public class RancorBurn : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Rancor Burn"); + Description.SetDefault("Burning"); + Main.debuff[Type] = true; + Main.buffNoSave[Type] = true; + Main.buffNoTimeDisplay[Type] = true; + canBeCleared = false; + } + + public override void Update(NPC npc, ref int buffIndex) + { + if (npc.Calamity().RancorBurnTime < npc.buffTime[buffIndex]) + npc.Calamity().RancorBurnTime = npc.buffTime[buffIndex]; + npc.DelBuff(buffIndex); + buffIndex--; + } + } +} diff --git a/Buffs/RancorBurn.png b/Buffs/RancorBurn.png new file mode 100644 index 0000000000000000000000000000000000000000..f7e99e7e26cef18d2148c3ad51b16ff887c861f5 GIT binary patch literal 358 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabR7dyjKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCijS1AIbUfwZrso2`cJS`)X&{{Bw#u8CrnX@O}P5(Zrg20+=4$WzHcin}Dp zFZe$kFnIYhegX<}7I;J!GcfQS24TkI`72U@g4;b^978Ppmrf4kJFLLtoY-Qp~Z5+Ujlf?)i8>gi9dl+U}XVXP$~|I4QCF466+r ze=1|hYBBa3hMO4@Gd7fem&-aU`#|`U*ad;vMoHRx*6Z~hFg_wCx9G&&u#d$JZPJb| zQ>L?aG_PIodq&+Z3#O=^rItBN=QtbYvl^svF!+47IndHkyehC)#DxFEB}e8L^Vsh& me(S!Z-aMW8-=E#rs~GJL@TRtRzS{!y0)wZkpUXO@geCxKg@lv< literal 0 HcmV?d00001 diff --git a/CalamityMod.cs b/CalamityMod.cs index eff183f798..3a898ee113 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -299,7 +299,7 @@ namespace CalamityMod CalamityShaders.LoadShaders(); FusableParticleManager.LoadParticleRenderSets(); - Main.OnPreDraw += _ => FusableParticleManager.PrepareFusableParticleTargets(); + Main.OnPreDraw += PrepareRenderTargets; RipperUI.Load(); AstralArcanumUI.Load(this); @@ -384,7 +384,7 @@ namespace CalamityMod TileFraming.Unload(); FusableParticleManager.UnloadParticleRenderSets(); - Main.OnPreDraw -= _ => FusableParticleManager.PrepareFusableParticleTargets(); + Main.OnPreDraw -= PrepareRenderTargets; RipperUI.Unload(); AstralArcanumUI.Unload(); @@ -422,6 +422,14 @@ namespace CalamityMod } #endregion + #region Render Target Management + public static void PrepareRenderTargets(GameTime gameTime) + { + FusableParticleManager.PrepareFusableParticleTargets(); + DeathAshParticle.PrepareRenderTargets(); + } + #endregion Render Target Management + #region ConfigCrap internal static void SaveConfig(CalamityConfig cfg) { @@ -1578,6 +1586,10 @@ namespace CalamityMod public override void MidUpdateTimeWorld() => TileEntityTimeHandler.Update(); #endregion + #region Ash Drawing + public override void MidUpdateItemDust() => DeathAshParticle.UpdateAll(); + #endregion Ash Drawing + #region Post NPC Updating // TODO - Apply caching to this process. For now most of the looping issues should be eradicated but it can be reduced further. public override void MidUpdateNPCGore() => CalamityGlobalTownNPC.ResetTownNPCNameBools(); diff --git a/ILEditing/ILChangesLoading.cs b/ILEditing/ILChangesLoading.cs index ce55c7ec3a..f2beb36ff8 100644 --- a/ILEditing/ILChangesLoading.cs +++ b/ILEditing/ILChangesLoading.cs @@ -45,6 +45,7 @@ namespace CalamityMod.ILEditing IL.Terraria.Player.ItemCheck += ApplyManaBurnIfNeeded; IL.Terraria.Player.AddBuff += AllowBuffTimeStackingForManaBurn; IL.Terraria.Main.DoDraw += DrawFusableParticles; + IL.Terraria.Main.DoDraw += DrawAshParticles; On.Terraria.Main.SetDisplayMode += ResetRenderTargetSizes; IL.Terraria.Main.DrawTiles += DrawCustomLava; IL.Terraria.GameContent.Liquid.LiquidRenderer.InternalDraw += DrawCustomLava2; @@ -118,6 +119,7 @@ namespace CalamityMod.ILEditing IL.Terraria.Player.ItemCheck -= ApplyManaBurnIfNeeded; IL.Terraria.Player.AddBuff -= AllowBuffTimeStackingForManaBurn; IL.Terraria.Main.DoDraw -= DrawFusableParticles; + IL.Terraria.Main.DoDraw -= DrawAshParticles; On.Terraria.Main.SetDisplayMode -= ResetRenderTargetSizes; IL.Terraria.Main.DrawTiles -= DrawCustomLava; IL.Terraria.GameContent.Liquid.LiquidRenderer.InternalDraw -= DrawCustomLava2; diff --git a/ILEditing/MechanicILChanges.cs b/ILEditing/MechanicILChanges.cs index 9c89c713e7..39de7df419 100644 --- a/ILEditing/MechanicILChanges.cs +++ b/ILEditing/MechanicILChanges.cs @@ -523,6 +523,21 @@ namespace CalamityMod.ILEditing } #endregion Fusable Particle Rendering + #region Ash Particle Rendering + private static void DrawAshParticles(ILContext il) + { + ILCursor cursor = new ILCursor(il); + + // Over NPCs but before Projectiles. + if (!cursor.TryGotoNext(c => c.MatchCallOrCallvirt
("DrawDust"))) + { + LogFailure("Ash Particle Rendering", "Could not locate the DrawDust reference method to attach to."); + return; + } + cursor.EmitDelegate(DeathAshParticle.DrawAll); + } + #endregion Ash Particle Rendering + #region Custom Lava Visuals private static void ResetRenderTargetSizes(On.Terraria.Main.orig_SetDisplayMode orig, int width, int height, bool fullscreen) { diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index ab9241d36c..d8e7a4f934 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -218,9 +218,10 @@ namespace CalamityMod.NPCs public int vulnerabilityHex = 0; public int banishingFire = 0; public int wither = 0; + public int RancorBurnTime = 0; - // whoAmI Variables - public static int[] bobbitWormBottom = new int[5]; + // whoAmI Variables + public static int[] bobbitWormBottom = new int[5]; public static int DD2CrystalIndex = -1; public static int hiveMind = -1; public static int perfHive = -1; @@ -4300,6 +4301,8 @@ namespace CalamityMod.NPCs banishingFire--; if (wither > 0) wither--; + if (RancorBurnTime > 0) + RancorBurnTime--; // Queen Bee is completely immune to having her movement impaired if not in a high difficulty mode. if (npc.type == NPCID.QueenBee && !CalamityWorld.revenge && !CalamityWorld.malice && !BossRushEvent.BossRushActive) @@ -4861,7 +4864,10 @@ namespace CalamityMod.NPCs #region Hit Effect public override void HitEffect(NPC npc, int hitDirection, double damage) { - if (CalamityWorld.revenge) + if (npc.life <= 0 && npc.Organic() && RancorBurnTime > 0) + DeathAshParticle.CreateAshesFromNPC(npc); + + if (CalamityWorld.revenge) { switch (npc.type) { diff --git a/NPCs/SupremeCalamitas/SupremeCataclysm.cs b/NPCs/SupremeCalamitas/SupremeCataclysm.cs index 176d1ec45f..47b0fb99df 100644 --- a/NPCs/SupremeCalamitas/SupremeCataclysm.cs +++ b/NPCs/SupremeCalamitas/SupremeCataclysm.cs @@ -9,6 +9,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Particles; namespace CalamityMod.NPCs.SupremeCalamitas { @@ -51,9 +52,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas npc.noTileCollide = true; npc.HitSound = SoundID.DD2_OgreRoar; npc.DeathSound = SoundID.NPCDeath52; - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToCold = true; - } + npc.Calamity().VulnerableToHeat = false; + npc.Calamity().VulnerableToCold = true; + } public override void SendExtraAI(BinaryWriter writer) { @@ -256,12 +257,12 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void NPCLoot() { - if (!CalamityWorld.malice && !CalamityWorld.revenge) - { - int heartAmt = Main.rand.Next(3) + 3; - for (int i = 0; i < heartAmt; i++) - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Heart); - } + if (!CalamityWorld.malice && !CalamityWorld.revenge) + { + int heartAmt = Main.rand.Next(3) + 3; + for (int i = 0; i < heartAmt; i++) + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Heart); + } DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); } @@ -295,6 +296,10 @@ namespace CalamityMod.NPCs.SupremeCalamitas num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } + + // Turn into dust on death. + if (npc.life <= 0) + DeathAshParticle.CreateAshesFromNPC(npc); } } } diff --git a/NPCs/SupremeCalamitas/SupremeCatastrophe.cs b/NPCs/SupremeCalamitas/SupremeCatastrophe.cs index 7243fd6987..d118c64b73 100644 --- a/NPCs/SupremeCalamitas/SupremeCatastrophe.cs +++ b/NPCs/SupremeCalamitas/SupremeCatastrophe.cs @@ -9,6 +9,7 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Particles; namespace CalamityMod.NPCs.SupremeCalamitas { @@ -52,9 +53,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas npc.noTileCollide = true; npc.HitSound = SoundID.DD2_OgreRoar; npc.DeathSound = SoundID.NPCDeath52; - npc.Calamity().VulnerableToHeat = false; - npc.Calamity().VulnerableToCold = true; - } + npc.Calamity().VulnerableToHeat = false; + npc.Calamity().VulnerableToCold = true; + } public override void SendExtraAI(BinaryWriter writer) { @@ -260,12 +261,12 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void NPCLoot() { - if (!CalamityWorld.malice && !CalamityWorld.revenge) - { - int heartAmt = Main.rand.Next(3) + 3; - for (int i = 0; i < heartAmt; i++) - Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Heart); - } + if (!CalamityWorld.malice && !CalamityWorld.revenge) + { + int heartAmt = Main.rand.Next(3) + 3; + for (int i = 0; i < heartAmt; i++) + Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Heart); + } DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); } @@ -299,6 +300,10 @@ namespace CalamityMod.NPCs.SupremeCalamitas num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } + + // Turn into dust on death. + if (npc.life <= 0) + DeathAshParticle.CreateAshesFromNPC(npc); } } } diff --git a/NPCs/Yharon/Yharon.cs b/NPCs/Yharon/Yharon.cs index 77b713a214..1706880781 100644 --- a/NPCs/Yharon/Yharon.cs +++ b/NPCs/Yharon/Yharon.cs @@ -14,6 +14,7 @@ using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; using CalamityMod.NPCs.TownNPCs; +using CalamityMod.Particles; using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.Rogue; using CalamityMod.Tiles.Ores; @@ -3088,6 +3089,10 @@ namespace CalamityMod.NPCs.Yharon num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 244, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } + + // Turn into dust on death. + if (npc.life <= 0) + DeathAshParticle.CreateAshesFromNPC(npc); } } #endregion diff --git a/Particles/BaseFusableParticleSet.cs b/Particles/BaseFusableParticleSet.cs index d1570da734..d76ad8091c 100644 --- a/Particles/BaseFusableParticleSet.cs +++ b/Particles/BaseFusableParticleSet.cs @@ -87,7 +87,7 @@ namespace CalamityMod.Particles // Clear away any particles that shouldn't exist anymore. Particles.RemoveAll(p => p.Size <= 5f); - // Prepare the sprite batch for specialized drawing in prepration that the graphics device will to new render targets. + // Prepare the sprite batch for specialized drawing in prepration that the graphics device will draw to new render targets. Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.EffectMatrix); // Draw the surviving particles. diff --git a/Particles/DeathAshParticle.cs b/Particles/DeathAshParticle.cs new file mode 100644 index 0000000000..31cce5f707 --- /dev/null +++ b/Particles/DeathAshParticle.cs @@ -0,0 +1,250 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using System.Linq; +using Terraria; +using Terraria.ID; + +namespace CalamityMod.Particles +{ + public class DeathAshParticle + { + internal static Dictionary PendingNPCsToDraw = new Dictionary(); + internal static BasicEffect basicShader = null; + internal static VertexPositionColorTexture[] VertexCache = new VertexPositionColorTexture[PrimitiveBatchSize * 4]; + internal static short[] IndexCache = new short[PrimitiveBatchSize * 6]; + + public int Time; + public int Lifetime; + public int ID; + public float Scale = 1f; + public Color AshColor; + public Vector2 Center; + public Vector2 Velocity; + public Vector2 TopLeft => Center - Vector2.One * Scale * 4f; + public Vector2 TopRight => Center + new Vector2(1f, -1f) * Scale * 4f; + public Vector2 BottomRight => Center + Vector2.One * Scale * 4f; + public Vector2 BottomLeft => Center + new Vector2(-1f, 1f) * Scale * 4f; + + public static HashSet Ashes = new HashSet(); + public const int PrimitiveBatchSize = 256; + public const int AshCountLimit = 45000; + public static BasicEffect BasicShader + { + get + { + if (Main.netMode != NetmodeID.Server && basicShader is null) + { + basicShader = new BasicEffect(Main.instance.GraphicsDevice) + { + VertexColorEnabled = true, + TextureEnabled = false + }; + } + return basicShader; + } + } + + public DeathAshParticle(int lifetime, float brightness, Vector2 spawnPosition) + { + Time = 0; + Lifetime = lifetime; + ID = Ashes.Count; + AshColor = Main.hslToRgb(0f, 0f, brightness * 0.67f); + Scale = Main.rand.NextFloat(0.7f, 1.3f); + Center = spawnPosition; + } + + public static void PrepareRenderTargets() + { + foreach (NPC npc in PendingNPCsToDraw.Keys) + { + // Prepare the sprite batch for specialized drawing in prepration that the graphics device will draw to new render targets. + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Matrix.Identity); + + // Draw the NPC to the temporary render target so that all of its drawcode is localized, and then get the colors from the results. + Main.instance.GraphicsDevice.SetRenderTarget(PendingNPCsToDraw[npc]); + Main.instance.GraphicsDevice.Clear(Color.Transparent); + + Vector2 oldPosition = npc.position; + npc.position = Main.screenPosition + new Vector2(Main.screenWidth, Main.screenHeight) * 0.5f; + try + { + Main.instance.DrawNPC(npc.whoAmI, true); + } + catch { } + npc.position = oldPosition; + npc.Opacity = 0f; + + Main.spriteBatch.End(); + } + Main.instance.GraphicsDevice.SetRenderTarget(null); + } + + public static void CreateAshesFromNPC(NPC npc) + { + // Don't create ashes serverside. + if (Main.netMode == NetmodeID.Server) + return; + + PendingNPCsToDraw[npc] = new RenderTarget2D(Main.instance.GraphicsDevice, Main.screenWidth, Main.screenHeight); + } + + public static Dictionary GetColorCacheFromTexture(Texture2D texture, Rectangle? frame = null, bool pruneForEfficency = false) + { + Dictionary colorCache = new Dictionary(); + Color[] uncleanedCache = new Color[texture.Width * texture.Height]; + texture.GetData(uncleanedCache); + + // Initialize the frame to its default of the texture size if nothing else is specified. + int width = texture.Width; + int height = texture.Height; + if (frame is null) + frame = new Rectangle(0, 0, width, height); + + int stride = 1; + int totalFilledPixels = uncleanedCache.Count(c => c.R != 0 || c.G != 0 || c.B != 0 || c.A != 0); + if (pruneForEfficency && totalFilledPixels > 16000) + stride = 2; + if (pruneForEfficency && totalFilledPixels > 38000) + stride = 3; + + // Store all non-empty pixels. + for (int i = 0; i < width; i += stride) + { + for (int j = 0; j < height; j += stride) + { + Color color = uncleanedCache[i + j * width]; + + // Ignore textures outside the bounds of the frame. + if (i < frame.Value.Left || i >= frame.Value.Right || j < frame.Value.Top || j >= frame.Value.Bottom) + continue; + + if (color.R != 0 || color.G != 0 || color.B != 0 || color.A != 0) + colorCache[new Vector2(i - frame.Value.X, j - frame.Value.Y)] = color; + } + } + return colorCache; + } + + public static void FlushContentsAndCreateAshes() + { + // Don't do anything if no NPCs have to be drawn. + if (PendingNPCsToDraw.Count == 0) + return; + + foreach (NPC npc in PendingNPCsToDraw.Keys) + { + RenderTarget2D temporaryTextureDrawTarget = PendingNPCsToDraw[npc]; + Rectangle frame = new Rectangle(0, 0, temporaryTextureDrawTarget.Width, temporaryTextureDrawTarget.Height); + Dictionary colorsOnNPC = GetColorCacheFromTexture(temporaryTextureDrawTarget, frame, true); + + // Enforce a hard limit on the amount of ashes that can exist. + if (Ashes.Count + colorsOnNPC.Count > AshCountLimit) + break; + + // Create ashes. + foreach (Vector2 drawOffset in colorsOnNPC.Keys) + { + int ashLifetime = Main.rand.Next(75, 115); + + // Adjust the offset of the ashes from pixel space by accounting for direction, rotation, and scale. + Vector2 ashSpawnPosition = npc.position + drawOffset - new Vector2(Main.screenWidth, Main.screenHeight) * 0.5f; + Color color = colorsOnNPC[drawOffset]; + float brightness = (color.R + color.G + color.B) / 765f; + DeathAshParticle ash = new DeathAshParticle(ashLifetime, brightness, ashSpawnPosition) + { + Velocity = (Main.npc.IndexInRange(npc.realLife) ? Main.npc[npc.realLife].velocity : npc.velocity) * 0.7f + }; + + if (brightness > 0.15f) + Ashes.Add(ash); + } + + // And release the render target. + PendingNPCsToDraw[npc].Dispose(); + } + + // Clear the pending NPCs once done. + PendingNPCsToDraw.Clear(); + } + + public static void DrawAll() + { + FlushContentsAndCreateAshes(); + + // Redefine the perspective matrices of the shader. + CalamityUtils.CalculatePerspectiveMatricies(out Matrix effectView, out Matrix effectProjection); + BasicShader.View = effectView; + BasicShader.Projection = effectProjection; + + int batchIndex = 0; + + // Reset the cache before drawing. + Array.Clear(VertexCache, 0, VertexCache.Length); + Array.Clear(IndexCache, 0, IndexCache.Length); + + // Go through all particles and draw them directly with primitives. + // Particles are drawn in batches, to prevent unnecessary overhead in the form of primitive draw preparations. + BasicShader.CurrentTechnique.Passes[0].Apply(); + foreach (DeathAshParticle ash in Ashes) + { + Color fadedAshColor = ash.AshColor * ash.Scale; + + VertexCache[batchIndex * 4] = new VertexPositionColorTexture(new Vector3(ash.TopLeft - Main.screenPosition, 0f), fadedAshColor, new Vector2(0f, 0f)); + VertexCache[batchIndex * 4 + 1] = new VertexPositionColorTexture(new Vector3(ash.TopRight - Main.screenPosition, 0f), fadedAshColor, new Vector2(1f, 0f)); + VertexCache[batchIndex * 4 + 2] = new VertexPositionColorTexture(new Vector3(ash.BottomRight - Main.screenPosition, 0f), fadedAshColor, new Vector2(1f, 1f)); + VertexCache[batchIndex * 4 + 3] = new VertexPositionColorTexture(new Vector3(ash.BottomLeft - Main.screenPosition, 0f), fadedAshColor, new Vector2(0f, 1f)); + + // Construct independent primitives by creating a square from two triangles defined by the edges of the particle. + IndexCache[batchIndex * 6] = (short)(batchIndex * 4); + IndexCache[batchIndex * 6 + 1] = (short)(batchIndex * 4 + 1); + IndexCache[batchIndex * 6 + 2] = (short)(batchIndex * 4 + 2); + IndexCache[batchIndex * 6 + 3] = (short)(batchIndex * 4); + IndexCache[batchIndex * 6 + 4] = (short)(batchIndex * 4 + 2); + IndexCache[batchIndex * 6 + 5] = (short)(batchIndex * 4 + 3); + + batchIndex++; + + // Draw the batch once it is at full capacity. + if (batchIndex >= PrimitiveBatchSize) + { + Main.instance.GraphicsDevice.DrawUserIndexedPrimitives(PrimitiveType.TriangleList, VertexCache, 0, PrimitiveBatchSize * 4, IndexCache, 0, PrimitiveBatchSize * 2); + batchIndex = 0; + } + } + + // Draw any remaining primitives which did not fit neatly into individual batches in the above loop. + // All undeclared vertices in the cache are ignored. + if (batchIndex > 0) + Main.instance.GraphicsDevice.DrawUserIndexedPrimitives(PrimitiveType.TriangleList, VertexCache, 0, batchIndex * 4, IndexCache, 0, batchIndex * 2); + } + + public void Update() + { + float brightness = (AshColor.R + AshColor.G + AshColor.B) / 765f; + + Time++; + Scale = MathHelper.Clamp(Scale - (brightness < 0.1f ? 0.08f : 0.008f), 0f, 1f); + + float dissipationFactor = Utils.InverseLerp(6f, 16f, Velocity.Length(), true); + float velocityInterpolant = Utils.InverseLerp(15f - dissipationFactor * 10f, 60f - dissipationFactor * 35f, Time, true); + Vector2 idealVelocity = new Vector2(Main.windSpeed * MathHelper.Lerp(0.8f, 1.2f, (float)Math.Sin(Center.Y / 50f + ID)) * 20f, (float)Math.Sin(Main.time / 20f + ID * 0.01f) * 3f - 1f); + Velocity = Vector2.Lerp(Velocity, idealVelocity, velocityInterpolant * 0.16f); + Center += Velocity; + } + + public static void UpdateAll() + { + // Don't draw ashes serverside. + if (Main.netMode == NetmodeID.Server) + return; + + foreach (DeathAshParticle ash in Ashes) + ash.Update(); + + Ashes.RemoveWhere(a => a.Time >= a.Lifetime); + } + } +} diff --git a/Projectiles/Magic/RancorLaserbeam.cs b/Projectiles/Magic/RancorLaserbeam.cs index 0460320de4..008eacd3dd 100644 --- a/Projectiles/Magic/RancorLaserbeam.cs +++ b/Projectiles/Magic/RancorLaserbeam.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs; using CalamityMod.Particles; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -48,9 +49,9 @@ namespace CalamityMod.Projectiles.Magic projectile.tileCollide = false; projectile.ignoreWater = true; projectile.hide = true; - projectile.Calamity().PierceResistHarshness = 0.06f; - projectile.Calamity().PierceResistCap = 0.4f; - } + projectile.Calamity().PierceResistHarshness = 0.06f; + projectile.Calamity().PierceResistCap = 0.4f; + } public override void AI() { @@ -189,6 +190,11 @@ namespace CalamityMod.Projectiles.Magic drawCacheProjsOverWiresUI.Add(index); } + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 150); + } + public override bool ShouldUpdatePosition() => false; } } From 2f2d95edcb9952ca3f94c874b848edc0165ec3d1 Mon Sep 17 00:00:00 2001 From: Dominic Date: Sun, 2 Jan 2022 18:48:38 -0600 Subject: [PATCH 33/35] Minor fix --- Particles/DeathAshParticle.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Particles/DeathAshParticle.cs b/Particles/DeathAshParticle.cs index 31cce5f707..c20e5f6644 100644 --- a/Particles/DeathAshParticle.cs +++ b/Particles/DeathAshParticle.cs @@ -61,13 +61,14 @@ namespace CalamityMod.Particles foreach (NPC npc in PendingNPCsToDraw.Keys) { // Prepare the sprite batch for specialized drawing in prepration that the graphics device will draw to new render targets. - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Matrix.Identity); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Matrix.Identity); // Draw the NPC to the temporary render target so that all of its drawcode is localized, and then get the colors from the results. Main.instance.GraphicsDevice.SetRenderTarget(PendingNPCsToDraw[npc]); Main.instance.GraphicsDevice.Clear(Color.Transparent); Vector2 oldPosition = npc.position; + npc.oldPos = new Vector2[npc.oldPos.Length]; npc.position = Main.screenPosition + new Vector2(Main.screenWidth, Main.screenHeight) * 0.5f; try { From 2c317e783842cd0889c1ab344661c6ffb082af27 Mon Sep 17 00:00:00 2001 From: Dominic Date: Sun, 2 Jan 2022 19:59:24 -0600 Subject: [PATCH 34/35] Debuff head icons don't turn into ashes --- NPCs/CalamityGlobalNPC.cs | 2 +- Particles/DeathAshParticle.cs | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index d8e7a4f934..ffdc052a6b 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -5609,7 +5609,7 @@ namespace CalamityMod.NPCs public override bool PreDraw(NPC npc, SpriteBatch spriteBatch, Color drawColor) { - if (npc.type != NPCID.BrainofCthulhu && (npc.type != NPCID.DukeFishron || npc.ai[0] <= 9f)) + if (npc.type != NPCID.BrainofCthulhu && (npc.type != NPCID.DukeFishron || npc.ai[0] <= 9f) && npc.active) { if (CalamityConfig.Instance.DebuffDisplay && (npc.boss || BossHealthBarManager.MinibossHPBarList.Contains(npc.type) || BossHealthBarManager.OneToMany.ContainsKey(npc.type) || CalamityLists.needsDebuffIconDisplayList.Contains(npc.type))) { diff --git a/Particles/DeathAshParticle.cs b/Particles/DeathAshParticle.cs index c20e5f6644..0fd96d5aa6 100644 --- a/Particles/DeathAshParticle.cs +++ b/Particles/DeathAshParticle.cs @@ -22,10 +22,10 @@ namespace CalamityMod.Particles public Color AshColor; public Vector2 Center; public Vector2 Velocity; - public Vector2 TopLeft => Center - Vector2.One * Scale * 4f; - public Vector2 TopRight => Center + new Vector2(1f, -1f) * Scale * 4f; - public Vector2 BottomRight => Center + Vector2.One * Scale * 4f; - public Vector2 BottomLeft => Center + new Vector2(-1f, 1f) * Scale * 4f; + public Vector2 TopLeft => Center - Vector2.One * Scale * 3.5f; + public Vector2 TopRight => Center + new Vector2(1f, -1f) * Scale * 3.5f; + public Vector2 BottomRight => Center + Vector2.One * Scale * 3.5f; + public Vector2 BottomLeft => Center + new Vector2(-1f, 1f) * Scale * 3.5f; public static HashSet Ashes = new HashSet(); public const int PrimitiveBatchSize = 256; @@ -148,7 +148,7 @@ namespace CalamityMod.Particles // Create ashes. foreach (Vector2 drawOffset in colorsOnNPC.Keys) { - int ashLifetime = Main.rand.Next(75, 115); + int ashLifetime = Main.rand.Next(105, 145); // Adjust the offset of the ashes from pixel space by accounting for direction, rotation, and scale. Vector2 ashSpawnPosition = npc.position + drawOffset - new Vector2(Main.screenWidth, Main.screenHeight) * 0.5f; @@ -159,7 +159,7 @@ namespace CalamityMod.Particles Velocity = (Main.npc.IndexInRange(npc.realLife) ? Main.npc[npc.realLife].velocity : npc.velocity) * 0.7f }; - if (brightness > 0.15f) + if (brightness > 0.05f) Ashes.Add(ash); } @@ -230,7 +230,7 @@ namespace CalamityMod.Particles Scale = MathHelper.Clamp(Scale - (brightness < 0.1f ? 0.08f : 0.008f), 0f, 1f); float dissipationFactor = Utils.InverseLerp(6f, 16f, Velocity.Length(), true); - float velocityInterpolant = Utils.InverseLerp(15f - dissipationFactor * 10f, 60f - dissipationFactor * 35f, Time, true); + float velocityInterpolant = Utils.InverseLerp(25f - dissipationFactor * 10f, 80f - dissipationFactor * 45f, Time, true); Vector2 idealVelocity = new Vector2(Main.windSpeed * MathHelper.Lerp(0.8f, 1.2f, (float)Math.Sin(Center.Y / 50f + ID)) * 20f, (float)Math.Sin(Main.time / 20f + ID * 0.01f) * 3f - 1f); Velocity = Vector2.Lerp(Velocity, idealVelocity, velocityInterpolant * 0.16f); Center += Velocity; @@ -238,6 +238,7 @@ namespace CalamityMod.Particles public static void UpdateAll() { + Main.windSpeed = 0.54f; // Don't draw ashes serverside. if (Main.netMode == NetmodeID.Server) return; From 9983e7250f19727e8d730c595d351f8efd73d539 Mon Sep 17 00:00:00 2001 From: Dominic Date: Mon, 3 Jan 2022 02:16:27 -0600 Subject: [PATCH 35/35] Removed an experimental snippet --- Particles/DeathAshParticle.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/Particles/DeathAshParticle.cs b/Particles/DeathAshParticle.cs index 0fd96d5aa6..e39f057ddb 100644 --- a/Particles/DeathAshParticle.cs +++ b/Particles/DeathAshParticle.cs @@ -238,7 +238,6 @@ namespace CalamityMod.Particles public static void UpdateAll() { - Main.windSpeed = 0.54f; // Don't draw ashes serverside. if (Main.netMode == NetmodeID.Server) return;