From 8b1d39a2179d2a8b7140395953b57a620dfd005c Mon Sep 17 00:00:00 2001 From: DominicKarma <51094361+DominicKarma@users.noreply.github.com> Date: Mon, 4 Apr 2022 16:16:18 -0500 Subject: [PATCH] Fixed pretty much all melee proj errors --- Projectiles/Magic/VolatileStarcore.cs | 8 +- Projectiles/Melee/AegisBeam.cs | 2 +- Projectiles/Melee/AegisFlame.cs | 2 +- Projectiles/Melee/AftershockRock.cs | 2 +- Projectiles/Melee/AncientBeam.cs | 2 - Projectiles/Melee/AncientStar.cs | 10 +- Projectiles/Melee/AquaStream.cs | 4 +- .../Melee/ArkOfTheAncients_ParryHoldout.cs | 25 +++-- .../Melee/ArkOfTheAncients_SwungBlade.cs | 11 +-- .../Melee/ArkOfTheCosmos_BlastAttack.cs | 29 +++--- .../Melee/ArkOfTheCosmos_ParryHoldout.cs | 35 ++++--- .../Melee/ArkOfTheCosmos_SwungBlade.cs | 87 +++++++++--------- .../Melee/ArkOfTheElements_ParryHoldout.cs | 30 +++--- .../Melee/ArkOfTheElements_SnapBlast.cs | 21 ++--- .../Melee/ArkOfTheElements_SwungBlade.cs | 91 +++++++++---------- .../Melee/ArkoftheCosmos_Constellation.cs | 5 +- Projectiles/Melee/AtaraxiaHoming.cs | 10 +- Projectiles/Melee/AtaraxiaMain.cs | 8 +- Projectiles/Melee/AtaraxiaSide.cs | 10 +- Projectiles/Melee/AtaraxiaSplit.cs | 8 +- .../Melee/BalefulHarvesterProjectile.cs | 2 +- Projectiles/Melee/BallOFuguProj.cs | 7 +- Projectiles/Melee/BansheeHookScythe.cs | 8 +- Projectiles/Melee/BiomeBladeHoldout.cs | 24 ++--- Projectiles/Melee/BladecrestOathswordProj.cs | 17 ++-- Projectiles/Melee/BlazingPhantomBlade.cs | 8 +- Projectiles/Melee/BloodBall.cs | 4 +- Projectiles/Melee/BloodScythe.cs | 4 +- Projectiles/Melee/BloodyBlade.cs | 2 +- Projectiles/Melee/BonebreakerFragment1.cs | 6 +- Projectiles/Melee/BonebreakerProjectile.cs | 4 +- Projectiles/Melee/Brimblast.cs | 3 +- Projectiles/Melee/BrimlanceStandingFire.cs | 3 +- Projectiles/Melee/Brimlash2.cs | 2 +- Projectiles/Melee/BrimlashProj.cs | 6 +- Projectiles/Melee/BrimstoneBoom.cs | 3 +- Projectiles/Melee/BrimstoneLaserFriendly.cs | 2 +- Projectiles/Melee/BrinySpout.cs | 4 +- Projectiles/Melee/BrinyTyphoonBubble.cs | 6 +- Projectiles/Melee/BrokenBiomeBladeHoldout.cs | 20 ++-- .../Melee/BrokenBiomeBlade_AridGrandeur.cs | 26 +++--- .../Melee/BrokenBiomeBlade_BitingEmbrace.cs | 22 ++--- .../Melee/BrokenBiomeBlade_DecaysRetort.cs | 12 +-- .../BrokenBiomeBlade_GrovetendersTouch.cs | 2 +- .../BrokenBiomeBlade_PurityProjection.cs | 4 +- Projectiles/Melee/BurningMeteor.cs | 4 +- Projectiles/Melee/ChaosFlameLarge.cs | 2 +- Projectiles/Melee/ChaosFlameSmall.cs | 2 +- Projectiles/Melee/ClamCrusherFlail.cs | 9 +- Projectiles/Melee/CometQuasherMeteor.cs | 8 +- Projectiles/Melee/CosmicDischargeFlail.cs | 9 +- Projectiles/Melee/CosmicShivBall.cs | 8 +- Projectiles/Melee/CrescentMoonFlail.cs | 2 +- Projectiles/Melee/CrescentMoonProj.cs | 2 +- Projectiles/Melee/DNA.cs | 4 +- Projectiles/Melee/DNA2.cs | 2 +- Projectiles/Melee/DarkBall.cs | 4 +- Projectiles/Melee/DarkBeam.cs | 4 +- Projectiles/Melee/DarkIceZero.cs | 2 +- Projectiles/Melee/DemonBlast.cs | 4 +- Projectiles/Melee/DracoBeam.cs | 4 +- Projectiles/Melee/DragonPowFlail.cs | 14 +-- Projectiles/Melee/DragonRageStaff.cs | 8 +- Projectiles/Melee/EarthProj.cs | 4 +- Projectiles/Melee/ElementalExcaliburBeam.cs | 4 +- Projectiles/Melee/ElementalGlassStar.cs | 10 +- Projectiles/Melee/EonBolt.cs | 6 +- Projectiles/Melee/EssenceBeam.cs | 2 +- Projectiles/Melee/EssenceScythe.cs | 2 +- Projectiles/Melee/ExcelsusMain.cs | 4 +- Projectiles/Melee/ExcelsusPink.cs | 4 +- Projectiles/Melee/FallenPaladinsHammerProj.cs | 2 +- .../Melee/ForbiddenOathbladeProjectile.cs | 2 +- Projectiles/Melee/GaelSkull.cs | 8 +- Projectiles/Melee/GaelSkull2.cs | 4 +- Projectiles/Melee/GalaxiaHoldout.cs | 8 +- Projectiles/Melee/Galaxia_AndromedasStride.cs | 21 ++--- .../Galaxia_AndromedasStrideBoltSpawner.cs | 8 +- Projectiles/Melee/Galaxia_AriesWrath.cs | 10 +- .../Melee/Galaxia_AriesWrathConstellation.cs | 2 +- Projectiles/Melee/Galaxia_PhoenixsPride.cs | 16 ++-- Projectiles/Melee/Galaxia_PolarisGaze.cs | 16 ++-- Projectiles/Melee/Galaxia_PolarisGazeDash.cs | 12 +-- Projectiles/Melee/Galaxia_PolarisGazeStar.cs | 10 +- Projectiles/Melee/GalaxySmasherHammer.cs | 10 +- Projectiles/Melee/GalaxyStar.cs | 3 +- Projectiles/Melee/GemTechYellowShard.cs | 8 +- Projectiles/Melee/HellionSpike.cs | 5 +- Projectiles/Melee/HyperBlade.cs | 2 +- Projectiles/Melee/IceBombFriendly.cs | 6 +- Projectiles/Melee/JudgementBlah.cs | 6 +- Projectiles/Melee/JudgementProj.cs | 6 +- Projectiles/Melee/LaserFountain.cs | 2 +- Projectiles/Melee/LifeScythe.cs | 2 +- Projectiles/Melee/LightBeam.cs | 4 +- Projectiles/Melee/LightningThing.cs | 2 +- .../Melee/MeldGreatswordBigProjectile.cs | 3 +- .../Melee/MeldGreatswordMediumProjectile.cs | 3 +- .../Melee/MeldGreatswordSmallProjectile.cs | 3 +- .../MendedBiomeBlade_BitingEmbraceMist.cs | 2 +- .../MendedBiomeBlade_DecaysRetortDash.cs | 11 +-- .../MendedBiomeBlade_ExtantAbhorrence.cs | 24 ++--- ...ndedBiomeBlade_ExtantAbhorrenceMonolith.cs | 14 +-- .../MendedBiomeBlade_GestureForTheDrowned.cs | 8 +- ...endedBiomeBlade_GestureForTheDrownedOrb.cs | 18 ++-- ...dBiomeBlade_GrovetendersEntanglingVines.cs | 2 +- .../Melee/MendedBiomeBlade_HeavensMight.cs | 18 ++-- .../MendedBiomeBlade_PurityProjectionSigil.cs | 1 - .../MendedBiomeBlade_TrueAridGrandeur.cs | 22 ++--- .../MendedBiomeBlade_TrueAridGrandeurShot.cs | 8 +- .../MendedBiomeBlade_TrueBitingEmbrace.cs | 26 +++--- .../MendedBiomeBlade_TrueDecaysRetort.cs | 22 ++--- .../MendedBiomeBlade_TruePurityProjection.cs | 4 +- Projectiles/Melee/MicrowaveAura.cs | 14 +-- Projectiles/Melee/MourningSkull.cs | 6 +- Projectiles/Melee/MourningstarFlail.cs | 5 +- Projectiles/Melee/MurasamaSlash.cs | 4 +- Projectiles/Melee/NebulashFlail.cs | 6 +- Projectiles/Melee/NeptuneOrb.cs | 2 +- Projectiles/Melee/Oathblade.cs | 2 +- Projectiles/Melee/OceanBeam.cs | 4 +- Projectiles/Melee/OldLordOathswordProj.cs | 18 ++-- Projectiles/Melee/OmnibladeSwing.cs | 4 +- .../Melee/PhosphorescentGauntletPunches.cs | 2 +- Projectiles/Melee/PhotonRipperProjectile.cs | 10 +- Projectiles/Melee/PlagueBeeDust.cs | 2 +- Projectiles/Melee/PlagueDust.cs | 3 +- Projectiles/Melee/PrismTooth.cs | 10 +- Projectiles/Melee/PrismaticBeam.cs | 8 +- Projectiles/Melee/ProfanedSwordProj.cs | 4 +- Projectiles/Melee/PwnagehammerProj.cs | 10 +- Projectiles/Melee/RSSolarFlare.cs | 4 +- Projectiles/Melee/RemsRevengeProj.cs | 7 +- Projectiles/Melee/RendingNeedle.cs | 14 +-- Projectiles/Melee/Rox1.cs | 6 +- Projectiles/Melee/RoxSlam.cs | 2 +- Projectiles/Melee/ScourgeoftheCosmosMini.cs | 4 +- Projectiles/Melee/ScourgeoftheCosmosProj.cs | 4 +- Projectiles/Melee/ShortBeam.cs | 5 +- Projectiles/Melee/ShortNightBeam.cs | 5 +- Projectiles/Melee/ShortTerraBeam.cs | 5 +- Projectiles/Melee/SolarNeedle.cs | 16 ++-- Projectiles/Melee/SoulScythe.cs | 4 +- Projectiles/Melee/SpatialSpear.cs | 2 +- Projectiles/Melee/SpatialSpear2.cs | 2 +- Projectiles/Melee/SpatialSpear3.cs | 2 +- Projectiles/Melee/Spears/StreamGougeProj.cs | 4 +- .../Melee/SpineOfThanatosProjectile.cs | 12 +-- Projectiles/Melee/StarnightBeam.cs | 2 +- Projectiles/Melee/StellarContemptHammer.cs | 10 +- Projectiles/Melee/StormMark.cs | 9 +- Projectiles/Melee/StormRulerProj.cs | 2 +- Projectiles/Melee/StreamGougePortal.cs | 12 +-- Projectiles/Melee/SunlightBlade.cs | 2 +- Projectiles/Melee/SwordsplosionBlue.cs | 2 +- Projectiles/Melee/SwordsplosionGreen.cs | 2 +- Projectiles/Melee/SwordsplosionPurple.cs | 2 +- Projectiles/Melee/SwordsplosionRed.cs | 2 +- Projectiles/Melee/TaintedBladeSlasher.cs | 31 ++++--- .../Melee/TemporalFloeSwordProjectile.cs | 4 +- .../Melee/TenebreusTidesWaterProjectile.cs | 2 +- Projectiles/Melee/TenebreusTidesWaterSpear.cs | 7 +- Projectiles/Melee/TenebreusTidesWaterSword.cs | 7 +- Projectiles/Melee/TerraEdgeBeam.cs | 2 +- Projectiles/Melee/TerratomereProjectile.cs | 2 +- Projectiles/Melee/TerrorBeam.cs | 2 +- Projectiles/Melee/TerrorBlast.cs | 2 +- Projectiles/Melee/ThornBase.cs | 2 +- Projectiles/Melee/ThornTip.cs | 2 +- Projectiles/Melee/TriactisHammerProj.cs | 4 +- Projectiles/Melee/TrueAncientBeam.cs | 8 +- Projectiles/Melee/TrueAncientBlast.cs | 16 ++-- .../TrueArkOfTheAncients_ParryHoldout.cs | 24 +++-- .../Melee/TrueArkOfTheAncients_SwungBlade.cs | 18 ++-- Projectiles/Melee/TrueBiomeBladeHoldout.cs | 28 +++--- .../Melee/TrueBiomeBlade_GhastlyChain.cs | 8 +- .../Melee/TrueBiomeBlade_MercurialTides.cs | 30 +++--- .../TrueBiomeBlade_MercurialTidesMonolith.cs | 21 ++--- .../TrueBiomeBlade_MercurialTidesShockwave.cs | 9 +- .../Melee/TrueBiomeBlade_SanguineFury.cs | 28 +++--- .../Melee/TrueBiomeBlade_SanguineFuryDash.cs | 14 ++- .../Melee/TrueBiomeBlade_SanguineFuryWheel.cs | 11 +-- .../Melee/TrueBiomeBlade_SwordsmithsPride.cs | 24 ++--- .../TrueBiomeBlade_SwordsmithsPrideBeam.cs | 10 +- Projectiles/Melee/TumbleweedFlail.cs | 7 +- Projectiles/Melee/TumbleweedRolling.cs | 3 +- Projectiles/Melee/UrchinBall.cs | 7 +- Projectiles/Melee/UrchinBallSpike.cs | 2 +- Projectiles/Melee/ViolenceSlashProjectile.cs | 12 +-- Projectiles/Melee/ViolenceThrownProjectile.cs | 16 ++-- Projectiles/Melee/VoidEssence.cs | 8 +- Projectiles/Melee/VoidTentacle.cs | 4 +- Projectiles/Melee/WhiteBoltAura.cs | 2 +- Projectiles/Melee/WhiteBoltAuraBlah.cs | 2 +- Projectiles/Melee/YateveoBloomProj.cs | 5 +- Projectiles/Melee/Yoyos/AzathothYoyo.cs | 2 +- Projectiles/Melee/Yoyos/ChaotrixYoyo.cs | 2 +- Projectiles/Melee/Yoyos/MicrowaveYoyo.cs | 15 +-- Projectiles/Melee/Yoyos/ObliteratorYoyo.cs | 6 +- Projectiles/Melee/Yoyos/OracleYoyo.cs | 6 +- Projectiles/Melee/Yoyos/QuagmireYoyo.cs | 6 +- Projectiles/Melee/Yoyos/RiptideYoyo.cs | 16 ++-- Projectiles/Melee/Yoyos/SolarFlareYoyo.cs | 2 +- .../Melee/Yoyos/SulphurousGrabberYoyo.cs | 6 +- Projectiles/Ranged/HandheldTankShell.cs | 8 +- Projectiles/Rogue/ButcherKnife.cs | 8 +- Projectiles/Rogue/CinquedeaProj.cs | 6 +- Projectiles/Rogue/GlaiveProj.cs | 4 +- Projectiles/Rogue/MonkeyDart.cs | 8 +- Projectiles/Rogue/NanoblackMain.cs | 8 +- Projectiles/Rogue/NanoblackSplit.cs | 8 +- Projectiles/Rogue/PenumbraBomb.cs | 10 +- Projectiles/Rogue/PenumbraSoul.cs | 6 +- Projectiles/Rogue/ProfanedPartisanProj.cs | 14 +-- Utilities/MiscUtils.cs | 5 +- 215 files changed, 924 insertions(+), 956 deletions(-) diff --git a/Projectiles/Magic/VolatileStarcore.cs b/Projectiles/Magic/VolatileStarcore.cs index 74d889e324..0354ce60be 100644 --- a/Projectiles/Magic/VolatileStarcore.cs +++ b/Projectiles/Magic/VolatileStarcore.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Weapons.Magic; using Microsoft.Xna.Framework; using Terraria; @@ -33,9 +33,9 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { // Draw offsets - drawOffsetX = -10; - drawOriginOffsetY = -10; - drawOriginOffsetX = 0; + DrawOffsetX = -10; + DrawOriginOffsetY = -10; + DrawOriginOffsetX = 0; // Play sound and set rotation on frame 1 if (Projectile.localAI[0] == 0f) diff --git a/Projectiles/Melee/AegisBeam.cs b/Projectiles/Melee/AegisBeam.cs index 75d115ef3e..125461b9c5 100644 --- a/Projectiles/Melee/AegisBeam.cs +++ b/Projectiles/Melee/AegisBeam.cs @@ -82,7 +82,7 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < flameAmt; i++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - Projectile.NewProjectile(Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.75), 0f, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.75), 0f, Projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Melee/AegisFlame.cs b/Projectiles/Melee/AegisFlame.cs index d8a32e68c2..1644e08bfe 100644 --- a/Projectiles/Melee/AegisFlame.cs +++ b/Projectiles/Melee/AegisFlame.cs @@ -87,7 +87,7 @@ namespace CalamityMod.Projectiles.Melee { if (Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)((double)damage * 0.75), knockback, Main.myPlayer); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)((double)damage * 0.75), knockback, Main.myPlayer); } } diff --git a/Projectiles/Melee/AftershockRock.cs b/Projectiles/Melee/AftershockRock.cs index 6b4c141397..bed94110d2 100644 --- a/Projectiles/Melee/AftershockRock.cs +++ b/Projectiles/Melee/AftershockRock.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.extraUpdates = 1; Projectile.DamageType = DamageClass.Melee; Projectile.ignoreWater = true; - aiType = ProjectileID.BoulderStaffOfEarth; + AIType = ProjectileID.BoulderStaffOfEarth; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; } diff --git a/Projectiles/Melee/AncientBeam.cs b/Projectiles/Melee/AncientBeam.cs index 19ada0f8fd..f544df671c 100644 --- a/Projectiles/Melee/AncientBeam.cs +++ b/Projectiles/Melee/AncientBeam.cs @@ -71,8 +71,6 @@ namespace CalamityMod.Projectiles.Melee Dust.NewDust(Projectile.Center, 14, 14, dustType, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f, 150, default, 1.3f); } - - if (Projectile.velocity.Length() < 1.0f) Projectile.Kill(); } diff --git a/Projectiles/Melee/AncientStar.cs b/Projectiles/Melee/AncientStar.cs index 8b6c477e63..cc10b3b564 100644 --- a/Projectiles/Melee/AncientStar.cs +++ b/Projectiles/Melee/AncientStar.cs @@ -1,4 +1,4 @@ -using CalamityMod.Particles; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -97,10 +97,10 @@ namespace CalamityMod.Projectiles.Melee if (Shine == 1f) { Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - Texture2D starTexture = ModContent.Request("CalamityMod/Particles/Sparkle"); - Texture2D bloomTexture = ModContent.Request("CalamityMod/Particles/BloomCircle"); + Texture2D starTexture = ModContent.Request("CalamityMod/Particles/Sparkle").Value; + Texture2D bloomTexture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; //Ajust the bloom's texture to be the same size as the star's float properBloomSize = (float)starTexture.Height / (float)bloomTexture.Height; @@ -113,7 +113,7 @@ namespace CalamityMod.Projectiles.Melee Main.EntitySpriteDraw(starTexture, sparkCenter, null, Color.White, rotation, starTexture.Size() / 2f, 1, SpriteEffects.None, 0); Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); } return false; diff --git a/Projectiles/Melee/AquaStream.cs b/Projectiles/Melee/AquaStream.cs index 92a544326c..c18d64c4bc 100644 --- a/Projectiles/Melee/AquaStream.cs +++ b/Projectiles/Melee/AquaStream.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Melee Dust dust; // You need to set position depending on what you are doing. You may need to subtract width/2 and height/2 as well to center the spawn rectangle. Vector2 position = Projectile.Center; - dust = Terraria.Dust.NewDustPerfect(position, 33, new Vector2(0f, 0f), 0, new Color(0, 142, 255), 2.368421f); + dust = Dust.NewDustPerfect(position, 33, new Vector2(0f, 0f), 0, new Color(0, 142, 255), 2.368421f); dust.noGravity = true; } } diff --git a/Projectiles/Melee/ArkOfTheAncients_ParryHoldout.cs b/Projectiles/Melee/ArkOfTheAncients_ParryHoldout.cs index cb5990a1db..79853aef05 100644 --- a/Projectiles/Melee/ArkOfTheAncients_ParryHoldout.cs +++ b/Projectiles/Melee/ArkOfTheAncients_ParryHoldout.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.penetrate = -1; } - public override bool CanDamage() => Timer <= ParryTime && AlreadyParried == 0f; + public override bool? CanDamage() => Timer <= ParryTime && AlreadyParried == 0f; public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { @@ -51,7 +51,7 @@ namespace CalamityMod.Projectiles.Melee public void GeneralParryEffects() { - ArkoftheAncients sword = (Owner.HeldItem.modItem as ArkoftheAncients); + ArkoftheAncients sword = (Owner.HeldItem.ModItem as ArkoftheAncients); if (sword != null) sword.Charge = 10f; @@ -159,8 +159,8 @@ namespace CalamityMod.Projectiles.Melee { if (Main.myPlayer == Owner.whoAmI) { - var barBG = GetTexture("CalamityMod/ExtraTextures/GenericBarBack"); - var barFG = GetTexture("CalamityMod/ExtraTextures/GenericBarFront"); + var barBG = Request("CalamityMod/ExtraTextures/GenericBarBack").Value; + var barFG = Request("CalamityMod/ExtraTextures/GenericBarFront").Value; Vector2 drawPos = Owner.Center - Main.screenPosition + new Vector2(0, -36) - barBG.Size() / 2; Rectangle frame = new Rectangle(0, 0, (int)((Timer - ParryTime) / (MaxTime - ParryTime) * barFG.Width), barFG.Height); @@ -168,30 +168,27 @@ namespace CalamityMod.Projectiles.Melee float opacity = Timer <= ParryTime + 25f ? (Timer - ParryTime) / 25f : (MaxTime - Timer <= 8) ? Projectile.timeLeft / 8f : 1f; Color color = Main.hslToRgb((Main.GlobalTimeWrappedHourly * 0.6f) % 1, 1, 0.85f + (float)Math.Sin(Main.GlobalTimeWrappedHourly * 3f) * 0.1f); - Main.EntitySpriteDraw(barBG, drawPos, color * opacity); - Main.EntitySpriteDraw(barFG, drawPos, frame, color * opacity * 0.8f); - - + Main.spriteBatch.Draw(barBG, drawPos, color * opacity); + Main.spriteBatch.Draw(barFG, drawPos, frame, color * opacity * 0.8f); } return false; } - Texture2D sword = GetTexture("CalamityMod/Items/Weapons/Melee/ArkoftheAncients"); - Texture2D glowmask = GetTexture("CalamityMod/Items/Weapons/Melee/ArkoftheAncientsGlow"); + Texture2D sword = Request("CalamityMod/Items/Weapons/Melee/ArkoftheAncients").Value; + Texture2D glowmask = Request("CalamityMod/Items/Weapons/Melee/ArkoftheAncientsGlow").Value; float drawRotation = Projectile.rotation + MathHelper.PiOver4; Vector2 drawOrigin = new Vector2(0f, sword.Height); Vector2 drawOffset = Owner.Center + Projectile.velocity * DistanceFromPlayer.Length() - Main.screenPosition; - - Main.EntitySpriteDraw(sword, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); - Main.EntitySpriteDraw(glowmask, drawOffset, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, Projectile.scale, 0f, 0f); + Main.EntitySpriteDraw(sword, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0); + Main.EntitySpriteDraw(glowmask, drawOffset, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, Projectile.scale, 0f, 0); if (AlreadyParried > 0) { drawOrigin = new Vector2(0f, 36f); Rectangle frame = new Rectangle(24, 0, 36, 36); drawOffset = Owner.Center + Projectile.velocity * (DistanceFromPlayer.Length() + 33) - Main.screenPosition; - Main.EntitySpriteDraw(glowmask, drawOffset, frame, Main.hslToRgb(Main.GlobalTimeWrappedHourly % 1, 1, 0.8f) * (1 - AlreadyParried / ParryTime), drawRotation, drawOrigin, Projectile.scale + AlreadyParried / ParryTime, 0f, 0f); + Main.EntitySpriteDraw(glowmask, drawOffset, frame, Main.hslToRgb(Main.GlobalTimeWrappedHourly % 1, 1, 0.8f) * (1 - AlreadyParried / ParryTime), drawRotation, drawOrigin, Projectile.scale + AlreadyParried / ParryTime, 0f, 0); } return false; diff --git a/Projectiles/Melee/ArkOfTheAncients_SwungBlade.cs b/Projectiles/Melee/ArkOfTheAncients_SwungBlade.cs index 52e1e6b455..a9684b34fc 100644 --- a/Projectiles/Melee/ArkOfTheAncients_SwungBlade.cs +++ b/Projectiles/Melee/ArkOfTheAncients_SwungBlade.cs @@ -94,7 +94,7 @@ namespace CalamityMod.Projectiles.Melee if (Owner.whoAmI == Main.myPlayer && SwingRatio() > 0.5f && HasFired == 0f && Charge > 0) { - Projectile.NewProjectile(Owner.Center + direction * 30f, Projectile.velocity * 1.25f, ProjectileType(), (int)(Projectile.damage * ArkoftheAncients.beamDamageMultiplier), 2f, Owner.whoAmI) ; + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Owner.Center + direction * 30f, Projectile.velocity * 1.25f, ProjectileType(), (int)(Projectile.damage * ArkoftheAncients.beamDamageMultiplier), 2f, Owner.whoAmI) ; HasFired = 1f; } @@ -120,9 +120,8 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - - Texture2D sword = GetTexture("CalamityMod/Items/Weapons/Melee/ArkoftheAncients"); - Texture2D glowmask = GetTexture("CalamityMod/Items/Weapons/Melee/ArkoftheAncientsGlow"); + Texture2D sword = Request("CalamityMod/Items/Weapons/Melee/ArkoftheAncients").Value; + Texture2D glowmask = Request("CalamityMod/Items/Weapons/Melee/ArkoftheAncientsGlow").Value; SpriteEffects flip = Owner.direction < 0 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; float extraAngle = Owner.direction < 0 ? MathHelper.PiOver2 : 0f; @@ -143,8 +142,8 @@ namespace CalamityMod.Projectiles.Melee } } - Main.EntitySpriteDraw(sword, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, flip, 0f); - Main.EntitySpriteDraw(glowmask, drawOffset, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, Projectile.scale, flip, 0f); + Main.EntitySpriteDraw(sword, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, flip, 0); + Main.EntitySpriteDraw(glowmask, drawOffset, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, Projectile.scale, flip, 0); return false; } diff --git a/Projectiles/Melee/ArkOfTheCosmos_BlastAttack.cs b/Projectiles/Melee/ArkOfTheCosmos_BlastAttack.cs index a1c6477940..2a6692ef1b 100644 --- a/Projectiles/Melee/ArkOfTheCosmos_BlastAttack.cs +++ b/Projectiles/Melee/ArkOfTheCosmos_BlastAttack.cs @@ -1,4 +1,4 @@ -using CalamityMod.Particles; +using CalamityMod.Particles; using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -77,7 +77,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.localNPCHitCooldown = (int)MaxTime + 2; } - public override bool CanDamage() + public override bool? CanDamage() { return HoldProgress > 0; } @@ -168,13 +168,14 @@ namespace CalamityMod.Projectiles.Melee { Dashing = false; Owner.velocity *= 0.1f; //Abrupt stop - SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/MeatySlash"), Projectile.Center); + SoundEngine.PlaySound(SoundLoader.GetLegacySoundSlot(Mod, "Sounds/Custom/MeatySlash"), Projectile.Center); if (Owner.whoAmI == Main.myPlayer) { for (int i = 0; i < 5; i++) { - Projectile blast = Projectile.NewProjectileDirect(Owner.Center, Main.rand.NextVector2CircularEdge(28, 28), ProjectileType(), (int)(ArkoftheCosmos.SlashBoltsDamageMultiplier * Projectile.damage), 0f, Owner.whoAmI, 0.55f, MathHelper.Pi * 0.07f); + var source = Projectile.GetProjectileSource_FromThis(); + Projectile blast = Projectile.NewProjectileDirect(Projectile.GetProjectileSource_FromThis(), source, Owner.Center, Main.rand.NextVector2CircularEdge(28, 28), ProjectileType(), (int)(ArkoftheCosmos.SlashBoltsDamageMultiplier * Projectile.damage), 0f, Owner.whoAmI, 0.55f, MathHelper.Pi * 0.07f); { blast.timeLeft = 100; } @@ -262,20 +263,19 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - Texture2D sliceTex = GetTexture("CalamityMod/Particles/BloomLine"); + Texture2D sliceTex = Request("CalamityMod/Particles/BloomLine").Value; Color sliceColor = Color.Lerp(Color.OrangeRed, Color.White, SnapProgress); float rot = Projectile.rotation + MathHelper.PiOver2; Vector2 sliceScale = new Vector2(0.2f * (1 - SnapProgress) ,ThrustDisplaceRatio() * 242f); - Main.EntitySpriteDraw(sliceTex, Projectile.Center - Main.screenPosition, null, sliceColor, rot, new Vector2(sliceTex.Width / 2f, sliceTex.Height), sliceScale, 0f, 0f); - + Main.EntitySpriteDraw(sliceTex, Projectile.Center - Main.screenPosition, null, sliceColor, rot, new Vector2(sliceTex.Width / 2f, sliceTex.Height), sliceScale, 0f, 0); //Draw the scissors if (HoldProgress <= 0.4f) { - Texture2D frontBlade = GetTexture("CalamityMod/Projectiles/Melee/SunderingScissorsLeft"); - Texture2D backBlade = GetTexture("CalamityMod/Projectiles/Melee/SunderingScissorsRight"); + Texture2D frontBlade = Request("CalamityMod/Projectiles/Melee/SunderingScissorsLeft").Value; + Texture2D backBlade = Request("CalamityMod/Projectiles/Melee/SunderingScissorsRight").Value; float snippingRotation = Projectile.rotation + MathHelper.PiOver4; float drawRotation = MathHelper.Lerp(snippingRotation - MathHelper.PiOver4, snippingRotation, RotationRatio()); @@ -289,14 +289,14 @@ namespace CalamityMod.Projectiles.Melee Color drawColor = Color.Tomato * opacity * 0.9f; Color drawColorBack = Color.DeepSkyBlue * opacity * 0.9f; - Main.EntitySpriteDraw(backBlade, drawPosition, null, drawColorBack, drawRotationBack, drawOriginBack, Projectile.scale, 0f, 0f); - Main.EntitySpriteDraw(frontBlade, drawPosition, null, drawColor * opacity, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); + Main.EntitySpriteDraw(backBlade, drawPosition, null, drawColorBack, drawRotationBack, drawOriginBack, Projectile.scale, 0f, 0); + Main.EntitySpriteDraw(frontBlade, drawPosition, null, drawColor * opacity, drawRotation, drawOrigin, Projectile.scale, 0f, 0); } //Draw the rip if (HoldProgress > 0) { - Texture2D lineTex = GetTexture("CalamityMod/Particles/ThinEndedLine"); + Texture2D lineTex = Request("CalamityMod/Particles/ThinEndedLine").Value; Vector2 Shake = HoldProgress > 0.2f ? Vector2.Zero : Vector2.One.RotatedByRandom(MathHelper.TwoPi) * (1 - HoldProgress * 5f) * 0.5f; float raise = (float)Math.Sin(HoldProgress * MathHelper.PiOver2); @@ -308,7 +308,6 @@ namespace CalamityMod.Projectiles.Melee Main.EntitySpriteDraw(lineTex, Projectile.Center - Main.screenPosition + Shake, null, Color.Lerp(Color.White, Color.OrangeRed * 0.7f, raise) * lineOpacity, rot, origin, scale, SpriteEffects.None, 0); - //Draw the stitches if (StitchProgress > 0) { @@ -336,7 +335,7 @@ namespace CalamityMod.Projectiles.Melee } Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); return false; } diff --git a/Projectiles/Melee/ArkOfTheCosmos_ParryHoldout.cs b/Projectiles/Melee/ArkOfTheCosmos_ParryHoldout.cs index cdab718dc6..1a4c76d092 100644 --- a/Projectiles/Melee/ArkOfTheCosmos_ParryHoldout.cs +++ b/Projectiles/Melee/ArkOfTheCosmos_ParryHoldout.cs @@ -7,10 +7,9 @@ using System.IO; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; using static Terraria.ModLoader.ModContent; using static CalamityMod.CalamityUtils; -using Terraria.Audio; - namespace CalamityMod.Projectiles.Melee { @@ -42,7 +41,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.penetrate = -1; } - public override bool CanDamage() => Timer <= ParryTime && AlreadyParried == 0f; + public override bool? CanDamage() => Timer <= ParryTime && AlreadyParried == 0f; public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { @@ -54,14 +53,14 @@ namespace CalamityMod.Projectiles.Melee public void GeneralParryEffects() { - ArkoftheCosmos sword = (Owner.HeldItem.modItem as ArkoftheCosmos); + ArkoftheCosmos sword = (Owner.HeldItem.ModItem as ArkoftheCosmos); if (sword != null) { sword.Charge = 10f; sword.Combo = 0f; } SoundEngine.PlaySound(SoundID.DD2_WitherBeastCrystalImpact); - var chunder = SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ScissorGuillotineSnap"), Projectile.Center); + var chunder = SoundEngine.PlaySound(SoundLoader.GetLegacySoundSlot(Mod, "Sounds/Custom/ScissorGuillotineSnap"), Projectile.Center); SafeVolumeChange(ref chunder, 1.3f); CombatText.NewText(Projectile.Hitbox, new Color(111, 247, 200), "Parry!", true); @@ -187,8 +186,8 @@ namespace CalamityMod.Projectiles.Melee { if (Main.myPlayer == Owner.whoAmI) { - var barBG = GetTexture("CalamityMod/ExtraTextures/GenericBarBack"); - var barFG = GetTexture("CalamityMod/ExtraTextures/GenericBarFront"); + var barBG = Request("CalamityMod/ExtraTextures/GenericBarBack").Value; + var barFG = Request("CalamityMod/ExtraTextures/GenericBarFront").Value; Vector2 drawPos = Owner.Center - Main.screenPosition + new Vector2(0, -36) - barBG.Size() / 2; Rectangle frame = new Rectangle(0, 0, (int)((Timer - ParryTime) / (MaxTime - ParryTime) * barFG.Width), barFG.Height); @@ -196,16 +195,16 @@ namespace CalamityMod.Projectiles.Melee float opacity = Timer <= ParryTime + 25f ? (Timer - ParryTime) / 25f : (MaxTime - Timer <= 8) ? Projectile.timeLeft / 8f : 1f; Color color = Main.hslToRgb((float)Math.Sin(Main.GlobalTimeWrappedHourly * 1.2f) * 0.05f + 0.08f, 1, 0.65f + (float)Math.Sin(Main.GlobalTimeWrappedHourly * 7f) * 0.1f); - Main.EntitySpriteDraw(barBG, drawPos, color * opacity); - Main.EntitySpriteDraw(barFG, drawPos, frame, color * opacity * 0.8f); + Main.spriteBatch.Draw(barBG, drawPos, color * opacity); + Main.spriteBatch.Draw(barFG, drawPos, frame, color * opacity * 0.8f); } return false; } - Texture2D frontBlade = GetTexture("CalamityMod/Projectiles/Melee/SunderingScissorsLeft"); - Texture2D frontBladeGlow = GetTexture("CalamityMod/Projectiles/Melee/SunderingScissorsLeftGlow"); - Texture2D backBlade = GetTexture("CalamityMod/Projectiles/Melee/SunderingScissorsRight"); - Texture2D backBladeGlow = GetTexture("CalamityMod/Projectiles/Melee/SunderingScissorsRightGlow"); + Texture2D frontBlade = Request("CalamityMod/Projectiles/Melee/SunderingScissorsLeft").Value; + Texture2D frontBladeGlow = Request("CalamityMod/Projectiles/Melee/SunderingScissorsLeftGlow").Value; + Texture2D backBlade = Request("CalamityMod/Projectiles/Melee/SunderingScissorsRight").Value; + Texture2D backBladeGlow = Request("CalamityMod/Projectiles/Melee/SunderingScissorsRightGlow").Value; float snippingRotation = Projectile.rotation + MathHelper.PiOver4; @@ -216,11 +215,11 @@ namespace CalamityMod.Projectiles.Melee Vector2 drawOriginBack = new Vector2(44f, 86); //Right on the hole Vector2 drawPosition = Owner.Center + Projectile.velocity * 15 + Projectile.velocity * ThrustDisplaceRatio() * 50f - Main.screenPosition; - Main.EntitySpriteDraw(backBlade, drawPosition, null, lightColor, drawRotationBack, drawOriginBack, Projectile.scale, 0f, 0f); - Main.EntitySpriteDraw(backBladeGlow, drawPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotationBack, drawOriginBack, Projectile.scale, 0f, 0f); + Main.EntitySpriteDraw(backBlade, drawPosition, null, lightColor, drawRotationBack, drawOriginBack, Projectile.scale, 0f, 0); + Main.EntitySpriteDraw(backBladeGlow, drawPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotationBack, drawOriginBack, Projectile.scale, 0f, 0); - Main.EntitySpriteDraw(frontBlade, drawPosition, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); - Main.EntitySpriteDraw(frontBladeGlow, drawPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, Projectile.scale, 0f, 0f); + Main.EntitySpriteDraw(frontBlade, drawPosition, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0); + Main.EntitySpriteDraw(frontBladeGlow, drawPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, Projectile.scale, 0f, 0); return false; } @@ -230,7 +229,7 @@ namespace CalamityMod.Projectiles.Melee if (Main.myPlayer == Owner.whoAmI) { var ding = SoundEngine.PlaySound(SoundID.Item35); - CalamityUtils.SafeVolumeChange(ref ding, 2f); + SafeVolumeChange(ref ding, 2f); } } diff --git a/Projectiles/Melee/ArkOfTheCosmos_SwungBlade.cs b/Projectiles/Melee/ArkOfTheCosmos_SwungBlade.cs index 035e46de93..2c39c298bf 100644 --- a/Projectiles/Melee/ArkOfTheCosmos_SwungBlade.cs +++ b/Projectiles/Melee/ArkOfTheCosmos_SwungBlade.cs @@ -1,4 +1,4 @@ -using CalamityMod.Particles; +using CalamityMod.Particles; using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -183,7 +183,8 @@ namespace CalamityMod.Projectiles.Melee //Slightly shift the blasts up so the final close shots don't go BELOW the cursor and instead go right on it. float adjustedBlastRotation = Projectile.rotation - MathHelper.PiOver4 * 1.15f * Owner.direction; - Projectile blast = Projectile.NewProjectileDirect(Owner.Center + adjustedBlastRotation.ToRotationVector2() * 10f, adjustedBlastRotation.ToRotationVector2() * 20f, ProjectileType(), (int)(ArkoftheCosmos.SwirlBoltDamageMultiplier / ArkoftheCosmos.SwirlBoltAmount * Projectile.damage), 0f, Owner.whoAmI, 0.55f, MathHelper.Pi * 0.05f); + var source = Projectile.GetProjectileSource_FromThis(); + Projectile blast = Projectile.NewProjectileDirect(Projectile.GetProjectileSource_FromThis(), source, Owner.Center + adjustedBlastRotation.ToRotationVector2() * 10f, adjustedBlastRotation.ToRotationVector2() * 20f, ProjectileType(), (int)(ArkoftheCosmos.SwirlBoltDamageMultiplier / ArkoftheCosmos.SwirlBoltAmount * Projectile.damage), 0f, Owner.whoAmI, 0.55f, MathHelper.Pi * 0.05f); { blast.timeLeft = 100; } @@ -204,7 +205,8 @@ namespace CalamityMod.Projectiles.Melee //Spawn a constellation link - Projectile chain = Projectile.NewProjectileDirect(Owner.Center, Vector2.Zero, ProjectileType(), (int)(Projectile.damage * ArkoftheCosmos.chainDamageMultiplier), 0, Owner.whoAmI, (int)(Projectile.timeLeft / 2f)); + var source = Projectile.GetProjectileSource_FromThis(); + Projectile chain = Projectile.NewProjectileDirect(Projectile.GetProjectileSource_FromThis(), source, Owner.Center, Vector2.Zero, ProjectileType(), (int)(Projectile.damage * ArkoftheCosmos.chainDamageMultiplier), 0, Owner.whoAmI, (int)(Projectile.timeLeft / 2f)); chain.timeLeft = (int)(Projectile.timeLeft / 2f); } @@ -241,7 +243,8 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < 3; i++) { - Projectile blast = Projectile.NewProjectileDirect(Projectile.Center + (MathHelper.TwoPi * (i / 3f) + rotationOffset).ToRotationVector2() * 30f, (MathHelper.TwoPi * (i / 3f) + rotationOffset).ToRotationVector2() * 20f, ProjectileType(), (int)(ArkoftheCosmos.SnapBoltsDamageMultiplier * Projectile.damage), 0f, Owner.whoAmI, 0.55f, MathHelper.Pi * 0.05f); + var source = Projectile.GetProjectileSource_FromThis(); + Projectile blast = Projectile.NewProjectileDirect(Projectile.GetProjectileSource_FromThis(), source, Projectile.Center + (MathHelper.TwoPi * (i / 3f) + rotationOffset).ToRotationVector2() * 30f, (MathHelper.TwoPi * (i / 3f) + rotationOffset).ToRotationVector2() * 20f, ProjectileType(), (int)(ArkoftheCosmos.SnapBoltsDamageMultiplier * Projectile.damage), 0f, Owner.whoAmI, 0.55f, MathHelper.Pi * 0.05f); { blast.timeLeft = 100; } @@ -429,12 +432,12 @@ namespace CalamityMod.Projectiles.Melee if (Combo == 3f) { - var snapSound = SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ScissorGuillotineSnap"), Projectile.Center); + var snapSound = SoundEngine.PlaySound(SoundLoader.GetLegacySoundSlot(Mod, "Sounds/Custom/ScissorGuillotineSnap"), Projectile.Center); SafeVolumeChange(ref snapSound, 1.3f); if (Charge <= 1) { - ArkoftheCosmos sword = (Owner.HeldItem.modItem as ArkoftheCosmos); + ArkoftheCosmos sword = (Owner.HeldItem.ModItem as ArkoftheCosmos); if (sword != null) sword.Charge = 2f; } @@ -481,8 +484,8 @@ namespace CalamityMod.Projectiles.Melee public void DrawSingleSwungScissorBlade(Color lightColor) { - Texture2D sword = GetTexture(Combo == 0 ? "CalamityMod/Projectiles/Melee/SunderingScissorsRight" : "CalamityMod/Projectiles/Melee/SunderingScissorsLeft"); - Texture2D glowmask = GetTexture(Combo == 0 ? "CalamityMod/Projectiles/Melee/SunderingScissorsRightGlow" : "CalamityMod/Projectiles/Melee/SunderingScissorsLeftGlow"); + Texture2D sword = Request(Combo == 0 ? "CalamityMod/Projectiles/Melee/SunderingScissorsRight" : "CalamityMod/Projectiles/Melee/SunderingScissorsLeft").Value; + Texture2D glowmask = Request(Combo == 0 ? "CalamityMod/Projectiles/Melee/SunderingScissorsRightGlow" : "CalamityMod/Projectiles/Melee/SunderingScissorsLeftGlow").Value; bool flipped = Owner.direction < 0; SpriteEffects flip = flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None; @@ -505,15 +508,15 @@ namespace CalamityMod.Projectiles.Melee } } - Main.EntitySpriteDraw(sword, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, flip, 0f); - Main.EntitySpriteDraw(glowmask, drawOffset, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, Projectile.scale, flip, 0f); + Main.EntitySpriteDraw(sword, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, flip, 0); + Main.EntitySpriteDraw(glowmask, drawOffset, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, Projectile.scale, flip, 0); if (SwingCompletion > 0.5f && Combo == 0f) { - Texture2D smear = GetTexture("CalamityMod/Particles/TrientCircularSmear"); + Texture2D smear = Request("CalamityMod/Particles/TrientCircularSmear").Value; Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); float opacity = (float)Math.Sin(SwingCompletion * MathHelper.Pi); float rotation = (-MathHelper.PiOver4 * 0.5f + MathHelper.PiOver4 * 0.5f * SwingCompletion + (Combo == 1f ? MathHelper.PiOver4 : 0)) * SwingDirection; @@ -522,16 +525,16 @@ namespace CalamityMod.Projectiles.Melee Main.EntitySpriteDraw(smear, Owner.Center - Main.screenPosition, null, smearColor * 0.5f * opacity, Projectile.velocity.ToRotation() + MathHelper.Pi + rotation, smear.Size() / 2f, Projectile.scale * 2.3f, SpriteEffects.None, 0); Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); } } public void DrawSwungScissors(Color lightColor) { - Texture2D frontBlade = GetTexture("CalamityMod/Projectiles/Melee/SunderingScissorsLeft"); - Texture2D frontBladeGlow = GetTexture("CalamityMod/Projectiles/Melee/SunderingScissorsLeftGlow"); - Texture2D backBlade = GetTexture("CalamityMod/Projectiles/Melee/SunderingScissorsRight"); - Texture2D backBladeGlow = GetTexture("CalamityMod/Projectiles/Melee/SunderingScissorsRightGlow"); + Texture2D frontBlade = Request("CalamityMod/Projectiles/Melee/SunderingScissorsLeft").Value; + Texture2D frontBladeGlow = Request("CalamityMod/Projectiles/Melee/SunderingScissorsLeftGlow").Value; + Texture2D backBlade = Request("CalamityMod/Projectiles/Melee/SunderingScissorsRight").Value; + Texture2D backBladeGlow = Request("CalamityMod/Projectiles/Melee/SunderingScissorsRightGlow").Value; //Front blade bool flipped = Owner.direction < 0; @@ -552,29 +555,29 @@ namespace CalamityMod.Projectiles.Melee if (CalamityConfig.Instance.Afterimages && SwingTimer > ProjectileID.Sets.TrailCacheLength[Projectile.type]) { - Texture2D afterimage = GetTexture("CalamityMod/Projectiles/Melee/SunderingScissorsGlow"); + Texture2D afterimage = Request("CalamityMod/Projectiles/Melee/SunderingScissorsGlow").Value; for (int i = 1; i < Projectile.oldRot.Length; ++i) { Color color = Main.hslToRgb((i / (float)Projectile.oldRot.Length) * 0.1f, 1, 0.6f + (Charge > 0 ? 0.3f : 0f)); float afterimageRotation = Projectile.oldRot[i] + angleShift + extraAngle; - Main.EntitySpriteDraw(afterimage, drawOffset, null, color * 0.15f, afterimageRotation, drawOrigin, Projectile.scale - 0.2f * ((i / (float)Projectile.oldRot.Length)), flip, 0f); + Main.EntitySpriteDraw(afterimage, drawOffset, null, color * 0.15f, afterimageRotation, drawOrigin, Projectile.scale - 0.2f * ((i / (float)Projectile.oldRot.Length)), flip, 0); } } - Main.EntitySpriteDraw(backBlade, backScissorDrawPosition, null, lightColor, drawRotation, backScissorOrigin, Projectile.scale, flip, 0f); - Main.EntitySpriteDraw(backBladeGlow, backScissorDrawPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, backScissorOrigin, Projectile.scale, flip, 0f); + Main.EntitySpriteDraw(backBlade, backScissorDrawPosition, null, lightColor, drawRotation, backScissorOrigin, Projectile.scale, flip, 0); + Main.EntitySpriteDraw(backBladeGlow, backScissorDrawPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, backScissorOrigin, Projectile.scale, flip, 0); - Main.EntitySpriteDraw(frontBlade, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, flip, 0f); - Main.EntitySpriteDraw(frontBladeGlow, drawOffset, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, Projectile.scale, flip, 0f); + Main.EntitySpriteDraw(frontBlade, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, flip, 0); + Main.EntitySpriteDraw(frontBladeGlow, drawOffset, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, Projectile.scale, flip, 0); if (SwingCompletion > 0.5f && Combo == 0f) { - Texture2D smear = GetTexture("CalamityMod/Particles/TrientCircularSmear"); + Texture2D smear = Request("CalamityMod/Particles/TrientCircularSmear").Value; Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); float opacity = (float)Math.Sin(SwingCompletion * MathHelper.Pi); float rotation = (-MathHelper.PiOver4 * 0.5f + MathHelper.PiOver4 * 0.5f * SwingCompletion + (Combo == 1f ? MathHelper.PiOver4 : 0)) * SwingDirection; @@ -583,42 +586,42 @@ namespace CalamityMod.Projectiles.Melee Main.EntitySpriteDraw(smear, Owner.Center - Main.screenPosition, null, smearColor * 0.5f * opacity, Projectile.velocity.ToRotation() + MathHelper.Pi + rotation, smear.Size() / 2f, Projectile.scale * 2.3f, SpriteEffects.None, 0); Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); } } public void DrawSingleThrownScissorBlade(Color lightColor) { - Texture2D sword = GetTexture("CalamityMod/Projectiles/Melee/SunderingScissorsLeft"); - Texture2D glowmask = GetTexture("CalamityMod/Projectiles/Melee/SunderingScissorsLeftGlow"); + Texture2D sword = Request("CalamityMod/Projectiles/Melee/SunderingScissorsLeft").Value; + Texture2D glowmask = Request("CalamityMod/Projectiles/Melee/SunderingScissorsLeftGlow").Value; if (Combo == 3f) { - Texture2D thrownSword = GetTexture("CalamityMod/Projectiles/Melee/SunderingScissorsRight"); - Texture2D thrownGlowmask = GetTexture("CalamityMod/Projectiles/Melee/SunderingScissorsRightGlow"); + Texture2D thrownSword = Request("CalamityMod/Projectiles/Melee/SunderingScissorsRight").Value; + Texture2D thrownGlowmask = Request("CalamityMod/Projectiles/Melee/SunderingScissorsRightGlow").Value; Vector2 drawPos2 = Vector2.SmoothStep(Owner.Center, Projectile.Center, MathHelper.Clamp(SnapEndCompletion + 0.25f, 0f, 1f)); float drawRotation2 = direction.ToRotation() + MathHelper.PiOver4; Vector2 drawOrigin2 = new Vector2(44, 86); - Main.EntitySpriteDraw(thrownSword, drawPos2 - Main.screenPosition, null, lightColor, drawRotation2, drawOrigin2, Projectile.scale, 0f, 0f); - Main.EntitySpriteDraw(thrownGlowmask, drawPos2 - Main.screenPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation2, drawOrigin2, Projectile.scale, 0f, 0f); + Main.EntitySpriteDraw(thrownSword, drawPos2 - Main.screenPosition, null, lightColor, drawRotation2, drawOrigin2, Projectile.scale, 0f, 0); + Main.EntitySpriteDraw(thrownGlowmask, drawPos2 - Main.screenPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation2, drawOrigin2, Projectile.scale, 0f, 0); } Vector2 drawPos = Projectile.Center; float drawRotation = Projectile.rotation + MathHelper.PiOver4; Vector2 drawOrigin = new Vector2(32, 86); //Right on the hole. Well tbh here its not the hole theres a gem on it but you get me. - Main.EntitySpriteDraw(sword, drawPos - Main.screenPosition, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); - Main.EntitySpriteDraw(glowmask, drawPos - Main.screenPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, Projectile.scale, 0f, 0f); + Main.EntitySpriteDraw(sword, drawPos - Main.screenPosition, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0); + Main.EntitySpriteDraw(glowmask, drawPos - Main.screenPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, Projectile.scale, 0f, 0); } public void DrawThrownScissors(Color lightColor) { - Texture2D frontBlade = GetTexture("CalamityMod/Projectiles/Melee/SunderingScissorsLeft"); - Texture2D frontBladeGlow = GetTexture("CalamityMod/Projectiles/Melee/SunderingScissorsLeftGlow"); - Texture2D backBlade = GetTexture("CalamityMod/Projectiles/Melee/SunderingScissorsRight"); - Texture2D backBladeGlow = GetTexture("CalamityMod/Projectiles/Melee/SunderingScissorsRightGlow"); + Texture2D frontBlade = Request("CalamityMod/Projectiles/Melee/SunderingScissorsLeft").Value; + Texture2D frontBladeGlow = Request("CalamityMod/Projectiles/Melee/SunderingScissorsLeftGlow").Value; + Texture2D backBlade = Request("CalamityMod/Projectiles/Melee/SunderingScissorsRight").Value; + Texture2D backBladeGlow = Request("CalamityMod/Projectiles/Melee/SunderingScissorsRightGlow").Value; Vector2 drawPos = Projectile.Center; Vector2 drawOrigin = new Vector2(32, 86); @@ -630,11 +633,11 @@ namespace CalamityMod.Projectiles.Melee if (Combo == 3f) drawRotation2 = Projectile.rotation + MathHelper.Lerp(MathHelper.PiOver2 * 1.33f, MathHelper.PiOver4, MathHelper.Clamp(SnapEndCompletion + 0.5f, 0f, 1f)); - Main.EntitySpriteDraw(backBlade, drawPos - Main.screenPosition, null, lightColor, drawRotation2, drawOrigin2, Projectile.scale, 0f, 0f); - Main.EntitySpriteDraw(backBladeGlow, drawPos - Main.screenPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation2, drawOrigin2, Projectile.scale, 0f, 0f); + Main.EntitySpriteDraw(backBlade, drawPos - Main.screenPosition, null, lightColor, drawRotation2, drawOrigin2, Projectile.scale, 0f, 0); + Main.EntitySpriteDraw(backBladeGlow, drawPos - Main.screenPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation2, drawOrigin2, Projectile.scale, 0f, 0); - Main.EntitySpriteDraw(frontBlade, drawPos - Main.screenPosition, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); - Main.EntitySpriteDraw(frontBladeGlow, drawPos - Main.screenPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, Projectile.scale, 0f, 0f); + Main.EntitySpriteDraw(frontBlade, drawPos - Main.screenPosition, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0); + Main.EntitySpriteDraw(frontBladeGlow, drawPos - Main.screenPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, Projectile.scale, 0f, 0); } public override void SendExtraAI(BinaryWriter writer) diff --git a/Projectiles/Melee/ArkOfTheElements_ParryHoldout.cs b/Projectiles/Melee/ArkOfTheElements_ParryHoldout.cs index 3fd7be49ec..389c01a677 100644 --- a/Projectiles/Melee/ArkOfTheElements_ParryHoldout.cs +++ b/Projectiles/Melee/ArkOfTheElements_ParryHoldout.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.penetrate = -1; } - public override bool CanDamage() => Timer <= ParryTime && AlreadyParried == 0f; + public override bool? CanDamage() => Timer <= ParryTime && AlreadyParried == 0f; public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { @@ -54,14 +54,14 @@ namespace CalamityMod.Projectiles.Melee public void GeneralParryEffects() { - ArkoftheElements sword = (Owner.HeldItem.modItem as ArkoftheElements); + ArkoftheElements sword = (Owner.HeldItem.ModItem as ArkoftheElements); if (sword != null) { sword.Charge = 10f; sword.Combo = 0f; } SoundEngine.PlaySound(SoundID.DD2_WitherBeastCrystalImpact); - var chunder = SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ScissorGuillotineSnap"), Projectile.Center); + var chunder = SoundEngine.PlaySound(SoundLoader.GetLegacySoundSlot(Mod, "Sounds/Custom/ScissorGuillotineSnap"), Projectile.Center); SafeVolumeChange(ref chunder, 1.3f); CombatText.NewText(Projectile.Hitbox, new Color(111, 247, 200), "Parry!", true); @@ -187,8 +187,8 @@ namespace CalamityMod.Projectiles.Melee { if (Main.myPlayer == Owner.whoAmI) { - var barBG = GetTexture("CalamityMod/ExtraTextures/GenericBarBack"); - var barFG = GetTexture("CalamityMod/ExtraTextures/GenericBarFront"); + var barBG = Request("CalamityMod/ExtraTextures/GenericBarBack").Value; + var barFG = Request("CalamityMod/ExtraTextures/GenericBarFront").Value; Vector2 drawPos = Owner.Center - Main.screenPosition + new Vector2(0, -36) - barBG.Size() / 2; Rectangle frame = new Rectangle(0, 0, (int)((Timer - ParryTime) / (MaxTime - ParryTime) * barFG.Width), barFG.Height); @@ -196,16 +196,16 @@ namespace CalamityMod.Projectiles.Melee float opacity = Timer <= ParryTime + 25f ? (Timer - ParryTime) / 25f : (MaxTime - Timer <= 8) ? Projectile.timeLeft / 8f : 1f; Color color = Main.hslToRgb((float)Math.Sin(Main.GlobalTimeWrappedHourly * 1.2f) * 0.05f + 0.08f, 1, 0.65f + (float)Math.Sin(Main.GlobalTimeWrappedHourly * 7f) * 0.1f); - Main.EntitySpriteDraw(barBG, drawPos, color * opacity); - Main.EntitySpriteDraw(barFG, drawPos, frame, color * opacity * 0.8f); + Main.spriteBatch.Draw(barBG, drawPos, color * opacity); + Main.spriteBatch.Draw(barFG, drawPos, frame, color * opacity * 0.8f); } return false; } - Texture2D frontBlade = GetTexture("CalamityMod/Projectiles/Melee/RendingScissorsRight"); - Texture2D frontBladeGlow = GetTexture("CalamityMod/Projectiles/Melee/RendingScissorsRightGlow"); - Texture2D backBlade = GetTexture("CalamityMod/Projectiles/Melee/RendingScissorsLeft"); - Texture2D backBladeGlow = GetTexture("CalamityMod/Projectiles/Melee/RendingScissorsLeftGlow"); + Texture2D frontBlade = Request("CalamityMod/Projectiles/Melee/RendingScissorsRight").Value; + Texture2D frontBladeGlow = Request("CalamityMod/Projectiles/Melee/RendingScissorsRightGlow").Value; + Texture2D backBlade = Request("CalamityMod/Projectiles/Melee/RendingScissorsLeft").Value; + Texture2D backBladeGlow = Request("CalamityMod/Projectiles/Melee/RendingScissorsLeftGlow").Value; float snippingRotation = Projectile.rotation + MathHelper.PiOver4; float snippingRotationBack = Projectile.rotation + MathHelper.PiOver4 * 1.75f; @@ -217,11 +217,11 @@ namespace CalamityMod.Projectiles.Melee Vector2 drawOriginBack = new Vector2(22, 109); //Right on the hole Vector2 drawPosition = Owner.Center + Projectile.velocity * 15 + Projectile.velocity * ThrustDisplaceRatio() * 50f - Main.screenPosition; - Main.EntitySpriteDraw(backBlade, drawPosition, null, lightColor, drawRotationBack, drawOriginBack, Projectile.scale, 0f, 0f); - Main.EntitySpriteDraw(backBladeGlow, drawPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotationBack, drawOriginBack, Projectile.scale, 0f, 0f); + Main.EntitySpriteDraw(backBlade, drawPosition, null, lightColor, drawRotationBack, drawOriginBack, Projectile.scale, 0f, 0); + Main.EntitySpriteDraw(backBladeGlow, drawPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotationBack, drawOriginBack, Projectile.scale, 0f, 0); - Main.EntitySpriteDraw(frontBlade, drawPosition, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); - Main.EntitySpriteDraw(frontBladeGlow, drawPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, Projectile.scale, 0f, 0f); + Main.EntitySpriteDraw(frontBlade, drawPosition, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0); + Main.EntitySpriteDraw(frontBladeGlow, drawPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, Projectile.scale, 0f, 0); return false; } diff --git a/Projectiles/Melee/ArkOfTheElements_SnapBlast.cs b/Projectiles/Melee/ArkOfTheElements_SnapBlast.cs index 780fc49164..2f684b1dc6 100644 --- a/Projectiles/Melee/ArkOfTheElements_SnapBlast.cs +++ b/Projectiles/Melee/ArkOfTheElements_SnapBlast.cs @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.localNPCHitCooldown = (int)MaxTime + 2; } - public override bool CanDamage() + public override bool? CanDamage() { return HoldProgress > 0; } @@ -180,21 +180,20 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - Texture2D sliceTex = GetTexture("CalamityMod/Particles/BloomLine"); + Texture2D sliceTex = Request("CalamityMod/Particles/BloomLine").Value; Color sliceColor = Color.Lerp(Color.OrangeRed, Color.White, SnapProgress); float rot = Projectile.rotation + MathHelper.PiOver2; Vector2 nitpickShiftCorrection = (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * 10f; //Ngl these minor nitpick variables probably be horrible to understand when decompiled into Vector43 Vector2 sliceScale = new Vector2(0.2f * (1 - SnapProgress) ,ThrustDisplaceRatio() * 242f); - Main.EntitySpriteDraw(sliceTex, Projectile.Center + nitpickShiftCorrection - Main.screenPosition, null, sliceColor, rot, new Vector2(sliceTex.Width / 2f, sliceTex.Height), sliceScale, 0f, 0f); - + Main.EntitySpriteDraw(sliceTex, Projectile.Center + nitpickShiftCorrection - Main.screenPosition, null, sliceColor, rot, new Vector2(sliceTex.Width / 2f, sliceTex.Height), sliceScale, 0f, 0); //Draw the scissors if (HoldProgress <= 0.4f) { - Texture2D frontBlade = GetTexture("CalamityMod/Projectiles/Melee/RendingScissorsRight"); - Texture2D backBlade = GetTexture("CalamityMod/Projectiles/Melee/RendingScissorsLeft"); + Texture2D frontBlade = Request("CalamityMod/Projectiles/Melee/RendingScissorsRight").Value; + Texture2D backBlade = Request("CalamityMod/Projectiles/Melee/RendingScissorsLeft").Value; float snippingRotation = Projectile.rotation + MathHelper.PiOver4; float snippingRotationBack = Projectile.rotation + MathHelper.PiOver4 * 1.75f; @@ -211,14 +210,14 @@ namespace CalamityMod.Projectiles.Melee Color drawColor = Color.Orange * opacity * 0.9f; Color drawColorBack = Color.HotPink * opacity * 0.9f; - Main.EntitySpriteDraw(backBlade, drawPosition, null, drawColorBack, drawRotationBack, drawOriginBack, Projectile.scale, 0f, 0f); - Main.EntitySpriteDraw(frontBlade, drawPosition, null, drawColor * opacity, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); + Main.EntitySpriteDraw(backBlade, drawPosition, null, drawColorBack, drawRotationBack, drawOriginBack, Projectile.scale, 0f, 0); + Main.EntitySpriteDraw(frontBlade, drawPosition, null, drawColor * opacity, drawRotation, drawOrigin, Projectile.scale, 0f, 0); } //Draw the rip if (HoldProgress > 0) { - Texture2D lineTex = GetTexture("CalamityMod/Particles/ThinEndedLine"); + Texture2D lineTex = Request("CalamityMod/Particles/ThinEndedLine").Value; Vector2 Shake = HoldProgress > 0.2f ? Vector2.Zero : Vector2.One.RotatedByRandom(MathHelper.TwoPi) * (1 - HoldProgress * 5f) * 0.5f; float raise = (float)Math.Sin(HoldProgress * MathHelper.PiOver2); @@ -258,7 +257,7 @@ namespace CalamityMod.Projectiles.Melee } Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); return false; } diff --git a/Projectiles/Melee/ArkOfTheElements_SwungBlade.cs b/Projectiles/Melee/ArkOfTheElements_SwungBlade.cs index d1e476db68..9efd414608 100644 --- a/Projectiles/Melee/ArkOfTheElements_SwungBlade.cs +++ b/Projectiles/Melee/ArkOfTheElements_SwungBlade.cs @@ -251,12 +251,12 @@ namespace CalamityMod.Projectiles.Melee if (Combo == 3f) { - var snapSound = SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ScissorGuillotineSnap"), Projectile.Center); + var snapSound = SoundEngine.PlaySound(SoundLoader.GetLegacySoundSlot(Mod, "Sounds/Custom/ScissorGuillotineSnap"), Projectile.Center); SafeVolumeChange(ref snapSound, 1.3f); if (Charge <= 1) { - ArkoftheElements sword = (Owner.HeldItem.modItem as ArkoftheElements); + ArkoftheElements sword = (Owner.HeldItem.ModItem as ArkoftheElements); if (sword != null) sword.Charge = 2f; } @@ -287,24 +287,24 @@ namespace CalamityMod.Projectiles.Melee if (!Thrown) { if (Charge > 0) - DrawSwungScissors(spriteBatch, lightColor); + DrawSwungScissors(lightColor); else - DrawSingleSwungScissorBlade(spriteBatch, lightColor); + DrawSingleSwungScissorBlade(lightColor); } else { if (Charge > 0) - DrawThrownScissors(spriteBatch, lightColor); + DrawThrownScissors(lightColor); else - DrawSingleThrownScissorBlade(spriteBatch, lightColor); + DrawSingleThrownScissorBlade(lightColor); } return false; } public void DrawSingleSwungScissorBlade(Color lightColor) { - Texture2D sword = GetTexture(Combo == 0 ? "CalamityMod/Projectiles/Melee/RendingScissorsRight" : "CalamityMod/Projectiles/Melee/RendingScissorsLeft"); - Texture2D glowmask = GetTexture(Combo == 0 ? "CalamityMod/Projectiles/Melee/RendingScissorsRightGlow" : "CalamityMod/Projectiles/Melee/RendingScissorsLeftGlow"); + Texture2D sword = Request(Combo == 0 ? "CalamityMod/Projectiles/Melee/RendingScissorsRight" : "CalamityMod/Projectiles/Melee/RendingScissorsLeft").Value; + Texture2D glowmask = Request(Combo == 0 ? "CalamityMod/Projectiles/Melee/RendingScissorsRightGlow" : "CalamityMod/Projectiles/Melee/RendingScissorsLeftGlow").Value; bool flipped = Owner.direction < 0; SpriteEffects flip = flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None; @@ -327,15 +327,15 @@ namespace CalamityMod.Projectiles.Melee } } - Main.EntitySpriteDraw(sword, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, flip, 0f); - Main.EntitySpriteDraw(glowmask, drawOffset, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, Projectile.scale, flip, 0f); + Main.EntitySpriteDraw(sword, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, flip, 0); + Main.EntitySpriteDraw(glowmask, drawOffset, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, Projectile.scale, flip, 0); if (SwingCompletion > 0.5f) { - Texture2D smear = GetTexture("CalamityMod/Particles/TrientCircularSmear"); + Texture2D smear = Request("CalamityMod/Particles/TrientCircularSmear").Value; Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); float opacity = (float)Math.Sin(SwingCompletion * MathHelper.Pi); float rotation = (-MathHelper.PiOver4 * 0.5f + MathHelper.PiOver4 * 0.5f * SwingCompletion + (Combo == 1f ? MathHelper.PiOver4 : 0)) * SwingDirection; @@ -344,16 +344,16 @@ namespace CalamityMod.Projectiles.Melee Main.EntitySpriteDraw(smear, Owner.Center - Main.screenPosition, null, smearColor * 0.5f * opacity, Projectile.velocity.ToRotation() + MathHelper.Pi + rotation, smear.Size() / 2f, Projectile.scale * 2.3f, SpriteEffects.None, 0); Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); } } public void DrawSwungScissors(Color lightColor) { - Texture2D frontBlade = GetTexture("CalamityMod/Projectiles/Melee/RendingScissorsRight"); - Texture2D frontBladeGlow = GetTexture("CalamityMod/Projectiles/Melee/RendingScissorsRightGlow"); - Texture2D backBlade = GetTexture("CalamityMod/Projectiles/Melee/RendingScissorsLeft"); - Texture2D backBladeGlow = GetTexture("CalamityMod/Projectiles/Melee/RendingScissorsLeftGlow"); + Texture2D frontBlade = Request("CalamityMod/Projectiles/Melee/RendingScissorsRight").Value; + Texture2D frontBladeGlow = Request("CalamityMod/Projectiles/Melee/RendingScissorsRightGlow").Value; + Texture2D backBlade = Request("CalamityMod/Projectiles/Melee/RendingScissorsLeft").Value; + Texture2D backBladeGlow = Request("CalamityMod/Projectiles/Melee/RendingScissorsLeftGlow").Value; //Front blade bool flipped = Owner.direction < 0; @@ -384,18 +384,18 @@ namespace CalamityMod.Projectiles.Melee } } - Main.EntitySpriteDraw(backBlade, backScissorDrawPosition, null, lightColor, backScissorRotation, backScissorOrigin, Projectile.scale, flip, 0f); + Main.EntitySpriteDraw(backBlade, backScissorDrawPosition, null, lightColor, backScissorRotation, backScissorOrigin, Projectile.scale, flip, 0); Main.EntitySpriteDraw(backBladeGlow, backScissorDrawPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), backScissorRotation, backScissorOrigin, Projectile.scale, flip, 0f); - Main.EntitySpriteDraw(frontBlade, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, flip, 0f); - Main.EntitySpriteDraw(frontBladeGlow, drawOffset, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, Projectile.scale, flip, 0f); + Main.EntitySpriteDraw(frontBlade, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, flip, 0); + Main.EntitySpriteDraw(frontBladeGlow, drawOffset, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, Projectile.scale, flip, 0); if (SwingCompletion > 0.5f) { - Texture2D smear = GetTexture("CalamityMod/Particles/TrientCircularSmear"); + Texture2D smear = Request("CalamityMod/Particles/TrientCircularSmear").Value; Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); float opacity = (float)Math.Sin(SwingCompletion * MathHelper.Pi); float rotation = (-MathHelper.PiOver4 * 0.5f + MathHelper.PiOver4 * 0.5f * SwingCompletion + (Combo == 1f ? MathHelper.PiOver4 : 0)) * SwingDirection; @@ -404,27 +404,26 @@ namespace CalamityMod.Projectiles.Melee Main.EntitySpriteDraw(smear, Owner.Center - Main.screenPosition, null, smearColor * 0.5f * opacity, Projectile.velocity.ToRotation() + MathHelper.Pi + rotation, smear.Size() / 2f, Projectile.scale * 2.3f, SpriteEffects.None, 0); Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); } } public void DrawSingleThrownScissorBlade(Color lightColor) { - Texture2D sword = GetTexture("CalamityMod/Projectiles/Melee/RendingScissorsRight"); - Texture2D glowmask = GetTexture("CalamityMod/Projectiles/Melee/RendingScissorsRightGlow"); - + Texture2D sword = Request("CalamityMod/Projectiles/Melee/RendingScissorsRight").Value; + Texture2D glowmask = Request("CalamityMod/Projectiles/Melee/RendingScissorsRightGlow").Value; if (Combo == 3f) { - Texture2D thrownSword = GetTexture("CalamityMod/Projectiles/Melee/RendingScissorsLeft"); - Texture2D thrownGlowmask = GetTexture("CalamityMod/Projectiles/Melee/RendingScissorsLeftGlow"); + Texture2D thrownSword = Request("CalamityMod/Projectiles/Melee/RendingScissorsLeft").Value; + Texture2D thrownGlowmask = Request("CalamityMod/Projectiles/Melee/RendingScissorsLeftGlow").Value; Vector2 drawPos2 = Vector2.SmoothStep(Owner.Center, Projectile.Center, MathHelper.Clamp(SnapEndCompletion + 0.25f, 0f, 1f)); Vector2 drawOrigin2 = new Vector2(22, 109); //Right on the hole float drawRotation2 = direction.ToRotation() + MathHelper.PiOver2; - Main.EntitySpriteDraw(thrownSword, drawPos2 - Main.screenPosition, null, lightColor, drawRotation2, drawOrigin2, Projectile.scale, 0f, 0f); - Main.EntitySpriteDraw(thrownGlowmask, drawPos2 - Main.screenPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation2, drawOrigin2, Projectile.scale, 0f, 0f); + Main.EntitySpriteDraw(thrownSword, drawPos2 - Main.screenPosition, null, lightColor, drawRotation2, drawOrigin2, Projectile.scale, 0f, 0); + Main.EntitySpriteDraw(thrownGlowmask, drawPos2 - Main.screenPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation2, drawOrigin2, Projectile.scale, 0f, 0); } @@ -432,13 +431,13 @@ namespace CalamityMod.Projectiles.Melee Vector2 drawOrigin = new Vector2(51, 86); //Right on the hole float drawRotation = Projectile.rotation + MathHelper.PiOver4; - Main.EntitySpriteDraw(sword, drawPos - Main.screenPosition, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); - Main.EntitySpriteDraw(glowmask, drawPos - Main.screenPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, Projectile.scale, 0f, 0f); + Main.EntitySpriteDraw(sword, drawPos - Main.screenPosition, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0); + Main.EntitySpriteDraw(glowmask, drawPos - Main.screenPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, Projectile.scale, 0f, 0); - Texture2D smear = GetTexture("CalamityMod/Particles/TrientCircularSmear"); + Texture2D smear = Request("CalamityMod/Particles/TrientCircularSmear").Value; Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); float opacity = Combo == 3f ? (float)Math.Sin(SnapEndCompletion * MathHelper.PiOver2 + MathHelper.PiOver2) : (float)Math.Sin(ThrowCompletion * MathHelper.Pi); float rotation = drawRotation + MathHelper.PiOver2 * 1.5f; @@ -447,15 +446,15 @@ namespace CalamityMod.Projectiles.Melee Main.EntitySpriteDraw(smear, Projectile.Center - Main.screenPosition, null, smearColor * 0.5f * opacity, rotation, smear.Size() / 2f, Projectile.scale * 1.4f, SpriteEffects.None, 0); Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); } public void DrawThrownScissors(Color lightColor) { - Texture2D frontBlade = GetTexture("CalamityMod/Projectiles/Melee/RendingScissorsRight"); - Texture2D frontBladeGlow = GetTexture("CalamityMod/Projectiles/Melee/RendingScissorsRightGlow"); - Texture2D backBlade = GetTexture("CalamityMod/Projectiles/Melee/RendingScissorsLeft"); - Texture2D backBladeGlow = GetTexture("CalamityMod/Projectiles/Melee/RendingScissorsLeftGlow"); + Texture2D frontBlade = Request("CalamityMod/Projectiles/Melee/RendingScissorsRight").Value; + Texture2D frontBladeGlow = Request("CalamityMod/Projectiles/Melee/RendingScissorsRightGlow").Value; + Texture2D backBlade = Request("CalamityMod/Projectiles/Melee/RendingScissorsLeft").Value; + Texture2D backBladeGlow = Request("CalamityMod/Projectiles/Melee/RendingScissorsLeftGlow").Value; Vector2 drawPos = Projectile.Center; Vector2 drawOrigin = new Vector2(51, 86); //Right on the hole @@ -467,18 +466,18 @@ namespace CalamityMod.Projectiles.Melee if (Combo == 3f) drawRotation2 = Projectile.rotation + MathHelper.Lerp(-MathHelper.PiOver4 * 0.33f, MathHelper.PiOver2 * 0.85f, MathHelper.Clamp(SnapEndCompletion + 0.5f, 0f, 1f)); - Main.EntitySpriteDraw(backBlade, drawPos - Main.screenPosition, null, lightColor, drawRotation2, drawOrigin2, Projectile.scale, 0f, 0f); - Main.EntitySpriteDraw(backBladeGlow, drawPos - Main.screenPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation2, drawOrigin2, Projectile.scale, 0f, 0f); + Main.EntitySpriteDraw(backBlade, drawPos - Main.screenPosition, null, lightColor, drawRotation2, drawOrigin2, Projectile.scale, 0f, 0); + Main.EntitySpriteDraw(backBladeGlow, drawPos - Main.screenPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation2, drawOrigin2, Projectile.scale, 0f, 0); - Main.EntitySpriteDraw(frontBlade, drawPos - Main.screenPosition, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); - Main.EntitySpriteDraw(frontBladeGlow, drawPos - Main.screenPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, Projectile.scale, 0f, 0f); + Main.EntitySpriteDraw(frontBlade, drawPos - Main.screenPosition, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0); + Main.EntitySpriteDraw(frontBladeGlow, drawPos - Main.screenPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, Projectile.scale, 0f, 0); //Smear stuff - Texture2D smear = GetTexture("CalamityMod/Particles/TrientCircularSmear"); + Texture2D smear = Request("CalamityMod/Particles/TrientCircularSmear").Value; Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); float opacity = Combo == 3f ? (float)Math.Sin(SnapEndCompletion * MathHelper.PiOver2 + MathHelper.PiOver2) : (float)Math.Sin(ThrowCompletion * MathHelper.Pi); float rotation = drawRotation + MathHelper.PiOver2 * 1.5f; @@ -487,7 +486,7 @@ namespace CalamityMod.Projectiles.Melee Main.EntitySpriteDraw(smear, Projectile.Center - Main.screenPosition, null, smearColor * 0.5f * opacity, rotation, smear.Size() / 2f, Projectile.scale * 1.4f, SpriteEffects.None, 0); Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); } public override void SendExtraAI(BinaryWriter writer) diff --git a/Projectiles/Melee/ArkoftheCosmos_Constellation.cs b/Projectiles/Melee/ArkoftheCosmos_Constellation.cs index 60fdd0dda6..b541c5ec28 100644 --- a/Projectiles/Melee/ArkoftheCosmos_Constellation.cs +++ b/Projectiles/Melee/ArkoftheCosmos_Constellation.cs @@ -146,11 +146,8 @@ namespace CalamityMod.Projectiles.Melee if (Particles != null) { Main.spriteBatch.EnterShaderRegion(BlendState.Additive); - foreach (Particle particle in Particles) - { - particle.CustomDraw(spriteBatch); - } + particle.CustomDraw(Main.spriteBatch); Main.spriteBatch.ExitShaderRegion(); } diff --git a/Projectiles/Melee/AtaraxiaHoming.cs b/Projectiles/Melee/AtaraxiaHoming.cs index 35b0f60f49..30f2722dc6 100644 --- a/Projectiles/Melee/AtaraxiaHoming.cs +++ b/Projectiles/Melee/AtaraxiaHoming.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using System; using Terraria; using Terraria.ModLoader; @@ -127,9 +127,9 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - drawOffsetX = -28; - drawOriginOffsetY = -2; - drawOriginOffsetX = 12; + DrawOffsetX = -28; + DrawOriginOffsetY = -2; + DrawOriginOffsetX = 12; Projectile.rotation = Projectile.velocity.ToRotation(); // Run homing code @@ -159,7 +159,7 @@ namespace CalamityMod.Projectiles.Melee } // Cannot deal damage for the first several frames of existence. - public override bool CanDamage() + public override bool? CanDamage() { return Projectile.timeLeft < Lifespan - IntangibleFrames; } diff --git a/Projectiles/Melee/AtaraxiaMain.cs b/Projectiles/Melee/AtaraxiaMain.cs index dfa5a4c34b..39ce8bd410 100644 --- a/Projectiles/Melee/AtaraxiaMain.cs +++ b/Projectiles/Melee/AtaraxiaMain.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -31,9 +31,9 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - drawOffsetX = -40; - drawOriginOffsetY = -3; - drawOriginOffsetX = 18; + DrawOffsetX = -40; + DrawOriginOffsetY = -3; + DrawOriginOffsetX = 18; Projectile.rotation = Projectile.velocity.ToRotation(); // Light diff --git a/Projectiles/Melee/AtaraxiaSide.cs b/Projectiles/Melee/AtaraxiaSide.cs index 872b22d903..4eabc6a6d2 100644 --- a/Projectiles/Melee/AtaraxiaSide.cs +++ b/Projectiles/Melee/AtaraxiaSide.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -31,9 +31,9 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - drawOffsetX = -28; - drawOriginOffsetY = -2; - drawOriginOffsetX = 12; + DrawOffsetX = -28; + DrawOriginOffsetY = -2; + DrawOriginOffsetX = 12; Projectile.rotation = Projectile.velocity.ToRotation(); // Light @@ -80,7 +80,7 @@ namespace CalamityMod.Projectiles.Melee { projVec = projVec.RotatedBy(angleVariance); if (Projectile.owner == Main.myPlayer) - Projectile.NewProjectile(Projectile.Center, projVec, splitID, damage, 1.5f, Main.myPlayer); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, projVec, splitID, damage, 1.5f, Main.myPlayer); } } } diff --git a/Projectiles/Melee/AtaraxiaSplit.cs b/Projectiles/Melee/AtaraxiaSplit.cs index 1d174a5e5b..2fc8855d3d 100644 --- a/Projectiles/Melee/AtaraxiaSplit.cs +++ b/Projectiles/Melee/AtaraxiaSplit.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { @@ -26,9 +26,9 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - drawOffsetX = -5; - drawOriginOffsetY = -1; - drawOriginOffsetX = 0; + DrawOffsetX = -5; + DrawOriginOffsetY = -1; + DrawOriginOffsetX = 0; Projectile.rotation = Projectile.velocity.ToRotation(); // Slow down exponentially and fade away diff --git a/Projectiles/Melee/BalefulHarvesterProjectile.cs b/Projectiles/Melee/BalefulHarvesterProjectile.cs index 96e0f3b28f..083960e713 100644 --- a/Projectiles/Melee/BalefulHarvesterProjectile.cs +++ b/Projectiles/Melee/BalefulHarvesterProjectile.cs @@ -153,7 +153,7 @@ namespace CalamityMod.Projectiles.Melee for (int k = 0; k < 2; k++) { Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 174, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); - Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, Main.rand.Next(-35, 36) * 0.2f, Main.rand.Next(-35, 36) * 0.2f, ModContent.ProjectileType(), + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, Main.rand.Next(-35, 36) * 0.2f, Main.rand.Next(-35, 36) * 0.2f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.35), Projectile.knockBack * 0.35f, Main.myPlayer, 0f, 0f); } } diff --git a/Projectiles/Melee/BallOFuguProj.cs b/Projectiles/Melee/BallOFuguProj.cs index 8f04821b4f..641cc2c9f2 100644 --- a/Projectiles/Melee/BallOFuguProj.cs +++ b/Projectiles/Melee/BallOFuguProj.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using Terraria; @@ -90,7 +90,7 @@ namespace CalamityMod.Projectiles.Melee vector63.Normalize(); vector63 *= (float)Main.rand.Next(45, 65) * 0.1f; vector63 = vector63.RotatedBy((Main.rand.NextDouble() - 0.5) * 1.5707963705062866, default); - Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, vector63.X, vector63.Y, ModContent.ProjectileType(), (int)(Projectile.damage * 0.6), Projectile.knockBack * 0.2f, Projectile.owner, -10f, 0f); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, vector63.X, vector63.Y, ModContent.ProjectileType(), (int)(Projectile.damage * 0.6), Projectile.knockBack * 0.2f, Projectile.owner, -10f, 0f); } } @@ -106,8 +106,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { Vector2 mountedCenter = Main.player[Projectile.owner].MountedCenter; - Color transparent = Microsoft.Xna.Framework.Color.Transparent; - Texture2D texture2D2 = ModContent.Request("CalamityMod/ExtraTextures/Chains/BallOFuguChain"); + Texture2D texture2D2 = ModContent.Request("CalamityMod/ExtraTextures/Chains/BallOFuguChain").Value; Vector2 vector17 = Projectile.Center; Rectangle? sourceRectangle = null; Vector2 origin = new Vector2((float)texture2D2.Width * 0.5f, (float)texture2D2.Height * 0.5f); diff --git a/Projectiles/Melee/BansheeHookScythe.cs b/Projectiles/Melee/BansheeHookScythe.cs index 6bbec2e0b5..cc2455a3ed 100644 --- a/Projectiles/Melee/BansheeHookScythe.cs +++ b/Projectiles/Melee/BansheeHookScythe.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -17,7 +17,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.height = 38; Projectile.aiStyle = 18; - aiType = ProjectileID.DeathSickle; + AIType = ProjectileID.DeathSickle; Projectile.alpha = 100; Projectile.friendly = true; @@ -41,8 +41,8 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.timeLeft < 85) { byte b2 = (byte)(Projectile.timeLeft * 3); - byte a2 = (byte)(100f * ((float)b2 / 255f)); - return new Color((int)b2, (int)b2, (int)b2, (int)a2); + byte a2 = (byte)(100f * (b2 / 255f)); + return new Color(b2, b2, b2, a2); } return new Color(255, 255, 255, 100); } diff --git a/Projectiles/Melee/BiomeBladeHoldout.cs b/Projectiles/Melee/BiomeBladeHoldout.cs index 7b5784fc3c..c1248a0e65 100644 --- a/Projectiles/Melee/BiomeBladeHoldout.cs +++ b/Projectiles/Melee/BiomeBladeHoldout.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Projectiles.Melee public class BiomeBladeHoldout : ModProjectile //Visuals { private Player Owner => Main.player[Projectile.owner]; - public bool OwnerCanUseItem => Owner.HeldItem == associatedItem ? (Owner.HeldItem.modItem as TrueBiomeBlade).CanUseItem(Owner) : false; + public bool OwnerCanUseItem => Owner.HeldItem == associatedItem ? (Owner.HeldItem.ModItem as TrueBiomeBlade).CanUseItem(Owner) : false; public bool OwnerMayChannel => Owner.itemAnimation == 0 && OwnerCanUseItem && Owner.Calamity().mouseRight && Owner.active && !Owner.dead && Owner.StandingStill() && !Owner.mount.Active && Owner.CheckSolidGround(1, 3); public ref float ChanneledState => ref Projectile.ai[0]; public ref float ChannelTimer => ref Projectile.ai[1]; @@ -64,9 +64,9 @@ namespace CalamityMod.Projectiles.Melee associatedItem = Owner.HeldItem; //Switch up the attunements - Attunement temporaryAttunementStorage = (associatedItem.modItem as TrueBiomeBlade).mainAttunement; - (associatedItem.modItem as TrueBiomeBlade).mainAttunement = (associatedItem.modItem as TrueBiomeBlade).secondaryAttunement; - (associatedItem.modItem as TrueBiomeBlade).secondaryAttunement = temporaryAttunementStorage; + Attunement temporaryAttunementStorage = (associatedItem.ModItem as TrueBiomeBlade).mainAttunement; + (associatedItem.ModItem as TrueBiomeBlade).mainAttunement = (associatedItem.ModItem as TrueBiomeBlade).secondaryAttunement; + (associatedItem.ModItem as TrueBiomeBlade).secondaryAttunement = temporaryAttunementStorage; Initialized = 1f; } @@ -89,11 +89,11 @@ namespace CalamityMod.Projectiles.Melee if (ChannelTimer >= ChannelTime) { - Attune((TrueBiomeBlade)associatedItem.modItem); + Attune((TrueBiomeBlade)associatedItem.ModItem); Projectile.timeLeft = 120; ChanneledState = 2f; //State where it stays invisible doing nothing. Acts as a cooldown - Color particleColor = (associatedItem.modItem as TrueBiomeBlade).mainAttunement.tooltipColor; + Color particleColor = (associatedItem.ModItem as TrueBiomeBlade).mainAttunement.tooltipColor; for (int i = 0; i <= 5; i++) { @@ -122,7 +122,7 @@ namespace CalamityMod.Projectiles.Melee bool desert = Owner.ZoneDesert; bool hell = Owner.ZoneUnderworldHeight; bool ocean = Owner.ZoneBeach || Owner.Calamity().ZoneSulphur; - bool holy = Owner.ZoneHoly; + bool hallow = Owner.ZoneHallow; bool astral = Owner.Calamity().ZoneAstral; bool marine = Owner.Calamity().ZoneAbyss || Owner.Calamity().ZoneSunkenSea; @@ -136,7 +136,7 @@ namespace CalamityMod.Projectiles.Melee attunement = Attunement.attunementArray[(int)AttunementID.TrueTropical]; if (evil) attunement = Attunement.attunementArray[(int)AttunementID.TrueEvil]; - if (holy) + if (hallow) attunement = Attunement.attunementArray[(int)AttunementID.Holy]; if (astral) attunement = Attunement.attunementArray[(int)AttunementID.Astral]; @@ -163,10 +163,10 @@ namespace CalamityMod.Projectiles.Melee return; } //If we swapped out the main attunement for the second one despite the second attunement being empty at the time, unswap them. - if ((associatedItem.modItem as TrueBiomeBlade).mainAttunement == null && (associatedItem.modItem as TrueBiomeBlade).secondaryAttunement != null) + if ((associatedItem.ModItem as TrueBiomeBlade).mainAttunement == null && (associatedItem.ModItem as TrueBiomeBlade).secondaryAttunement != null) { - (associatedItem.modItem as TrueBiomeBlade).mainAttunement = (associatedItem.modItem as TrueBiomeBlade).secondaryAttunement; - (associatedItem.modItem as TrueBiomeBlade).secondaryAttunement = null; + (associatedItem.ModItem as TrueBiomeBlade).mainAttunement = (associatedItem.ModItem as TrueBiomeBlade).secondaryAttunement; + (associatedItem.ModItem as TrueBiomeBlade).secondaryAttunement = null; } } @@ -177,7 +177,7 @@ namespace CalamityMod.Projectiles.Melee else if (ChanneledState == 1f) { - Texture2D tex = GetTexture(Texture); + Texture2D tex = Request(Texture).Value; Vector2 squishyScale = new Vector2(Math.Abs((float)Math.Sin(MathHelper.Pi + MathHelper.TwoPi * Projectile.timeLeft / 30f)), 1f); SpriteEffects flip = (float)Math.Sin(MathHelper.Pi + MathHelper.TwoPi * Projectile.timeLeft / 30f) > 0 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; Main.EntitySpriteDraw(tex, Projectile.position - Main.screenPosition, null, lightColor * (Projectile.timeLeft / 60f), 0, tex.Size() / 2, squishyScale * (2f - (Projectile.timeLeft / 60f)), flip, 0); diff --git a/Projectiles/Melee/BladecrestOathswordProj.cs b/Projectiles/Melee/BladecrestOathswordProj.cs index f7ef4a71f7..877ecb2f6f 100644 --- a/Projectiles/Melee/BladecrestOathswordProj.cs +++ b/Projectiles/Melee/BladecrestOathswordProj.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Items.Weapons.Melee; using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Melee public override string Texture => "CalamityMod/Items/Weapons/Melee/BladecrestOathsword"; public override int AssociatedItemID => ModContent.ItemType(); public override int IntendedProjectileType => ModContent.ProjectileType(); - public override bool CanDamage() => CurrentState != 0; //Could also disable the damage during the channel state, + public override bool? CanDamage() => CurrentState != 0; //Could also disable the damage during the channel state, public override void SetStaticDefaults() { @@ -92,7 +92,7 @@ namespace CalamityMod.Projectiles.Melee if ((swingCompletion > 0f && swingCompletion < 1f) || PostSwingRepositionDelay > 0f) { - swingSpeedInterpolant = MathHelper.Lerp(swingSpeedInterpolant, 1f, Utils.InverseLerp(0f, 0.2f, swingCompletion, true)); + swingSpeedInterpolant = MathHelper.Lerp(swingSpeedInterpolant, 1f, Utils.GetLerpValue(0f, 0.2f, swingCompletion, true)); float horizontalAngle = MathHelper.Lerp(-1.2f, 2.6f, (float)Math.Pow(MathHelper.SmoothStep(0f, 1f, swingCompletion), 3D)) * Direction; Matrix offsetLinearTransformation = Matrix.CreateRotationZ(horizontalAngle); @@ -100,13 +100,12 @@ namespace CalamityMod.Projectiles.Melee aimDirection3D = Vector3.Transform(Vector3.UnitX, offsetLinearTransformation); } - // Fuck this shit. - // The code is kept around if we want the holdout effect but I'm honestly not going to continue Criticism Whack-a-Mole with this frankly arbitrary visual. + // Disable the holdout effect. This was decided after indeciciveness with what would be best. else Projectile.Opacity = 0f; // Determine the horizontal stretch offset of the blade. This is used in matrix math below to create 2.5D visuals. - BladeHorizontalFactor = MathHelper.Lerp(1f, 1.5f, (aimDirection3D.X * 0.5f + 0.5f) * Utils.InverseLerp(1f, 0.8f, unchangedSwingCompletion, true)); + BladeHorizontalFactor = MathHelper.Lerp(1f, 1.5f, (aimDirection3D.X * 0.5f + 0.5f) * Utils.GetLerpValue(1f, 0.8f, unchangedSwingCompletion, true)); float baseRotation = new Vector2(aimDirection3D.X, aimDirection3D.Y).ToRotation(); @@ -129,7 +128,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.rotation = Projectile.rotation.AngleTowards(idealRotation, swingSpeedInterpolant * 0.45f).AngleLerp(idealRotation, swingSpeedInterpolant * 0.2f); // Offset the blade so that the handle is attached to the owner's hand. - float horizontalBladeOffset = MathHelper.Lerp(-4f, 10f, Utils.InverseLerp(1f, 0.72f, unchangedSwingCompletion, true) * Utils.InverseLerp(0f, 0.28f, unchangedSwingCompletion, true)); + float horizontalBladeOffset = MathHelper.Lerp(-4f, 10f, Utils.GetLerpValue(1f, 0.72f, unchangedSwingCompletion, true) * Utils.GetLerpValue(0f, 0.28f, unchangedSwingCompletion, true)); Vector2 bladeOffset = (Projectile.rotation - MathHelper.PiOver4).ToRotationVector2() * Projectile.width * 0.5f; bladeOffset += new Vector2(Direction * horizontalBladeOffset, 2f).RotatedBy(Owner.fullRotation) + Vector2.UnitY * Owner.gfxOffY; Projectile.position += bladeOffset; @@ -153,7 +152,7 @@ namespace CalamityMod.Projectiles.Melee bloodScytheShootVelocity.Y *= 0.04f; bloodScytheShootVelocity = bloodScytheShootVelocity.SafeNormalize(Vector2.UnitY) * 50f; Vector2 bloodScytheSpawnPosition = Projectile.Center + bloodScytheShootVelocity.SafeNormalize(Vector2.UnitY) * 50f; - Projectile.NewProjectile(bloodScytheSpawnPosition, bloodScytheShootVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack * 0.4f, Projectile.owner); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), bloodScytheSpawnPosition, bloodScytheShootVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack * 0.4f, Projectile.owner); } } } @@ -209,7 +208,7 @@ namespace CalamityMod.Projectiles.Melee { ItemLoader.OnHitNPC(Owner.ActiveItem(), Owner, target, damage, knockback, crit); NPCLoader.OnHitByItem(target, Owner, Owner.ActiveItem(), damage, knockback, crit); - PlayerHooks.OnHitNPC(Owner, Owner.ActiveItem(), target, damage, knockback, crit); + PlayerLoader.OnHitNPC(Owner, Owner.ActiveItem(), target, damage, knockback, crit); } } } diff --git a/Projectiles/Melee/BlazingPhantomBlade.cs b/Projectiles/Melee/BlazingPhantomBlade.cs index 90677796da..151e0871bf 100644 --- a/Projectiles/Melee/BlazingPhantomBlade.cs +++ b/Projectiles/Melee/BlazingPhantomBlade.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.penetrate = 5; Projectile.timeLeft = 180; Projectile.ignoreWater = true; - aiType = ProjectileID.DeathSickle; + AIType = ProjectileID.DeathSickle; } public override void AI() @@ -42,8 +42,8 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.timeLeft < 85) { byte b2 = (byte)(Projectile.timeLeft * 3); - byte a2 = (byte)(100f * ((float)b2 / 255f)); - return new Color((int)b2, (int)b2, (int)b2, (int)a2); + byte a2 = (byte)(100f * (b2 / 255f)); + return new Color(b2, b2, b2, a2); } return new Color(255, 255, 255, 100); } diff --git a/Projectiles/Melee/BloodBall.cs b/Projectiles/Melee/BloodBall.cs index 9a963cdfea..2570c90510 100644 --- a/Projectiles/Melee/BloodBall.cs +++ b/Projectiles/Melee/BloodBall.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; using Terraria.ID; @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Melee { for (int num228 = num225; num228 < num226; num228++) { - if (Main.tile[num227, num228] != null && Main.tile[num227, num228].nactive() && (Main.tileSolid[(int)Main.tile[num227, num228].TileType] || (Main.tileSolidTop[(int)Main.tile[num227, num228].TileType] && Main.tile[num227, num228].TileFrameY == 0))) + if (Main.tile[num227, num228] != null && Main.tile[num227, num228].HasUnactuatedTile && (Main.tileSolid[(int)Main.tile[num227, num228].TileType] || (Main.tileSolidTop[(int)Main.tile[num227, num228].TileType] && Main.tile[num227, num228].TileFrameY == 0))) { Vector2 vector19; vector19.X = (float)(num227 * 16); diff --git a/Projectiles/Melee/BloodScythe.cs b/Projectiles/Melee/BloodScythe.cs index 073f99055b..0747cad3d4 100644 --- a/Projectiles/Melee/BloodScythe.cs +++ b/Projectiles/Melee/BloodScythe.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using Terraria; @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.velocity *= 0.935f; Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.1f; - Projectile.Opacity = Utils.InverseLerp(1f, 6f, Projectile.velocity.Length(), true); + Projectile.Opacity = Utils.GetLerpValue(1f, 6f, Projectile.velocity.Length(), true); if (Projectile.Opacity <= 0f) Projectile.Kill(); diff --git a/Projectiles/Melee/BloodyBlade.cs b/Projectiles/Melee/BloodyBlade.cs index ae466ed35c..7216c38328 100644 --- a/Projectiles/Melee/BloodyBlade.cs +++ b/Projectiles/Melee/BloodyBlade.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.width = 48; Projectile.height = 48; Projectile.aiStyle = 18; - aiType = ProjectileID.DeathSickle; + AIType = ProjectileID.DeathSickle; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; Projectile.penetrate = 3; diff --git a/Projectiles/Melee/BonebreakerFragment1.cs b/Projectiles/Melee/BonebreakerFragment1.cs index 3ec64edc25..d2f58f7697 100644 --- a/Projectiles/Melee/BonebreakerFragment1.cs +++ b/Projectiles/Melee/BonebreakerFragment1.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; @@ -31,13 +31,13 @@ namespace CalamityMod.Projectiles.Melee //Changes the texture of the projectile if (Projectile.ai[0] == 1f) { - Texture2D texture = ModContent.Request("CalamityMod/Projectiles/Melee/BonebreakerFragment2"); + Texture2D texture = ModContent.Request("CalamityMod/Projectiles/Melee/BonebreakerFragment2").Value; Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, texture.Height / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } if (Projectile.ai[0] == 2f) { - Texture2D texture = ModContent.Request("CalamityMod/Projectiles/Melee/BonebreakerFragment2"); + Texture2D texture = ModContent.Request("CalamityMod/Projectiles/Melee/BonebreakerFragment2").Value; Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, texture.Height / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Melee/BonebreakerProjectile.cs b/Projectiles/Melee/BonebreakerProjectile.cs index 9941c25115..ed0bbb61b5 100644 --- a/Projectiles/Melee/BonebreakerProjectile.cs +++ b/Projectiles/Melee/BonebreakerProjectile.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -89,7 +89,7 @@ namespace CalamityMod.Projectiles.Melee } velocity.Normalize(); velocity *= (float)Main.rand.Next(70, 101) * 0.1f; - int shard = Projectile.NewProjectile(Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5f), Projectile.knockBack * 0.5f, Projectile.owner, Main.rand.Next(0,4), 0f); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5f), Projectile.knockBack * 0.5f, Projectile.owner, Main.rand.Next(0,4), 0f); } } } diff --git a/Projectiles/Melee/Brimblast.cs b/Projectiles/Melee/Brimblast.cs index 8b9022c3a0..f1c893f270 100644 --- a/Projectiles/Melee/Brimblast.cs +++ b/Projectiles/Melee/Brimblast.cs @@ -1,4 +1,4 @@ -using CalamityMod.Dusts; +using CalamityMod.Dusts; using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; @@ -86,6 +86,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { + // TODO -- Change this to use proper i-frame variables. target.immune[Projectile.owner] = 7; target.AddBuff(ModContent.BuffType(), 120); } diff --git a/Projectiles/Melee/BrimlanceStandingFire.cs b/Projectiles/Melee/BrimlanceStandingFire.cs index 214cb2730b..1786526e7a 100644 --- a/Projectiles/Melee/BrimlanceStandingFire.cs +++ b/Projectiles/Melee/BrimlanceStandingFire.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; @@ -97,6 +97,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { + // TODO -- Change this to use proper i-frame variables. target.immune[Projectile.owner] = 7; target.AddBuff(ModContent.BuffType(), 120); } diff --git a/Projectiles/Melee/Brimlash2.cs b/Projectiles/Melee/Brimlash2.cs index b5e6ffcb0c..4a10e1f0ac 100644 --- a/Projectiles/Melee/Brimlash2.cs +++ b/Projectiles/Melee/Brimlash2.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.width = 20; Projectile.height = 20; Projectile.aiStyle = 27; - aiType = ProjectileID.LightBeam; + AIType = ProjectileID.LightBeam; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.penetrate = 1; diff --git a/Projectiles/Melee/BrimlashProj.cs b/Projectiles/Melee/BrimlashProj.cs index 8d5113d1d9..d5ab8efe48 100644 --- a/Projectiles/Melee/BrimlashProj.cs +++ b/Projectiles/Melee/BrimlashProj.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.width = 20; Projectile.height = 20; Projectile.aiStyle = 27; - aiType = ProjectileID.LightBeam; + AIType = ProjectileID.LightBeam; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.penetrate = -1; @@ -88,8 +88,8 @@ namespace CalamityMod.Projectiles.Melee for (i = 0; i < 2; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); - Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Melee/BrimstoneBoom.cs b/Projectiles/Melee/BrimstoneBoom.cs index cdfae4c092..1029a0ebbf 100644 --- a/Projectiles/Melee/BrimstoneBoom.cs +++ b/Projectiles/Melee/BrimstoneBoom.cs @@ -1,4 +1,4 @@ -using CalamityMod.Dusts; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; using System; using Terraria; @@ -69,6 +69,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { + // TODO -- Change this to use proper i-frame variables. target.immune[Projectile.owner] = 6; } } diff --git a/Projectiles/Melee/BrimstoneLaserFriendly.cs b/Projectiles/Melee/BrimstoneLaserFriendly.cs index bbdb2a27b2..66e5bd7914 100644 --- a/Projectiles/Melee/BrimstoneLaserFriendly.cs +++ b/Projectiles/Melee/BrimstoneLaserFriendly.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.width = 2; Projectile.height = 2; Projectile.aiStyle = 1; - aiType = ProjectileID.DeathLaser; + AIType = ProjectileID.DeathLaser; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; Projectile.scale = 2f; diff --git a/Projectiles/Melee/BrinySpout.cs b/Projectiles/Melee/BrinySpout.cs index 0da290488d..ea724c2353 100644 --- a/Projectiles/Melee/BrinySpout.cs +++ b/Projectiles/Melee/BrinySpout.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using Terraria; @@ -95,7 +95,7 @@ namespace CalamityMod.Projectiles.Melee float num618 = ((float)(num613 + num614) - Projectile.ai[1] + 1f) * num615 / (float)(num614 + num613); center.Y -= (float)num617 * num618 / 2f; center.Y += 2f; - int num335 = Projectile.NewProjectile(center.X, center.Y, Projectile.velocity.X, Projectile.velocity.Y, Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner, 8f, Projectile.ai[1] - 1f); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), center.X, center.Y, Projectile.velocity.X, Projectile.velocity.Y, Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner, 8f, Projectile.ai[1] - 1f); } if (Projectile.ai[0] <= 0f) { diff --git a/Projectiles/Melee/BrinyTyphoonBubble.cs b/Projectiles/Melee/BrinyTyphoonBubble.cs index 1524810668..d6d0c919c6 100644 --- a/Projectiles/Melee/BrinyTyphoonBubble.cs +++ b/Projectiles/Melee/BrinyTyphoonBubble.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using System; using Terraria; using Terraria.ModLoader; @@ -133,13 +133,13 @@ namespace CalamityMod.Projectiles.Melee for (int num333 = num330; num333 < num330 + num332; num333++) { Tile tile = Main.tile[num331, num333]; - if (tile.active() && (Main.tileSolid[(int)tile.TileType] || tile.liquid != 0)) + if (tile.HasTile && (Main.tileSolid[(int)tile.TileType] || tile.LiquidAmount != 0)) { num330 = num333; break; } } - int num335 = Projectile.NewProjectile((float)(num331 * 16 + 8), (float)(num330 * 16 - 24), 0f, 0f, ModContent.ProjectileType(), Projectile.damage, 6f, Main.myPlayer, 8f, 25f); + int num335 = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), (float)(num331 * 16 + 8), (float)(num330 * 16 - 24), 0f, 0f, ModContent.ProjectileType(), Projectile.damage, 6f, Main.myPlayer, 8f, 25f); Main.projectile[num335].netUpdate = true; } } diff --git a/Projectiles/Melee/BrokenBiomeBladeHoldout.cs b/Projectiles/Melee/BrokenBiomeBladeHoldout.cs index 97284256aa..9eaacc2acf 100644 --- a/Projectiles/Melee/BrokenBiomeBladeHoldout.cs +++ b/Projectiles/Melee/BrokenBiomeBladeHoldout.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Projectiles.Melee { private Player Owner => Main.player[Projectile.owner]; - public bool OwnerCanUseItem => Owner.HeldItem == associatedItem ? (Owner.HeldItem.modItem as BiomeBlade).CanUseItem(Owner) : false; + public bool OwnerCanUseItem => Owner.HeldItem == associatedItem ? (Owner.HeldItem.ModItem as BiomeBlade).CanUseItem(Owner) : false; public bool OwnerMayChannel => Owner.itemAnimation == 0 && OwnerCanUseItem && Owner.Calamity().mouseRight && Owner.active && !Owner.dead && Owner.StandingStill() && !Owner.mount.Active && Owner.CheckSolidGround(1, 3); public ref float ChanneledState => ref Projectile.ai[0]; public ref float ChannelTimer => ref Projectile.ai[1]; @@ -67,9 +67,9 @@ namespace CalamityMod.Projectiles.Melee associatedItem = Owner.HeldItem; //Switch up the attunements - Attunement temporaryAttunementStorage = (associatedItem.modItem as BiomeBlade).mainAttunement; - (associatedItem.modItem as BiomeBlade).mainAttunement = (associatedItem.modItem as BiomeBlade).secondaryAttunement; - (associatedItem.modItem as BiomeBlade).secondaryAttunement = temporaryAttunementStorage; + Attunement temporaryAttunementStorage = (associatedItem.ModItem as BiomeBlade).mainAttunement; + (associatedItem.ModItem as BiomeBlade).mainAttunement = (associatedItem.ModItem as BiomeBlade).secondaryAttunement; + (associatedItem.ModItem as BiomeBlade).secondaryAttunement = temporaryAttunementStorage; Initialized = 1f; } @@ -92,11 +92,11 @@ namespace CalamityMod.Projectiles.Melee if (ChannelTimer >= ChannelTime) { - Attune((BiomeBlade)associatedItem.modItem); + Attune((BiomeBlade)associatedItem.ModItem); Projectile.timeLeft = 120; ChanneledState = 2f; //State where it stays invisible doing nothing. Acts as a cooldown - Color particleColor = (associatedItem.modItem as BiomeBlade).mainAttunement.tooltipColor; + Color particleColor = (associatedItem.ModItem as BiomeBlade).mainAttunement.tooltipColor; for (int i = 0; i <= 5; i++) { @@ -166,10 +166,10 @@ namespace CalamityMod.Projectiles.Melee } //If we swapped out the main attunement for the second one despite the second attunement being empty at the time, unswap them. - if ((associatedItem.modItem as BiomeBlade).mainAttunement == null && (associatedItem.modItem as BiomeBlade).secondaryAttunement != null) + if ((associatedItem.ModItem as BiomeBlade).mainAttunement == null && (associatedItem.ModItem as BiomeBlade).secondaryAttunement != null) { - (associatedItem.modItem as BiomeBlade).mainAttunement = (associatedItem.modItem as BiomeBlade).secondaryAttunement; - (associatedItem.modItem as BiomeBlade).secondaryAttunement = null; + (associatedItem.ModItem as BiomeBlade).mainAttunement = (associatedItem.ModItem as BiomeBlade).secondaryAttunement; + (associatedItem.ModItem as BiomeBlade).secondaryAttunement = null; } //Cool particles @@ -182,7 +182,7 @@ namespace CalamityMod.Projectiles.Melee else if (ChanneledState == 1f) { - Texture2D tex = GetTexture(Texture); + Texture2D tex = Request(Texture).Value; Vector2 squishyScale = new Vector2(Math.Abs((float)Math.Sin(MathHelper.Pi + MathHelper.TwoPi * Projectile.timeLeft / 30f)), 1f); SpriteEffects flip = (float)Math.Sin(MathHelper.Pi + MathHelper.TwoPi * Projectile.timeLeft / 30f) > 0 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; Main.EntitySpriteDraw(tex, Projectile.position - Main.screenPosition, null, lightColor * (Projectile.timeLeft / 60f), 0, tex.Size() / 2, squishyScale * (2f - (Projectile.timeLeft / 60f)), flip, 0); diff --git a/Projectiles/Melee/BrokenBiomeBlade_AridGrandeur.cs b/Projectiles/Melee/BrokenBiomeBlade_AridGrandeur.cs index d76de6333a..21902180ab 100644 --- a/Projectiles/Melee/BrokenBiomeBlade_AridGrandeur.cs +++ b/Projectiles/Melee/BrokenBiomeBlade_AridGrandeur.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.timeLeft = BiomeBlade.HotAttunement_LocalIFrames; } - public override bool CanDamage() + public override bool? CanDamage() { return Projectile.timeLeft <= 2; //Prevent spam click abuse } @@ -90,7 +90,7 @@ namespace CalamityMod.Projectiles.Melee } if (Owner.HeldItem.type == ItemType()) - (Owner.HeldItem.modItem as BiomeBlade).CanLunge = 1; // Reset the lunge counter on pogo. This should make for more interesting and fun synergies + (Owner.HeldItem.ModItem as BiomeBlade).CanLunge = 1; // Reset the lunge counter on pogo. This should make for more interesting and fun synergies } } @@ -174,10 +174,10 @@ namespace CalamityMod.Projectiles.Melee damage = (int)(currentDamage * damageReduction); } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => ShredTarget(target); - public override void OnHitPvp(Player target, int damage, bool crit) => ShredTarget(target); + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => ShredTarget(); + public override void OnHitPvp(Player target, int damage, bool crit) => ShredTarget(); - private void ShredTarget(Entity target) + private void ShredTarget() { if (Main.myPlayer != Owner.whoAmI) return; @@ -200,8 +200,8 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - Texture2D handle = GetTexture("CalamityMod/Items/Weapons/Melee/BiomeBlade"); - Texture2D blade = GetTexture("CalamityMod/Projectiles/Melee/BrokenBiomeBlade_AridGrandeur"); + Texture2D handle = Request("CalamityMod/Items/Weapons/Melee/BiomeBlade").Value; + Texture2D blade = Request("CalamityMod/Projectiles/Melee/BrokenBiomeBlade_AridGrandeur").Value; int bladeAmount = 4; @@ -211,21 +211,21 @@ namespace CalamityMod.Projectiles.Melee Vector2 drawOrigin = new Vector2(0f, handle.Height); Vector2 drawOffset = Owner.Center + direction * 10f - Main.screenPosition; - Main.EntitySpriteDraw(handle, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); + Main.EntitySpriteDraw(handle, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0); //Turn on additive blending Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); //Update the parameters drawOrigin = new Vector2(0f, blade.Height); drawOffset = Owner.Center + (drawAngle.ToRotationVector2() * 32f * Projectile.scale) - Main.screenPosition; - Main.EntitySpriteDraw(blade, drawOffset, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); + Main.EntitySpriteDraw(blade, drawOffset, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f, drawRotation, drawOrigin, Projectile.scale, 0f, 0); for (int i = 0; i < bladeAmount; i++) //Draw extra copies { - blade = GetTexture("CalamityMod/Projectiles/Melee/BrokenBiomeBlade_AridGrandeurExtra"); + blade = Request("CalamityMod/Projectiles/Melee/BrokenBiomeBlade_AridGrandeurExtra").Value; drawAngle = direction.ToRotation(); @@ -238,12 +238,12 @@ namespace CalamityMod.Projectiles.Melee Vector2 drawOffsetStraight = Owner.Center + direction * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 7) * 10 - Main.screenPosition; //How far from the player Vector2 drawDisplacementAngle = direction.RotatedBy(MathHelper.PiOver2) * circleCompletion.ToRotationVector2().Y * (20 + 40 * ShredRatio); //How far perpendicularly - Main.EntitySpriteDraw(blade, drawOffsetStraight + drawDisplacementAngle, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.8f, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); + Main.EntitySpriteDraw(blade, drawOffsetStraight + drawDisplacementAngle, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.8f, drawRotation, drawOrigin, Projectile.scale, 0f, 0); } //Back to normal Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); return false; } diff --git a/Projectiles/Melee/BrokenBiomeBlade_BitingEmbrace.cs b/Projectiles/Melee/BrokenBiomeBlade_BitingEmbrace.cs index 249e46e122..4160fd77c3 100644 --- a/Projectiles/Melee/BrokenBiomeBlade_BitingEmbrace.cs +++ b/Projectiles/Melee/BrokenBiomeBlade_BitingEmbrace.cs @@ -199,31 +199,31 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - Texture2D handle = GetTexture("CalamityMod/Items/Weapons/Melee/BiomeBlade"); + Texture2D handle = Request("CalamityMod/Items/Weapons/Melee/BiomeBlade").Value; if (SwingMode != 2) { - Texture2D blade = GetTexture("CalamityMod/Projectiles/Melee/BrokenBiomeBlade_BitingEmbrace" + (SwingMode == 0 ? "Small" : "Big")); + Texture2D blade = Request("CalamityMod/Projectiles/Melee/BrokenBiomeBlade_BitingEmbrace" + (SwingMode == 0 ? "Small" : "Big")).Value; float drawAngle = rotation; float drawRotation = rotation + MathHelper.PiOver4; Vector2 drawOrigin = new Vector2(0f, handle.Height); Vector2 drawOffset = Owner.Center + drawAngle.ToRotationVector2() * 10f - Main.screenPosition; - Main.EntitySpriteDraw(handle, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); + Main.EntitySpriteDraw(handle, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0); //Turn on additive blending Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); //Update the parameters drawOrigin = new Vector2(0f, blade.Height); drawOffset = Owner.Center + (drawAngle.ToRotationVector2() * 28f * Projectile.scale) - Main.screenPosition; - Main.EntitySpriteDraw(blade, drawOffset, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.8f, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); + Main.EntitySpriteDraw(blade, drawOffset, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.8f, drawRotation, drawOrigin, Projectile.scale, 0f, 0); //Back to normal Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); } else { - Texture2D blade = GetTexture("CalamityMod/Projectiles/Melee/BrokenBiomeBlade_BitingEmbraceThrust"); + Texture2D blade = Request("CalamityMod/Projectiles/Melee/BrokenBiomeBlade_BitingEmbraceThrust").Value; Vector2 thrustDisplace = direction * (ThrustDisplaceRatio() * 60); float drawAngle = rotation; @@ -231,10 +231,10 @@ namespace CalamityMod.Projectiles.Melee Vector2 drawOrigin = new Vector2(0f, handle.Height); Vector2 drawOffset = Owner.Center + drawAngle.ToRotationVector2() * 10f - Main.screenPosition; - Main.EntitySpriteDraw(handle, drawOffset + thrustDisplace, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); + Main.EntitySpriteDraw(handle, drawOffset + thrustDisplace, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0); //Turn on additive blending Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); //Update the parameters drawOrigin = new Vector2(0f, 114f); @@ -242,10 +242,10 @@ namespace CalamityMod.Projectiles.Melee //Anim stuff Rectangle frameRectangle = new Rectangle(0, 0 + (116 * Projectile.frame), 114, 114); - Main.EntitySpriteDraw(blade, drawOffset + thrustDisplace, frameRectangle, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); + Main.EntitySpriteDraw(blade, drawOffset + thrustDisplace, frameRectangle, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f, drawRotation, drawOrigin, Projectile.scale, 0f, 0); //Back to normal Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); } return false; diff --git a/Projectiles/Melee/BrokenBiomeBlade_DecaysRetort.cs b/Projectiles/Melee/BrokenBiomeBlade_DecaysRetort.cs index af6172915c..fb886c79e0 100644 --- a/Projectiles/Melee/BrokenBiomeBlade_DecaysRetort.cs +++ b/Projectiles/Melee/BrokenBiomeBlade_DecaysRetort.cs @@ -118,8 +118,8 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - Texture2D handle = GetTexture("CalamityMod/Items/Weapons/Melee/BiomeBlade"); - Texture2D tex = GetTexture("CalamityMod/Projectiles/Melee/BrokenBiomeBlade_DecaysRetort"); + Texture2D handle = Request("CalamityMod/Items/Weapons/Melee/BiomeBlade").Value; + Texture2D tex = Request("CalamityMod/Projectiles/Melee/BrokenBiomeBlade_DecaysRetort").Value; float drawAngle = direction.ToRotation(); float drawRotation = drawAngle + MathHelper.PiOver4; @@ -128,19 +128,19 @@ namespace CalamityMod.Projectiles.Melee Vector2 drawOrigin = new Vector2(0f, handle.Height); Vector2 drawOffset = Owner.Center + direction * 10f - Main.screenPosition; - Main.EntitySpriteDraw(handle, drawOffset + displace, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); + Main.EntitySpriteDraw(handle, drawOffset + displace, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0); //Turn on additive blending Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); //Update the parameters drawOrigin = new Vector2(0f, tex.Height); drawOffset = Owner.Center + (drawAngle.ToRotationVector2() * 24f * Projectile.scale) - Main.screenPosition; - Main.EntitySpriteDraw(tex, drawOffset + displace, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); + Main.EntitySpriteDraw(tex, drawOffset + displace, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f, drawRotation, drawOrigin, Projectile.scale, 0f, 0); //Back to normal Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); return false; } diff --git a/Projectiles/Melee/BrokenBiomeBlade_GrovetendersTouch.cs b/Projectiles/Melee/BrokenBiomeBlade_GrovetendersTouch.cs index 7d3f438c42..21e6ca7393 100644 --- a/Projectiles/Melee/BrokenBiomeBlade_GrovetendersTouch.cs +++ b/Projectiles/Melee/BrokenBiomeBlade_GrovetendersTouch.cs @@ -189,7 +189,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 projBottom = Projectile.Center + new Vector2(-handle.Width / 2, handle.Height / 2).RotatedBy(Projectile.rotation + MathHelper.PiOver4) * 0.75f; DrawChain(projBottom, out Vector2[] chainPositions); - float drawRotation = (projBottom - chainPositions[chainPositions.Length - 2]).ToRotation() + MathHelper.PiOver4; //Face away from the last point of the bezier curve + float drawRotation = (projBottom - chainPositions[^2]).ToRotation() + MathHelper.PiOver4; //Face away from the last point of the bezier curve drawRotation += SnapCoyoteTime > 0 ? MathHelper.Pi : 0; //During coyote time the blade flips for some reason. Prevent that from happening drawRotation += Projectile.spriteDirection < 0 ? 0f : 0f; diff --git a/Projectiles/Melee/BrokenBiomeBlade_PurityProjection.cs b/Projectiles/Melee/BrokenBiomeBlade_PurityProjection.cs index 1c9ae5bd74..279667d33c 100644 --- a/Projectiles/Melee/BrokenBiomeBlade_PurityProjection.cs +++ b/Projectiles/Melee/BrokenBiomeBlade_PurityProjection.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Melee { Projectile.width = Projectile.height = 32; Projectile.aiStyle = 27; - aiType = ProjectileID.LightBeam; + AIType = ProjectileID.LightBeam; Projectile.friendly = true; Projectile.penetrate = 1; Projectile.timeLeft = 40; diff --git a/Projectiles/Melee/BurningMeteor.cs b/Projectiles/Melee/BurningMeteor.cs index d8572305d7..b001c830b6 100644 --- a/Projectiles/Melee/BurningMeteor.cs +++ b/Projectiles/Melee/BurningMeteor.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; @@ -75,7 +75,7 @@ namespace CalamityMod.Projectiles.Melee { Projectile.alpha = num58; } - Projectile.rotation = Projectile.velocity.ToRotation() - 1.57079637f; + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; } public override void Kill(int timeLeft) diff --git a/Projectiles/Melee/ChaosFlameLarge.cs b/Projectiles/Melee/ChaosFlameLarge.cs index bd3b42e6e1..1ad339fbdb 100644 --- a/Projectiles/Melee/ChaosFlameLarge.cs +++ b/Projectiles/Melee/ChaosFlameLarge.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.DamageType = DamageClass.Melee; Projectile.penetrate = 1; Projectile.timeLeft = 600; - aiType = ProjectileID.SporeCloud; + AIType = ProjectileID.SporeCloud; } public override void AI() diff --git a/Projectiles/Melee/ChaosFlameSmall.cs b/Projectiles/Melee/ChaosFlameSmall.cs index b499d064bd..2490c66b83 100644 --- a/Projectiles/Melee/ChaosFlameSmall.cs +++ b/Projectiles/Melee/ChaosFlameSmall.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.DamageType = DamageClass.Melee; Projectile.penetrate = 1; Projectile.timeLeft = 600; - aiType = ProjectileID.SporeCloud; + AIType = ProjectileID.SporeCloud; } public override void AI() diff --git a/Projectiles/Melee/ClamCrusherFlail.cs b/Projectiles/Melee/ClamCrusherFlail.cs index cd4446f307..d73f039331 100644 --- a/Projectiles/Melee/ClamCrusherFlail.cs +++ b/Projectiles/Melee/ClamCrusherFlail.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -125,7 +125,7 @@ namespace CalamityMod.Projectiles.Melee Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); Projectile.ai[0] = 1f; Projectile.netUpdate = true; - SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/ClamImpact"), (int)Projectile.position.X, (int)Projectile.position.Y); + SoundEngine.PlaySound(SoundLoader.GetLegacySoundSlot(Mod, "Sounds/Item/ClamImpact"), (int)Projectile.position.X, (int)Projectile.position.Y); for (int num105 = 0; num105 < 50; num105++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); @@ -139,8 +139,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { Vector2 mountedCenter = Main.player[Projectile.owner].MountedCenter; - Color transparent = Microsoft.Xna.Framework.Color.Transparent; - Texture2D texture2D2 = ModContent.Request("CalamityMod/ExtraTextures/Chains/ClamCrusherChain"); + Texture2D texture2D2 = ModContent.Request("CalamityMod/ExtraTextures/Chains/ClamCrusherChain").Value; Vector2 vector17 = Projectile.Center; Rectangle? sourceRectangle = null; Vector2 origin = new Vector2((float)texture2D2.Width * 0.5f, (float)texture2D2.Height * 0.5f); @@ -184,7 +183,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.ai[0] = 1f; Projectile.netUpdate = true; - SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/ClamImpact"), (int)Projectile.position.X, (int)Projectile.position.Y); + SoundEngine.PlaySound(SoundLoader.GetLegacySoundSlot(Mod, "Sounds/Item/ClamImpact"), (int)Projectile.position.X, (int)Projectile.position.Y); } } } diff --git a/Projectiles/Melee/CometQuasherMeteor.cs b/Projectiles/Melee/CometQuasherMeteor.cs index c3141326c3..b939939bc2 100644 --- a/Projectiles/Melee/CometQuasherMeteor.cs +++ b/Projectiles/Melee/CometQuasherMeteor.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; @@ -24,16 +24,16 @@ namespace CalamityMod.Projectiles.Melee Projectile.DamageType = DamageClass.Melee; Projectile.tileCollide = false; Projectile.extraUpdates = 2; - aiType = ProjectileID.Meteor1; + AIType = ProjectileID.Meteor1; } public override bool PreDraw(ref Color lightColor) { Texture2D tex = ModContent.Request(Texture).Value; if (Projectile.Calamity().lineColor == 1) - tex = ModContent.Request("CalamityMod/Projectiles/Melee/CometQuasherMeteor2"); + tex = ModContent.Request("CalamityMod/Projectiles/Melee/CometQuasherMeteor2").Value; if (Projectile.Calamity().lineColor == 2) - tex = ModContent.Request("CalamityMod/Projectiles/Melee/CometQuasherMeteor3"); + tex = ModContent.Request("CalamityMod/Projectiles/Melee/CometQuasherMeteor3").Value; CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1, tex); return false; diff --git a/Projectiles/Melee/CosmicDischargeFlail.cs b/Projectiles/Melee/CosmicDischargeFlail.cs index c39a5cca75..071a5a26fb 100644 --- a/Projectiles/Melee/CosmicDischargeFlail.cs +++ b/Projectiles/Melee/CosmicDischargeFlail.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatBuffs; using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; @@ -44,8 +44,9 @@ namespace CalamityMod.Projectiles.Melee public override int TailStartY => 114; public override int TailHeight => 84; - //All of this wouldnt be here if depthLayer fucking worked, i wanna hit someone - Shucks - //the hell you mean, depthlayer is a useless fucking variable bro - Iban 2022 + // All of this wouldnt be here if depthLayer fucking worked, i wanna hit someone - Shucks + // the hell you mean, depthlayer is a useless fucking variable bro - Iban 2022 + // Not necessarily. Terraria is just made in such a way that we're forced to use sprite batch states that ignore it - Dominic 2022 public override void PostDraw(Color lightColor) { Vector2 mountedCenter = Main.player[Projectile.owner].MountedCenter; @@ -108,7 +109,7 @@ namespace CalamityMod.Projectiles.Melee target.AddBuff(ModContent.BuffType(), 60); if (Projectile.localAI[1] <= 0f && Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, 10f, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, 10f, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); } Projectile.localAI[1] = 4f; player.AddBuff(ModContent.BuffType(), 300); diff --git a/Projectiles/Melee/CosmicShivBall.cs b/Projectiles/Melee/CosmicShivBall.cs index df2388f61f..f7ad4362e1 100644 --- a/Projectiles/Melee/CosmicShivBall.cs +++ b/Projectiles/Melee/CosmicShivBall.cs @@ -1,4 +1,4 @@ -using System; +using System; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -80,7 +80,7 @@ namespace CalamityMod.Projectiles.Melee int directionSign = Main.rand.NextBool(2).ToDirectionInt(); Vector2 spawnPos = new Vector2(target.Center.X + directionSign * 650, Projectile.Center.Y + Main.rand.Next(-500, 501)); Vector2 velocity = Vector2.Normalize(target.Center - spawnPos) * 30f; - Projectile.NewProjectile(spawnPos.X, spawnPos.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack * 0.1f, Projectile.owner); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), spawnPos.X, spawnPos.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack * 0.1f, Projectile.owner); } int starMax = Main.rand.Next(6, 11); // 6 to 10 stars for (int i = -starMax / 2; i < starMax / 2; i++) @@ -88,7 +88,7 @@ namespace CalamityMod.Projectiles.Melee int ySpawnAdditive = Main.rand.Next(-40, 41); Vector2 toSpawn = target.Center - new Vector2(0f, 800f + ySpawnAdditive).RotatedBy(MathHelper.ToRadians(i * 11f / starMax)); Vector2 toTarget = Vector2.Normalize(target.Center - toSpawn) * 35f; - Projectile.NewProjectile(toSpawn, toTarget, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack * 0.5f, Projectile.owner); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), toSpawn, toTarget, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack * 0.5f, Projectile.owner); } target.AddBuff(ModContent.BuffType(), 60); target.AddBuff(BuffID.Frostburn, 60); @@ -125,7 +125,7 @@ namespace CalamityMod.Projectiles.Melee target.StrikeNPC(damage, 0f, 0, crit, false, false); if (Main.netMode != NetmodeID.SinglePlayer) - NetMessage.SendData(MessageID.StrikeNPC, -1, -1, null, i, damage, 0f, 0f, crit ? 1 : 0, 0, 0); + NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, i, damage, 0f, 0f, crit ? 1 : 0, 0, 0); } } } diff --git a/Projectiles/Melee/CrescentMoonFlail.cs b/Projectiles/Melee/CrescentMoonFlail.cs index d0df81762d..5c1c7d9fec 100644 --- a/Projectiles/Melee/CrescentMoonFlail.cs +++ b/Projectiles/Melee/CrescentMoonFlail.cs @@ -59,7 +59,7 @@ namespace CalamityMod.Projectiles.Melee vectorBruh -= new Vector2((float)(player.bodyFrame.Width - player.width), (float)(player.bodyFrame.Height - 42)) / 2f; Vector2 newCenter = player.RotatedRelativePoint(Main.player[Projectile.owner].position + vectorBruh, true) + Projectile.velocity; int moonDamage = (int)(Projectile.damage * 0.18f); - Projectile.NewProjectile(newCenter.X, newCenter.Y, 0f, 0f, ModContent.ProjectileType(), moonDamage, 0f, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), newCenter.X, newCenter.Y, 0f, 0f, ModContent.ProjectileType(), moonDamage, 0f, Projectile.owner, 0f, 0f); moonCounter = 6; } } diff --git a/Projectiles/Melee/CrescentMoonProj.cs b/Projectiles/Melee/CrescentMoonProj.cs index 373376aef8..2a2549207a 100644 --- a/Projectiles/Melee/CrescentMoonProj.cs +++ b/Projectiles/Melee/CrescentMoonProj.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.localNPCHitCooldown = 10; Projectile.extraUpdates = 1; Projectile.aiStyle = 18; - aiType = ProjectileID.DeathSickle; + AIType = ProjectileID.DeathSickle; } public override void AI() diff --git a/Projectiles/Melee/DNA.cs b/Projectiles/Melee/DNA.cs index 75a59e82cd..9164f8bdb9 100644 --- a/Projectiles/Melee/DNA.cs +++ b/Projectiles/Melee/DNA.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Melee; Projectile.ignoreWater = true; - aiType = ProjectileID.CrystalVileShardHead; + AIType = ProjectileID.CrystalVileShardHead; } public override void AI() @@ -51,7 +51,7 @@ namespace CalamityMod.Projectiles.Melee } int num49 = Projectile.damage; float num50 = Projectile.knockBack; - int number = Projectile.NewProjectile(Projectile.position.X + Projectile.velocity.X + (float)(Projectile.width / 2), Projectile.position.Y + Projectile.velocity.Y + (float)(Projectile.height / 2), Projectile.velocity.X, Projectile.velocity.Y, num48, num49, num50, Projectile.owner, 0f, Projectile.ai[1] + 1f); + int number = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.position.X + Projectile.velocity.X + (float)(Projectile.width / 2), Projectile.position.Y + Projectile.velocity.Y + (float)(Projectile.height / 2), Projectile.velocity.X, Projectile.velocity.Y, num48, num49, num50, Projectile.owner, 0f, Projectile.ai[1] + 1f); NetMessage.SendData(MessageID.SyncProjectile, -1, -1, null, number, 0f, 0f, 0f, 0, 0, 0); } } diff --git a/Projectiles/Melee/DNA2.cs b/Projectiles/Melee/DNA2.cs index 2ab072ecca..1f62ff2b5e 100644 --- a/Projectiles/Melee/DNA2.cs +++ b/Projectiles/Melee/DNA2.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Melee; Projectile.ignoreWater = true; - aiType = ProjectileID.CrystalVileShardShaft; + AIType = ProjectileID.CrystalVileShardShaft; } public override void AI() diff --git a/Projectiles/Melee/DarkBall.cs b/Projectiles/Melee/DarkBall.cs index 18f46e70ba..e58101b6e1 100644 --- a/Projectiles/Melee/DarkBall.cs +++ b/Projectiles/Melee/DarkBall.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Melee { for (int num228 = num225; num228 < num226; num228++) { - if (Main.tile[num227, num228] != null && Main.tile[num227, num228].nactive() && (Main.tileSolid[(int)Main.tile[num227, num228].TileType] || (Main.tileSolidTop[(int)Main.tile[num227, num228].TileType] && Main.tile[num227, num228].TileFrameY == 0))) + if (Main.tile[num227, num228] != null && Main.tile[num227, num228].HasUnactuatedTile && (Main.tileSolid[(int)Main.tile[num227, num228].TileType] || (Main.tileSolidTop[(int)Main.tile[num227, num228].TileType] && Main.tile[num227, num228].TileFrameY == 0))) { Vector2 vector19; vector19.X = (float)(num227 * 16); diff --git a/Projectiles/Melee/DarkBeam.cs b/Projectiles/Melee/DarkBeam.cs index fa808eb56c..2277a430ee 100644 --- a/Projectiles/Melee/DarkBeam.cs +++ b/Projectiles/Melee/DarkBeam.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.width = 56; Projectile.height = 56; Projectile.aiStyle = 18; - aiType = ProjectileID.DeathSickle; + AIType = ProjectileID.DeathSickle; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; Projectile.penetrate = 1; @@ -69,7 +69,7 @@ namespace CalamityMod.Projectiles.Melee { for (int k = 0; k < 3; k++) { - Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, Main.rand.Next(-35, 36) * 0.2f, Main.rand.Next(-35, 36) * 0.2f, ModContent.ProjectileType(), + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, Main.rand.Next(-35, 36) * 0.2f, Main.rand.Next(-35, 36) * 0.2f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.15f, Main.myPlayer); } } diff --git a/Projectiles/Melee/DarkIceZero.cs b/Projectiles/Melee/DarkIceZero.cs index 0c1742e538..50b4f532fd 100644 --- a/Projectiles/Melee/DarkIceZero.cs +++ b/Projectiles/Melee/DarkIceZero.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.width = 28; Projectile.height = 28; Projectile.aiStyle = 1; - aiType = ProjectileID.Bullet; + AIType = ProjectileID.Bullet; Projectile.timeLeft = 600; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; diff --git a/Projectiles/Melee/DemonBlast.cs b/Projectiles/Melee/DemonBlast.cs index 1d1e803a9c..416975ca90 100644 --- a/Projectiles/Melee/DemonBlast.cs +++ b/Projectiles/Melee/DemonBlast.cs @@ -1,4 +1,4 @@ -using CalamityMod.Dusts; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Melee if (tileCheck) dust.noLight = true; - Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.ToRadians(45); + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(45); } public override void Kill(int timeLeft) diff --git a/Projectiles/Melee/DracoBeam.cs b/Projectiles/Melee/DracoBeam.cs index d6828581ff..299c1287c5 100644 --- a/Projectiles/Melee/DracoBeam.cs +++ b/Projectiles/Melee/DracoBeam.cs @@ -57,8 +57,8 @@ namespace CalamityMod.Projectiles.Melee for (i = 0; i < 4; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); - Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); } } for (int k = 0; k < 10; k++) diff --git a/Projectiles/Melee/DragonPowFlail.cs b/Projectiles/Melee/DragonPowFlail.cs index c0fb234fda..2d91c62ba0 100644 --- a/Projectiles/Melee/DragonPowFlail.cs +++ b/Projectiles/Melee/DragonPowFlail.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -40,9 +40,9 @@ namespace CalamityMod.Projectiles.Melee // ai[1] = tick counter used to spawn projectiles and control transparency public override void AI() { - drawOffsetX = 0; - drawOriginOffsetY = -11; - drawOriginOffsetX = 0; + DrawOffsetX = 0; + DrawOriginOffsetY = -11; + DrawOriginOffsetX = 0; Player owner = Main.player[Projectile.owner]; @@ -133,7 +133,7 @@ namespace CalamityMod.Projectiles.Melee float sparkVariety = Main.rand.Next(3); if (Projectile.owner == Main.myPlayer) - Projectile.NewProjectile(Projectile.Center, vel, type, damage, kb, Projectile.owner, sparkVariety, 0f); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, vel, type, damage, kb, Projectile.owner, sparkVariety, 0f); } } @@ -215,7 +215,7 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.owner == Main.myPlayer) { - int idx = Projectile.NewProjectile(startPos, fallVec, type, waterfallDamage, waterfallKB, Projectile.owner, 0f, 0f); + int idx = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), startPos, fallVec, type, waterfallDamage, waterfallKB, Projectile.owner, 0f, 0f); Main.projectile[idx].timeLeft = 100; Main.projectile[idx].tileCollide = false; } @@ -228,7 +228,7 @@ namespace CalamityMod.Projectiles.Melee Player owner = Main.player[Projectile.owner]; Vector2 mountedCenter = owner.MountedCenter; Color transparent = Color.Transparent; - Texture2D chainTex = ModContent.Request("CalamityMod/ExtraTextures/Chains/DragonPowChain"); + Texture2D chainTex = ModContent.Request("CalamityMod/ExtraTextures/Chains/DragonPowChain").Value; Vector2 chainDrawPos = Projectile.Center; Rectangle? sourceRectangle = null; diff --git a/Projectiles/Melee/DragonRageStaff.cs b/Projectiles/Melee/DragonRageStaff.cs index ba991426ce..8d54230f95 100644 --- a/Projectiles/Melee/DragonRageStaff.cs +++ b/Projectiles/Melee/DragonRageStaff.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -166,7 +166,7 @@ namespace CalamityMod.Projectiles.Melee modPlayer.dragonRageHits = 0; } - int proj = Projectile.NewProjectile(position, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage / 4, Projectile.knockBack, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + int proj = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), position, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage / 4, Projectile.knockBack, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); Main.projectile[proj].Calamity().forceMelee = true; } } @@ -182,7 +182,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 velocity = new Vector2(0f, speed); velocity = velocity.RotatedBy(angleStep * i * Main.rand.NextFloat(0.9f, 1.1f)); - Projectile.NewProjectile(Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage / 8, Projectile.knockBack / 3f, Projectile.owner); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage / 8, Projectile.knockBack / 3f, Projectile.owner); } } @@ -200,7 +200,7 @@ namespace CalamityMod.Projectiles.Melee bool hostileProjs = Projectile.hostile && npc.friendly && !npc.dontTakeDamageFromHostiles; if (npc.active && !npc.dontTakeDamage && (friendlyProjs || hostileProjs) && (Projectile.owner < 0 || npc.immune[Projectile.owner] == 0 || Projectile.maxPenetrate == 1)) { - if (npc.noTileCollide || !Projectile.ownerHitCheck || Projectile.CanHit(npc)) + if (npc.noTileCollide || !Projectile.ownerHitCheck || (ProjectileLoader.CanHitNPC(Projectile, npc) ?? false)) { bool canHit; Rectangle rect = npc.Hitbox; diff --git a/Projectiles/Melee/EarthProj.cs b/Projectiles/Melee/EarthProj.cs index 6395be85a3..76bd69639a 100644 --- a/Projectiles/Melee/EarthProj.cs +++ b/Projectiles/Melee/EarthProj.cs @@ -121,8 +121,8 @@ namespace CalamityMod.Projectiles.Melee projChoice = ModContent.ProjectileType(); } offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), projChoice, Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); - Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), projChoice, Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), projChoice, Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), projChoice, Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); } SoundEngine.PlaySound(SoundID.Item10, (int)Projectile.position.X, (int)Projectile.position.Y); for (int k = 0; k < 15; k++) diff --git a/Projectiles/Melee/ElementalExcaliburBeam.cs b/Projectiles/Melee/ElementalExcaliburBeam.cs index 4365d9e184..fecf141d87 100644 --- a/Projectiles/Melee/ElementalExcaliburBeam.cs +++ b/Projectiles/Melee/ElementalExcaliburBeam.cs @@ -118,7 +118,7 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < numProj + 1; i++) { Vector2 perturbedSpeed = Projectile.velocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(Projectile.Center, perturbedSpeed * 0.5f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, perturbedSpeed * 0.5f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Projectile.owner, 0f, 0f); } } Projectile.Kill(); @@ -223,7 +223,7 @@ namespace CalamityMod.Projectiles.Melee { Projectile.localAI[1] = 1f; if (Main.myPlayer == Projectile.owner) - Projectile.NewProjectile(Projectile.Center + Projectile.velocity, Projectile.velocity, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack * 0.5f, Projectile.owner, 10f, 0f); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center + Projectile.velocity, Projectile.velocity, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack * 0.5f, Projectile.owner, 10f, 0f); } break; diff --git a/Projectiles/Melee/ElementalGlassStar.cs b/Projectiles/Melee/ElementalGlassStar.cs index 79ac3a53cf..6d2fdb2a60 100644 --- a/Projectiles/Melee/ElementalGlassStar.cs +++ b/Projectiles/Melee/ElementalGlassStar.cs @@ -1,4 +1,4 @@ -using CalamityMod.Particles; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -97,10 +97,10 @@ namespace CalamityMod.Projectiles.Melee CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - Texture2D starTexture = ModContent.Request("CalamityMod/Particles/Sparkle"); - Texture2D bloomTexture = ModContent.Request("CalamityMod/Particles/BloomCircle"); + Texture2D starTexture = ModContent.Request("CalamityMod/Particles/Sparkle").Value; + Texture2D bloomTexture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; //Ajust the bloom's texture to be the same size as the star's float properBloomSize = (float)starTexture.Height / (float)bloomTexture.Height; @@ -113,7 +113,7 @@ namespace CalamityMod.Projectiles.Melee Main.EntitySpriteDraw(starTexture, sparkCenter, null, Color.White, rotation, starTexture.Size() / 2f, 2f, SpriteEffects.None, 0); Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); return false; diff --git a/Projectiles/Melee/EonBolt.cs b/Projectiles/Melee/EonBolt.cs index d1d03128d7..d9b85dc2f8 100644 --- a/Projectiles/Melee/EonBolt.cs +++ b/Projectiles/Melee/EonBolt.cs @@ -87,7 +87,7 @@ namespace CalamityMod.Projectiles.Melee internal Color ColorFunction(float completionRatio) { float fadeToEnd = MathHelper.Lerp(0.65f, 1f, (float)Math.Cos(-Main.GlobalTimeWrappedHourly * 3f) * 0.5f + 0.5f); - float fadeOpacity = Utils.InverseLerp(1f, 0.64f, completionRatio, true) * Projectile.Opacity; + float fadeOpacity = Utils.GetLerpValue(1f, 0.64f, completionRatio, true) * Projectile.Opacity; Color colorHue = Main.hslToRgb(Hue, 1, 0.8f); Color endColor = Color.Lerp(colorHue, Color.PaleTurquoise, (float)Math.Sin(completionRatio * MathHelper.Pi * 1.6f - Main.GlobalTimeWrappedHourly * 4f) * 0.5f + 0.5f); @@ -105,10 +105,10 @@ namespace CalamityMod.Projectiles.Melee if (TrailDrawer is null) TrailDrawer = new PrimitiveTrail(WidthFunction, ColorFunction, specialShader: GameShaders.Misc["CalamityMod:TrailStreak"]); - GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/ScarletDevilStreak")); + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(Request("CalamityMod/ExtraTextures/ScarletDevilStreak").Value); TrailDrawer.Draw(Projectile.oldPos, Projectile.Size * 0.5f - Main.screenPosition, 30); - Texture2D texture = GetTexture("CalamityMod/Projectiles/Melee/GalaxiaBolt"); + Texture2D texture = GetTexture("CalamityMod/Projectiles/Melee/GalaxiaBolt").Value; Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, null, Color.Lerp(lightColor, Color.White, 0.5f), Projectile.rotation, texture.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; diff --git a/Projectiles/Melee/EssenceBeam.cs b/Projectiles/Melee/EssenceBeam.cs index 03a911c65f..f1e3e97a27 100644 --- a/Projectiles/Melee/EssenceBeam.cs +++ b/Projectiles/Melee/EssenceBeam.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.width = 26; Projectile.height = 26; Projectile.aiStyle = 27; - aiType = ProjectileID.LightBeam; + AIType = ProjectileID.LightBeam; Projectile.ignoreWater = true; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; diff --git a/Projectiles/Melee/EssenceScythe.cs b/Projectiles/Melee/EssenceScythe.cs index 82582cab09..37da2c8021 100644 --- a/Projectiles/Melee/EssenceScythe.cs +++ b/Projectiles/Melee/EssenceScythe.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.penetrate = 10; Projectile.timeLeft = 300; Projectile.ignoreWater = true; - aiType = ProjectileID.DeathSickle; + AIType = ProjectileID.DeathSickle; } public override void AI() diff --git a/Projectiles/Melee/ExcelsusMain.cs b/Projectiles/Melee/ExcelsusMain.cs index 2a8a235d12..31dfab5928 100644 --- a/Projectiles/Melee/ExcelsusMain.cs +++ b/Projectiles/Melee/ExcelsusMain.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using Terraria; @@ -87,7 +87,7 @@ namespace CalamityMod.Projectiles.Melee color = new Color(255, 255, 255, 100); } Vector2 origin = new Vector2(39f, 46f); - Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Projectiles/Melee/ExcelsusMainGlow"), Projectile.Center - Main.screenPosition, null, color, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Projectiles/Melee/ExcelsusMainGlow").Value, Projectile.Center - Main.screenPosition, null, color, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Melee/ExcelsusPink.cs b/Projectiles/Melee/ExcelsusPink.cs index 50f76f931c..5c6f0903f5 100644 --- a/Projectiles/Melee/ExcelsusPink.cs +++ b/Projectiles/Melee/ExcelsusPink.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using Terraria; @@ -87,7 +87,7 @@ namespace CalamityMod.Projectiles.Melee color = new Color(255, 255, 255, 100); } Vector2 origin = new Vector2(39f, 46f); - Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Projectiles/Melee/ExcelsusPinkGlow"), Projectile.Center - Main.screenPosition, null, color, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Projectiles/Melee/ExcelsusPinkGlow").Value, Projectile.Center - Main.screenPosition, null, color, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Melee/FallenPaladinsHammerProj.cs b/Projectiles/Melee/FallenPaladinsHammerProj.cs index b82e3b9c31..fec3fbc59f 100644 --- a/Projectiles/Melee/FallenPaladinsHammerProj.cs +++ b/Projectiles/Melee/FallenPaladinsHammerProj.cs @@ -120,7 +120,7 @@ namespace CalamityMod.Projectiles.Melee { if (Projectile.owner == Main.myPlayer) { - int proj = Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + int proj = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().forceMelee = true; } diff --git a/Projectiles/Melee/ForbiddenOathbladeProjectile.cs b/Projectiles/Melee/ForbiddenOathbladeProjectile.cs index 2584257b68..201fd567a1 100644 --- a/Projectiles/Melee/ForbiddenOathbladeProjectile.cs +++ b/Projectiles/Melee/ForbiddenOathbladeProjectile.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.penetrate = 3; Projectile.usesIDStaticNPCImmunity = true; Projectile.idStaticNPCHitCooldown = 10; - aiType = ProjectileID.DemonScythe; + AIType = ProjectileID.DemonScythe; } public override void AI() diff --git a/Projectiles/Melee/GaelSkull.cs b/Projectiles/Melee/GaelSkull.cs index 2863feab8e..89d3417023 100644 --- a/Projectiles/Melee/GaelSkull.cs +++ b/Projectiles/Melee/GaelSkull.cs @@ -1,18 +1,18 @@ -using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; + namespace CalamityMod.Projectiles.Melee { public class GaelSkull : ModProjectile { public override void SetStaticDefaults() { - DisplayName.SetDefault("Ark of the Cosmos' Superior Cousin"); + DisplayName.SetDefault("No Longer Ark of the Cosmos' Superior Cousin"); ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; ProjectileID.Sets.TrailingMode[Projectile.type] = 0; Main.projFrames[Projectile.type] = 5; @@ -146,7 +146,7 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.scale == 1.75f) Projectile.damage /= 2; Projectile.Damage(); - SoundEngine.PlaySound((int)SoundType.NPCKilled, (int)Projectile.Center.X, (int)Projectile.Center.Y, 52, 0.4f); + SoundEngine.PlaySound(SoundID.NPCDeath52, Projectile.Center); for (int i = 0; i < 3; i++) { Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 218, 0f, 0f, 100, default, 1.5f); diff --git a/Projectiles/Melee/GaelSkull2.cs b/Projectiles/Melee/GaelSkull2.cs index e5723a4864..6ded1c3616 100644 --- a/Projectiles/Melee/GaelSkull2.cs +++ b/Projectiles/Melee/GaelSkull2.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -13,7 +13,7 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - DisplayName.SetDefault("Ark of the Cosmos' Superior Cousin"); + DisplayName.SetDefault("No Longer Ark of the Cosmos' Superior Cousin"); ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4; ProjectileID.Sets.TrailingMode[Projectile.type] = 0; Main.projFrames[Projectile.type] = 5; diff --git a/Projectiles/Melee/GalaxiaHoldout.cs b/Projectiles/Melee/GalaxiaHoldout.cs index 22faa0336f..2b82d3b540 100644 --- a/Projectiles/Melee/GalaxiaHoldout.cs +++ b/Projectiles/Melee/GalaxiaHoldout.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Projectiles.Melee public class GalaxiaHoldout : ModProjectile //Visuals. Now much simpler than before! { private Player Owner => Main.player[Projectile.owner]; - public bool OwnerCanUseItem => Owner.HeldItem == associatedItem ? (Owner.HeldItem.modItem as FourSeasonsGalaxia).CanUseItem(Owner) : false; + public bool OwnerCanUseItem => Owner.HeldItem == associatedItem ? (Owner.HeldItem.ModItem as FourSeasonsGalaxia).CanUseItem(Owner) : false; public ref float Initialized => ref Projectile.ai[0]; public ref float CycleDirection => ref Projectile.ai[1]; @@ -51,11 +51,11 @@ namespace CalamityMod.Projectiles.Melee associatedItem = Owner.HeldItem; //Switch up the attunements - Reattune((FourSeasonsGalaxia)associatedItem.modItem); + Reattune((FourSeasonsGalaxia)associatedItem.ModItem); //Do particles around the player - Color particleColor = (associatedItem.modItem as FourSeasonsGalaxia).mainAttunement.tooltipColor; + Color particleColor = (associatedItem.ModItem as FourSeasonsGalaxia).mainAttunement.tooltipColor; for (int i = 0; i <= 5; i++) { Vector2 displace = Vector2.UnitX * 20 * Main.rand.NextFloat(-1f, 1f); @@ -184,7 +184,7 @@ namespace CalamityMod.Projectiles.Melee } //Chunger - var Sound = SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ThunderStrike"), Projectile.Center); + var Sound = SoundEngine.PlaySound(SoundLoader.GetLegacySoundSlot(Mod, "Sounds/Custom/ThunderStrike"), Projectile.Center); CalamityUtils.SafeVolumeChange(ref Sound, 0.4f); if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < 5) Main.LocalPlayer.Calamity().GeneralScreenShakePower = 5; diff --git a/Projectiles/Melee/Galaxia_AndromedasStride.cs b/Projectiles/Melee/Galaxia_AndromedasStride.cs index 7296b1f5db..a9983a5efc 100644 --- a/Projectiles/Melee/Galaxia_AndromedasStride.cs +++ b/Projectiles/Melee/Galaxia_AndromedasStride.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.localNPCHitCooldown = 16; } - public override bool CanDamage() + public override bool? CanDamage() { return (State == 1); } @@ -118,7 +118,7 @@ namespace CalamityMod.Projectiles.Melee //WOahhh do a ring of projectiles!! woahhh for (int i = 0; i < 5; i++) { - Projectile blast = Projectile.NewProjectileDirect(Owner.Center, (MathHelper.TwoPi * i / 5f).ToRotationVector2() * 10f, ProjectileType(), (int)(Projectile.damage * FourSeasonsGalaxia.AndromedaAttunement_BoltsDamageReduction), 0f, Owner.whoAmI, 0.75f, MathHelper.Pi * 0.02f); + Projectile blast = Projectile.NewProjectileDirect(Projectile.GetProjectileSource_FromThis(), Owner.Center, (MathHelper.TwoPi * i / 5f).ToRotationVector2() * 10f, ProjectileType(), (int)(Projectile.damage * FourSeasonsGalaxia.AndromedaAttunement_BoltsDamageReduction), 0f, Owner.whoAmI, 0.75f, MathHelper.Pi * 0.02f); { blast.timeLeft = 30; } @@ -152,14 +152,14 @@ namespace CalamityMod.Projectiles.Melee //Projectiles!!! wah!!! for (int i = 0; i < 9; i++) { - Projectile blast = Projectile.NewProjectileDirect(Owner.Center, (MathHelper.TwoPi * i / 9f).ToRotationVector2() * 10f, ProjectileType(), (int)(Projectile.damage * FourSeasonsGalaxia.AndromedaAttunement_BoltsDamageReduction), 0f, Owner.whoAmI, 0.75f, MathHelper.Pi * 0.02f); + Projectile blast = Projectile.NewProjectileDirect(Projectile.GetProjectileSource_FromThis(), Owner.Center, (MathHelper.TwoPi * i / 9f).ToRotationVector2() * 10f, ProjectileType(), (int)(Projectile.damage * FourSeasonsGalaxia.AndromedaAttunement_BoltsDamageReduction), 0f, Owner.whoAmI, 0.75f, MathHelper.Pi * 0.02f); { blast.timeLeft = 50; } } OverCharge = 20f; - SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AstralBeaconUse"), Projectile.Center); + SoundEngine.PlaySound(SoundLoader.GetLegacySoundSlot(Mod, "Sounds/Custom/AstralBeaconUse"), Projectile.Center); CurrentIndicator++; } } @@ -219,7 +219,7 @@ namespace CalamityMod.Projectiles.Melee if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < 15) Main.LocalPlayer.Calamity().GeneralScreenShakePower = 15; - Projectile proj = Projectile.NewProjectileDirect(Owner.Center + (direction * 120 * Projectile.scale), -direction * 16f, ProjectileType(), Projectile.damage, 10f, Owner.whoAmI, 0.75f, MathHelper.Pi / 25f); + Projectile proj = Projectile.NewProjectileDirect(Projectile.GetProjectileSource_FromThis(), Owner.Center + (direction * 120 * Projectile.scale), -direction * 16f, ProjectileType(), Projectile.damage, 10f, Owner.whoAmI, 0.75f, MathHelper.Pi / 25f); proj.scale = 3f; proj.timeLeft = 50; @@ -253,8 +253,8 @@ namespace CalamityMod.Projectiles.Melee { Vector2 projPosition = Owner.Center + (direction * 120 * Projectile.scale) + direction.RotatedBy((widestSurfaceAngle * MathHelper.PiOver2 + MathHelper.PiOver4) * facing) * distance; Vector2 monolithRotation = direction.RotatedBy(Utils.AngleLerp(widestSurfaceAngle * -facing, 0f, projSize)); - Projectile proj = Projectile.NewProjectileDirect(projPosition, -monolithRotation, ProjectileType(), (int)(Projectile.damage * FourSeasonsGalaxia.AndromedaAttunement_MonolithDamageBoost), 10f, Owner.whoAmI, Main.rand.Next(4), projSize); - if (proj.modProjectile is AndromedasStrideBoltSpawner spawner) + Projectile proj = Projectile.NewProjectileDirect(Projectile.GetProjectileSource_FromThis(), projPosition, -monolithRotation, ProjectileType(), (int)(Projectile.damage * FourSeasonsGalaxia.AndromedaAttunement_MonolithDamageBoost), 10f, Owner.whoAmI, Main.rand.Next(4), projSize); + if (proj.ModProjectile is AndromedasStrideBoltSpawner spawner) { spawner.WaitTimer = (1 - projSize) * 34f; spawner.OriginDirection = direction; @@ -277,7 +277,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - Texture2D sword = GetTexture("CalamityMod/Items/Weapons/Melee/GalaxiaExtra"); + Texture2D sword = Request("CalamityMod/Items/Weapons/Melee/GalaxiaExtra").Value; float drawAngle = direction.ToRotation(); float drawRotation = drawAngle + MathHelper.PiOver4; @@ -285,7 +285,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 drawOrigin = new Vector2(0f, sword.Height); Vector2 drawOffset = Projectile.Center - Main.screenPosition; - CalamityUtils.EnterShaderRegion(spriteBatch); + Main.spriteBatch.EnterShaderRegion(); if (OverCharge < 0) OverCharge = 0f; @@ -295,8 +295,7 @@ namespace CalamityMod.Projectiles.Melee GameShaders.Misc["CalamityMod:BasicTint"].Apply(); Main.EntitySpriteDraw(sword, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); - - CalamityUtils.ExitShaderRegion(spriteBatch); + Main.spriteBatch.ExitShaderRegion(); return false; } diff --git a/Projectiles/Melee/Galaxia_AndromedasStrideBoltSpawner.cs b/Projectiles/Melee/Galaxia_AndromedasStrideBoltSpawner.cs index 92dbf1cb74..18e780131f 100644 --- a/Projectiles/Melee/Galaxia_AndromedasStrideBoltSpawner.cs +++ b/Projectiles/Melee/Galaxia_AndromedasStrideBoltSpawner.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.hide = true; } - public override bool CanDamage() => false; + public override bool? CanDamage() => false; public override void AI() { @@ -82,7 +82,7 @@ namespace CalamityMod.Projectiles.Melee //New bolt if (Owner.whoAmI == Main.myPlayer) { - Projectile proj = Projectile.NewProjectileDirect(Projectile.position, Projectile.rotation.ToRotationVector2() * 18f, ProjectileType(), Projectile.damage, 10f, Owner.whoAmI, 0.75f, MathHelper.Pi / 25f); + Projectile proj = Projectile.NewProjectileDirect(Projectile.GetProjectileSource_FromThis(), Projectile.position, Projectile.rotation.ToRotationVector2() * 18f, ProjectileType(), Projectile.damage, 10f, Owner.whoAmI, 0.75f, MathHelper.Pi / 25f); proj.scale = Size * 3f; proj.timeLeft = 50; } @@ -145,8 +145,8 @@ namespace CalamityMod.Projectiles.Melee { Vector2 projPosition = Projectile.Center + OriginDirection.RotatedBy((widestSurfaceAngle * MathHelper.PiOver2 + MathHelper.PiOver4) * facing) * distance; Vector2 monolithRotation = OriginDirection.RotatedBy(Utils.AngleLerp(widestSurfaceAngle * -facing, 0f, projSize)); - Projectile proj = Projectile.NewProjectileDirect(projPosition, -monolithRotation, ProjectileType(), Projectile.damage, 10f, Owner.whoAmI, Main.rand.Next(4), projSize); - if (proj.modProjectile is AndromedasStrideBoltSpawner spawner) + Projectile proj = Projectile.NewProjectileDirect(Projectile.GetProjectileSource_FromThis(), projPosition, -monolithRotation, ProjectileType(), Projectile.damage, 10f, Owner.whoAmI, Main.rand.Next(4), projSize); + if (proj.ModProjectile is AndromedasStrideBoltSpawner spawner) { spawner.WaitTimer = (float)Math.Sqrt(1.0 - Math.Pow(projSize - 1.0, 2)) * 3f; spawner.OriginDirection = OriginDirection; diff --git a/Projectiles/Melee/Galaxia_AriesWrath.cs b/Projectiles/Melee/Galaxia_AriesWrath.cs index 8ed71ae95d..e7f8718722 100644 --- a/Projectiles/Melee/Galaxia_AriesWrath.cs +++ b/Projectiles/Melee/Galaxia_AriesWrath.cs @@ -1,4 +1,4 @@ -using CalamityMod.Particles; +using CalamityMod.Particles; using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -76,7 +76,7 @@ namespace CalamityMod.Projectiles.Melee NPC potentialTarget = TargetNext(target.Center, i); if (potentialTarget == null) break; - Projectile proj = Projectile.NewProjectileDirect(target.Center, target.SafeDirectionTo(potentialTarget.Center, Vector2.Zero) * 25f, ProjectileType(), (int)(damage * FourSeasonsGalaxia.AriesAttunement_OnHitBoltDamageReduction), 0, Owner.whoAmI, 0.9f, MathHelper.PiOver4 * 0.4f); + Projectile proj = Projectile.NewProjectileDirect(Projectile.GetProjectileSource_FromThis(), target.Center, target.SafeDirectionTo(potentialTarget.Center, Vector2.Zero) * 25f, ProjectileType(), (int)(damage * FourSeasonsGalaxia.AriesAttunement_OnHitBoltDamageReduction), 0, Owner.whoAmI, 0.9f, MathHelper.PiOver4 * 0.4f); proj.scale = 2f; } Array.Clear(excludedTargets, 0, 3); @@ -214,7 +214,7 @@ namespace CalamityMod.Projectiles.Melee if ((lastConstellation == null || !lastConstellation.active) && Owner.whoAmI == Main.myPlayer && ChainSwapTimer > 20) { - lastConstellation = Projectile.NewProjectileDirect(Owner.Center, Vector2.Zero, ProjectileType(), (int)(Projectile.damage * FourSeasonsGalaxia.AriesAttunement_ChainDamageReduction), 0, Owner.whoAmI); + lastConstellation = Projectile.NewProjectileDirect(Projectile.GetProjectileSource_FromThis(), Owner.Center, Vector2.Zero, ProjectileType(), (int)(Projectile.damage * FourSeasonsGalaxia.AriesAttunement_ChainDamageReduction), 0, Owner.whoAmI); } ChainSwapTimer++; @@ -223,13 +223,13 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - Texture2D sword = GetTexture("CalamityMod/Items/Weapons/Melee/GalaxiaExtra2"); + Texture2D sword = Request("CalamityMod/Items/Weapons/Melee/GalaxiaExtra2").Value; Vector2 drawPos = Projectile.Center; Vector2 drawOrigin = sword.Size() / 2f; float drawRotation = Projectile.rotation + MathHelper.PiOver4; - Main.EntitySpriteDraw(sword, drawPos - Main.screenPosition, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); + Main.EntitySpriteDraw(sword, drawPos - Main.screenPosition, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0); return false; } diff --git a/Projectiles/Melee/Galaxia_AriesWrathConstellation.cs b/Projectiles/Melee/Galaxia_AriesWrathConstellation.cs index 16f6306fb8..fe526824f4 100644 --- a/Projectiles/Melee/Galaxia_AriesWrathConstellation.cs +++ b/Projectiles/Melee/Galaxia_AriesWrathConstellation.cs @@ -146,7 +146,7 @@ namespace CalamityMod.Projectiles.Melee foreach (Particle particle in Particles) { - particle.CustomDraw(spriteBatch); + particle.CustomDraw(Main.spriteBatch); } Main.spriteBatch.ExitShaderRegion(); diff --git a/Projectiles/Melee/Galaxia_PhoenixsPride.cs b/Projectiles/Melee/Galaxia_PhoenixsPride.cs index 416a74a6d5..efa428182b 100644 --- a/Projectiles/Melee/Galaxia_PhoenixsPride.cs +++ b/Projectiles/Melee/Galaxia_PhoenixsPride.cs @@ -119,7 +119,7 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i <= 5; i++) { float angle = direction.ToRotation() + MathHelper.Lerp(-MathHelper.PiOver4, MathHelper.PiOver4, i / 5f); - Projectile.NewProjectile(Owner.Center, angle.ToRotationVector2() * 30f, ProjectileType(), (int)(Projectile.damage * FourSeasonsGalaxia.PhoenixAttunement_BoltThrowDamageMultiplier), 0f, Owner.whoAmI, 0.1f, MathHelper.Pi * 0.02f); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Owner.Center, angle.ToRotationVector2() * 30f, ProjectileType(), (int)(Projectile.damage * FourSeasonsGalaxia.PhoenixAttunement_BoltThrowDamageMultiplier), 0f, Owner.whoAmI, 0.1f, MathHelper.Pi * 0.02f); } } } @@ -178,7 +178,7 @@ namespace CalamityMod.Projectiles.Melee if ((Empowerment + OverEmpowerment) % 30 == 29 && Owner.whoAmI == Main.myPlayer) { Vector2 shotDirection = Main.rand.NextVector2CircularEdge(15f, 15f); - Projectile.NewProjectile(Owner.Center, shotDirection, ProjectileType(), (int)(Projectile.damage * FourSeasonsGalaxia.PhoenixAttunement_BoltDamageReduction), 0f, Owner.whoAmI, 0.1f, MathHelper.Pi * 0.02f); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Owner.Center, shotDirection, ProjectileType(), (int)(Projectile.damage * FourSeasonsGalaxia.PhoenixAttunement_BoltDamageReduction), 0f, Owner.whoAmI, 0.1f, MathHelper.Pi * 0.02f); } } @@ -209,7 +209,7 @@ namespace CalamityMod.Projectiles.Melee { if (Owner.whoAmI == Main.myPlayer) { - Projectile.NewProjectile(Owner.Center, Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.One) * 15f, ProjectileType(), (int)(Projectile.damage * FourSeasonsGalaxia.PhoenixAttunement_BoltDamageReduction), 0f, Owner.whoAmI, 0.1f, MathHelper.Pi * 0.02f); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Owner.Center, Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.One) * 15f, ProjectileType(), (int)(Projectile.damage * FourSeasonsGalaxia.PhoenixAttunement_BoltDamageReduction), 0f, Owner.whoAmI, 0.1f, MathHelper.Pi * 0.02f); } CanDirectFire = false; AngleReset = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.One).ToRotation(); @@ -278,7 +278,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - Texture2D sword = GetTexture("CalamityMod/Items/Weapons/Melee/GalaxiaExtra2"); + Texture2D sword = Request("CalamityMod/Items/Weapons/Melee/GalaxiaExtra2").Value; float drawAngle = direction.ToRotation(); float drawRotation = drawAngle + MathHelper.PiOver4; @@ -297,11 +297,11 @@ namespace CalamityMod.Projectiles.Melee } } - Main.EntitySpriteDraw(sword, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); + Main.EntitySpriteDraw(sword, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0); //Turn on additive blending Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); //Update the parameters //Don't draw the glowing blade after the retraction @@ -321,14 +321,14 @@ namespace CalamityMod.Projectiles.Melee //Back to normal Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); return false; } public void drawChain(float snapProgress, float retractProgress) { - Texture2D chainTex = GetTexture("CalamityMod/Projectiles/Melee/MendedBiomeBlade_HeavensMightChain"); + Texture2D chainTex = Request("CalamityMod/Projectiles/Melee/MendedBiomeBlade_HeavensMightChain").Value; float opacity = retractProgress < 0.5 ? 1 : (retractProgress - 0.5f) / 0.5f; diff --git a/Projectiles/Melee/Galaxia_PolarisGaze.cs b/Projectiles/Melee/Galaxia_PolarisGaze.cs index ef8e2ce111..92293ffda0 100644 --- a/Projectiles/Melee/Galaxia_PolarisGaze.cs +++ b/Projectiles/Melee/Galaxia_PolarisGaze.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.localNPCHitCooldown = FourSeasonsGalaxia.PolarisAttunement_LocalIFrames; } - public override bool CanDamage() + public override bool? CanDamage() { return Shred >= FourSeasonsGalaxia.PolarisAttunement_LocalIFrames; //Prevent spam click abuse } @@ -167,21 +167,21 @@ namespace CalamityMod.Projectiles.Melee { Dashing = false; Owner.velocity *= 0.1f; //Abrupt stop - SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/MeatySlash"), Projectile.Center); + SoundEngine.PlaySound(SoundLoader.GetLegacySoundSlot(Mod, "Sounds/Custom/MeatySlash"), Projectile.Center); if (Owner.whoAmI == Main.myPlayer) { for (int i = 0; i < 5; i++) { - Projectile blast = Projectile.NewProjectileDirect(Owner.Center, Main.rand.NextVector2CircularEdge(15, 15), ProjectileType(), (int)(FourSeasonsGalaxia.PolarisAttunement_SlashBoltsDamage * Owner.GetDamage(DamageClass.Melee)), 0f, Owner.whoAmI, 0.55f, MathHelper.Pi * 0.02f); + Projectile blast = Projectile.NewProjectileDirect(Projectile.GetProjectileSource_FromThis(), Owner.Center, Main.rand.NextVector2CircularEdge(15, 15), ProjectileType(), (int)(FourSeasonsGalaxia.PolarisAttunement_SlashBoltsDamage * Owner.GetDamage(DamageClass.Melee)), 0f, Owner.whoAmI, 0.55f, MathHelper.Pi * 0.02f); { blast.timeLeft = 100; } } - Projectile proj = Projectile.NewProjectileDirect(Owner.Center - DashStart / 2f, Vector2.Zero, ProjectileType(), (int)(Projectile.damage * FourSeasonsGalaxia.PolarisAttunement_SlashDamageBoost), 0, Owner.whoAmI); - if (proj.modProjectile is PolarisGazeDash dash) + Projectile proj = Projectile.NewProjectileDirect(Projectile.GetProjectileSource_FromThis(), Owner.Center - DashStart / 2f, Vector2.Zero, ProjectileType(), (int)(Projectile.damage * FourSeasonsGalaxia.PolarisAttunement_SlashDamageBoost), 0, Owner.whoAmI); + if (proj.ModProjectile is PolarisGazeDash dash) { dash.DashStart = DashStart; dash.DashEnd = Owner.Center; @@ -286,7 +286,7 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(SoundID.NPCHit43, Projectile.Center); if (ShredRatio > 0.85 && Owner.whoAmI == Main.myPlayer) { - Projectile.NewProjectile(Projectile.Center, direction * 36f, ProjectileType(), (int)(Projectile.damage * FourSeasonsGalaxia.PolarisAttunement_ShotDamageBoost), Projectile.knockBack, Owner.whoAmI, Shred); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, direction * 36f, ProjectileType(), (int)(Projectile.damage * FourSeasonsGalaxia.PolarisAttunement_ShotDamageBoost), Projectile.knockBack, Owner.whoAmI, Shred); } if (Dashing) { @@ -298,7 +298,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - Texture2D sword = GetTexture("CalamityMod/Items/Weapons/Melee/GalaxiaExtra"); + Texture2D sword = Request("CalamityMod/Items/Weapons/Melee/GalaxiaExtra").Value; float drawAngle = direction.ToRotation(); float drawRotation = drawAngle + MathHelper.PiOver4; @@ -306,7 +306,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 drawOrigin = new Vector2(0f, sword.Height); Vector2 drawOffset = Owner.Center + direction * 10f - Main.screenPosition; - Main.EntitySpriteDraw(sword, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); + Main.EntitySpriteDraw(sword, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0); return false; } diff --git a/Projectiles/Melee/Galaxia_PolarisGazeDash.cs b/Projectiles/Melee/Galaxia_PolarisGazeDash.cs index ce48fd912a..99dc54b3e9 100644 --- a/Projectiles/Melee/Galaxia_PolarisGazeDash.cs +++ b/Projectiles/Melee/Galaxia_PolarisGazeDash.cs @@ -56,7 +56,7 @@ namespace CalamityMod.Projectiles.Melee //Explode into cosmic bolts for (int i = 0; i < 3; i++) { - Projectile blast = Projectile.NewProjectileDirect(Owner.Center, Owner.SafeDirectionTo(target.Center, Vector2.Zero).RotatedByRandom(MathHelper.PiOver4) * 30f, ProjectileType(), (int)(FourSeasonsGalaxia.PolarisAttunement_SlashBoltsDamage * Owner.GetDamage(DamageClass.Melee)), 0f, Owner.whoAmI, 0.55f, MathHelper.Pi * 0.01f); + Projectile blast = Projectile.NewProjectileDirect(Projectile.GetProjectileSource_FromThis(), Owner.Center, Owner.SafeDirectionTo(target.Center, Vector2.Zero).RotatedByRandom(MathHelper.PiOver4) * 30f, ProjectileType(), (int)(FourSeasonsGalaxia.PolarisAttunement_SlashBoltsDamage * Owner.GetDamage(DamageClass.Melee)), 0f, Owner.whoAmI, 0.55f, MathHelper.Pi * 0.01f); { blast.timeLeft = 100; } @@ -69,9 +69,9 @@ namespace CalamityMod.Projectiles.Melee { Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - Texture2D lineTex = GetTexture("CalamityMod/Particles/ThinEndedLine"); + Texture2D lineTex = Request("CalamityMod/Particles/ThinEndedLine").Value; Vector2 Shake = Projectile.timeLeft < 15 ? Vector2.Zero : Vector2.One.RotatedByRandom(MathHelper.TwoPi) * (15 - Projectile.timeLeft / 5f) * 0.5f; float bump = (float)Math.Sin(((20f - Projectile.timeLeft) / 20f) * MathHelper.Pi); @@ -83,8 +83,8 @@ namespace CalamityMod.Projectiles.Melee Main.EntitySpriteDraw(lineTex, DashStart - Main.screenPosition + Shake, null, Color.Lerp(Color.White, Color.CornflowerBlue * 0.7f, raise), rot, origin, scale, SpriteEffects.None, 0); - Texture2D sparkTexture = GetTexture("CalamityMod/Particles/ThinSparkle"); - Texture2D bloomTexture = GetTexture("CalamityMod/Particles/BloomCircle"); + Texture2D sparkTexture = Request("CalamityMod/Particles/ThinSparkle").Value; + Texture2D bloomTexture = Request("CalamityMod/Particles/BloomCircle").Value; //Ajust the bloom's texture to be the same size as the star's float properBloomSize = (float)sparkTexture.Width / (float)bloomTexture.Height; @@ -96,7 +96,7 @@ namespace CalamityMod.Projectiles.Melee //Back to normal Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); return false; } } diff --git a/Projectiles/Melee/Galaxia_PolarisGazeStar.cs b/Projectiles/Melee/Galaxia_PolarisGazeStar.cs index 985e31731d..63e0fe101c 100644 --- a/Projectiles/Melee/Galaxia_PolarisGazeStar.cs +++ b/Projectiles/Melee/Galaxia_PolarisGazeStar.cs @@ -109,18 +109,18 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - var tex = GetTexture("CalamityMod/Particles/Sparkle"); + var tex = Request("CalamityMod/Particles/Sparkle").Value; float opacityFade = Projectile.timeLeft > 15 ? 1 : Projectile.timeLeft / 15f; - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.5f * opacityFade, Main.GlobalTimeWrappedHourly * 10f + MathHelper.PiOver4, tex.Size() / 2f, Projectile.scale * 1.5f, 0f, 0f); + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.5f * opacityFade, Main.GlobalTimeWrappedHourly * 10f + MathHelper.PiOver4, tex.Size() / 2f, Projectile.scale * 1.5f, 0f, 0); - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.8f * opacityFade, Main.GlobalTimeWrappedHourly * 10f, tex.Size() / 2f, Projectile.scale * 2f, 0f, 0f); + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.8f * opacityFade, Main.GlobalTimeWrappedHourly * 10f, tex.Size() / 2f, Projectile.scale * 2f, 0f, 0); //Back to normal Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); return false; } diff --git a/Projectiles/Melee/GalaxySmasherHammer.cs b/Projectiles/Melee/GalaxySmasherHammer.cs index cd96d77a1e..69b044455c 100644 --- a/Projectiles/Melee/GalaxySmasherHammer.cs +++ b/Projectiles/Melee/GalaxySmasherHammer.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -44,9 +44,9 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - drawOffsetX = -12; - drawOriginOffsetY = -5; - drawOriginOffsetX = 0; + DrawOffsetX = -12; + DrawOriginOffsetY = -5; + DrawOriginOffsetX = 0; // Produces violet dust constantly while in flight. This lights the hammer. int numDust = 2; @@ -200,7 +200,7 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.owner == Main.myPlayer) { - int proj = Projectile.NewProjectile(startPoint, velocity, laserID, laserDamage, laserKB, Projectile.owner); + int proj = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), startPoint, velocity, laserID, laserDamage, laserKB, Projectile.owner); if (proj.WithinBounds(Main.maxProjectiles)) { Main.projectile[proj].Calamity().forceMelee = true; diff --git a/Projectiles/Melee/GalaxyStar.cs b/Projectiles/Melee/GalaxyStar.cs index 252a49cfbb..faa3cdd7b3 100644 --- a/Projectiles/Melee/GalaxyStar.cs +++ b/Projectiles/Melee/GalaxyStar.cs @@ -1,6 +1,5 @@ -using System; +using System; using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Projectiles/Melee/GemTechYellowShard.cs b/Projectiles/Melee/GemTechYellowShard.cs index 79f15b6930..8924062d88 100644 --- a/Projectiles/Melee/GemTechYellowShard.cs +++ b/Projectiles/Melee/GemTechYellowShard.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -62,11 +62,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.Opacity = (float)System.Math.Sqrt(Projectile.timeLeft / 45f); } - public override void Kill(int timeLeft) - { - } - // Cannot deal damage for the first several frames of existence. - public override bool CanDamage() => Time >= IntangibleFrames; + public override bool? CanDamage() => Time >= IntangibleFrames; } } diff --git a/Projectiles/Melee/HellionSpike.cs b/Projectiles/Melee/HellionSpike.cs index 9d9ec0623b..1a68e55156 100644 --- a/Projectiles/Melee/HellionSpike.cs +++ b/Projectiles/Melee/HellionSpike.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.DamageType = DamageClass.Melee; Projectile.penetrate = 3; Projectile.timeLeft = 600; - aiType = ProjectileID.SporeCloud; + AIType = ProjectileID.SporeCloud; } public override void AI() @@ -55,6 +55,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { + // TODO -- Make this use proper i-frame variables. target.immune[Projectile.owner] = 8; OnHitEffects(target.Center, crit); target.AddBuff(BuffID.Venom, 180); diff --git a/Projectiles/Melee/HyperBlade.cs b/Projectiles/Melee/HyperBlade.cs index 363d8ce15d..dbf3a03da3 100644 --- a/Projectiles/Melee/HyperBlade.cs +++ b/Projectiles/Melee/HyperBlade.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.penetrate = 5; Projectile.timeLeft = 300; Projectile.ignoreWater = true; - aiType = ProjectileID.DeathSickle; + AIType = ProjectileID.DeathSickle; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 4; Projectile.extraUpdates = 1; diff --git a/Projectiles/Melee/IceBombFriendly.cs b/Projectiles/Melee/IceBombFriendly.cs index 4879fcb180..5d7e246edd 100644 --- a/Projectiles/Melee/IceBombFriendly.cs +++ b/Projectiles/Melee/IceBombFriendly.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.timeLeft = 180; } - public override bool CanDamage() => Projectile.ai[0] >= 120f; + public override bool? CanDamage() => Projectile.ai[0] >= 120f; public override void AI() { @@ -104,13 +104,13 @@ namespace CalamityMod.Projectiles.Melee for (i = 0; i < 2; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - int projectile1 = Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ProjectileID.FrostShard, (int)(Projectile.damage * 0.5), 0f, Projectile.owner, 0f, 0f); + int projectile1 = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ProjectileID.FrostShard, (int)(Projectile.damage * 0.5), 0f, Projectile.owner, 0f, 0f); if (projectile1.WithinBounds(Main.maxProjectiles)) { Main.projectile[projectile1].Calamity().forceMelee = true; Main.projectile[projectile1].penetrate = 2; } - int projectile2 = Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ProjectileID.FrostShard, (int)(Projectile.damage * 0.5), 0f, Projectile.owner, 0f, 0f); + int projectile2 = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ProjectileID.FrostShard, (int)(Projectile.damage * 0.5), 0f, Projectile.owner, 0f, 0f); if (projectile2.WithinBounds(Main.maxProjectiles)) { Main.projectile[projectile2].Calamity().forceMelee = true; diff --git a/Projectiles/Melee/JudgementBlah.cs b/Projectiles/Melee/JudgementBlah.cs index 568a9956ba..20b37b26ec 100644 --- a/Projectiles/Melee/JudgementBlah.cs +++ b/Projectiles/Melee/JudgementBlah.cs @@ -77,8 +77,8 @@ namespace CalamityMod.Projectiles.Melee for (i = 0; i < 1; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 0.6f), (float)(Math.Cos(offsetAngle) * 0.6f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); - Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 0.6f), (float)(-Math.Cos(offsetAngle) * 0.6f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 0.6f), (float)(Math.Cos(offsetAngle) * 0.6f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 0.6f), (float)(-Math.Cos(offsetAngle) * 0.6f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } } whiteLightTimer = 5; @@ -125,7 +125,7 @@ namespace CalamityMod.Projectiles.Melee } if (Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y - 100, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X, Projectile.Center.Y - 100, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Melee/JudgementProj.cs b/Projectiles/Melee/JudgementProj.cs index 7dcdc7c58f..c785de6fcc 100644 --- a/Projectiles/Melee/JudgementProj.cs +++ b/Projectiles/Melee/JudgementProj.cs @@ -43,8 +43,8 @@ namespace CalamityMod.Projectiles.Melee for (i = 0; i < 1; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - int projectile1 = Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); - int projectile2 = Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + int projectile1 = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + int projectile2 = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); Main.projectile[projectile1].velocity.X *= 0.1f; Main.projectile[projectile1].velocity.Y *= 0.1f; Main.projectile[projectile2].velocity.X *= 0.1f; @@ -72,7 +72,7 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(SoundID.Item122, Projectile.position); if (Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y - 100, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X, Projectile.Center.Y - 100, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Melee/LaserFountain.cs b/Projectiles/Melee/LaserFountain.cs index 4f2dc60a84..3cb4a12b6f 100644 --- a/Projectiles/Melee/LaserFountain.cs +++ b/Projectiles/Melee/LaserFountain.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Melee { if (Projectile.owner == Main.myPlayer) { - int projectile1 = Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, SpeedX, SpeedY, ModContent.ProjectileType(), (int)(350f * Main.player[Projectile.owner].MeleeDamage()), Projectile.knockBack, Projectile.owner, 0f, 0f); + int projectile1 = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, SpeedX, SpeedY, ModContent.ProjectileType(), (int)(350f * Main.player[Projectile.owner].MeleeDamage()), Projectile.knockBack, Projectile.owner, 0f, 0f); if (projectile1.WithinBounds(Main.maxProjectiles)) { Main.projectile[projectile1].Calamity().forceMelee = true; diff --git a/Projectiles/Melee/LifeScythe.cs b/Projectiles/Melee/LifeScythe.cs index 0d504c92a7..657b131d77 100644 --- a/Projectiles/Melee/LifeScythe.cs +++ b/Projectiles/Melee/LifeScythe.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.timeLeft = 240; Projectile.ignoreWater = true; Projectile.tileCollide = false; - aiType = ProjectileID.DeathSickle; + AIType = ProjectileID.DeathSickle; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 4; } diff --git a/Projectiles/Melee/LightBeam.cs b/Projectiles/Melee/LightBeam.cs index bb0bfaef99..6fa19ab889 100644 --- a/Projectiles/Melee/LightBeam.cs +++ b/Projectiles/Melee/LightBeam.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.width = 56; Projectile.height = 56; Projectile.aiStyle = 18; - aiType = ProjectileID.DeathSickle; + AIType = ProjectileID.DeathSickle; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; Projectile.penetrate = 1; @@ -69,7 +69,7 @@ namespace CalamityMod.Projectiles.Melee { for (int k = 0; k < 3; k++) { - Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, Main.rand.Next(-35, 36) * 0.2f, Main.rand.Next(-35, 36) * 0.2f, ModContent.ProjectileType(), + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, Main.rand.Next(-35, 36) * 0.2f, Main.rand.Next(-35, 36) * 0.2f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.15f, Main.myPlayer, 1f, 0f); } } diff --git a/Projectiles/Melee/LightningThing.cs b/Projectiles/Melee/LightningThing.cs index 520439973f..201cc6ab01 100644 --- a/Projectiles/Melee/LightningThing.cs +++ b/Projectiles/Melee/LightningThing.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Melee int damage = (int)(GaelsGreatsword.BaseDamage * Main.player[Projectile.owner].MeleeDamage()); for (int i = 0; i < 3; i++) { - int idx = Projectile.NewProjectile(Projectile.Center + new Vector2(Main.rand.NextFloat(-35f, 35f), -1600f), Vector2.UnitY * 12f, + int idx = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center + new Vector2(Main.rand.NextFloat(-35f, 35f), -1600f), Vector2.UnitY * 12f, ProjectileID.CultistBossLightningOrbArc, damage, 0f, Projectile.owner, MathHelper.PiOver2, Main.rand.Next(100)); if (idx.WithinBounds(Main.maxProjectiles)) diff --git a/Projectiles/Melee/MeldGreatswordBigProjectile.cs b/Projectiles/Melee/MeldGreatswordBigProjectile.cs index 853e310e9c..cc09aa3548 100644 --- a/Projectiles/Melee/MeldGreatswordBigProjectile.cs +++ b/Projectiles/Melee/MeldGreatswordBigProjectile.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; @@ -38,7 +38,6 @@ namespace CalamityMod.Projectiles.Melee { for (int num41 = 0; num41 < 2; num41++) { - Vector2 value8 = Vector2.UnitX * -15f; value8 = -Vector2.UnitY.RotatedBy((double)(Projectile.localAI[0] * 0.1308997f + (float)num41 * 3.14159274f), default) * value7; int num42 = Dust.NewDust(Projectile.Center, 0, 0, 27, 0f, 0f, 160, default, 1f); Main.dust[num42].scale = 1f; diff --git a/Projectiles/Melee/MeldGreatswordMediumProjectile.cs b/Projectiles/Melee/MeldGreatswordMediumProjectile.cs index 28162d1493..0fc1fd963e 100644 --- a/Projectiles/Melee/MeldGreatswordMediumProjectile.cs +++ b/Projectiles/Melee/MeldGreatswordMediumProjectile.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; @@ -38,7 +38,6 @@ namespace CalamityMod.Projectiles.Melee { for (int num41 = 0; num41 < 2; num41++) { - Vector2 value8 = Vector2.UnitX * -15f; value8 = -Vector2.UnitY.RotatedBy((double)(Projectile.localAI[0] * 0.1308997f + (float)num41 * 3.14159274f), default) * value7; int num42 = Dust.NewDust(Projectile.Center, 0, 0, 27, 0f, 0f, 160, default, 1f); Main.dust[num42].scale = 1f; diff --git a/Projectiles/Melee/MeldGreatswordSmallProjectile.cs b/Projectiles/Melee/MeldGreatswordSmallProjectile.cs index 6b5d1d6310..8215842bd9 100644 --- a/Projectiles/Melee/MeldGreatswordSmallProjectile.cs +++ b/Projectiles/Melee/MeldGreatswordSmallProjectile.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; @@ -38,7 +38,6 @@ namespace CalamityMod.Projectiles.Melee { for (int num41 = 0; num41 < 2; num41++) { - Vector2 value8 = Vector2.UnitX * -15f; value8 = -Vector2.UnitY.RotatedBy((double)(Projectile.localAI[0] * 0.1308997f + (float)num41 * 3.14159274f), default) * value7; int num42 = Dust.NewDust(Projectile.Center, 0, 0, 27, 0f, 0f, 160, default, 1f); Main.dust[num42].scale = 1f; diff --git a/Projectiles/Melee/MendedBiomeBlade_BitingEmbraceMist.cs b/Projectiles/Melee/MendedBiomeBlade_BitingEmbraceMist.cs index 81e8a6b9cc..e90b2a0358 100644 --- a/Projectiles/Melee/MendedBiomeBlade_BitingEmbraceMist.cs +++ b/Projectiles/Melee/MendedBiomeBlade_BitingEmbraceMist.cs @@ -71,7 +71,7 @@ namespace CalamityMod.Projectiles.Melee { Main.spriteBatch.EnterShaderRegion(BlendState.Additive); - var tex = GetTexture("CalamityMod/Particles/MediumMist"); + var tex = Request("CalamityMod/Particles/MediumMist").Value; Rectangle frame = tex.Frame(1, 3, 0, variant); Main.EntitySpriteDraw(tex, Projectile.position - Main.screenPosition, frame, mistColor * 0.5f * ((255f - Projectile.alpha) / 255f), Projectile.rotation, frame.Size() * 0.5f, Projectile.scale, SpriteEffects.None, 0); diff --git a/Projectiles/Melee/MendedBiomeBlade_DecaysRetortDash.cs b/Projectiles/Melee/MendedBiomeBlade_DecaysRetortDash.cs index d1c67c4ac6..4b0e1fa78b 100644 --- a/Projectiles/Melee/MendedBiomeBlade_DecaysRetortDash.cs +++ b/Projectiles/Melee/MendedBiomeBlade_DecaysRetortDash.cs @@ -49,11 +49,10 @@ namespace CalamityMod.Projectiles.Melee } public override bool PreDraw(ref Color lightColor) //OMw to reuse way too much code from the entangling vines { - Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - Texture2D chainTex = GetTexture("CalamityMod/Projectiles/Melee/MendedBiomeBlade_DecaysRetortDash"); + Texture2D chainTex = Request("CalamityMod/Projectiles/Melee/MendedBiomeBlade_DecaysRetortDash").Value; Vector2 Shake = Projectile.timeLeft < 15 ? Vector2.Zero : Vector2.One.RotatedByRandom(MathHelper.TwoPi) * (15 - Projectile.timeLeft / 5f) * 0.5f; @@ -79,8 +78,8 @@ namespace CalamityMod.Projectiles.Melee Main.EntitySpriteDraw(chainTex, Nodes[i] - Main.screenPosition, null, Color.Crimson * opacity, rotation, origin, scale, SpriteEffects.None, 0); } - Texture2D sparkTexture = GetTexture("CalamityMod/Particles/CritSpark"); - Texture2D bloomTexture = GetTexture("CalamityMod/Particles/BloomCircle"); + Texture2D sparkTexture = Request("CalamityMod/Particles/CritSpark").Value; + Texture2D bloomTexture = Request("CalamityMod/Particles/BloomCircle").Value; //Ajust the bloom's texture to be the same size as the star's float properBloomSize = (float)sparkTexture.Width / (float)bloomTexture.Height; @@ -93,7 +92,7 @@ namespace CalamityMod.Projectiles.Melee //Back to normal Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); return false; } } diff --git a/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrence.cs b/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrence.cs index 832cc4ad44..51e4b48cc8 100644 --- a/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrence.cs +++ b/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrence.cs @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.localNPCHitCooldown = 16; } - public override bool CanDamage() + public override bool? CanDamage() { return (State == 1); } @@ -115,7 +115,7 @@ namespace CalamityMod.Projectiles.Melee if ((Charge / MaxCharge >= 0.25f && CurrentIndicator == 0f) || (Charge / MaxCharge >= 0.5f && CurrentIndicator == 1f) || (Charge / MaxCharge >= 0.75f && CurrentIndicator == 2f)) { - var chargeSound = SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AstralBeaconOrbPulse"), Projectile.Center); + var chargeSound = SoundEngine.PlaySound(SoundLoader.GetLegacySoundSlot(Mod, "Sounds/Custom/AstralBeaconOrbPulse"), Projectile.Center); if (chargeSound != null) chargeSound.Pitch = -0.2f + 0.1f * CurrentIndicator; CurrentIndicator++; @@ -128,7 +128,7 @@ namespace CalamityMod.Projectiles.Melee if (Owner.whoAmI == Main.myPlayer && CurrentIndicator < 4f) { OverCharge = 20f; - SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AstralBeaconUse"), Projectile.Center); + SoundEngine.PlaySound(SoundLoader.GetLegacySoundSlot(Mod, "Sounds/Custom/AstralBeaconUse"), Projectile.Center); CurrentIndicator++; } } @@ -194,7 +194,7 @@ namespace CalamityMod.Projectiles.Melee //Only create the central monolith if over half charge if (Charge / MaxCharge < 0.5f) return; - Projectile.NewProjectile(Owner.Center + (direction * 120 * Projectile.scale), -direction, ProjectileType(), (int)(Projectile.damage * TrueBiomeBlade.AstralAttunement_MonolithDamageBoost), 10f, Owner.whoAmI, Main.rand.Next(4), 1f); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Owner.Center + (direction * 120 * Projectile.scale), -direction, ProjectileType(), (int)(Projectile.damage * TrueBiomeBlade.AstralAttunement_MonolithDamageBoost), 10f, Owner.whoAmI, Main.rand.Next(4), 1f); //Only create the side monoliths if over 3/4th charge if (Charge / MaxCharge < 0.75f) @@ -231,8 +231,8 @@ namespace CalamityMod.Projectiles.Melee { Vector2 projPosition = Owner.Center + (direction * 120 * Projectile.scale) + direction.RotatedBy((widestSurfaceAngle * MathHelper.PiOver2 + MathHelper.PiOver4) * facing) * distance; Vector2 monolithRotation = direction.RotatedBy(Utils.AngleLerp(widestSurfaceAngle * -facing, 0f, projSize)); - Projectile proj = Projectile.NewProjectileDirect(projPosition, -monolithRotation, ProjectileType(), (int)(Projectile.damage * TrueBiomeBlade.AstralAttunement_MonolithDamageBoost), 10f, Owner.whoAmI, Main.rand.Next(4), projSize); - if (proj.modProjectile is ExtantAbhorrenceMonolith monolith) + Projectile proj = Projectile.NewProjectileDirect(Projectile.GetProjectileSource_FromThis(), projPosition, -monolithRotation, ProjectileType(), (int)(Projectile.damage * TrueBiomeBlade.AstralAttunement_MonolithDamageBoost), 10f, Owner.whoAmI, Main.rand.Next(4), projSize); + if (proj.ModProjectile is ExtantAbhorrenceMonolith monolith) monolith.WaitTimer = (1 - projSize) * 34f; } @@ -251,8 +251,8 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - Texture2D handle = GetTexture("CalamityMod/Projectiles/Melee/MendedBiomeBlade"); - Texture2D blade = GetTexture("CalamityMod/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrence"); + Texture2D handle = Request("CalamityMod/Projectiles/Melee/MendedBiomeBlade").Value; + Texture2D blade = Request("CalamityMod/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrence").Value; float drawAngle = direction.ToRotation(); float drawRotation = drawAngle + MathHelper.PiOver4; @@ -260,11 +260,11 @@ namespace CalamityMod.Projectiles.Melee Vector2 drawOrigin = new Vector2(0f, handle.Height); Vector2 drawOffset = Projectile.Center - Main.screenPosition; - Main.EntitySpriteDraw(handle, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); + Main.EntitySpriteDraw(handle, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0); //Turn on additive blending Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); //Just in case if (OverCharge < 0) @@ -277,11 +277,11 @@ namespace CalamityMod.Projectiles.Melee //Update the parameters drawOrigin = new Vector2(0f, blade.Height); - Main.EntitySpriteDraw(blade, drawOffset, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); + Main.EntitySpriteDraw(blade, drawOffset, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f, drawRotation, drawOrigin, Projectile.scale, 0f, 0); //Back to normal Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); return false; } diff --git a/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrenceMonolith.cs b/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrenceMonolith.cs index 5bab445d7f..5ab729541f 100644 --- a/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrenceMonolith.cs +++ b/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrenceMonolith.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.hide = true; } - public override bool CanDamage() => WaitTimer <= 0; + public override bool? CanDamage() => WaitTimer <= 0; public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { @@ -60,9 +60,9 @@ namespace CalamityMod.Projectiles.Melee return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + ((Projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * Height()), Width(), ref collisionPoint); } - public override void DrawBehind(int index, List drawCacheProjsBehindNPCsAndTiles, List drawCacheProjsBehindNPCs, List drawCacheProjsBehindProjectiles, List drawCacheProjsOverWiresUI) + public override void DrawBehind(int index, List behindNPCsAndTiles, List behindNPCs, List behindProjectiles, List overPlayers, List overWiresUI) { - drawCacheProjsBehindNPCsAndTiles.Add(index); + behindNPCsAndTiles.Add(index); } public override void AI() @@ -140,7 +140,7 @@ namespace CalamityMod.Projectiles.Melee if (WaitTimer > 0) return false; - Texture2D tex = GetTexture("CalamityMod/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrenceMonolith"); + Texture2D tex = Request("CalamityMod/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrenceMonolith").Value; float drawAngle = Projectile.rotation; Rectangle frame = new Rectangle(0 + (int)Variant * 94, 0, 94, 420); @@ -151,7 +151,7 @@ namespace CalamityMod.Projectiles.Melee float opacity = MathHelper.Clamp(1f - ((Timer - 0.85f) / 0.15f), 0f, 1f); - Main.EntitySpriteDraw(tex, drawPosition, frame, lightColor * opacity, drawAngle, drawOrigin, drawScale, 0f, 0f); + Main.EntitySpriteDraw(tex, drawPosition, frame, lightColor * opacity, drawAngle, drawOrigin, drawScale, 0f, 0); return false; } @@ -160,7 +160,7 @@ namespace CalamityMod.Projectiles.Melee if (WaitTimer > 0) return; - Texture2D tex = GetTexture("CalamityMod/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrenceMonolith_Glow"); + Texture2D tex = Request("CalamityMod/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrenceMonolith_Glow").Value; float drawAngle = Projectile.rotation; Rectangle frame = new Rectangle(0 + (int)Variant * 94, 0, 94, 420); @@ -171,7 +171,7 @@ namespace CalamityMod.Projectiles.Melee float opacity = MathHelper.Clamp(1f - ((Timer - 0.85f) / 0.15f), 0f, 1f); - Main.EntitySpriteDraw(tex, drawPosition, frame, Color.White * opacity, drawAngle, drawOrigin, drawScale, 0f, 0f); + Main.EntitySpriteDraw(tex, drawPosition, frame, Color.White * opacity, drawAngle, drawOrigin, drawScale, 0f, 0); } diff --git a/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrowned.cs b/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrowned.cs index 57869fad0d..05147b8ae8 100644 --- a/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrowned.cs +++ b/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrowned.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.tileCollide = false; } - public override bool CanDamage() => false; + public override bool? CanDamage() => false; public override void AI() { @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Melee if (Owner.whoAmI == Main.myPlayer) { - Projectile.NewProjectile(Owner.Center, direction * 0.1f + Owner.velocity, ProjectileType(), Projectile.damage, 0, Owner.whoAmI); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Owner.Center, direction * 0.1f + Owner.velocity, ProjectileType(), Projectile.damage, 0, Owner.whoAmI); } Particle Sparkle = new CritSpark(Projectile.Center, Main.rand.NextVector2Circular(1f, 1f) * Main.rand.NextFloat(7.5f, 20f), Color.White, Main.rand.NextBool() ? Color.CornflowerBlue : Color.DodgerBlue, 0.1f + Main.rand.NextFloat(0f, 1.5f), 20 + Main.rand.Next(30), 1, 3f); @@ -68,14 +68,14 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - Texture2D blade = GetTexture("CalamityMod/Items/Weapons/Melee/TrueBiomeBlade"); + Texture2D blade = Request("CalamityMod/Items/Weapons/Melee/TrueBiomeBlade").Value; float drawAngle = direction.ToRotation(); float drawRotation = drawAngle + MathHelper.PiOver4; Vector2 drawOrigin = new Vector2(0f, blade.Height); Vector2 drawOffset = Projectile.Center - Main.screenPosition; - Main.EntitySpriteDraw(blade, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); + Main.EntitySpriteDraw(blade, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0); return false; } diff --git a/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrownedOrb.cs b/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrownedOrb.cs index a4f5ae3348..47c70852b7 100644 --- a/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrownedOrb.cs +++ b/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrownedOrb.cs @@ -73,9 +73,9 @@ namespace CalamityMod.Projectiles.Melee return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center + Utils.SafeNormalize(Projectile.velocity.RotatedBy(MathHelper.PiOver2), Vector2.Zero) * halfLenght, Projectile.Center - Utils.SafeNormalize(Projectile.velocity.RotatedBy(MathHelper.PiOver2), Vector2.Zero) * halfLenght, 40f, ref collisionPoint); } - public override void DrawBehind(int index, List drawCacheProjsBehindNPCsAndTiles, List drawCacheProjsBehindNPCs, List drawCacheProjsBehindProjectiles, List drawCacheProjsOverWiresUI) + public override void DrawBehind(int index, List behindNPCsAndTiles, List behindNPCs, List behindProjectiles, List overPlayers, List overWiresUI) { - drawCacheProjsBehindNPCsAndTiles.Add(index); + behindNPCsAndTiles.Add(index); } public override void AI() @@ -232,20 +232,20 @@ namespace CalamityMod.Projectiles.Melee if (WaterMode) { - Texture2D wave = GetTexture("CalamityMod/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrownedAquaWave"); + Texture2D wave = Request("CalamityMod/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrownedAquaWave").Value; float drawRotation = Projectile.velocity.ToRotation() + MathHelper.Pi; Vector2 drawOrigin = new Vector2(wave.Width / 2f, wave.Height / 2f); Vector2 drawOffset = Projectile.Center - Main.screenPosition; - Main.EntitySpriteDraw(wave, drawOffset - Projectile.velocity, null, Color.Lerp(lightColor, Color.White, 0.5f) * 0.2f, drawRotation, drawOrigin, Projectile.scale - 0.2f, 0f, 0f); - Main.EntitySpriteDraw(wave, drawOffset, null, Color.Lerp(lightColor, Color.White, 0.5f) * 0.5f, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); + Main.EntitySpriteDraw(wave, drawOffset - Projectile.velocity, null, Color.Lerp(lightColor, Color.White, 0.5f) * 0.2f, drawRotation, drawOrigin, Projectile.scale - 0.2f, 0f, 0); + Main.EntitySpriteDraw(wave, drawOffset, null, Color.Lerp(lightColor, Color.White, 0.5f) * 0.5f, drawRotation, drawOrigin, Projectile.scale, 0f, 0); return false; } if (HasLanded == 1f && TimeSinceLanding > 10f) { - Texture2D wave = GetTexture("CalamityMod/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrownedWave"); + Texture2D wave = Request("CalamityMod/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrownedWave").Value; Rectangle frame = new Rectangle(0, 0 + 110 * Projectile.frame, 40, 110); float drawRotation = 0f; @@ -268,7 +268,7 @@ namespace CalamityMod.Projectiles.Melee float slightfade = 1f - 0.24f * i; Color darkenedColor = Color.Lerp(lightColor, Color.Black, i * 0.15f); - Main.EntitySpriteDraw(wave, drawOffset, frame, darkenedColor * MathHelper.Clamp(TimeSinceLanding / 30f, 0f, 1f) * slightfade, drawRotation, drawOrigin, Scale, flip, 0f); + Main.EntitySpriteDraw(wave, drawOffset, frame, darkenedColor * MathHelper.Clamp(TimeSinceLanding / 30f, 0f, 1f) * slightfade, drawRotation, drawOrigin, Scale, flip, 0); } @@ -278,12 +278,12 @@ namespace CalamityMod.Projectiles.Melee else { - Texture2D ball = GetTexture("CalamityMod/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrowned"); + Texture2D ball = Request("CalamityMod/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrowned").Value; float drawRotation = Projectile.rotation; Vector2 drawOrigin = Projectile.Size / 2f; Vector2 drawOffset = Projectile.Center - Main.screenPosition; - Main.EntitySpriteDraw(ball, drawOffset, null, lightColor * MathHelper.Clamp(1 - TimeSinceLanding / 10f, 0f, 1f), drawRotation, drawOrigin, Projectile.scale, 0f, 0f); + Main.EntitySpriteDraw(ball, drawOffset, null, lightColor * MathHelper.Clamp(1 - TimeSinceLanding / 10f, 0f, 1f), drawRotation, drawOrigin, Projectile.scale, 0f, 0); return false; } diff --git a/Projectiles/Melee/MendedBiomeBlade_GrovetendersEntanglingVines.cs b/Projectiles/Melee/MendedBiomeBlade_GrovetendersEntanglingVines.cs index c577f77854..9c503691b6 100644 --- a/Projectiles/Melee/MendedBiomeBlade_GrovetendersEntanglingVines.cs +++ b/Projectiles/Melee/MendedBiomeBlade_GrovetendersEntanglingVines.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - Texture2D chainTex = GetTexture("CalamityMod/Projectiles/Melee/BrokenBiomeBlade_GrovetendersTouchChain"); + Texture2D chainTex = Request("CalamityMod/Projectiles/Melee/BrokenBiomeBlade_GrovetendersTouchChain").Value; float opacity = Projectile.timeLeft > 10 ? 1 : Projectile.timeLeft / 10f; Vector2 Shake = Projectile.timeLeft < 15 ? Vector2.Zero : Vector2.One.RotatedByRandom(MathHelper.TwoPi) * (15 - Projectile.timeLeft / 5f) * 0.5f; diff --git a/Projectiles/Melee/MendedBiomeBlade_HeavensMight.cs b/Projectiles/Melee/MendedBiomeBlade_HeavensMight.cs index fae25c6d1a..8305ac13c7 100644 --- a/Projectiles/Melee/MendedBiomeBlade_HeavensMight.cs +++ b/Projectiles/Melee/MendedBiomeBlade_HeavensMight.cs @@ -206,8 +206,8 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - Texture2D handle = GetTexture("CalamityMod/Items/Weapons/Melee/TrueBiomeBlade"); - Texture2D blade = GetTexture("CalamityMod/Projectiles/Melee/MendedBiomeBlade_HeavensMight"); + Texture2D handle = Request("CalamityMod/Items/Weapons/Melee/TrueBiomeBlade").Value; + Texture2D blade = Request("CalamityMod/Projectiles/Melee/MendedBiomeBlade_HeavensMight").Value; float drawAngle = direction.ToRotation(); float drawRotation = drawAngle + MathHelper.PiOver4; @@ -226,7 +226,7 @@ namespace CalamityMod.Projectiles.Melee } Main.spriteBatch.End(); //Haha sup babe what if i restarted the spritebatch way too many times haha /blushes - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); Vector2 afterimageDrawOrigin = new Vector2(0f, blade.Height); for (int i = 0; i < Projectile.oldRot.Length; ++i) @@ -236,15 +236,15 @@ namespace CalamityMod.Projectiles.Melee Main.spriteBatch.Draw(blade, drawOffset, null, color * MathHelper.Lerp(0f, 0.5f, MathHelper.Clamp((Empowerment / maxEmpowerment - 0.4f) / 0.1f, 0f, 1f)), afterimageRotation, afterimageDrawOrigin, Projectile.scale - 0.2f * ((i / (float)Projectile.oldRot.Length)), 0f, 0f); } Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); } - Main.EntitySpriteDraw(handle, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); + Main.EntitySpriteDraw(handle, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0); //Turn on additive blending Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); //Update the parameters drawOrigin = new Vector2(0f, blade.Height); @@ -258,7 +258,7 @@ namespace CalamityMod.Projectiles.Melee GameShaders.Misc["CalamityMod:BasicTint"].Apply(); } - Main.EntitySpriteDraw(blade, drawOffset, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f * opacityFade, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); + Main.EntitySpriteDraw(blade, drawOffset, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f * opacityFade, drawRotation, drawOrigin, Projectile.scale, 0f, 0); if (CurrentState == 1f && snapTimer > 0) { @@ -267,14 +267,14 @@ namespace CalamityMod.Projectiles.Melee //Back to normal Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); return false; } public void drawChain(float snapProgress, float retractProgress) { - Texture2D chainTex = GetTexture("CalamityMod/Projectiles/Melee/MendedBiomeBlade_HeavensMightChain"); + Texture2D chainTex = Request("CalamityMod/Projectiles/Melee/MendedBiomeBlade_HeavensMightChain").Value; float opacity = retractProgress < 0.5 ? 1 : (retractProgress - 0.5f) / 0.5f; diff --git a/Projectiles/Melee/MendedBiomeBlade_PurityProjectionSigil.cs b/Projectiles/Melee/MendedBiomeBlade_PurityProjectionSigil.cs index 1f47719332..d8d6a52624 100644 --- a/Projectiles/Melee/MendedBiomeBlade_PurityProjectionSigil.cs +++ b/Projectiles/Melee/MendedBiomeBlade_PurityProjectionSigil.cs @@ -37,7 +37,6 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - Lighting.AddLight(Projectile.Center, 0.75f, 1f, 0.24f); int dustParticle = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 75, 0f, 0f, 100, default, 0.9f); Main.dust[dustParticle].noGravity = true; diff --git a/Projectiles/Melee/MendedBiomeBlade_TrueAridGrandeur.cs b/Projectiles/Melee/MendedBiomeBlade_TrueAridGrandeur.cs index d18503395f..1abff187cf 100644 --- a/Projectiles/Melee/MendedBiomeBlade_TrueAridGrandeur.cs +++ b/Projectiles/Melee/MendedBiomeBlade_TrueAridGrandeur.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.timeLeft = TrueBiomeBlade.HotAttunement_LocalIFrames; } - public override bool CanDamage() + public override bool? CanDamage() { return Projectile.timeLeft <= 2; //Prevent spam click abuse } @@ -92,7 +92,7 @@ namespace CalamityMod.Projectiles.Melee } if (Owner.HeldItem.type == ItemType()) - (Owner.HeldItem.modItem as TrueBiomeBlade).StoredLunges = 2; // Reset the lunge counter on pogo. This should make for more interesting and fun synergies + (Owner.HeldItem.ModItem as TrueBiomeBlade).StoredLunges = 2; // Reset the lunge counter on pogo. This should make for more interesting and fun synergies } } @@ -215,14 +215,14 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(SoundID.NPCHit43, Projectile.Center); if (ShredRatio > 0.5 && Owner.whoAmI == Main.myPlayer) { - Projectile.NewProjectile(Projectile.Center, direction * 16f, ProjectileType(), (int)(Projectile.damage * TrueBiomeBlade.HotAttunement_ShotDamageBoost), Projectile.knockBack, Owner.whoAmI, Shred); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, direction * 16f, ProjectileType(), (int)(Projectile.damage * TrueBiomeBlade.HotAttunement_ShotDamageBoost), Projectile.knockBack, Owner.whoAmI, Shred); } } public override bool PreDraw(ref Color lightColor) { - Texture2D handle = GetTexture("CalamityMod/Projectiles/Melee/MendedBiomeBlade"); - Texture2D blade = GetTexture("CalamityMod/Projectiles/Melee/MendedBiomeBlade_AridGrandeur"); + Texture2D handle = Request("CalamityMod/Projectiles/Melee/MendedBiomeBlade").Value; + Texture2D blade = Request("CalamityMod/Projectiles/Melee/MendedBiomeBlade_AridGrandeur").Value; int bladeAmount = 4; @@ -232,20 +232,20 @@ namespace CalamityMod.Projectiles.Melee Vector2 drawOrigin = new Vector2(0f, handle.Height); Vector2 drawOffset = Owner.Center + direction * 10f - Main.screenPosition; - Main.EntitySpriteDraw(handle, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); + Main.EntitySpriteDraw(handle, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0); //Turn on additive blending Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); //Update the parameters drawOrigin = new Vector2(0f, blade.Height); - Main.EntitySpriteDraw(blade, drawOffset, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); + Main.EntitySpriteDraw(blade, drawOffset, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f, drawRotation, drawOrigin, Projectile.scale, 0f, 0); for (int i = 0; i < bladeAmount; i++) //Draw extra copies { - blade = GetTexture("CalamityMod/Projectiles/Melee/MendedBiomeBlade_AridGrandeurExtra"); + blade = Request("CalamityMod/Projectiles/Melee/MendedBiomeBlade_AridGrandeurExtra").Value; drawAngle = direction.ToRotation(); @@ -258,12 +258,12 @@ namespace CalamityMod.Projectiles.Melee Vector2 drawDisplacementAngle = direction.RotatedBy(MathHelper.PiOver2) * circleCompletion.ToRotationVector2().Y * (20 + 40 * ShredRatio); //How far perpendicularly Vector2 drawOffsetFromBounce = direction * MathHelper.Clamp(BounceTime, 0f, 20f) / 20f * 20f; - Main.EntitySpriteDraw(blade, drawOffsetStraight + drawDisplacementAngle + drawOffsetFromBounce, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.8f, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); + Main.EntitySpriteDraw(blade, drawOffsetStraight + drawDisplacementAngle + drawOffsetFromBounce, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.8f, drawRotation, drawOrigin, Projectile.scale, 0f, 0); } //Back to normal Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); return false; } diff --git a/Projectiles/Melee/MendedBiomeBlade_TrueAridGrandeurShot.cs b/Projectiles/Melee/MendedBiomeBlade_TrueAridGrandeurShot.cs index 7f2a280106..33c3214c80 100644 --- a/Projectiles/Melee/MendedBiomeBlade_TrueAridGrandeurShot.cs +++ b/Projectiles/Melee/MendedBiomeBlade_TrueAridGrandeurShot.cs @@ -73,11 +73,11 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); for (int i = 0; i < 4; i++) //Draw extra copies { - var tex = GetTexture("CalamityMod/Projectiles/Melee/MendedBiomeBlade_AridGrandeurExtra"); + var tex = Request("CalamityMod/Projectiles/Melee/MendedBiomeBlade_AridGrandeurExtra").Value; float drawAngle = direction.ToRotation(); @@ -92,12 +92,12 @@ namespace CalamityMod.Projectiles.Melee float opacityFade = Projectile.timeLeft > 15 ? 1 : Projectile.timeLeft / 15f; - Main.EntitySpriteDraw(tex, drawOffsetStraight + drawDisplacementAngle, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.8f * opacityFade, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); + Main.EntitySpriteDraw(tex, drawOffsetStraight + drawDisplacementAngle, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.8f * opacityFade, drawRotation, drawOrigin, Projectile.scale, 0f, 0); } //Back to normal Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); return false; } diff --git a/Projectiles/Melee/MendedBiomeBlade_TrueBitingEmbrace.cs b/Projectiles/Melee/MendedBiomeBlade_TrueBitingEmbrace.cs index 1933acaf94..62da5a9a05 100644 --- a/Projectiles/Melee/MendedBiomeBlade_TrueBitingEmbrace.cs +++ b/Projectiles/Melee/MendedBiomeBlade_TrueBitingEmbrace.cs @@ -155,7 +155,7 @@ namespace CalamityMod.Projectiles.Melee if (Main.rand.NextBool() && Owner.whoAmI == Main.myPlayer) { - Projectile mist = Projectile.NewProjectileDirect(Owner.Center + direction * 40 + Main.rand.NextVector2Circular(30f, 30f), Vector2.Zero, ProjectileType(), (int)(Projectile.damage * TrueBiomeBlade.ColdAttunement_MistDamageReduction), 0f, Owner.whoAmI); + Projectile mist = Projectile.NewProjectileDirect(Projectile.GetProjectileSource_FromThis(), Owner.Center + direction * 40 + Main.rand.NextVector2Circular(30f, 30f), Vector2.Zero, ProjectileType(), (int)(Projectile.damage * TrueBiomeBlade.ColdAttunement_MistDamageReduction), 0f, Owner.whoAmI); mist.velocity = (mist.Center - Owner.Center) * 0.2f + Owner.velocity; } @@ -165,7 +165,7 @@ namespace CalamityMod.Projectiles.Melee { if (Main.rand.NextFloat(0f, 1f) > 0.75f && Owner.whoAmI == Main.myPlayer) { - Projectile.NewProjectile(Owner.Center + direction * 40, rotation.ToRotationVector2() * 5, ProjectileType(), (int)(Projectile.damage * TrueBiomeBlade.ColdAttunement_MistDamageReduction), 0f, Owner.whoAmI); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Owner.Center + direction * 40, rotation.ToRotationVector2() * 5, ProjectileType(), (int)(Projectile.damage * TrueBiomeBlade.ColdAttunement_MistDamageReduction), 0f, Owner.whoAmI); Vector2 particlePosition = Owner.Center + (rotation.ToRotationVector2() * 100f * Projectile.scale); Particle snowflake = new SnowflakeSparkle(particlePosition, rotation.ToRotationVector2() * 3f, Color.White, new Color(75, 177, 250), Main.rand.NextFloat(0.3f, 1.5f), 40, 0.5f); @@ -199,30 +199,30 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - Texture2D handle = GetTexture("CalamityMod/Projectiles/Melee/MendedBiomeBlade"); + Texture2D handle = Request("CalamityMod/Projectiles/Melee/MendedBiomeBlade").Value; if (SwingMode != 2) { - Texture2D blade = GetTexture("CalamityMod/Projectiles/Melee/MendedBiomeBlade_BitingEmbrace"); + Texture2D blade = Request("CalamityMod/Projectiles/Melee/MendedBiomeBlade_BitingEmbrace").Value; float drawAngle = rotation; float drawRotation = rotation + MathHelper.PiOver4; Vector2 drawOrigin = new Vector2(0f, handle.Height); Vector2 drawOffset = Owner.Center + drawAngle.ToRotationVector2() * 10f - Main.screenPosition; - Main.EntitySpriteDraw(handle, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); + Main.EntitySpriteDraw(handle, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0); //Turn on additive blending Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); //Update the parameters drawOrigin = new Vector2(0f, blade.Height); - Main.EntitySpriteDraw(blade, drawOffset, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.8f, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); + Main.EntitySpriteDraw(blade, drawOffset, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.8f, drawRotation, drawOrigin, Projectile.scale, 0f, 0); //Back to normal Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); } else { - Texture2D blade = GetTexture("CalamityMod/Projectiles/Melee/MendedBiomeBlade_BitingEmbraceThrust"); + Texture2D blade = Request("CalamityMod/Projectiles/Melee/MendedBiomeBlade_BitingEmbraceThrust").Value; Vector2 thrustDisplace = direction * (ThrustDisplaceRatio() * 60); float drawAngle = rotation; @@ -230,19 +230,19 @@ namespace CalamityMod.Projectiles.Melee Vector2 drawOrigin = new Vector2(0f, handle.Height); Vector2 drawOffset = Owner.Center + drawAngle.ToRotationVector2() * 10f - Main.screenPosition; - Main.EntitySpriteDraw(handle, drawOffset + thrustDisplace, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); + Main.EntitySpriteDraw(handle, drawOffset + thrustDisplace, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0); //Turn on additive blending Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); //Update the parameters drawOrigin = new Vector2(0f, blade.Height); //Anim stuff - Main.EntitySpriteDraw(blade, drawOffset + thrustDisplace, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); + Main.EntitySpriteDraw(blade, drawOffset + thrustDisplace, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f, drawRotation, drawOrigin, Projectile.scale, 0f, 0); //Back to normal Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); } return false; diff --git a/Projectiles/Melee/MendedBiomeBlade_TrueDecaysRetort.cs b/Projectiles/Melee/MendedBiomeBlade_TrueDecaysRetort.cs index 21f1542037..3bcfd8f0b9 100644 --- a/Projectiles/Melee/MendedBiomeBlade_TrueDecaysRetort.cs +++ b/Projectiles/Melee/MendedBiomeBlade_TrueDecaysRetort.cs @@ -87,12 +87,12 @@ namespace CalamityMod.Projectiles.Melee Owner.velocity *= 0.1f; //Abrupt stop Owner.Calamity().LungingDown = false; - SoundEngine.PlaySound(Mod.GetLegacySoundSlot(Terraria.ModLoader.SoundType.Custom, "Sounds/Custom/SwiftSlice"), Owner.Center); + SoundEngine.PlaySound(SoundLoader.GetLegacySoundSlot(Mod, "Sounds/Custom/SwiftSlice"), Owner.Center); if (Owner.whoAmI == Main.myPlayer) { - Projectile proj = Projectile.NewProjectileDirect(Owner.Center - PowerLungeStart / 2f, Vector2.Zero, ProjectileType(), (int)(Projectile.damage * TrueBiomeBlade.EvilAttunement_SlashDamageBoost), 0, Owner.whoAmI); - if (proj.modProjectile is DecaysRetortDash dash) + Projectile proj = Projectile.NewProjectileDirect(Projectile.GetProjectileSource_FromThis(), Owner.Center - PowerLungeStart / 2f, Vector2.Zero, ProjectileType(), (int)(Projectile.damage * TrueBiomeBlade.EvilAttunement_SlashDamageBoost), 0, Owner.whoAmI); + if (proj.ModProjectile is DecaysRetortDash dash) { dash.DashStart = PowerLungeStart; dash.DashEnd = Owner.Center; @@ -162,7 +162,7 @@ namespace CalamityMod.Projectiles.Melee Owner.GiveIFrames(TrueBiomeBlade.EvilAttunement_BounceIFrames); // i frames for free! if (Owner.whoAmI == Main.myPlayer) { - if (Owner.HeldItem.modItem is TrueBiomeBlade sword) + if (Owner.HeldItem.ModItem is TrueBiomeBlade sword) { sword.PowerLungeCounter++; if (sword.PowerLungeCounter == 3) @@ -173,8 +173,8 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - Texture2D handle = GetTexture("CalamityMod/Projectiles/Melee/MendedBiomeBlade"); - Texture2D tex = GetTexture("CalamityMod/Projectiles/Melee/MendedBiomeBlade_DecaysRetort"); + Texture2D handle = Request("CalamityMod/Projectiles/Melee/MendedBiomeBlade").Value; + Texture2D tex = Request("CalamityMod/Projectiles/Melee/MendedBiomeBlade_DecaysRetort").Value; float drawAngle = direction.ToRotation(); float drawRotation = drawAngle + MathHelper.PiOver4; @@ -183,25 +183,25 @@ namespace CalamityMod.Projectiles.Melee Vector2 drawOrigin = new Vector2(0f, handle.Height); Vector2 drawOffset = Owner.Center + direction * 10f - Main.screenPosition; - Main.EntitySpriteDraw(handle, drawOffset + displace, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); + Main.EntitySpriteDraw(handle, drawOffset + displace, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0); //Turn on additive blending Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); //Update the parameters drawOrigin = new Vector2(0f, tex.Height); - Main.EntitySpriteDraw(tex, drawOffset + displace, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); + Main.EntitySpriteDraw(tex, drawOffset + displace, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f, drawRotation, drawOrigin, Projectile.scale, 0f, 0); if (dashTimer > 0f && dashTimer < maxDash) { float thrustRatio = (float)Math.Sin(dashTimer / maxDash * MathHelper.Pi); - Main.EntitySpriteDraw(tex, drawOffset + displace, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f, drawRotation, drawOrigin, Projectile.scale * (1 + thrustRatio * 0.2f), 0f, 0f); + Main.EntitySpriteDraw(tex, drawOffset + displace, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f, drawRotation, drawOrigin, Projectile.scale * (1 + thrustRatio * 0.2f), 0f, 0); } //Back to normal Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); return false; } diff --git a/Projectiles/Melee/MendedBiomeBlade_TruePurityProjection.cs b/Projectiles/Melee/MendedBiomeBlade_TruePurityProjection.cs index 14da93b5f2..308886a4b6 100644 --- a/Projectiles/Melee/MendedBiomeBlade_TruePurityProjection.cs +++ b/Projectiles/Melee/MendedBiomeBlade_TruePurityProjection.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Melee { Projectile.width = Projectile.height = 32; Projectile.aiStyle = 27; - aiType = ProjectileID.LightBeam; + AIType = ProjectileID.LightBeam; Projectile.friendly = true; Projectile.penetrate = 1; Projectile.timeLeft = TrueBiomeBlade.DefaultAttunement_BeamTime; diff --git a/Projectiles/Melee/MicrowaveAura.cs b/Projectiles/Melee/MicrowaveAura.cs index 4cc4a325a3..8bfdd3e7c2 100644 --- a/Projectiles/Melee/MicrowaveAura.cs +++ b/Projectiles/Melee/MicrowaveAura.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Projectiles.Melee.Yoyos; using Microsoft.Xna.Framework; using Terraria; @@ -50,20 +50,20 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { target.AddBuff(ModContent.BuffType(), 180); - if (target.life <= 0 && (FindParent().modProjectile as MicrowaveYoyo).soundCooldown <= 0) + if (target.life <= 0 && (FindParent().ModProjectile as MicrowaveYoyo).soundCooldown <= 0) { - SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/MicrowaveBeep"), (int)Projectile.Center.X, (int)Projectile.Center.Y); - (FindParent().modProjectile as MicrowaveYoyo).soundCooldown = 60; + SoundEngine.PlaySound(SoundLoader.GetLegacySoundSlot(Mod, "Sounds/Custom/MicrowaveBeep"), (int)Projectile.Center.X, (int)Projectile.Center.Y); + (FindParent().ModProjectile as MicrowaveYoyo).soundCooldown = 60; } } public override void OnHitPvp(Player target, int damage, bool crit) { target.AddBuff(ModContent.BuffType(), 180); - if (target.statLife <= 0 && (FindParent().modProjectile as MicrowaveYoyo).soundCooldown <= 0) + if (target.statLife <= 0 && (FindParent().ModProjectile as MicrowaveYoyo).soundCooldown <= 0) { - SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/MicrowaveBeep"), (int)Projectile.Center.X, (int)Projectile.Center.Y); - (FindParent().modProjectile as MicrowaveYoyo).soundCooldown = 60; + SoundEngine.PlaySound(SoundLoader.GetLegacySoundSlot(Mod, "Sounds/Custom/MicrowaveBeep"), (int)Projectile.Center.X, (int)Projectile.Center.Y); + (FindParent().ModProjectile as MicrowaveYoyo).soundCooldown = 60; } } diff --git a/Projectiles/Melee/MourningSkull.cs b/Projectiles/Melee/MourningSkull.cs index eae34425f8..de99842161 100644 --- a/Projectiles/Melee/MourningSkull.cs +++ b/Projectiles/Melee/MourningSkull.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using Terraria; @@ -162,8 +162,8 @@ namespace CalamityMod.Projectiles.Melee for (int k = 0; k < 2; k++) { Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 174, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); - Projectile.NewProjectile(Projectile.position.X, Projectile.position.Y, (float)Main.rand.Next(-35, 36) * 0.2f, (float)Main.rand.Next(-35, 36) * 0.2f, ModContent.ProjectileType(), - (int)((double)Projectile.damage * 0.35), Projectile.knockBack * 0.35f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.position.X, Projectile.position.Y, Main.rand.Next(-35, 36) * 0.2f, Main.rand.Next(-35, 36) * 0.2f, ModContent.ProjectileType(), + (int)(Projectile.damage * 0.35), Projectile.knockBack * 0.35f, Main.myPlayer, 0f, 0f); } } } diff --git a/Projectiles/Melee/MourningstarFlail.cs b/Projectiles/Melee/MourningstarFlail.cs index 437e9bfa99..353309cf69 100644 --- a/Projectiles/Melee/MourningstarFlail.cs +++ b/Projectiles/Melee/MourningstarFlail.cs @@ -1,6 +1,7 @@ -using CalamityMod.Projectiles.BaseProjectiles; +using CalamityMod.Projectiles.BaseProjectiles; using Terraria; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { @@ -33,7 +34,7 @@ namespace CalamityMod.Projectiles.Melee // If it is to be rebalanced, consider replacing it with the FuckYou projectile (which does not mess with I-frames) if (Projectile.localAI[1] <= 0f && Projectile.owner == Main.myPlayer) { - int proj = Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ProjectileID.SolarWhipSwordExplosion, Projectile.damage, knockback, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + int proj = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), target.Center.X, target.Center.Y, 0f, 0f, ProjectileID.SolarWhipSwordExplosion, Projectile.damage, knockback, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); Main.projectile[proj].usesLocalNPCImmunity = true; Main.projectile[proj].localNPCHitCooldown = 4; } diff --git a/Projectiles/Melee/MurasamaSlash.cs b/Projectiles/Melee/MurasamaSlash.cs index 0cc930252b..e11932b495 100644 --- a/Projectiles/Melee/MurasamaSlash.cs +++ b/Projectiles/Melee/MurasamaSlash.cs @@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 origin = texture.Size() / new Vector2(2f, 7f) * 0.5f; Rectangle frame = texture.Frame(2, 7, frameX, frameY); SpriteEffects spriteEffects = Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, frame, Color.White, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, frame, Color.White, Projectile.rotation, origin, Projectile.scale, spriteEffects, 0); return false; } @@ -141,6 +141,6 @@ namespace CalamityMod.Projectiles.Melee public override Color? GetAlpha(Color lightColor) => new Color(200, 0, 0, 0); - //public override bool CanDamage() => Slashing; + //public override bool? CanDamage() => Slashing; } } diff --git a/Projectiles/Melee/NebulashFlail.cs b/Projectiles/Melee/NebulashFlail.cs index d534aa0693..08acd43d4a 100644 --- a/Projectiles/Melee/NebulashFlail.cs +++ b/Projectiles/Melee/NebulashFlail.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 3; } - public override Color SpecialDrawColor => new Color(255, 200, 0); + public override Color SpecialDrawColor => new(255, 200, 0); public override int ExudeDustType => ModContent.DustType(); public override int WhipDustType => ModContent.DustType(); public override int HandleHeight => 60; @@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Melee target.AddBuff(ModContent.BuffType(), 240); if (Projectile.localAI[1] <= 0f && Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), Projectile.damage / 2, knockback, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), Projectile.damage / 2, knockback, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); } Projectile.localAI[1] = 4f; } diff --git a/Projectiles/Melee/NeptuneOrb.cs b/Projectiles/Melee/NeptuneOrb.cs index 2cdfac3009..fc30fe7055 100644 --- a/Projectiles/Melee/NeptuneOrb.cs +++ b/Projectiles/Melee/NeptuneOrb.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.timeLeft % 20 == 19 && Projectile.owner == Main.myPlayer) { int splitDamage = Projectile.damage / 2; - Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, 0f, 15f, ModContent.ProjectileType(), splitDamage, Projectile.knockBack, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, 0f, 15f, ModContent.ProjectileType(), splitDamage, Projectile.knockBack, Projectile.owner, 0f, 0f); } int num458 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 33, 0f, 0f, 100, default, 0.4f); Main.dust[num458].noGravity = true; diff --git a/Projectiles/Melee/Oathblade.cs b/Projectiles/Melee/Oathblade.cs index f3a5e4505d..afe3725f3e 100644 --- a/Projectiles/Melee/Oathblade.cs +++ b/Projectiles/Melee/Oathblade.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.DamageType = DamageClass.Melee; Projectile.tileCollide = true; Projectile.penetrate = 1; - aiType = ProjectileID.DemonScythe; + AIType = ProjectileID.DemonScythe; } public override void AI() diff --git a/Projectiles/Melee/OceanBeam.cs b/Projectiles/Melee/OceanBeam.cs index e6097018a9..da090603a2 100644 --- a/Projectiles/Melee/OceanBeam.cs +++ b/Projectiles/Melee/OceanBeam.cs @@ -1,4 +1,4 @@ -using System; +using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.frame = 0; } - Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X); + Projectile.rotation = Projectile.velocity.ToRotation(); Projectile.ai[1] += 1f; if (Projectile.ai[1] >= 60f) diff --git a/Projectiles/Melee/OldLordOathswordProj.cs b/Projectiles/Melee/OldLordOathswordProj.cs index d7d67349d0..85088d07ed 100644 --- a/Projectiles/Melee/OldLordOathswordProj.cs +++ b/Projectiles/Melee/OldLordOathswordProj.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Items.Weapons.Melee; using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Melee public ref float ChargeTime => ref Projectile.ai[0]; public ref float GeneralTime => ref Projectile.ai[1]; public ref float PostSwingRepositionDelay => ref Projectile.localAI[0]; - public ref bool RMBChannel => ref (Owner.HeldItem.modItem as OldLordOathsword).RMBchannel; + public ref bool RMBChannel => ref (Owner.HeldItem.ModItem as OldLordOathsword).RMBchannel; public bool LMBUse => Owner.altFunctionUse != 2 && !RMBChannel && Owner.itemAnimation > 0; public ref float ChargePower => ref Projectile.localAI[1]; @@ -35,7 +35,7 @@ namespace CalamityMod.Projectiles.Melee public override string Texture => "CalamityMod/Items/Weapons/Melee/OldLordOathsword"; public override int AssociatedItemID => ModContent.ItemType(); public override int IntendedProjectileType => ModContent.ProjectileType(); - public override bool CanDamage() => CurrentState != 0; //Could also disable the damage during the channel state, + public override bool? CanDamage() => CurrentState != 0; //Could also disable the damage during the channel state, public override void SetStaticDefaults() { @@ -100,7 +100,7 @@ namespace CalamityMod.Projectiles.Melee Direction = Owner.direction; float swingCompletion = Owner.itemAnimation / (float)Owner.itemAnimationMax; - float swingSpeedInterpolant = Utils.InverseLerp(1f, 0.8f, swingCompletion, true) * Utils.InverseLerp(-0.11f, 0.12f, swingCompletion, true); + float swingSpeedInterpolant = Utils.GetLerpValue(1f, 0.8f, swingCompletion, true) * Utils.GetLerpValue(-0.11f, 0.12f, swingCompletion, true); float swingInterpolant = (float)Math.Sin(Math.Pow(swingCompletion, 1.15) * MathHelper.TwoPi); if (swingInterpolant < 0f) { @@ -144,7 +144,7 @@ namespace CalamityMod.Projectiles.Melee // Release flames. if (Main.myPlayer == Projectile.owner && GeneralTime % 6f == 5f) - Projectile.NewProjectile(Projectile.Center, Main.rand.NextVector2CircularEdge(8f, 8f), ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack * 0.5f, Projectile.owner); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, Main.rand.NextVector2CircularEdge(8f, 8f), ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack * 0.5f, Projectile.owner); if (Main.myPlayer == Projectile.owner) { @@ -183,7 +183,7 @@ namespace CalamityMod.Projectiles.Melee // Raise the blade and do charge effects upwards if channeling. float horizontalBladeOffset = -4f; - float chargeInterpolant = Utils.InverseLerp(0f, 35f, ChargeTime, true); + float chargeInterpolant = Utils.GetLerpValue(0f, 35f, ChargeTime, true); if (CurrentState == SwingState.Channeling) { baseRotation = MathHelper.PiOver2 * -Direction; @@ -215,7 +215,7 @@ namespace CalamityMod.Projectiles.Melee // Decide how far out the blade should go. float bladeOffsetFactor = 0.5f + chargeInterpolant * 0.3f; if (chargeInterpolant <= 0f) - bladeOffsetFactor += Utils.InverseLerp(0.5f, 0.7f, swingCompletion, true) * Utils.InverseLerp(1f, 0.7f, swingCompletion, true) * 0.45f; + bladeOffsetFactor += Utils.GetLerpValue(0.5f, 0.7f, swingCompletion, true) * Utils.GetLerpValue(1f, 0.7f, swingCompletion, true) * 0.45f; // Offset the blade so that the handle is attached to the owner's hand. Vector2 bladeOffset = (Projectile.rotation - MathHelper.PiOver4).ToRotationVector2() * Projectile.width * bladeOffsetFactor; @@ -305,7 +305,7 @@ namespace CalamityMod.Projectiles.Melee GameShaders.Misc["CalamityMod:BasicTint"].UseOpacity(0.7f - ((Main.GlobalTimeWrappedHourly * 30) % 30f / 60f)); GameShaders.Misc["CalamityMod:BasicTint"].Apply(); - var texture = ModContent.Request("CalamityMod/Items/Weapons/Melee/OldLordOathsword"); + var texture = ModContent.Request("CalamityMod/Items/Weapons/Melee/OldLordOathsword").Value; Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, Projectile.Size / 2f, Projectile.scale, Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); Main.spriteBatch.ExitShaderRegion(); @@ -317,7 +317,7 @@ namespace CalamityMod.Projectiles.Melee { ItemLoader.OnHitNPC(Owner.ActiveItem(), Owner, target, damage, knockback, crit); NPCLoader.OnHitByItem(target, Owner, Owner.ActiveItem(), damage, knockback, crit); - PlayerHooks.OnHitNPC(Owner, Owner.ActiveItem(), target, damage, knockback, crit); + PlayerLoader.OnHitNPC(Owner, Owner.ActiveItem(), target, damage, knockback, crit); } public override void Kill(int timeLeft) => Owner.fullRotation = 0f; diff --git a/Projectiles/Melee/OmnibladeSwing.cs b/Projectiles/Melee/OmnibladeSwing.cs index 89b9fc0cf4..7aefd9fbad 100644 --- a/Projectiles/Melee/OmnibladeSwing.cs +++ b/Projectiles/Melee/OmnibladeSwing.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; @@ -94,6 +94,6 @@ namespace CalamityMod.Projectiles.Melee public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, 170); // Don't suffer from the same issues Murasama did in the past; encouraging people to kill their wrists for some extra DPS is bad lmao - public override bool CanDamage() => Projectile.frameCounter > 6; + public override bool? CanDamage() => Projectile.frameCounter > 6; } } diff --git a/Projectiles/Melee/PhosphorescentGauntletPunches.cs b/Projectiles/Melee/PhosphorescentGauntletPunches.cs index d17e9ec392..8668120e5c 100644 --- a/Projectiles/Melee/PhosphorescentGauntletPunches.cs +++ b/Projectiles/Melee/PhosphorescentGauntletPunches.cs @@ -157,7 +157,7 @@ namespace CalamityMod.Projectiles.Melee // Manual drawing is used to correct the origin of the projectile when drawn. public override bool PreDraw(ref Color lightColor) { - Texture2D punchTexture = ModContent.Request(Texture); + Texture2D punchTexture = ModContent.Request(Texture).Value; Rectangle frame = punchTexture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); Vector2 origin = frame.Size() * 0.5f; SpriteEffects directionEffect = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; diff --git a/Projectiles/Melee/PhotonRipperProjectile.cs b/Projectiles/Melee/PhotonRipperProjectile.cs index 8d21ba1578..57849522fc 100644 --- a/Projectiles/Melee/PhotonRipperProjectile.cs +++ b/Projectiles/Melee/PhotonRipperProjectile.cs @@ -43,14 +43,14 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { Texture2D texture = ModContent.Request(Texture).Value; - Texture2D glowmaskTexture = ModContent.Request("CalamityMod/Projectiles/Melee/PhotonRipperGlowmask"); + Texture2D glowmaskTexture = ModContent.Request("CalamityMod/Projectiles/Melee/PhotonRipperGlowmask").Value; Rectangle glowmaskRectangle = glowmaskTexture.Frame(1, 6, 0, Projectile.frame); Vector2 origin = texture.Size() * 0.5f; Vector2 drawPosition = Projectile.Center - Main.screenPosition; SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - Main.EntitySpriteDraw(texture, drawPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, direction, 0f); - Main.EntitySpriteDraw(glowmaskTexture, drawPosition, glowmaskRectangle, Color.White, Projectile.rotation, origin, Projectile.scale, direction, 0f); + Main.EntitySpriteDraw(texture, drawPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, direction, 0); + Main.EntitySpriteDraw(glowmaskTexture, drawPosition, glowmaskRectangle, Color.White, Projectile.rotation, origin, Projectile.scale, direction, 0); return false; } @@ -161,7 +161,7 @@ namespace CalamityMod.Projectiles.Melee // Increase the turn speed if close to the ideal direction, since successive linear interpolations // are asymptotic. - angularAimVelocity += MathHelper.Lerp(0f, 0.25f, Utils.InverseLerp(0.28f, 0.08f, directionAngularDisparity, true)); + angularAimVelocity += MathHelper.Lerp(0f, 0.25f, Utils.GetLerpValue(0.28f, 0.08f, directionAngularDisparity, true)); if (directionAngularDisparity > 0.02f) Projectile.velocity = Vector2.Lerp(Projectile.velocity, idealAimDirection, angularAimVelocity); @@ -223,7 +223,7 @@ namespace CalamityMod.Projectiles.Melee if (distanceFromMouse < shootReach && distanceFromMouse > 40f) shootReach = distanceFromMouse + 32f; - Projectile.NewProjectile(Owner.Center, Projectile.velocity, ModContent.ProjectileType(), (int)ToothDamage, 0f, Projectile.owner, shootReach, Projectile.whoAmI); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Owner.Center, Projectile.velocity, ModContent.ProjectileType(), (int)ToothDamage, 0f, Projectile.owner, shootReach, Projectile.whoAmI); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) diff --git a/Projectiles/Melee/PlagueBeeDust.cs b/Projectiles/Melee/PlagueBeeDust.cs index 05913dd814..80749b6016 100644 --- a/Projectiles/Melee/PlagueBeeDust.cs +++ b/Projectiles/Melee/PlagueBeeDust.cs @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Melee { int spawnX = (int)(Projectile.width / 2); int spawnY = (int)(Projectile.width / 2); - int bee = Projectile.NewProjectile(Projectile.Center.X + (float)Main.rand.Next(-spawnX, spawnX), Projectile.Center.Y + (float)Main.rand.Next(-spawnY, spawnY), Projectile.velocity.X, Projectile.velocity.Y, player.beeType(), player.beeDamage(Projectile.damage / 3), player.beeKB(0f), Projectile.owner); + int bee = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X + (float)Main.rand.Next(-spawnX, spawnX), Projectile.Center.Y + (float)Main.rand.Next(-spawnY, spawnY), Projectile.velocity.X, Projectile.velocity.Y, player.beeType(), player.beeDamage(Projectile.damage / 3), player.beeKB(0f), Projectile.owner); if (bee.WithinBounds(Main.maxProjectiles)) { Main.projectile[bee].Calamity().forceMelee = true; diff --git a/Projectiles/Melee/PlagueDust.cs b/Projectiles/Melee/PlagueDust.cs index 340b36be47..517a50794a 100644 --- a/Projectiles/Melee/PlagueDust.cs +++ b/Projectiles/Melee/PlagueDust.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -105,6 +105,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { + // TODO -- Why are there so many incorrectly programmed i-frame sets target.immune[Projectile.owner] = 5; target.AddBuff(ModContent.BuffType(), 120); } diff --git a/Projectiles/Melee/PrismTooth.cs b/Projectiles/Melee/PrismTooth.cs index a2c7d5b5bb..fcf11c5439 100644 --- a/Projectiles/Melee/PrismTooth.cs +++ b/Projectiles/Melee/PrismTooth.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using Terraria; @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Melee positionOffset = positionOffset.RotatedBy(Projectile.velocity.ToRotation() - MathHelper.PiOver2); Projectile.Center = Owner.RotatedRelativePoint(Owner.MountedCenter) + Projectile.velocity * 42f + positionOffset; - Projectile.Opacity = Utils.InverseLerp(0f, 12f, Time, true) * Utils.InverseLerp(Lifetime, Lifetime - 12f, Lifetime - Projectile.timeLeft, true); + Projectile.Opacity = Utils.GetLerpValue(0f, 12f, Time, true) * Utils.GetLerpValue(Lifetime, Lifetime - 12f, Lifetime - Projectile.timeLeft, true); // Destroy trees within the range of the past 20 oldPos positions. for (int i = 0; i < 20; i++) @@ -83,7 +83,7 @@ namespace CalamityMod.Projectiles.Melee Tile tileAtPosition = CalamityUtils.ParanoidTileRetrieval(x, y); // Ignore tiles that are not active and are not breakable by axes. - if (!tileAtPosition.active() || !Main.tileAxe[tileAtPosition.TileType]) + if (!tileAtPosition.HasTile || !Main.tileAxe[tileAtPosition.TileType]) return; // Don't attempt to mine the tile if for whatever reason it's not supposed to be broken. @@ -101,7 +101,7 @@ namespace CalamityMod.Projectiles.Melee public override Color? GetAlpha(Color lightColor) => Color.White; - internal float WidthFunction(float completionRatio) => Projectile.scale * 24f * (1f - Utils.InverseLerp(0.7f, 1f, completionRatio, true)) + 1f; + internal float WidthFunction(float completionRatio) => Projectile.scale * 24f * (1f - Utils.GetLerpValue(0.7f, 1f, completionRatio, true)) + 1f; internal Color ColorFunction(float completionRatio) { @@ -132,7 +132,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.oldPos[1] = oldPosition; Main.spriteBatch.EnterShaderRegion(); - GameShaders.Misc["CalamityMod:PrismaticStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/ScarletDevilStreak")); + GameShaders.Misc["CalamityMod:PrismaticStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/ScarletDevilStreak").Value); TrailDrawer.Draw(Projectile.oldPos, Projectile.Size * 0.5f + generalOffset - Main.screenPosition, 65); Main.spriteBatch.ExitShaderRegion(); diff --git a/Projectiles/Melee/PrismaticBeam.cs b/Projectiles/Melee/PrismaticBeam.cs index 3c9a825f3b..a29f23c848 100644 --- a/Projectiles/Melee/PrismaticBeam.cs +++ b/Projectiles/Melee/PrismaticBeam.cs @@ -49,9 +49,9 @@ namespace CalamityMod.Projectiles.Melee public override float Lifetime => 300f; public override float MaxScale => 1.5f; public override float MaxLaserLength => 2200f; - public override Texture2D LaserBeginTexture => ModContent.Request("CalamityMod/ExtraTextures/Lasers/UltimaRayStart"); - public override Texture2D LaserMiddleTexture => ModContent.Request("CalamityMod/ExtraTextures/Lasers/UltimaRayMid"); - public override Texture2D LaserEndTexture => ModContent.Request("CalamityMod/ExtraTextures/Lasers/UltimaRayEnd"); + public override Texture2D LaserBeginTexture => ModContent.Request("CalamityMod/ExtraTextures/Lasers/UltimaRayStart").Value; + public override Texture2D LaserMiddleTexture => ModContent.Request("CalamityMod/ExtraTextures/Lasers/UltimaRayMid").Value; + public override Texture2D LaserEndTexture => ModContent.Request("CalamityMod/ExtraTextures/Lasers/UltimaRayEnd").Value; public override void SetStaticDefaults() { @@ -78,7 +78,7 @@ namespace CalamityMod.Projectiles.Melee public override void DetermineScale() { - Projectile.scale = Time < ChargeupTime ? 0f : Utils.InverseLerp(0f, 40f, Projectile.timeLeft, true) * MaxScale; + Projectile.scale = Time < ChargeupTime ? 0f : Utils.GetLerpValue(0f, 40f, Projectile.timeLeft, true) * MaxScale; } public override float DetermineLaserLength() diff --git a/Projectiles/Melee/ProfanedSwordProj.cs b/Projectiles/Melee/ProfanedSwordProj.cs index 9367fd19b2..1fff6735f7 100644 --- a/Projectiles/Melee/ProfanedSwordProj.cs +++ b/Projectiles/Melee/ProfanedSwordProj.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.penetrate = -1; Projectile.aiStyle = 113; Projectile.timeLeft = 600; - aiType = ProjectileID.BoneJavelin; + AIType = ProjectileID.BoneJavelin; Projectile.DamageType = DamageClass.Melee; } @@ -69,7 +69,7 @@ namespace CalamityMod.Projectiles.Melee { if (explosionCount < 3) { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), knockback, Projectile.owner); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), knockback, Projectile.owner); explosionCount++; } } diff --git a/Projectiles/Melee/PwnagehammerProj.cs b/Projectiles/Melee/PwnagehammerProj.cs index 8c5a5e1207..b715745151 100644 --- a/Projectiles/Melee/PwnagehammerProj.cs +++ b/Projectiles/Melee/PwnagehammerProj.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Audio; using Microsoft.Xna.Framework.Graphics; using System; @@ -150,7 +150,7 @@ namespace CalamityMod.Projectiles.Melee player.addDPS((int)damage); } } - SoundEffectInstance sound1 = SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PwnagehammerHoming"), Projectile.Center); + SoundEffectInstance sound1 = SoundEngine.PlaySound(SoundLoader.GetLegacySoundSlot(Mod, "Sounds/Item/PwnagehammerHoming"), Projectile.Center); if (sound1 != null) sound1.Volume = 0.3f; SoundEffectInstance sound2 = SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); @@ -187,7 +187,7 @@ namespace CalamityMod.Projectiles.Melee player.addDPS((int)damage); } } - SoundEffectInstance sound1 = SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/PwnagehammerSound"), Projectile.Center); + SoundEffectInstance sound1 = SoundEngine.PlaySound(SoundLoader.GetLegacySoundSlot(Mod, "Sounds/Item/PwnagehammerSound"), Projectile.Center); if (sound1 != null) { sound1.Volume = 0.16f; @@ -204,7 +204,7 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.ai[0] == 1f && Main.myPlayer == Projectile.owner) { crit = true; - int hammer = Projectile.NewProjectile(Projectile.Center, new Vector2(0, -15f), ModContent.ProjectileType(), Projectile.damage * 2, Projectile.knockBack, Projectile.owner, 0f, Projectile.ai[1]); + int hammer = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, new Vector2(0, -15f), ModContent.ProjectileType(), Projectile.damage * 2, Projectile.knockBack, Projectile.owner, 0f, Projectile.ai[1]); Main.projectile[hammer].localAI[0] = Math.Sign(Projectile.velocity.X); Main.projectile[hammer].netUpdate = true; } @@ -214,7 +214,7 @@ namespace CalamityMod.Projectiles.Melee { if (Projectile.ai[0] == 1f && Main.myPlayer == Projectile.owner) { - int hammer = Projectile.NewProjectile(Projectile.Center, new Vector2(0, -15f), ModContent.ProjectileType(), Projectile.damage * 2, Projectile.knockBack, Projectile.owner, 0f, Projectile.ai[1]); + int hammer = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, new Vector2(0, -15f), ModContent.ProjectileType(), Projectile.damage * 2, Projectile.knockBack, Projectile.owner, 0f, Projectile.ai[1]); Main.projectile[hammer].localAI[0] = Math.Sign(Projectile.velocity.X); Main.projectile[hammer].netUpdate = true; } diff --git a/Projectiles/Melee/RSSolarFlare.cs b/Projectiles/Melee/RSSolarFlare.cs index ce38a3e3db..b2b04400c6 100644 --- a/Projectiles/Melee/RSSolarFlare.cs +++ b/Projectiles/Melee/RSSolarFlare.cs @@ -90,8 +90,8 @@ namespace CalamityMod.Projectiles.Melee for (i = 0; i < 1; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); - Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); } } SoundEngine.PlaySound(SoundID.Item14, Projectile.position); diff --git a/Projectiles/Melee/RemsRevengeProj.cs b/Projectiles/Melee/RemsRevengeProj.cs index c770d82c08..edff568fbc 100644 --- a/Projectiles/Melee/RemsRevengeProj.cs +++ b/Projectiles/Melee/RemsRevengeProj.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -99,8 +99,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { Vector2 mountedCenter = Main.player[Projectile.owner].MountedCenter; - Color transparent = Microsoft.Xna.Framework.Color.Transparent; - Texture2D chainTexture = ModContent.Request("CalamityMod/ExtraTextures/Chains/RemsRevengeChain"); + Texture2D chainTexture = ModContent.Request("CalamityMod/ExtraTextures/Chains/RemsRevengeChain").Value; Vector2 projCenter = Projectile.Center; Rectangle? sourceRectangle = null; Vector2 origin = new Vector2((float)chainTexture.Width * 0.5f, (float)chainTexture.Height * 0.5f); @@ -142,7 +141,7 @@ namespace CalamityMod.Projectiles.Melee target.AddBuff(ModContent.BuffType(), 240); hitCounter++; if (hitCounter < 6) - Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Projectile.owner); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Projectile.owner); if (hitCounter > 3) { Projectile.ai[0] = 1f; diff --git a/Projectiles/Melee/RendingNeedle.cs b/Projectiles/Melee/RendingNeedle.cs index 625deeff17..8178a34012 100644 --- a/Projectiles/Melee/RendingNeedle.cs +++ b/Projectiles/Melee/RendingNeedle.cs @@ -73,7 +73,7 @@ namespace CalamityMod.Projectiles.Melee internal Color ColorFunction(float completionRatio) { float fadeToEnd = MathHelper.Lerp(0.65f, 1f, (float)Math.Cos(-Main.GlobalTimeWrappedHourly * 3f) * 0.5f + 0.5f); - float fadeOpacity = Utils.InverseLerp(1f, 0.64f, completionRatio, true) * Projectile.Opacity; + float fadeOpacity = Utils.GetLerpValue(1f, 0.64f, completionRatio, true) * Projectile.Opacity; Color endColor = Color.Lerp(Color.Cyan, Color.Crimson, (float)Math.Sin(completionRatio * MathHelper.Pi * 1.6f - Main.GlobalTimeWrappedHourly * 4f) * 0.5f + 0.5f); return Color.Lerp(Color.White, endColor, fadeToEnd) * fadeOpacity; @@ -91,21 +91,21 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.timeLeft > 35) return false; - Texture2D texture = GetTexture("CalamityMod/Projectiles/Melee/RendingNeedle"); + Texture2D texture = Request("CalamityMod/Projectiles/Melee/RendingNeedle").Value; if (TrailDrawer is null) TrailDrawer = new PrimitiveTrail(WidthFunction, ColorFunction, specialShader: GameShaders.Misc["CalamityMod:TrailStreak"]); - GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/ScarletDevilStreak")); + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(Request("CalamityMod/ExtraTextures/ScarletDevilStreak").Value); TrailDrawer.Draw(Projectile.oldPos, Projectile.Size * 0.5f - Utils.SafeNormalize(Projectile.velocity, Vector2.Zero) * 30.5f - Main.screenPosition, 30); Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, null, Color.Lerp(lightColor, Color.White, 0.5f), Projectile.rotation, texture.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - Texture2D starTexture = GetTexture("CalamityMod/Particles/Sparkle"); - Texture2D bloomTexture = GetTexture("CalamityMod/Particles/BloomCircle"); + Texture2D starTexture = Request("CalamityMod/Particles/Sparkle").Value; + Texture2D bloomTexture = Request("CalamityMod/Particles/BloomCircle").Value; //Ajust the bloom's texture to be the same size as the star's float properBloomSize = (float)starTexture.Height / (float)bloomTexture.Height; @@ -119,7 +119,7 @@ namespace CalamityMod.Projectiles.Melee Main.EntitySpriteDraw(starTexture, sparkCenter, null, Color.White, rotation, starTexture.Size() / 2f, 2, SpriteEffects.None, 0); Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); return false; diff --git a/Projectiles/Melee/Rox1.cs b/Projectiles/Melee/Rox1.cs index d1a3cbf775..38a8d9fc01 100644 --- a/Projectiles/Melee/Rox1.cs +++ b/Projectiles/Melee/Rox1.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; @@ -41,13 +41,13 @@ namespace CalamityMod.Projectiles.Melee //Changes the texture of the projectile if (Projectile.ai[0] == 1f) { - Texture2D texture = ModContent.Request("CalamityMod/Projectiles/Melee/Rox2"); + Texture2D texture = ModContent.Request("CalamityMod/Projectiles/Melee/Rox2").Value; Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, texture.Width, 20)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, 20 / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } if (Projectile.ai[0] == 2f) { - Texture2D texture = ModContent.Request("CalamityMod/Projectiles/Melee/Rox3"); + Texture2D texture = ModContent.Request("CalamityMod/Projectiles/Melee/Rox3").Value; Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, texture.Width, 20)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, 20 / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Melee/RoxSlam.cs b/Projectiles/Melee/RoxSlam.cs index 05f4a0e938..dd934e3919 100644 --- a/Projectiles/Melee/RoxSlam.cs +++ b/Projectiles/Melee/RoxSlam.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Melee //reset player fall damage player.fallStart = (int)(player.position.Y / 16f); //Spawns the shockwave - Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), 300, 12, Projectile.owner); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), 300, 12, Projectile.owner); SoundEngine.PlaySound(SoundID.Item14, Projectile.position); Projectile.Kill(); //Pretty things diff --git a/Projectiles/Melee/ScourgeoftheCosmosMini.cs b/Projectiles/Melee/ScourgeoftheCosmosMini.cs index faf4cefca2..38ea479122 100644 --- a/Projectiles/Melee/ScourgeoftheCosmosMini.cs +++ b/Projectiles/Melee/ScourgeoftheCosmosMini.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using Terraria; @@ -152,7 +152,7 @@ namespace CalamityMod.Projectiles.Melee int num214 = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; int y6 = num214 * Projectile.frame; Vector2 origin = new Vector2(9f, 10f); - Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Projectiles/Melee/ScourgeoftheCosmosMiniGlow"), Projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Color.White, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Projectiles/Melee/ScourgeoftheCosmosMiniGlow").Value, Projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Color.White, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); } } } diff --git a/Projectiles/Melee/ScourgeoftheCosmosProj.cs b/Projectiles/Melee/ScourgeoftheCosmosProj.cs index d406e69e6f..ab9a5e71b1 100644 --- a/Projectiles/Melee/ScourgeoftheCosmosProj.cs +++ b/Projectiles/Melee/ScourgeoftheCosmosProj.cs @@ -93,7 +93,7 @@ namespace CalamityMod.Projectiles.Melee float num629 = Main.rand.Next(-35, 36) * 0.02f; num628 *= 10f; num629 *= 10f; - Projectile.NewProjectile(Projectile.position.X, Projectile.position.Y, num628, num629, ModContent.ProjectileType(), (int)(Projectile.damage * 0.7), Projectile.knockBack * 0.35f, Main.myPlayer); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.position.X, Projectile.position.Y, num628, num629, ModContent.ProjectileType(), (int)(Projectile.damage * 0.7), Projectile.knockBack * 0.35f, Main.myPlayer); num3 = num627; } } @@ -136,7 +136,7 @@ namespace CalamityMod.Projectiles.Melee float num629 = Main.rand.Next(-35, 36) * 0.02f; num628 *= 10f; num629 *= 10f; - Projectile.NewProjectile(Projectile.position.X, Projectile.position.Y, num628, num629, ModContent.ProjectileType(), (int)(Projectile.damage * 0.7), Projectile.knockBack * 0.35f, Main.myPlayer); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.position.X, Projectile.position.Y, num628, num629, ModContent.ProjectileType(), (int)(Projectile.damage * 0.7), Projectile.knockBack * 0.35f, Main.myPlayer); num3 = num627; } } diff --git a/Projectiles/Melee/ShortBeam.cs b/Projectiles/Melee/ShortBeam.cs index 37e28269a1..2b9ea44d31 100644 --- a/Projectiles/Melee/ShortBeam.cs +++ b/Projectiles/Melee/ShortBeam.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.DamageType = DamageClass.Melee; Projectile.penetrate = 3; Projectile.timeLeft = 60; - aiType = ProjectileID.LightBeam; + AIType = ProjectileID.LightBeam; } public override void AI() @@ -53,6 +53,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { + // TODO -- Use proper i-frame variables. target.immune[Projectile.owner] = 7; } } diff --git a/Projectiles/Melee/ShortNightBeam.cs b/Projectiles/Melee/ShortNightBeam.cs index 457964b117..abc43f1cd4 100644 --- a/Projectiles/Melee/ShortNightBeam.cs +++ b/Projectiles/Melee/ShortNightBeam.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.DamageType = DamageClass.Melee; Projectile.penetrate = 3; Projectile.timeLeft = 60; - aiType = ProjectileID.TerraBeam; + AIType = ProjectileID.TerraBeam; } public override void AI() @@ -53,6 +53,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { + // TODO -- Use proper i-frame variables. target.immune[Projectile.owner] = 7; } } diff --git a/Projectiles/Melee/ShortTerraBeam.cs b/Projectiles/Melee/ShortTerraBeam.cs index 6c4649202f..1d05007b06 100644 --- a/Projectiles/Melee/ShortTerraBeam.cs +++ b/Projectiles/Melee/ShortTerraBeam.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.DamageType = DamageClass.Melee; Projectile.penetrate = 4; Projectile.timeLeft = 120; - aiType = ProjectileID.TerraBeam; + AIType = ProjectileID.TerraBeam; } public override void AI() @@ -47,6 +47,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { + // TODO -- Use proper i-frame variables. target.immune[Projectile.owner] = 7; } diff --git a/Projectiles/Melee/SolarNeedle.cs b/Projectiles/Melee/SolarNeedle.cs index 640c2baaa6..56f273c3c0 100644 --- a/Projectiles/Melee/SolarNeedle.cs +++ b/Projectiles/Melee/SolarNeedle.cs @@ -77,11 +77,11 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.timeLeft > 35) return false; - Texture2D texture = GetTexture("CalamityMod/Projectiles/Melee/SolarNeedle"); + Texture2D texture = Request("CalamityMod/Projectiles/Melee/SolarNeedle").Value; if (Empowered == 1f) { - CalamityUtils.EnterShaderRegion(spriteBatch); + Main.spriteBatch.EnterShaderRegion(); Color outlineColor = Color.Lerp(Color.White, Color.OrangeRed, Timer / MaxTime); Vector3 outlineHSL = Main.rgbToHsl(outlineColor); //BasicTint uses the opposite hue i guess? or smth is fucked with the way shaders get their colors. anyways, we invert it float outlineThickness = MathHelper.Clamp(Timer / MaxTime * 4f, 0f, 3f); @@ -92,19 +92,19 @@ namespace CalamityMod.Projectiles.Melee for (float i = 0; i < 1; i += 0.125f) { - Main.EntitySpriteDraw(texture, Projectile.Center + (i * MathHelper.TwoPi + Projectile.rotation).ToRotationVector2() * outlineThickness - Main.screenPosition, null, outlineColor, Projectile.rotation, texture.Size() / 2f, Projectile.scale, 0f, 0f); + Main.EntitySpriteDraw(texture, Projectile.Center + (i * MathHelper.TwoPi + Projectile.rotation).ToRotationVector2() * outlineThickness - Main.screenPosition, null, outlineColor, Projectile.rotation, texture.Size() / 2f, Projectile.scale, 0f, 0); } - CalamityUtils.ExitShaderRegion(spriteBatch); + Main.spriteBatch.ExitShaderRegion(); } DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - Texture2D starTexture = GetTexture("CalamityMod/Particles/Sparkle"); - Texture2D bloomTexture = GetTexture("CalamityMod/Particles/BloomCircle"); + Texture2D starTexture = Request("CalamityMod/Particles/Sparkle").Value; + Texture2D bloomTexture = Request("CalamityMod/Particles/BloomCircle").Value; //Ajust the bloom's texture to be the same size as the star's float properBloomSize = (float)starTexture.Height / (float)bloomTexture.Height; @@ -118,7 +118,7 @@ namespace CalamityMod.Projectiles.Melee Main.EntitySpriteDraw(starTexture, sparkCenter, null, Color.White, rotation, starTexture.Size() / 2f, 2, SpriteEffects.None, 0); Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); return false; diff --git a/Projectiles/Melee/SoulScythe.cs b/Projectiles/Melee/SoulScythe.cs index 8c14ee5bb6..9820c657ac 100644 --- a/Projectiles/Melee/SoulScythe.cs +++ b/Projectiles/Melee/SoulScythe.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.timeLeft = 420; Projectile.ignoreWater = true; Projectile.tileCollide = false; - aiType = ProjectileID.DeathSickle; + AIType = ProjectileID.DeathSickle; } public override void AI() @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(SoundID.Item14, Projectile.position); if (Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(target.Center.X, target.Center.Y, Projectile.velocity.X * 0f, Projectile.velocity.Y * 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), target.Center.X, target.Center.Y, Projectile.velocity.X * 0f, Projectile.velocity.Y * 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Melee/SpatialSpear.cs b/Projectiles/Melee/SpatialSpear.cs index a5ff593070..17ccc9a40e 100644 --- a/Projectiles/Melee/SpatialSpear.cs +++ b/Projectiles/Melee/SpatialSpear.cs @@ -78,7 +78,7 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < numProj + 1; i++) { Vector2 perturbedSpeed = Projectile.velocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(Projectile.Center, perturbedSpeed, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, perturbedSpeed, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Melee/SpatialSpear2.cs b/Projectiles/Melee/SpatialSpear2.cs index 935c42b9d7..499e427ae6 100644 --- a/Projectiles/Melee/SpatialSpear2.cs +++ b/Projectiles/Melee/SpatialSpear2.cs @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < numProj + 1; i++) { Vector2 perturbedSpeed = Projectile.velocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(Projectile.Center, perturbedSpeed, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, perturbedSpeed, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Melee/SpatialSpear3.cs b/Projectiles/Melee/SpatialSpear3.cs index 3a0f023bdf..75a4273810 100644 --- a/Projectiles/Melee/SpatialSpear3.cs +++ b/Projectiles/Melee/SpatialSpear3.cs @@ -64,7 +64,7 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < numProj + 1; i++) { Vector2 perturbedSpeed = Projectile.velocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(Projectile.Center, perturbedSpeed, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, perturbedSpeed, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Melee/Spears/StreamGougeProj.cs b/Projectiles/Melee/Spears/StreamGougeProj.cs index be56612f53..6c47fde843 100644 --- a/Projectiles/Melee/Spears/StreamGougeProj.cs +++ b/Projectiles/Melee/Spears/StreamGougeProj.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -85,7 +85,7 @@ namespace CalamityMod.Projectiles.Melee.Spears { Vector2 portalSpawnPosition = Main.MouseWorld + Main.rand.NextVector2Unit() * Main.rand.NextFloat(50f, 140f); Vector2 spearVelocity = (Main.MouseWorld - portalSpawnPosition).SafeNormalize(Vector2.UnitY); - Projectile.NewProjectile(Projectile.GetItemSource_FromThis(), portalSpawnPosition, spearVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.GetItemSource_FromThis(), portalSpawnPosition, spearVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } Time++; diff --git a/Projectiles/Melee/SpineOfThanatosProjectile.cs b/Projectiles/Melee/SpineOfThanatosProjectile.cs index 3a580c79b6..f1c744b017 100644 --- a/Projectiles/Melee/SpineOfThanatosProjectile.cs +++ b/Projectiles/Melee/SpineOfThanatosProjectile.cs @@ -64,7 +64,7 @@ namespace CalamityMod.Projectiles.Melee bendOffset *= CurrentBendFactor * CalamityUtils.Convert01To010(i / 12f); // Smoothly zero out the bending effects if the current position is near the owner. - bendOffset *= Utils.InverseLerp(0f, 300f, Owner.Distance(Vector2.Lerp(startingPosition, Projectile.Center, i / 12f) + bendOffset), true); + bendOffset *= Utils.GetLerpValue(0f, 300f, Owner.Distance(Vector2.Lerp(startingPosition, Projectile.Center, i / 12f) + bendOffset), true); initialPoints.Add(Vector2.Lerp(startingPosition, Projectile.Center, i / 12f) + bendOffset); } initialPoints.Add(Projectile.Center); @@ -107,7 +107,7 @@ namespace CalamityMod.Projectiles.Melee if (InitialDirectionRotation == 0f) InitialDirectionRotation = WhipOutwardness.ToRotation() - MathHelper.PiOver2; - float attackCompletionRatio = Utils.InverseLerp(Lifetime, FlyBackTime, Projectile.timeLeft, true); + float attackCompletionRatio = Utils.GetLerpValue(Lifetime, FlyBackTime, Projectile.timeLeft, true); // Normally swing from a "cone" to a collision area that causes both whips to collide. float baseSwingAngle = MathHelper.Lerp(-1.1f, 1.57f, 1f - attackCompletionRatio); @@ -150,7 +150,7 @@ namespace CalamityMod.Projectiles.Melee if (Main.myPlayer != Projectile.owner) return; - Projectile.NewProjectile(WhipEnd, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage * 2, 0f, Projectile.owner); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), WhipEnd, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage * 2, 0f, Projectile.owner); // Fire a bunch of rays rays. int rayDamage = (int)(Projectile.damage * 1.5); @@ -172,7 +172,7 @@ namespace CalamityMod.Projectiles.Melee if (potentialTarget != null && targetAimDisparity < MathHelper.Pi * 0.27f) prismEndPosition = potentialTarget.Center + potentialTarget.velocity * 4f; - int prismRay = Projectile.NewProjectile(prismEndPosition, Vector2.Zero, ModContent.ProjectileType(), rayDamage, Projectile.knockBack * 0.2f, Projectile.owner); + int prismRay = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), prismEndPosition, Vector2.Zero, ModContent.ProjectileType(), rayDamage, Projectile.knockBack * 0.2f, Projectile.owner); if (Main.projectile.IndexInRange(prismRay)) { Main.projectile[prismRay].ModProjectile().RayHue = i / (float)LaserRayCount; @@ -192,8 +192,8 @@ namespace CalamityMod.Projectiles.Melee whipTexturePath = "CalamityMod/Projectiles/Melee/SpineOfThanatosTail"; else whipTexturePath = $"CalamityMod/Projectiles/Melee/SpineOfThanatosBody{i % 2 + 1}"; - Texture2D whipSegmentTexture = ModContent.Request(whipTexturePath); - Texture2D whipSegmentGlowmaskTexture = ModContent.Request($"{whipTexturePath}Glowmask"); + Texture2D whipSegmentTexture = ModContent.Request(whipTexturePath).Value; + Texture2D whipSegmentGlowmaskTexture = ModContent.Request($"{whipTexturePath}Glowmask").Value; Vector2 origin = whipSegmentTexture.Size() * 0.5f; float rotation = (WhipPoints[i + 1] - WhipPoints[i]).ToRotation() + MathHelper.PiOver2; diff --git a/Projectiles/Melee/StarnightBeam.cs b/Projectiles/Melee/StarnightBeam.cs index 7b63c34a7c..12712eb258 100644 --- a/Projectiles/Melee/StarnightBeam.cs +++ b/Projectiles/Melee/StarnightBeam.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.DamageType = DamageClass.Melee; Projectile.penetrate = 3; Projectile.timeLeft = 600; - aiType = ProjectileID.LightBeam; + AIType = ProjectileID.LightBeam; } public override void AI() diff --git a/Projectiles/Melee/StellarContemptHammer.cs b/Projectiles/Melee/StellarContemptHammer.cs index 850d655dd7..afa6022f4f 100644 --- a/Projectiles/Melee/StellarContemptHammer.cs +++ b/Projectiles/Melee/StellarContemptHammer.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -40,9 +40,9 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - drawOffsetX = -11; - drawOriginOffsetY = -10; - drawOriginOffsetX = 0; + DrawOffsetX = -11; + DrawOriginOffsetY = -10; + DrawOriginOffsetX = 0; Lighting.AddLight(Projectile.Center, 0.7f, 0.3f, 0.6f); @@ -209,7 +209,7 @@ namespace CalamityMod.Projectiles.Melee float AI1 = Main.rand.Next(3); if (Projectile.owner == Main.myPlayer) { - int proj = Projectile.NewProjectile(startPoint, velocity, ProjectileID.LunarFlare, flareDamage, flareKB, Main.myPlayer, 0f, AI1); + int proj = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), startPoint, velocity, ProjectileID.LunarFlare, flareDamage, flareKB, Main.myPlayer, 0f, AI1); if (proj.WithinBounds(Main.maxProjectiles)) { CalamityGlobalProjectile cgp = Main.projectile[proj].Calamity(); diff --git a/Projectiles/Melee/StormMark.cs b/Projectiles/Melee/StormMark.cs index 355b8610df..0346cd753a 100644 --- a/Projectiles/Melee/StormMark.cs +++ b/Projectiles/Melee/StormMark.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; @@ -130,7 +130,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.localAI[1] += 1f; if (Projectile.localAI[1] == 60f && Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, 3f, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, 3f, Projectile.owner, 0f, 0f); } if (Projectile.localAI[1] >= 120f) { @@ -141,11 +141,6 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { Color color25 = Lighting.GetColor((int)((double)Projectile.position.X + (double)Projectile.width * 0.5) / 16, (int)(((double)Projectile.position.Y + (double)Projectile.height * 0.5) / 16.0)); - SpriteEffects spriteEffects = SpriteEffects.None; - if (Projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } Vector2 vector38 = Projectile.position + new Vector2((float)Projectile.width, (float)Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; Texture2D texture2D27 = ModContent.Request(Texture).Value; Rectangle rectangle11 = texture2D27.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); diff --git a/Projectiles/Melee/StormRulerProj.cs b/Projectiles/Melee/StormRulerProj.cs index aea65f8c24..76d3c58379 100644 --- a/Projectiles/Melee/StormRulerProj.cs +++ b/Projectiles/Melee/StormRulerProj.cs @@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Melee { if (Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); } } diff --git a/Projectiles/Melee/StreamGougePortal.cs b/Projectiles/Melee/StreamGougePortal.cs index 039e8a5250..2a051c03d3 100644 --- a/Projectiles/Melee/StreamGougePortal.cs +++ b/Projectiles/Melee/StreamGougePortal.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Items.Weapons.Melee; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -40,13 +40,13 @@ namespace CalamityMod.Projectiles.Melee // Play a slice sound when spawning. if (Projectile.localAI[0] == 0f) { - Main.PlayTrackedSound(CalamityUtils.GetTrackableSound("Sounds/Custom/SwiftSlice"), Projectile.Center); + SoundEngine.PlayTrackedSound(CalamityUtils.GetTrackableSound("CalamityMod/Sounds/Custom/SwiftSlice"), Projectile.Center); Projectile.localAI[0] = 1f; } - float spearOutwardness = MathHelper.Lerp(4f, 52f, Utils.InverseLerp(0f, 18f, Time, true)); + float spearOutwardness = MathHelper.Lerp(4f, 52f, Utils.GetLerpValue(0f, 18f, Time, true)); Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * spearOutwardness; - Projectile.Opacity = Utils.InverseLerp(0f, 8f, Time, true) * Utils.InverseLerp(0f, 10f, Projectile.timeLeft, true); + Projectile.Opacity = Utils.GetLerpValue(0f, 8f, Time, true) * Utils.GetLerpValue(0f, 10f, Projectile.timeLeft, true); Projectile.scale = Projectile.Opacity; Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; Time++; @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ModContent.Request("CalamityMod/Items/Weapons/Melee/StreamGouge"); + Texture2D texture = ModContent.Request("CalamityMod/Items/Weapons/Melee/StreamGouge").Value; Vector2 spearDrawPosition = SpearCenter - Main.screenPosition; Vector2 spearOrigin = texture.Size() * 0.5f; Color spearColor = Main.hslToRgb(Projectile.identity % 10f / 40f + 0.67f, 1f, 0.5f); @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < 2; i++) Main.EntitySpriteDraw(texture, spearDrawPosition, null, spearColor * Projectile.Opacity, Projectile.rotation, spearOrigin, Projectile.scale, 0, 0); - Texture2D portalTexture = ModContent.Request("CalamityMod/Projectiles/Melee/StreamGougePortal"); + Texture2D portalTexture = ModContent.Request("CalamityMod/Projectiles/Melee/StreamGougePortal").Value; Vector2 origin = portalTexture.Size() * 0.5f; Color baseColor = Color.White; Vector2 drawPosition = Projectile.Center - Main.screenPosition; diff --git a/Projectiles/Melee/SunlightBlade.cs b/Projectiles/Melee/SunlightBlade.cs index 2c5dd1028f..44c8cdabed 100644 --- a/Projectiles/Melee/SunlightBlade.cs +++ b/Projectiles/Melee/SunlightBlade.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.penetrate = 5; Projectile.timeLeft = 180; Projectile.ignoreWater = true; - aiType = ProjectileID.DeathSickle; + AIType = ProjectileID.DeathSickle; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 3; } diff --git a/Projectiles/Melee/SwordsplosionBlue.cs b/Projectiles/Melee/SwordsplosionBlue.cs index ed0a944cd7..680bcfb9b3 100644 --- a/Projectiles/Melee/SwordsplosionBlue.cs +++ b/Projectiles/Melee/SwordsplosionBlue.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.tileCollide = false; Projectile.penetrate = 3; Projectile.timeLeft = 200; - aiType = ProjectileID.EnchantedBeam; + AIType = ProjectileID.EnchantedBeam; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; } diff --git a/Projectiles/Melee/SwordsplosionGreen.cs b/Projectiles/Melee/SwordsplosionGreen.cs index 999435bf1e..19212d93e1 100644 --- a/Projectiles/Melee/SwordsplosionGreen.cs +++ b/Projectiles/Melee/SwordsplosionGreen.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.DamageType = DamageClass.Melee; Projectile.penetrate = 3; Projectile.timeLeft = 300; - aiType = ProjectileID.EnchantedBeam; + AIType = ProjectileID.EnchantedBeam; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; } diff --git a/Projectiles/Melee/SwordsplosionPurple.cs b/Projectiles/Melee/SwordsplosionPurple.cs index 5810cfc472..ab9934cd09 100644 --- a/Projectiles/Melee/SwordsplosionPurple.cs +++ b/Projectiles/Melee/SwordsplosionPurple.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.DamageType = DamageClass.Melee; Projectile.penetrate = 3; Projectile.timeLeft = 300; - aiType = ProjectileID.EnchantedBeam; + AIType = ProjectileID.EnchantedBeam; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; } diff --git a/Projectiles/Melee/SwordsplosionRed.cs b/Projectiles/Melee/SwordsplosionRed.cs index ee360551ea..1afc80aed8 100644 --- a/Projectiles/Melee/SwordsplosionRed.cs +++ b/Projectiles/Melee/SwordsplosionRed.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.tileCollide = false; Projectile.penetrate = 3; Projectile.timeLeft = 200; - aiType = ProjectileID.EnchantedBeam; + AIType = ProjectileID.EnchantedBeam; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; } diff --git a/Projectiles/Melee/TaintedBladeSlasher.cs b/Projectiles/Melee/TaintedBladeSlasher.cs index 33935caa22..548f5691e5 100644 --- a/Projectiles/Melee/TaintedBladeSlasher.cs +++ b/Projectiles/Melee/TaintedBladeSlasher.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -8,6 +8,7 @@ using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; +using Terraria.GameContent; namespace CalamityMod.Projectiles.Melee { @@ -37,7 +38,7 @@ namespace CalamityMod.Projectiles.Melee { get { - Texture2D bladeTexture = Main.itemTexture[(int)SwordItemID]; + Texture2D bladeTexture = TextureAssets.Item[(int)SwordItemID]; Rectangle bladeFrame = bladeTexture.Frame(1, 1, 0, 0); bool hasMultipleFrames = Main.itemAnimations[(int)SwordItemID] != null; if (hasMultipleFrames) @@ -57,7 +58,7 @@ namespace CalamityMod.Projectiles.Melee return baseAimPosition; Vector2 endSwingPosition = Owner.Center + Vector2.UnitX * Owner.direction * 510f; - return Vector2.SmoothStep(baseAimPosition, endSwingPosition, Utils.InverseLerp(0f, 0.67f, AttackCompletionRatio, true) * Utils.InverseLerp(1f, 0.67f, AttackCompletionRatio, true)); + return Vector2.SmoothStep(baseAimPosition, endSwingPosition, Utils.GetLerpValue(0f, 0.67f, AttackCompletionRatio, true) * Utils.GetLerpValue(1f, 0.67f, AttackCompletionRatio, true)); } } public Vector2 IdleMoveOffset @@ -99,7 +100,7 @@ namespace CalamityMod.Projectiles.Melee return FrontArmEnd + BladeOffsetDirection * offsetFactor; } } - public float BladeRotationOffset => MathHelper.Lerp(MathHelper.PiOver2, 0f, Utils.InverseLerp(0f, 0.17f, 1f - AttackCompletionRatio, true)) * -Owner.direction; + public float BladeRotationOffset => MathHelper.Lerp(MathHelper.PiOver2, 0f, Utils.GetLerpValue(0f, 0.17f, 1f - AttackCompletionRatio, true)) * -Owner.direction; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public override void SetStaticDefaults() @@ -144,7 +145,7 @@ namespace CalamityMod.Projectiles.Melee if (Variant == 1) swingOffsetAngle -= 0.7f; swingOffsetAngle *= Owner.direction; - swingOffsetAngle = MathHelper.Lerp(0f, swingOffsetAngle, Utils.InverseLerp(0f, 0.16f, AttackCompletionRatio, true)); + swingOffsetAngle = MathHelper.Lerp(0f, swingOffsetAngle, Utils.GetLerpValue(0f, 0.16f, AttackCompletionRatio, true)); if (Owner.itemAnimation == 0) swingOffsetAngle = 0f; @@ -201,7 +202,7 @@ namespace CalamityMod.Projectiles.Melee internal Color PrimitiveColorFunction(float completionRatio) { - float opacity = Utils.InverseLerp(0.8f, 0.52f, completionRatio, true) * Utils.InverseLerp(1f, 0.81f, AttackCompletionRatio, true); + float opacity = Utils.GetLerpValue(0.8f, 0.52f, completionRatio, true) * Utils.GetLerpValue(1f, 0.81f, AttackCompletionRatio, true); Color startingColor = Color.Lerp(Color.Red, Color.DarkRed, 0.4f); Color endingColor = Color.Lerp(Color.DarkRed, Color.Purple, 0.77f); return Color.Lerp(startingColor, endingColor, (float)Math.Pow(completionRatio, 0.37f)) * opacity; @@ -212,18 +213,18 @@ namespace CalamityMod.Projectiles.Melee if (TrailDrawer is null) TrailDrawer = new PrimitiveTrail(PrimitiveWidthFunction, PrimitiveColorFunction, specialShader: GameShaders.Misc["CalamityMod:FadingSolidTrail"]); - Texture2D forearmTexture = ModContent.Request("CalamityMod/ExtraTextures/TaintedForearm"); - Texture2D armTexture = ModContent.Request("CalamityMod/ExtraTextures/TaintedArm"); - Texture2D handTexture = ModContent.Request("CalamityMod/ExtraTextures/TaintedHand"); + Texture2D forearmTexture = ModContent.Request("CalamityMod/ExtraTextures/TaintedForearm").Value; + Texture2D armTexture = ModContent.Request("CalamityMod/ExtraTextures/TaintedArm").Value; + Texture2D handTexture = ModContent.Request("CalamityMod/ExtraTextures/TaintedHand").Value; // Reflect the 1st hand variant horizontally. SpriteEffects handDirection = SpriteEffects.None; if (Variant == (Owner.direction == -1).ToInt()) { - handTexture = ModContent.Request("CalamityMod/ExtraTextures/TaintedHand2"); + handTexture = ModContent.Request("CalamityMod/ExtraTextures/TaintedHand2").Value; handDirection = SpriteEffects.FlipHorizontally; } - Texture2D bladeTexture = Main.itemTexture[(int)SwordItemID]; + Texture2D bladeTexture = TextureAssets.Item[(int)SwordItemID]; // Draw the arms. float backArmRotation = Owner.AngleTo(BackArmAimPosition); @@ -241,7 +242,7 @@ namespace CalamityMod.Projectiles.Melee // Draw the trail behind the blade. if (Owner.itemAnimation > 0) { - GameShaders.Misc["CalamityMod:FadingSolidTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/BladeTrailUVMap")); + GameShaders.Misc["CalamityMod:FadingSolidTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/BladeTrailUVMap").Value); GameShaders.Misc["CalamityMod:FadingSolidTrail"].Shader.Parameters["shouldFlip"].SetValue((float)(Owner.direction == -1).ToInt()); Vector2 bottom = BladeCenterPosition - BladeOffsetDirection * BladeFrame.Height * 0.5f - Main.screenPosition; @@ -271,10 +272,10 @@ namespace CalamityMod.Projectiles.Melee // Draw the blade. Vector2 bladeDrawPosition = BladeCenterPosition - Main.screenPosition; SpriteEffects bladeDirection = Owner.direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Main.EntitySpriteDraw(bladeTexture, bladeDrawPosition, BladeFrame, Color.White, bladeRotation, BladeFrame.Size() * 0.5f, Projectile.scale, bladeDirection, 0f); + Main.EntitySpriteDraw(bladeTexture, bladeDrawPosition, BladeFrame, Color.White, bladeRotation, BladeFrame.Size() * 0.5f, Projectile.scale, bladeDirection, 0); // Draw the hand. - Main.EntitySpriteDraw(handTexture, FrontArmEnd - Main.screenPosition, null, Projectile.GetAlpha(Color.White), handRotation, handTexture.Size() * 0.5f, Projectile.scale, handDirection, 0f); + Main.EntitySpriteDraw(handTexture, FrontArmEnd - Main.screenPosition, null, Projectile.GetAlpha(Color.White), handRotation, handTexture.Size() * 0.5f, Projectile.scale, handDirection, 0); return false; } @@ -292,7 +293,7 @@ namespace CalamityMod.Projectiles.Melee { ItemLoader.OnHitNPC(Owner.ActiveItem(), Owner, target, damage, knockback, crit); NPCLoader.OnHitByItem(target, Owner, Owner.ActiveItem(), damage, knockback, crit); - PlayerHooks.OnHitNPC(Owner, Owner.ActiveItem(), target, damage, knockback, crit); + PlayerLoader.OnHitNPC(Owner, Owner.ActiveItem(), target, damage, knockback, crit); } } } diff --git a/Projectiles/Melee/TemporalFloeSwordProjectile.cs b/Projectiles/Melee/TemporalFloeSwordProjectile.cs index 3770afa077..1d19fc626b 100644 --- a/Projectiles/Melee/TemporalFloeSwordProjectile.cs +++ b/Projectiles/Melee/TemporalFloeSwordProjectile.cs @@ -98,8 +98,8 @@ namespace CalamityMod.Projectiles.Melee int dmg = Projectile.damage / 2; float kback = Projectile.knockBack * 0.5f; - Projectile.NewProjectile(Projectile.Center, hourVector, projType, dmg, kback, Projectile.owner, 0f, 0f); - Projectile.NewProjectile(Projectile.Center, minuteVector, projType, dmg, kback, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, hourVector, projType, dmg, kback, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, minuteVector, projType, dmg, kback, Projectile.owner, 0f, 0f); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Melee/TenebreusTidesWaterProjectile.cs b/Projectiles/Melee/TenebreusTidesWaterProjectile.cs index 25d695f797..5fe4eabaf3 100644 --- a/Projectiles/Melee/TenebreusTidesWaterProjectile.cs +++ b/Projectiles/Melee/TenebreusTidesWaterProjectile.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.usesIDStaticNPCImmunity = true; Projectile.idStaticNPCHitCooldown = 10; Projectile.tileCollide = false; - aiType = ProjectileID.LightBeam; + AIType = ProjectileID.LightBeam; } public override void AI() diff --git a/Projectiles/Melee/TenebreusTidesWaterSpear.cs b/Projectiles/Melee/TenebreusTidesWaterSpear.cs index 5db9c44e4d..cb4a82ea83 100644 --- a/Projectiles/Melee/TenebreusTidesWaterSpear.cs +++ b/Projectiles/Melee/TenebreusTidesWaterSpear.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -206,14 +206,11 @@ namespace CalamityMod.Projectiles.Melee Texture2D texture = ModContent.Request(Texture).Value; int height = texture.Height / Main.projFrames[Projectile.type]; int frameHeight = height * Projectile.frame; - SpriteEffects spriteEffects = SpriteEffects.None; - if (Projectile.spriteDirection == -1) - spriteEffects = SpriteEffects.FlipHorizontally; Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, frameHeight, texture.Width, height)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture.Width / 2f, (float)height / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } - public override bool CanDamage() + public override bool? CanDamage() { // Do not do damage if a tile is hit OR if projectile has 'split' and hasn't been live for more than 5 frames if ((((int)(Projectile.ai[0] - 1f) / penetrationAmt == 0 && penetrationAmt < 3) || Projectile.ai[1] < 5f) && Projectile.ai[0] != 0f) diff --git a/Projectiles/Melee/TenebreusTidesWaterSword.cs b/Projectiles/Melee/TenebreusTidesWaterSword.cs index b511a94337..a4177ddc6a 100644 --- a/Projectiles/Melee/TenebreusTidesWaterSword.cs +++ b/Projectiles/Melee/TenebreusTidesWaterSword.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -190,14 +190,11 @@ namespace CalamityMod.Projectiles.Melee if (dontDraw) return false; Texture2D texture = ModContent.Request(Texture).Value; - SpriteEffects spriteEffects = SpriteEffects.None; - if (Projectile.spriteDirection == -1) - spriteEffects = SpriteEffects.FlipHorizontally; Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture.Width / 2f, (float)texture.Height / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } - public override bool CanDamage() + public override bool? CanDamage() { // Do not do damage if a tile is hit OR if projectile has 'split' and hasn't been live for more than 5 frames if ((((int)(Projectile.ai[0] - 1f) / penetrationAmt == 0 && penetrationAmt < 3) || Projectile.ai[1] < 5f) && Projectile.ai[0] != 0f) diff --git a/Projectiles/Melee/TerraEdgeBeam.cs b/Projectiles/Melee/TerraEdgeBeam.cs index 1d3260e5ab..8295432bd6 100644 --- a/Projectiles/Melee/TerraEdgeBeam.cs +++ b/Projectiles/Melee/TerraEdgeBeam.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.DamageType = DamageClass.Melee; Projectile.penetrate = 3; Projectile.timeLeft = 600; - aiType = ProjectileID.TerraBeam; + AIType = ProjectileID.TerraBeam; } public override void AI() diff --git a/Projectiles/Melee/TerratomereProjectile.cs b/Projectiles/Melee/TerratomereProjectile.cs index 8380cb2cbb..ed75b99e91 100644 --- a/Projectiles/Melee/TerratomereProjectile.cs +++ b/Projectiles/Melee/TerratomereProjectile.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.penetrate = 1; Projectile.timeLeft = 180; Projectile.tileCollide = false; - aiType = ProjectileID.TerraBeam; + AIType = ProjectileID.TerraBeam; } public override void AI() diff --git a/Projectiles/Melee/TerrorBeam.cs b/Projectiles/Melee/TerrorBeam.cs index 02d047e568..68eae3fd54 100644 --- a/Projectiles/Melee/TerrorBeam.cs +++ b/Projectiles/Melee/TerrorBeam.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Melee { int projID = ModContent.ProjectileType(); int blastDamage = (int)(Projectile.damage * TerrorBlade.TerrorBlastMultiplier); - Projectile.NewProjectile(Projectile.Center, Vector2.Zero, projID, blastDamage, Projectile.knockBack, Projectile.owner); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, Vector2.Zero, projID, blastDamage, Projectile.knockBack, Projectile.owner); } public override bool OnTileCollide(Vector2 oldVelocity) diff --git a/Projectiles/Melee/TerrorBlast.cs b/Projectiles/Melee/TerrorBlast.cs index 9fcf8d8ea1..66cbf07554 100644 --- a/Projectiles/Melee/TerrorBlast.cs +++ b/Projectiles/Melee/TerrorBlast.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Melee } // Terror Blasts do nothing until they explode. - public override bool CanDamage() => Projectile.localAI[0] > 0f; + public override bool? CanDamage() => Projectile.localAI[0] > 0f; public override void Kill(int timeLeft) { diff --git a/Projectiles/Melee/ThornBase.cs b/Projectiles/Melee/ThornBase.cs index cf37e252b9..a5c45acbf6 100644 --- a/Projectiles/Melee/ThornBase.cs +++ b/Projectiles/Melee/ThornBase.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Melee int type = Projectile.type; if (Projectile.ai[1] >= 6f) type = ModContent.ProjectileType(); - int number = Projectile.NewProjectile(Projectile.position.X + Projectile.velocity.X + (float)(Projectile.width / 2), Projectile.position.Y + Projectile.velocity.Y + (float)(Projectile.height / 2), Projectile.velocity.X, Projectile.velocity.Y, type, Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + int number = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.position.X + Projectile.velocity.X + (float)(Projectile.width / 2), Projectile.position.Y + Projectile.velocity.Y + (float)(Projectile.height / 2), Projectile.velocity.X, Projectile.velocity.Y, type, Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); Main.projectile[number].ai[1] = Projectile.ai[1] + 1f; } } diff --git a/Projectiles/Melee/ThornTip.cs b/Projectiles/Melee/ThornTip.cs index d2c8352cb0..f94a4f3b43 100644 --- a/Projectiles/Melee/ThornTip.cs +++ b/Projectiles/Melee/ThornTip.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.alpha = 255; Projectile.ignoreWater = true; Projectile.DamageType = DamageClass.Melee; - aiType = ProjectileID.VilethornTip; + AIType = ProjectileID.VilethornTip; } } } diff --git a/Projectiles/Melee/TriactisHammerProj.cs b/Projectiles/Melee/TriactisHammerProj.cs index f29629556b..444cb4606a 100644 --- a/Projectiles/Melee/TriactisHammerProj.cs +++ b/Projectiles/Melee/TriactisHammerProj.cs @@ -107,7 +107,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { if (Projectile.owner == Main.myPlayer) - Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.25), Projectile.knockBack, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.25), Projectile.knockBack, Projectile.owner, 0f, 0f); SoundEngine.PlaySound(SoundID.Item14, Projectile.position); for (int num621 = 0; num621 < 40; num621++) { @@ -132,7 +132,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitPvp(Player target, int damage, bool crit) { if (Projectile.owner == Main.myPlayer) - Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.25), Projectile.knockBack, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.25), Projectile.knockBack, Projectile.owner, 0f, 0f); SoundEngine.PlaySound(SoundID.Item14, Projectile.position); for (int num621 = 0; num621 < 40; num621++) { diff --git a/Projectiles/Melee/TrueAncientBeam.cs b/Projectiles/Melee/TrueAncientBeam.cs index 5ade00e920..56517aee68 100644 --- a/Projectiles/Melee/TrueAncientBeam.cs +++ b/Projectiles/Melee/TrueAncientBeam.cs @@ -85,10 +85,10 @@ namespace CalamityMod.Projectiles.Melee DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - Texture2D starTexture = GetTexture("CalamityMod/Particles/Sparkle"); - Texture2D bloomTexture = GetTexture("CalamityMod/Particles/BloomCircle"); + Texture2D starTexture = Request("CalamityMod/Particles/Sparkle").Value; + Texture2D bloomTexture = Request("CalamityMod/Particles/BloomCircle").Value; //Ajust the bloom's texture to be the same size as the star's float properBloomSize = (float)starTexture.Height / (float)bloomTexture.Height; @@ -102,7 +102,7 @@ namespace CalamityMod.Projectiles.Melee Main.EntitySpriteDraw(starTexture, sparkCenter, null, Color.White, rotation, starTexture.Size() / 2f, 2, SpriteEffects.None, 0); Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); return false; diff --git a/Projectiles/Melee/TrueAncientBlast.cs b/Projectiles/Melee/TrueAncientBlast.cs index 1d096af989..9881a6bfec 100644 --- a/Projectiles/Melee/TrueAncientBlast.cs +++ b/Projectiles/Melee/TrueAncientBlast.cs @@ -84,8 +84,8 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - Texture2D sword = GetTexture("CalamityMod/Items/Weapons/Melee/TrueArkoftheAncients"); - Texture2D glowmask = GetTexture("CalamityMod/Items/Weapons/Melee/TrueArkoftheAncientsGlow"); + Texture2D sword = Request("CalamityMod/Items/Weapons/Melee/TrueArkoftheAncients").Value; + Texture2D glowmask = Request("CalamityMod/Items/Weapons/Melee/TrueArkoftheAncientsGlow").Value; float displace = 10 * (1f + ((float)Math.Sin(Timer / MaxTime * MathHelper.Pi) * 0.8f)); @@ -97,14 +97,14 @@ namespace CalamityMod.Projectiles.Melee float swordSize = 1.4f + ((float)Math.Sin(Timer / MaxTime * MathHelper.Pi) * 0.6f); - Main.EntitySpriteDraw(sword, drawOffset, null, lightColor, drawRotation, drawOrigin, swordSize, 0f, 0f); - Main.EntitySpriteDraw(glowmask, drawOffset, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, swordSize, 0f, 0f); + Main.EntitySpriteDraw(sword, drawOffset, null, lightColor, drawRotation, drawOrigin, swordSize, 0f, 0); + Main.EntitySpriteDraw(glowmask, drawOffset, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, swordSize, 0f, 0); Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); //Draw the laser - Texture2D tex = GetTexture("CalamityMod/Particles/BloomLine"); + Texture2D tex = Request("CalamityMod/Particles/BloomLine").Value; float rot = angle + MathHelper.PiOver2; Vector2 origin = new Vector2(tex.Width / 2f, tex.Height); float size = Timer / MaxTime > 0.5f ? (float)Math.Sin(Timer / MaxTime * MathHelper.Pi) * 0.2f + 0.8f : (float)Math.Sin(Timer / MaxTime * MathHelper.Pi); @@ -113,7 +113,7 @@ namespace CalamityMod.Projectiles.Melee Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Color.LightPink, rot, origin, scale, SpriteEffects.None, 0); //Cap the lines - Texture2D cap = GetTexture("CalamityMod/Particles/BloomLineCap"); + Texture2D cap = Request("CalamityMod/Particles/BloomLineCap").Value; scale = new Vector2(size, size); origin = new Vector2(cap.Width / 2f, cap.Height); Main.EntitySpriteDraw(cap, Projectile.Center - Main.screenPosition, null, Color.LightPink, rot + MathHelper.Pi, origin, scale, SpriteEffects.None, 0); @@ -121,7 +121,7 @@ namespace CalamityMod.Projectiles.Melee Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); return false; } } diff --git a/Projectiles/Melee/TrueArkOfTheAncients_ParryHoldout.cs b/Projectiles/Melee/TrueArkOfTheAncients_ParryHoldout.cs index a370bcf24f..8adccb635f 100644 --- a/Projectiles/Melee/TrueArkOfTheAncients_ParryHoldout.cs +++ b/Projectiles/Melee/TrueArkOfTheAncients_ParryHoldout.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.penetrate = -1; } - public override bool CanDamage() => Timer <= ParryTime && AlreadyParried == 0f; + public override bool? CanDamage() => Timer <= ParryTime && AlreadyParried == 0f; public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { @@ -51,7 +51,7 @@ namespace CalamityMod.Projectiles.Melee public void GeneralParryEffects() { - TrueArkoftheAncients sword = (Owner.HeldItem.modItem as TrueArkoftheAncients); + TrueArkoftheAncients sword = (Owner.HeldItem.ModItem as TrueArkoftheAncients); if (sword != null) sword.Charge = 10f; SoundEngine.PlaySound(SoundID.DD2_WitherBeastCrystalImpact); @@ -161,8 +161,8 @@ namespace CalamityMod.Projectiles.Melee { if (Main.myPlayer == Owner.whoAmI) { - var barBG = GetTexture("CalamityMod/ExtraTextures/GenericBarBack"); - var barFG = GetTexture("CalamityMod/ExtraTextures/GenericBarFront"); + var barBG = Request("CalamityMod/ExtraTextures/GenericBarBack").Value; + var barFG = Request("CalamityMod/ExtraTextures/GenericBarFront").Value; Vector2 drawPos = Owner.Center - Main.screenPosition + new Vector2(0, -36) - barBG.Size() / 2; Rectangle frame = new Rectangle(0, 0, (int)((Timer - ParryTime) / (MaxTime - ParryTime) * barFG.Width), barFG.Height); @@ -170,30 +170,28 @@ namespace CalamityMod.Projectiles.Melee float opacity = Timer <= ParryTime + 25f ? (Timer - ParryTime) / 25f : (MaxTime - Timer <= 8) ? Projectile.timeLeft / 8f : 1f; Color color = Main.hslToRgb((Main.GlobalTimeWrappedHourly * 1.2f) % 1, 1, 0.85f + (float)Math.Sin(Main.GlobalTimeWrappedHourly * 7f) * 0.1f); - Main.EntitySpriteDraw(barBG, drawPos, color * opacity); - Main.EntitySpriteDraw(barFG, drawPos, frame, color * opacity * 0.8f); - - + Main.spriteBatch.Draw(barBG, drawPos, color * opacity); + Main.spriteBatch.Draw(barFG, drawPos, frame, color * opacity * 0.8f); } return false; } - Texture2D sword = GetTexture("CalamityMod/Items/Weapons/Melee/TrueArkoftheAncients"); - Texture2D glowmask = GetTexture("CalamityMod/Items/Weapons/Melee/TrueArkoftheAncientsGlow"); + Texture2D sword = Request("CalamityMod/Items/Weapons/Melee/TrueArkoftheAncients").Value; + Texture2D glowmask = Request("CalamityMod/Items/Weapons/Melee/TrueArkoftheAncientsGlow").Value; float drawRotation = Projectile.rotation + MathHelper.PiOver4; Vector2 drawOrigin = new Vector2(0f, sword.Height); Vector2 drawOffset = Owner.Center + Projectile.velocity * DistanceFromPlayer.Length() - Main.screenPosition; - Main.EntitySpriteDraw(sword, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); - Main.EntitySpriteDraw(glowmask, drawOffset, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, Projectile.scale, 0f, 0f); + Main.EntitySpriteDraw(sword, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0); + Main.EntitySpriteDraw(glowmask, drawOffset, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, Projectile.scale, 0f, 0); if (AlreadyParried > 0) { drawOrigin = new Vector2(0f, 48f); Rectangle frame = new Rectangle(24, 0, 48, 48); drawOffset = Owner.Center + Projectile.velocity * (DistanceFromPlayer.Length() + 34) - Main.screenPosition; - Main.EntitySpriteDraw(glowmask, drawOffset, frame, Main.hslToRgb(Main.GlobalTimeWrappedHourly % 1, 1, 0.8f) * (1 - AlreadyParried / ParryTime), drawRotation, drawOrigin, Projectile.scale + AlreadyParried / ParryTime, 0f, 0f); + Main.EntitySpriteDraw(glowmask, drawOffset, frame, Main.hslToRgb(Main.GlobalTimeWrappedHourly % 1, 1, 0.8f) * (1 - AlreadyParried / ParryTime), drawRotation, drawOrigin, Projectile.scale + AlreadyParried / ParryTime, 0f, 0); } return false; diff --git a/Projectiles/Melee/TrueArkOfTheAncients_SwungBlade.cs b/Projectiles/Melee/TrueArkOfTheAncients_SwungBlade.cs index 066217f4e5..e283051bdd 100644 --- a/Projectiles/Melee/TrueArkOfTheAncients_SwungBlade.cs +++ b/Projectiles/Melee/TrueArkOfTheAncients_SwungBlade.cs @@ -94,7 +94,7 @@ namespace CalamityMod.Projectiles.Melee if (Owner.whoAmI == Main.myPlayer && SwingRatio() > 0.5f && HasFired == 0f && Charge > 0) { - Projectile.NewProjectile(Owner.Center + direction * 30f, Projectile.velocity * 2f, ProjectileType(), (int)(Projectile.damage * TrueArkoftheAncients.beamDamageMultiplier), 2f, Owner.whoAmI) ; + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Owner.Center + direction * 30f, Projectile.velocity * 2f, ProjectileType(), (int)(Projectile.damage * TrueArkoftheAncients.beamDamageMultiplier), 2f, Owner.whoAmI) ; HasFired = 1f; } @@ -121,8 +121,8 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - Texture2D sword = GetTexture("CalamityMod/Items/Weapons/Melee/TrueArkoftheAncients"); - Texture2D glowmask = GetTexture("CalamityMod/Items/Weapons/Melee/TrueArkoftheAncientsGlow"); + Texture2D sword = Request("CalamityMod/Items/Weapons/Melee/TrueArkoftheAncients").Value; + Texture2D glowmask = Request("CalamityMod/Items/Weapons/Melee/TrueArkoftheAncientsGlow").Value; SpriteEffects flip = Owner.direction < 0 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; float extraAngle = Owner.direction < 0 ? MathHelper.PiOver2 : 0f; @@ -139,19 +139,19 @@ namespace CalamityMod.Projectiles.Melee { Color color = Main.hslToRgb((i / (float)Projectile.oldRot.Length) * 0.7f, 1, 0.6f + (Charge > 0 ? 0.3f : 0f)); float afterimageRotation = Projectile.oldRot[i] + MathHelper.PiOver4; - Main.EntitySpriteDraw(glowmask, drawOffset, null, color * 0.15f, afterimageRotation + extraAngle, drawOrigin, Projectile.scale - 0.2f * ((i / (float)Projectile.oldRot.Length)), flip, 0f); + Main.EntitySpriteDraw(glowmask, drawOffset, null, color * 0.15f, afterimageRotation + extraAngle, drawOrigin, Projectile.scale - 0.2f * ((i / (float)Projectile.oldRot.Length)), flip, 0); } } - Main.EntitySpriteDraw(sword, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, flip, 0f); - Main.EntitySpriteDraw(glowmask, drawOffset, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, Projectile.scale, flip, 0f); + Main.EntitySpriteDraw(sword, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, flip, 0); + Main.EntitySpriteDraw(glowmask, drawOffset, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, Projectile.scale, flip, 0); if (Charge > 0 && Timer / MaxTime > 0.5f) { - Texture2D smear = GetTexture("CalamityMod/Particles/TrientCircularSmear"); + Texture2D smear = Request("CalamityMod/Particles/TrientCircularSmear").Value; Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); float opacity = (float)Math.Sin(Timer / MaxTime * MathHelper.Pi); float rotation = (-MathHelper.PiOver4 * 0.5f + MathHelper.PiOver4 * 0.5f * Timer / MaxTime) * SwingDirection; @@ -160,7 +160,7 @@ namespace CalamityMod.Projectiles.Melee Main.EntitySpriteDraw(smear, Owner.Center - Main.screenPosition, null, smearColor * 0.5f * opacity, Projectile.velocity.ToRotation() + MathHelper.Pi + rotation, smear.Size() / 2f, Projectile.scale * 1.4f, SpriteEffects.None, 0); Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); } return false; } diff --git a/Projectiles/Melee/TrueBiomeBladeHoldout.cs b/Projectiles/Melee/TrueBiomeBladeHoldout.cs index 5f0a00f902..40a5940117 100644 --- a/Projectiles/Melee/TrueBiomeBladeHoldout.cs +++ b/Projectiles/Melee/TrueBiomeBladeHoldout.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Projectiles.Melee public class TrueBiomeBladeHoldout : ModProjectile //Visuals { private Player Owner => Main.player[Projectile.owner]; - public bool OwnerCanUseItem => Owner.HeldItem == associatedItem ? (Owner.HeldItem.modItem as OmegaBiomeBlade).CanUseItem(Owner) : false; + public bool OwnerCanUseItem => Owner.HeldItem == associatedItem ? (Owner.HeldItem.ModItem as OmegaBiomeBlade).CanUseItem(Owner) : false; public bool OwnerMayChannel => Owner.itemAnimation == 0 && OwnerCanUseItem && Owner.Calamity().mouseRight && Owner.active && !Owner.dead; public ref float ChanneledState => ref Projectile.ai[0]; public ref float ChannelTimer => ref Projectile.ai[1]; @@ -64,9 +64,9 @@ namespace CalamityMod.Projectiles.Melee associatedItem = Owner.HeldItem; //Switch up the attunements - Attunement temporaryAttunementStorage = (associatedItem.modItem as OmegaBiomeBlade).mainAttunement; - (associatedItem.modItem as OmegaBiomeBlade).mainAttunement = (associatedItem.modItem as OmegaBiomeBlade).secondaryAttunement; - (associatedItem.modItem as OmegaBiomeBlade).secondaryAttunement = temporaryAttunementStorage; + Attunement temporaryAttunementStorage = (associatedItem.ModItem as OmegaBiomeBlade).mainAttunement; + (associatedItem.ModItem as OmegaBiomeBlade).mainAttunement = (associatedItem.ModItem as OmegaBiomeBlade).secondaryAttunement; + (associatedItem.ModItem as OmegaBiomeBlade).secondaryAttunement = temporaryAttunementStorage; Initialized = 1f; } @@ -90,8 +90,8 @@ namespace CalamityMod.Projectiles.Melee if (ChannelTimer == ChannelTime - 15) { - Attune((OmegaBiomeBlade)associatedItem.modItem); - Color particleColor = (associatedItem.modItem as OmegaBiomeBlade).mainAttunement.tooltipColor; + Attune((OmegaBiomeBlade)associatedItem.ModItem); + Color particleColor = (associatedItem.ModItem as OmegaBiomeBlade).mainAttunement.tooltipColor; for (int i = 0; i <= 5; i++) { @@ -136,7 +136,7 @@ namespace CalamityMod.Projectiles.Melee bool desert = Owner.ZoneDesert; bool hell = Owner.ZoneUnderworldHeight; bool ocean = Owner.ZoneBeach || Owner.Calamity().ZoneSulphur; - bool holy = Owner.ZoneHoly; + bool hallow = Owner.ZoneHallow; bool astral = Owner.Calamity().ZoneAstral; bool marine = Owner.Calamity().ZoneAbyss || Owner.Calamity().ZoneSunkenSea; @@ -149,7 +149,7 @@ namespace CalamityMod.Projectiles.Melee attunement = Attunement.attunementArray[(int)AttunementID.SuperPogo]; if (astral || marine) attunement = Attunement.attunementArray[(int)AttunementID.Shockwave]; - if (holy) + if (hallow) attunement = Attunement.attunementArray[(int)AttunementID.Whirlwind]; //Putting holy check at the end so it may override hallowed variants of biomes //If the owner already had the attunement , break out of it (And unswap) @@ -161,7 +161,7 @@ namespace CalamityMod.Projectiles.Melee return; } //Chunger - var Sound = SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ThunderStrike"), Projectile.Center); + var Sound = SoundEngine.PlaySound(SoundLoader.GetLegacySoundSlot(Mod, "Sounds/Custom/ThunderStrike"), Projectile.Center); CalamityUtils.SafeVolumeChange(ref Sound, 0.4f); Particle thunder = new ThunderBoltVFX(Projectile.Center + Vector2.UnitY * 20f, Main.rand.NextBool() ? Main.rand.NextBool() ? Color.Goldenrod : Color.GreenYellow : Main.rand.NextBool() ? Color.Cyan : Color.Magenta, 0f, 1.5f, Vector2.One, 1f, 15f, Projectile, 20f); GeneralParticleHandler.SpawnParticle(thunder); @@ -179,10 +179,10 @@ namespace CalamityMod.Projectiles.Melee return; } //If we swapped out the main attunement for the second one despite the second attunement being empty at the time, unswap them. - if ((associatedItem.modItem as OmegaBiomeBlade).mainAttunement == null && (associatedItem.modItem as OmegaBiomeBlade).secondaryAttunement != null) + if ((associatedItem.ModItem as OmegaBiomeBlade).mainAttunement == null && (associatedItem.ModItem as OmegaBiomeBlade).secondaryAttunement != null) { - (associatedItem.modItem as OmegaBiomeBlade).mainAttunement = (associatedItem.modItem as OmegaBiomeBlade).secondaryAttunement; - (associatedItem.modItem as OmegaBiomeBlade).secondaryAttunement = null; + (associatedItem.ModItem as OmegaBiomeBlade).mainAttunement = (associatedItem.modItem as OmegaBiomeBlade).secondaryAttunement; + (associatedItem.ModItem as OmegaBiomeBlade).secondaryAttunement = null; } } @@ -192,7 +192,7 @@ namespace CalamityMod.Projectiles.Melee if (ChanneledState == 0f && ChannelTimer > 10f) { - Texture2D tex = GetTexture(Texture); + Texture2D tex = Request(Texture).Value; Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, lightColor, Projectile.rotation, tex.Size() / 2, 1, 0, 0); return false; @@ -200,7 +200,7 @@ namespace CalamityMod.Projectiles.Melee } else if (ChanneledState == 1f) { - Texture2D tex = GetTexture(Texture); + Texture2D tex = Request(Texture).Value; Vector2 squishyScale = new Vector2(Math.Abs((float)Math.Sin(MathHelper.Pi + MathHelper.TwoPi * Projectile.timeLeft / 30f)), 1f); SpriteEffects flip = (float)Math.Sin(MathHelper.Pi + MathHelper.TwoPi * Projectile.timeLeft / 30f) > 0 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; Main.EntitySpriteDraw(tex, Projectile.position - Main.screenPosition, null, lightColor * (Projectile.timeLeft / 60f), 0, tex.Size() / 2, squishyScale * (2f - (Projectile.timeLeft / 60f)), flip, 0); diff --git a/Projectiles/Melee/TrueBiomeBlade_GhastlyChain.cs b/Projectiles/Melee/TrueBiomeBlade_GhastlyChain.cs index 051d90a48f..e403af6f29 100644 --- a/Projectiles/Melee/TrueBiomeBlade_GhastlyChain.cs +++ b/Projectiles/Melee/TrueBiomeBlade_GhastlyChain.cs @@ -53,18 +53,18 @@ namespace CalamityMod.Projectiles.Melee public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - if (Owner.HeldItem.modItem is OmegaBiomeBlade sword && Main.rand.NextFloat() <= OmegaBiomeBlade.FlailBladeAttunement_GhostChainProc) + if (Owner.HeldItem.ModItem is OmegaBiomeBlade sword && Main.rand.NextFloat() <= OmegaBiomeBlade.FlailBladeAttunement_GhostChainProc) sword.OnHitProc = true; } public override bool PreDraw(ref Color lightColor) { - Texture2D chainTex = GetTexture("CalamityMod/Projectiles/Melee/TrueBiomeBlade_LamentationsOfTheChainedChain"); + Texture2D chainTex = Request("CalamityMod/Projectiles/Melee/TrueBiomeBlade_LamentationsOfTheChainedChain").Value; //Turn on additive blending Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); float opacity = Projectile.timeLeft > 10 ? 1 : Projectile.timeLeft / 10f; Vector2 Shake = Projectile.timeLeft < 15 ? Vector2.Zero : Vector2.One.RotatedByRandom(MathHelper.TwoPi) * (15 - Projectile.timeLeft / 5f) * 0.5f; @@ -87,7 +87,7 @@ namespace CalamityMod.Projectiles.Melee //Back to normal Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); return false; } diff --git a/Projectiles/Melee/TrueBiomeBlade_MercurialTides.cs b/Projectiles/Melee/TrueBiomeBlade_MercurialTides.cs index 1142814a7b..32cc14a6bf 100644 --- a/Projectiles/Melee/TrueBiomeBlade_MercurialTides.cs +++ b/Projectiles/Melee/TrueBiomeBlade_MercurialTides.cs @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.localNPCHitCooldown = 16; } - public override bool CanDamage() + public override bool? CanDamage() { return (State == 1); } @@ -114,8 +114,8 @@ namespace CalamityMod.Projectiles.Melee Projectile.timeLeft = 2; if ((Charge / MaxCharge >= 0.25f && CurrentIndicator == 0f) || (Charge / MaxCharge >= 0.5f && CurrentIndicator == 1f) || (Charge / MaxCharge >= 0.75f && CurrentIndicator == 2f) && Owner.whoAmI == Main.myPlayer) { - Projectile.NewProjectile(Owner.Center, Vector2.Zero, ProjectileType(), (int)(Projectile.damage * OmegaBiomeBlade.ShockwaveAttunement_BlastDamageReduction), 10f, Owner.whoAmI, 1f + CurrentIndicator * 0.15f); - var chargeSound = SoundEngine.PlaySound(Mod.GetLegacySoundSlot(Terraria.ModLoader.SoundType.Custom, "Sounds/Custom/AstralBeaconOrbPulse"), Projectile.Center); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Owner.Center, Vector2.Zero, ProjectileType(), (int)(Projectile.damage * OmegaBiomeBlade.ShockwaveAttunement_BlastDamageReduction), 10f, Owner.whoAmI, 1f + CurrentIndicator * 0.15f); + var chargeSound = SoundEngine.PlaySound(SoundLoader.GetLegacySoundSlot(Mod, "Sounds/Custom/AstralBeaconOrbPulse"), Projectile.Center); if (chargeSound != null) chargeSound.Pitch = -0.2f + 0.1f * CurrentIndicator; CurrentIndicator++; @@ -127,9 +127,9 @@ namespace CalamityMod.Projectiles.Melee Charge = MaxCharge; if (Owner.whoAmI == Main.myPlayer && CurrentIndicator < 4f) { - Projectile.NewProjectile(Owner.Center, Vector2.Zero, ProjectileType(), (int)(Projectile.damage * OmegaBiomeBlade.ShockwaveAttunement_BlastDamageReduction), 10f, Owner.whoAmI, 1f + CurrentIndicator * 0.15f); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Owner.Center, Vector2.Zero, ProjectileType(), (int)(Projectile.damage * OmegaBiomeBlade.ShockwaveAttunement_BlastDamageReduction), 10f, Owner.whoAmI, 1f + CurrentIndicator * 0.15f); OverCharge = 20f; - SoundEngine.PlaySound(Mod.GetLegacySoundSlot(Terraria.ModLoader.SoundType.Custom, "Sounds/Custom/AstralBeaconUse"), Projectile.Center); + SoundEngine.PlaySound(SoundLoader.GetLegacySoundSlot(Mod, "Sounds/Custom/AstralBeaconUse"), Projectile.Center); CurrentIndicator++; } } @@ -192,7 +192,7 @@ namespace CalamityMod.Projectiles.Melee if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < 15) Main.LocalPlayer.Calamity().GeneralScreenShakePower = 15; - Projectile proj = Projectile.NewProjectileDirect(Owner.Center + (direction * 120 * Projectile.scale), -direction, ProjectileType(), (int)(Projectile.damage * OmegaBiomeBlade.ShockwaveAttunement_MonolithDamageBoost), 10f, Owner.whoAmI, Main.rand.Next(4), 1f); + Projectile proj = Projectile.NewProjectileDirect(Projectile.GetProjectileSource_FromThis(), Owner.Center + (direction * 120 * Projectile.scale), -direction, ProjectileType(), (int)(Projectile.damage * OmegaBiomeBlade.ShockwaveAttunement_MonolithDamageBoost), 10f, Owner.whoAmI, Main.rand.Next(4), 1f); proj.timeLeft = 81; @@ -224,8 +224,8 @@ namespace CalamityMod.Projectiles.Melee { Vector2 projPosition = Owner.Center + (direction * 120 * Projectile.scale) + direction.RotatedBy((widestSurfaceAngle * MathHelper.PiOver2 + MathHelper.PiOver4) * facing) * distance; Vector2 monolithRotation = direction.RotatedBy(Utils.AngleLerp(widestSurfaceAngle * -facing, 0f, projSize)); - Projectile proj = Projectile.NewProjectileDirect(projPosition, -monolithRotation, ProjectileType(), (int)(Projectile.damage * OmegaBiomeBlade.ShockwaveAttunement_MonolithDamageBoost), 10f, Owner.whoAmI, Main.rand.Next(4), projSize); - if (proj.modProjectile is MercurialTidesMonolith monolith) + Projectile proj = Projectile.NewProjectileDirect(Projectile.GetProjectileSource_FromThis(), projPosition, -monolithRotation, ProjectileType(), (int)(Projectile.damage * OmegaBiomeBlade.ShockwaveAttunement_MonolithDamageBoost), 10f, Owner.whoAmI, Main.rand.Next(4), projSize); + if (proj.ModProjectile is MercurialTidesMonolith monolith) { monolith.WaitTimer = (1 - projSize) * 34f; monolith.OriginDirection = direction; @@ -245,14 +245,14 @@ namespace CalamityMod.Projectiles.Melee { damage = (int)(damage * (1f + OmegaBiomeBlade.ShockwaveAttunement_FullChargeBoost * (float)Math.Pow(Charge / MaxCharge, 2))); - if (Owner.HeldItem.modItem is OmegaBiomeBlade sword && Main.rand.NextFloat() <= OmegaBiomeBlade.ShockwaveAttunement_SwordProc) + if (Owner.HeldItem.ModItem is OmegaBiomeBlade sword && Main.rand.NextFloat() <= OmegaBiomeBlade.ShockwaveAttunement_SwordProc) sword.OnHitProc = true; } public override bool PreDraw(ref Color lightColor) { - Texture2D handle = GetTexture("CalamityMod/Items/Weapons/Melee/OmegaBiomeBlade"); - Texture2D blade = GetTexture("CalamityMod/Projectiles/Melee/TrueBiomeBlade_MercurialTides"); + Texture2D handle = Request("CalamityMod/Items/Weapons/Melee/OmegaBiomeBlade").Value; + Texture2D blade = Request("CalamityMod/Projectiles/Melee/TrueBiomeBlade_MercurialTides").Value; float drawAngle = direction.ToRotation(); float drawRotation = drawAngle + MathHelper.PiOver4; @@ -260,11 +260,11 @@ namespace CalamityMod.Projectiles.Melee Vector2 drawOrigin = new Vector2(0f, handle.Height); Vector2 drawOffset = Projectile.Center - Main.screenPosition; - Main.EntitySpriteDraw(handle, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); + Main.EntitySpriteDraw(handle, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0); //Turn on additive blending Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); //Just in case if (OverCharge < 0) @@ -277,11 +277,11 @@ namespace CalamityMod.Projectiles.Melee //Update the parameters drawOrigin = new Vector2(0f, blade.Height); - Main.EntitySpriteDraw(blade, drawOffset, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); + Main.EntitySpriteDraw(blade, drawOffset, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f, drawRotation, drawOrigin, Projectile.scale, 0f, 0); //Back to normal Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); return false; } diff --git a/Projectiles/Melee/TrueBiomeBlade_MercurialTidesMonolith.cs b/Projectiles/Melee/TrueBiomeBlade_MercurialTidesMonolith.cs index 00f38166fc..0a037e1012 100644 --- a/Projectiles/Melee/TrueBiomeBlade_MercurialTidesMonolith.cs +++ b/Projectiles/Melee/TrueBiomeBlade_MercurialTidesMonolith.cs @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.hide = true; } - public override bool CanDamage() => WaitTimer <= 0; + public override bool? CanDamage() => WaitTimer <= 0; public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { @@ -63,9 +63,9 @@ namespace CalamityMod.Projectiles.Melee return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + ((Projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * Height()), Width(), ref collisionPoint); } - public override void DrawBehind(int index, List drawCacheProjsBehindNPCsAndTiles, List drawCacheProjsBehindNPCs, List drawCacheProjsBehindProjectiles, List drawCacheProjsOverWiresUI) + public override void DrawBehind(int index, List behindNPCsAndTiles, List behindNPCs, List behindProjectiles, List overPlayers, List overWiresUI) { - drawCacheProjsBehindNPCsAndTiles.Add(index); + behindNPCsAndTiles.Add(index); } public override void AI() @@ -162,8 +162,8 @@ namespace CalamityMod.Projectiles.Melee { Vector2 projPosition = Projectile.Center + OriginDirection.RotatedBy((widestSurfaceAngle * MathHelper.PiOver2 + MathHelper.PiOver4) * facing) * distance; Vector2 monolithRotation = OriginDirection.RotatedBy(Utils.AngleLerp(widestSurfaceAngle * -facing, 0f, projSize)); - Projectile proj = Projectile.NewProjectileDirect(projPosition, -monolithRotation, ProjectileType(), Projectile.damage, 10f, Owner.whoAmI, Main.rand.Next(4), projSize); - if (proj.modProjectile is MercurialTidesMonolith monolith) + Projectile proj = Projectile.NewProjectileDirect(Projectile.GetProjectileSource_FromThis(), projPosition, -monolithRotation, ProjectileType(), Projectile.damage, 10f, Owner.whoAmI, Main.rand.Next(4), projSize); + if (proj.ModProjectile is MercurialTidesMonolith monolith) { monolith.WaitTimer = (float)Math.Sqrt(1.0 - Math.Pow(projSize - 1.0, 2)) * 3f; monolith.OriginDirection = OriginDirection; @@ -176,7 +176,7 @@ namespace CalamityMod.Projectiles.Melee public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - if (Owner.HeldItem.modItem is OmegaBiomeBlade sword && Main.rand.NextFloat() <= OmegaBiomeBlade.ShockwaveAttunement_MonolithProc) + if (Owner.HeldItem.ModItem is OmegaBiomeBlade sword && Main.rand.NextFloat() <= OmegaBiomeBlade.ShockwaveAttunement_MonolithProc) sword.OnHitProc = true; if (Projectile.numHits > 0) @@ -189,7 +189,7 @@ namespace CalamityMod.Projectiles.Melee if (WaitTimer > 0) return false; - Texture2D tex = GetTexture("CalamityMod/Projectiles/Melee/TrueBiomeBlade_MercurialTidesMonolith"); + Texture2D tex = Request("CalamityMod/Projectiles/Melee/TrueBiomeBlade_MercurialTidesMonolith").Value; Vector2 Shake = Projectile.timeLeft < 70 ? Vector2.Zero : Vector2.One.RotatedByRandom(MathHelper.TwoPi) * (70 - Projectile.timeLeft / 30f) * 0.05f; @@ -202,7 +202,7 @@ namespace CalamityMod.Projectiles.Melee float opacity = MathHelper.Clamp(1f - ((Timer - 0.85f) / 0.15f), 0f, 1f); - Main.EntitySpriteDraw(tex, drawPosition + Shake, frame, lightColor * opacity, drawAngle, drawOrigin, drawScale, 0f, 0f); + Main.EntitySpriteDraw(tex, drawPosition + Shake, frame, lightColor * opacity, drawAngle, drawOrigin, drawScale, 0f, 0); return false; } @@ -211,7 +211,7 @@ namespace CalamityMod.Projectiles.Melee if (WaitTimer > 0) return; - Texture2D tex = GetTexture("CalamityMod/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrenceMonolith_Glow"); + Texture2D tex = Request("CalamityMod/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrenceMonolith_Glow").Value; float drawAngle = Projectile.rotation; Rectangle frame = new Rectangle(0 + (int)Variant * 94, 0, 94, 420); @@ -222,10 +222,9 @@ namespace CalamityMod.Projectiles.Melee float opacity = MathHelper.Clamp(1f - ((Timer - 0.85f) / 0.15f), 0f, 1f); - Main.EntitySpriteDraw(tex, drawPosition, frame, Color.White * opacity, drawAngle, drawOrigin, drawScale, 0f, 0f); + Main.EntitySpriteDraw(tex, drawPosition, frame, Color.White * opacity, drawAngle, drawOrigin, drawScale, 0f, 0); } - public override void SendExtraAI(BinaryWriter writer) { writer.Write(WaitTimer); diff --git a/Projectiles/Melee/TrueBiomeBlade_MercurialTidesShockwave.cs b/Projectiles/Melee/TrueBiomeBlade_MercurialTidesShockwave.cs index e46336e87f..a375ab9917 100644 --- a/Projectiles/Melee/TrueBiomeBlade_MercurialTidesShockwave.cs +++ b/Projectiles/Melee/TrueBiomeBlade_MercurialTidesShockwave.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.timeLeft = 60; } - public override bool CanDamage() => Projectile.timeLeft < 40; + public override bool? CanDamage() => Projectile.timeLeft < 40; public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { @@ -87,13 +87,13 @@ namespace CalamityMod.Projectiles.Melee public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - if (Owner.HeldItem.modItem is OmegaBiomeBlade sword && Main.rand.NextFloat() <= OmegaBiomeBlade.ShockwaveAttunement_BlastProc) + if (Owner.HeldItem.ModItem is OmegaBiomeBlade sword && Main.rand.NextFloat() <= OmegaBiomeBlade.ShockwaveAttunement_BlastProc) sword.OnHitProc = true; } public override bool PreDraw(ref Color lightColor) { - Texture2D tex = GetTexture("CalamityMod/Projectiles/Melee/TrueBiomeBlade_MercurialTidesShockwave"); + Texture2D tex = Request("CalamityMod/Projectiles/Melee/TrueBiomeBlade_MercurialTidesShockwave").Value; float drawAngle = Projectile.rotation; int animFrame = 6 - (int)Math.Ceiling(Projectile.timeLeft / 10f); @@ -102,8 +102,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 drawPosition = Projectile.Center - Main.screenPosition; Vector2 drawOrigin = frame.Size() / 2f; - Main.EntitySpriteDraw(tex, drawPosition, frame, Color.White, drawAngle, drawOrigin, Projectile.scale, 0f, 0f); - + Main.EntitySpriteDraw(tex, drawPosition, frame, Color.White, drawAngle, drawOrigin, Projectile.scale, 0f, 0); return false; } diff --git a/Projectiles/Melee/TrueBiomeBlade_SanguineFury.cs b/Projectiles/Melee/TrueBiomeBlade_SanguineFury.cs index dde2f845c4..4fdb67274f 100644 --- a/Projectiles/Melee/TrueBiomeBlade_SanguineFury.cs +++ b/Projectiles/Melee/TrueBiomeBlade_SanguineFury.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.timeLeft = OmegaBiomeBlade.SuperPogoAttunement_LocalIFrames; } - public override bool CanDamage() + public override bool? CanDamage() { return Projectile.timeLeft <= 2; //Prevent spam click abuse } @@ -155,11 +155,11 @@ namespace CalamityMod.Projectiles.Melee Dashing = false; Owner.velocity *= 0.1f; //Abrupt stop - SoundEngine.PlaySound(Mod.GetLegacySoundSlot(Terraria.ModLoader.SoundType.Custom, "Sounds/Custom/MeatySlash"), Projectile.Center); + SoundEngine.PlaySound(SoundLoader.GetLegacySoundSlot(Mod, "Sounds/Custom/MeatySlash"), Projectile.Center); if (Owner.whoAmI == Main.myPlayer) { - Projectile proj = Projectile.NewProjectileDirect(Owner.Center - DashStart / 2f, Vector2.Zero, ProjectileType(), (int)(Projectile.damage * OmegaBiomeBlade.SuperPogoAttunement_SlashDamageBoost), 0, Owner.whoAmI); - if (proj.modProjectile is SanguineFuryDash dash) + Projectile proj = Projectile.NewProjectileDirect(Projectile.GetProjectileSource_FromThis(), Owner.Center - DashStart / 2f, Vector2.Zero, ProjectileType(), (int)(Projectile.damage * OmegaBiomeBlade.SuperPogoAttunement_SlashDamageBoost), 0, Owner.whoAmI); + if (proj.ModProjectile is SanguineFuryDash dash) { dash.DashStart = DashStart; dash.DashEnd = Owner.Center; @@ -224,7 +224,7 @@ namespace CalamityMod.Projectiles.Melee //Since the iframes vary, adjust the damage to be consistent no matter the iframes. The true scaling happens between the BaseDamage and the FulLChargeDamage public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - if (Owner.HeldItem.modItem is OmegaBiomeBlade sword && Main.rand.NextFloat() <= OmegaBiomeBlade.SuperPogoAttunement_ShredderProc) + if (Owner.HeldItem.ModItem is OmegaBiomeBlade sword && Main.rand.NextFloat() <= OmegaBiomeBlade.SuperPogoAttunement_ShredderProc) sword.OnHitProc = true; float deviationFromBaseDamage = damage / (float)OmegaBiomeBlade.SuperPogoAttunement_BaseDamage; @@ -274,7 +274,7 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(SoundID.NPCHit43, Projectile.Center); if (ShredRatio > 0.8 && Owner.whoAmI == Main.myPlayer) { - Projectile.NewProjectile(Projectile.Center, direction * 16f, ProjectileType(), (int)(Projectile.damage * OmegaBiomeBlade.SuperPogoAttunement_ShotDamageBoost), Projectile.knockBack, Owner.whoAmI, Shred); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, direction * 16f, ProjectileType(), (int)(Projectile.damage * OmegaBiomeBlade.SuperPogoAttunement_ShotDamageBoost), Projectile.knockBack, Owner.whoAmI, Shred); } if (Dashing) { @@ -285,8 +285,8 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - Texture2D handle = GetTexture("CalamityMod/Items/Weapons/Melee/OmegaBiomeBlade"); - Texture2D blade = GetTexture("CalamityMod/Projectiles/Melee/TrueBiomeBlade_SanguineFury"); + Texture2D handle = Request("CalamityMod/Items/Weapons/Melee/OmegaBiomeBlade").Value; + Texture2D blade = Request("CalamityMod/Projectiles/Melee/TrueBiomeBlade_SanguineFury").Value; int bladeAmount = 4; @@ -296,11 +296,11 @@ namespace CalamityMod.Projectiles.Melee Vector2 drawOrigin = new Vector2(0f, handle.Height); Vector2 drawOffset = Owner.Center + direction * 10f - Main.screenPosition; - Main.EntitySpriteDraw(handle, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); + Main.EntitySpriteDraw(handle, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0); //Turn on additive blending Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); GameShaders.Misc["CalamityMod:BasicTint"].UseOpacity(MathHelper.Clamp(BounceTime, 0f, 20f) / 20f); GameShaders.Misc["CalamityMod:BasicTint"].UseColor(new Color(207, 248, 255)); @@ -309,12 +309,12 @@ namespace CalamityMod.Projectiles.Melee //Update the parameters drawOrigin = new Vector2(0f, blade.Height); - Main.EntitySpriteDraw(blade, drawOffset, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); + Main.EntitySpriteDraw(blade, drawOffset, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f, drawRotation, drawOrigin, Projectile.scale, 0f, 0); for (int i = 0; i < bladeAmount; i++) //Draw extra copies { - blade = GetTexture("CalamityMod/Projectiles/Melee/TrueBiomeBlade_SanguineFuryExtra"); + blade = Request("CalamityMod/Projectiles/Melee/TrueBiomeBlade_SanguineFuryExtra").Value; drawAngle = direction.ToRotation(); @@ -327,12 +327,12 @@ namespace CalamityMod.Projectiles.Melee Vector2 drawDisplacementAngle = direction.RotatedBy(MathHelper.PiOver2) * circleCompletion.ToRotationVector2().Y * (20 + 40 * ShredRatio); //How far perpendicularly Vector2 drawOffsetFromBounce = direction * MathHelper.Clamp(BounceTime, 0f, 20f) / 20f * 20f; - Main.EntitySpriteDraw(blade, drawOffsetStraight + drawDisplacementAngle + drawOffsetFromBounce, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.8f, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); + Main.EntitySpriteDraw(blade, drawOffsetStraight + drawDisplacementAngle + drawOffsetFromBounce, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.8f, drawRotation, drawOrigin, Projectile.scale, 0f, 0); } //Back to normal Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); return false; } diff --git a/Projectiles/Melee/TrueBiomeBlade_SanguineFuryDash.cs b/Projectiles/Melee/TrueBiomeBlade_SanguineFuryDash.cs index 1e92f82cde..39d618dbe1 100644 --- a/Projectiles/Melee/TrueBiomeBlade_SanguineFuryDash.cs +++ b/Projectiles/Melee/TrueBiomeBlade_SanguineFuryDash.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Melee { crit = true; - if (Owner.HeldItem.modItem is OmegaBiomeBlade sword && Main.rand.NextFloat() <= OmegaBiomeBlade.SuperPogoAttunement_DashProc) + if (Owner.HeldItem.ModItem is OmegaBiomeBlade sword && Main.rand.NextFloat() <= OmegaBiomeBlade.SuperPogoAttunement_DashProc) sword.OnHitProc = true; Particle bloom = new StrongBloom(target.Center, target.velocity, Color.Crimson * 0.5f, 1f, 30); @@ -60,15 +60,13 @@ namespace CalamityMod.Projectiles.Melee Owner.HealEffect(OmegaBiomeBlade.SuperPogoAttunementSlashLifesteal); } - - public override bool PreDraw(ref Color lightColor) //OMw to reuse way too much code from the entangling vines { Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - Texture2D lineTex = GetTexture("CalamityMod/Particles/ThinEndedLine"); + Texture2D lineTex = Request("CalamityMod/Particles/ThinEndedLine").Value; Vector2 Shake = Projectile.timeLeft < 15 ? Vector2.Zero : Vector2.One.RotatedByRandom(MathHelper.TwoPi) * (15 - Projectile.timeLeft / 5f) * 0.5f; float bump = (float)Math.Sin(((20f - Projectile.timeLeft) / 20f) * MathHelper.Pi); @@ -80,8 +78,8 @@ namespace CalamityMod.Projectiles.Melee Main.EntitySpriteDraw(lineTex, DashStart - Main.screenPosition + Shake, null, Color.Lerp(Color.White, Color.Crimson * 0.7f, raise), rot, origin, scale, SpriteEffects.None, 0); - Texture2D sparkTexture = GetTexture("CalamityMod/Particles/ThinSparkle"); - Texture2D bloomTexture = GetTexture("CalamityMod/Particles/BloomCircle"); + Texture2D sparkTexture = Request("CalamityMod/Particles/ThinSparkle").Value; + Texture2D bloomTexture = Request("CalamityMod/Particles/BloomCircle").Value; //Ajust the bloom's texture to be the same size as the star's float properBloomSize = (float)sparkTexture.Width / (float)bloomTexture.Height; @@ -93,7 +91,7 @@ namespace CalamityMod.Projectiles.Melee //Back to normal Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); return false; } } diff --git a/Projectiles/Melee/TrueBiomeBlade_SanguineFuryWheel.cs b/Projectiles/Melee/TrueBiomeBlade_SanguineFuryWheel.cs index 4bfa4a2be7..71e336f29e 100644 --- a/Projectiles/Melee/TrueBiomeBlade_SanguineFuryWheel.cs +++ b/Projectiles/Melee/TrueBiomeBlade_SanguineFuryWheel.cs @@ -84,18 +84,18 @@ namespace CalamityMod.Projectiles.Melee public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - if (Owner.HeldItem.modItem is OmegaBiomeBlade sword && Main.rand.NextFloat() <= OmegaBiomeBlade.SuperPogoAttunement_WheelProc) + if (Owner.HeldItem.ModItem is OmegaBiomeBlade sword && Main.rand.NextFloat() <= OmegaBiomeBlade.SuperPogoAttunement_WheelProc) sword.OnHitProc = true; } public override bool PreDraw(ref Color lightColor) { Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); for (int i = 0; i < 4; i++) //Draw extra copies { - var tex = GetTexture("CalamityMod/Projectiles/Melee/TrueBiomeBlade_SanguineFuryExtra"); + var tex = Request("CalamityMod/Projectiles/Melee/TrueBiomeBlade_SanguineFuryExtra").Value; float drawAngleWheel = MathHelper.WrapAngle(i * MathHelper.PiOver2 + (Main.GlobalTimeWrappedHourly * 6)); Vector2 drawOrigin = new Vector2(0f, tex.Height); @@ -105,12 +105,12 @@ namespace CalamityMod.Projectiles.Melee float opacityFade = Projectile.timeLeft > 15 ? 1 : Projectile.timeLeft / 15f; - Main.EntitySpriteDraw(tex, drawPositionWheel, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.8f * opacityFade, drawAngleWheel, drawOrigin, Projectile.scale * 0.85f, 0f, 0f); + Main.EntitySpriteDraw(tex, drawPositionWheel, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.8f * opacityFade, drawAngleWheel, drawOrigin, Projectile.scale * 0.85f, 0f, 0); } //Back to normal Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); return false; } @@ -124,6 +124,5 @@ namespace CalamityMod.Projectiles.Melee GeneralParticleHandler.SpawnParticle(Sparkle); } } - } } diff --git a/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPride.cs b/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPride.cs index 4d2054ef4e..b2e36a0146 100644 --- a/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPride.cs +++ b/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPride.cs @@ -149,7 +149,7 @@ namespace CalamityMod.Projectiles.Melee { shotDirection = (shotDirection.ToRotation().AngleTowards(Owner.AngleTo(lastTarget.Center), MathHelper.PiOver2)).ToRotationVector2() * 15f; } - Projectile.NewProjectile(Owner.Center, shotDirection, ProjectileType(), (int)(Projectile.damage * OmegaBiomeBlade.WhirlwindAttunement_BeamDamageReduction), 0f, Owner.whoAmI); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Owner.Center, shotDirection, ProjectileType(), (int)(Projectile.damage * OmegaBiomeBlade.WhirlwindAttunement_BeamDamageReduction), 0f, Owner.whoAmI); } @@ -197,7 +197,7 @@ namespace CalamityMod.Projectiles.Melee if (Owner.whoAmI == Main.myPlayer) { - Projectile.NewProjectile(Owner.Center, Owner.SafeDirectionTo(Main.MouseWorld, Vector2.One) * 15f, ProjectileType(), (int)(Projectile.damage * OmegaBiomeBlade.WhirlwindAttunement_BeamDamageReduction), 0f, Owner.whoAmI); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Owner.Center, Owner.SafeDirectionTo(Main.MouseWorld, Vector2.One) * 15f, ProjectileType(), (int)(Projectile.damage * OmegaBiomeBlade.WhirlwindAttunement_BeamDamageReduction), 0f, Owner.whoAmI); } CanDirectFire = false; AngleReset = Owner.SafeDirectionTo(Main.MouseWorld, Vector2.One).ToRotation(); @@ -260,12 +260,12 @@ namespace CalamityMod.Projectiles.Melee if (CurrentState != 1) { - if (Owner.HeldItem.modItem is OmegaBiomeBlade sword && Main.rand.NextFloat() <= OmegaBiomeBlade.WhirlwindAttunement_WhirlwindProc) + if (Owner.HeldItem.ModItem is OmegaBiomeBlade sword && Main.rand.NextFloat() <= OmegaBiomeBlade.WhirlwindAttunement_WhirlwindProc) sword.OnHitProc = true; return; } - if (Owner.HeldItem.modItem is OmegaBiomeBlade blade && Main.rand.NextFloat() <= OmegaBiomeBlade.WhirlwindAttunement_SwordThrowProc) + if (Owner.HeldItem.ModItem is OmegaBiomeBlade blade && Main.rand.NextFloat() <= OmegaBiomeBlade.WhirlwindAttunement_SwordThrowProc) blade.OnHitProc = true; lastTarget = target; @@ -279,7 +279,7 @@ namespace CalamityMod.Projectiles.Melee return; } } - Projectile sigil = Projectile.NewProjectileDirect(target.Center, Vector2.Zero, ProjectileType(), 0, 0, Owner.whoAmI, target.whoAmI); + Projectile sigil = Projectile.NewProjectileDirect(Projectile.GetProjectileSource_FromThis(), target.Center, Vector2.Zero, ProjectileType(), 0, 0, Owner.whoAmI, target.whoAmI); sigil.timeLeft = OmegaBiomeBlade.WhirlwindAttunement_SigilTime; } @@ -293,8 +293,8 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - Texture2D handle = GetTexture("CalamityMod/Items/Weapons/Melee/OmegaBiomeBlade"); - Texture2D blade = GetTexture("CalamityMod/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPride"); + Texture2D handle = Request("CalamityMod/Items/Weapons/Melee/OmegaBiomeBlade").Value; + Texture2D blade = Request("CalamityMod/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPride").Value; float drawAngle = direction.ToRotation(); float drawRotation = drawAngle + MathHelper.PiOver4; @@ -302,11 +302,11 @@ namespace CalamityMod.Projectiles.Melee Vector2 drawOrigin = new Vector2(0f, handle.Height); Vector2 drawOffset = Projectile.Center - Main.screenPosition; - Main.EntitySpriteDraw(handle, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); + Main.EntitySpriteDraw(handle, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0); //Turn on additive blending Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); //Update the parameters drawOrigin = new Vector2(0f, blade.Height); @@ -331,7 +331,7 @@ namespace CalamityMod.Projectiles.Melee GameShaders.Misc["CalamityMod:BasicTint"].Apply(); } - Main.EntitySpriteDraw(blade, drawOffset, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f * opacityFade, drawRotation, drawOrigin, Projectile.scale, 0f, 0f); + Main.EntitySpriteDraw(blade, drawOffset, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f * opacityFade, drawRotation, drawOrigin, Projectile.scale, 0f, 0); if (CurrentState == 1f && snapTimer > 0) { @@ -340,14 +340,14 @@ namespace CalamityMod.Projectiles.Melee //Back to normal Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); return false; } public void drawChain(float snapProgress, float retractProgress) { - Texture2D chainTex = GetTexture("CalamityMod/Projectiles/Melee/MendedBiomeBlade_HeavensMightChain"); + Texture2D chainTex = Request("CalamityMod/Projectiles/Melee/MendedBiomeBlade_HeavensMightChain").Value; float opacity = retractProgress < 0.5 ? 1 : (retractProgress - 0.5f) / 0.5f; diff --git a/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPrideBeam.cs b/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPrideBeam.cs index 24d6793fcb..852e982776 100644 --- a/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPrideBeam.cs +++ b/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPrideBeam.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Melee { Projectile.width = Projectile.height = 32; Projectile.aiStyle = 27; - aiType = ProjectileID.LightBeam; + AIType = ProjectileID.LightBeam; Projectile.friendly = true; Projectile.penetrate = 1; Projectile.timeLeft = 80; @@ -77,14 +77,14 @@ namespace CalamityMod.Projectiles.Melee DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); Main.spriteBatch.End(); //Haha sup babe what if i restarted the spritebatch way too many times haha /blushes - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); Texture2D tex = ModContent.Request(Texture).Value; - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Color.Lerp(Color.HotPink, Color.GreenYellow, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 2f)), Projectile.rotation, tex.Size() * 0.5f, 1f, 0f, 0f); + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Color.Lerp(Color.HotPink, Color.GreenYellow, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 2f)), Projectile.rotation, tex.Size() * 0.5f, 1f, 0f, 0); Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); return false; } @@ -108,7 +108,7 @@ namespace CalamityMod.Projectiles.Melee } public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { - if (Owner.HeldItem.modItem is OmegaBiomeBlade sword && Main.rand.NextFloat() <= OmegaBiomeBlade.WhirlwindAttunement_SwordBeamProc) + if (Owner.HeldItem.ModItem is OmegaBiomeBlade sword && Main.rand.NextFloat() <= OmegaBiomeBlade.WhirlwindAttunement_SwordBeamProc) sword.OnHitProc = true; } diff --git a/Projectiles/Melee/TumbleweedFlail.cs b/Projectiles/Melee/TumbleweedFlail.cs index a0fd421b21..573a8fe4a3 100644 --- a/Projectiles/Melee/TumbleweedFlail.cs +++ b/Projectiles/Melee/TumbleweedFlail.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using Terraria; @@ -97,8 +97,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { Vector2 mountedCenter = Main.player[Projectile.owner].MountedCenter; - Color transparent = Microsoft.Xna.Framework.Color.Transparent; - Texture2D texture2D2 = ModContent.Request("CalamityMod/ExtraTextures/Chains/TumbleweedChain"); + Texture2D texture2D2 = ModContent.Request("CalamityMod/ExtraTextures/Chains/TumbleweedChain").Value; Vector2 vector17 = Projectile.Center; Rectangle? sourceRectangle = null; Vector2 origin = new Vector2((float)texture2D2.Width * 0.5f, (float)texture2D2.Height * 0.5f); @@ -156,7 +155,7 @@ namespace CalamityMod.Projectiles.Melee } if (Projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, Projectile.velocity.X, Projectile.velocity.Y, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, Projectile.velocity.X, Projectile.velocity.Y, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Main.myPlayer, 0f, 0f); } Projectile.Kill(); } diff --git a/Projectiles/Melee/TumbleweedRolling.cs b/Projectiles/Melee/TumbleweedRolling.cs index bfaf011c05..715bff23bf 100644 --- a/Projectiles/Melee/TumbleweedRolling.cs +++ b/Projectiles/Melee/TumbleweedRolling.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -46,6 +46,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { + // TODO -- Make this use proper i-frame variables. target.immune[Projectile.owner] = 5; } diff --git a/Projectiles/Melee/UrchinBall.cs b/Projectiles/Melee/UrchinBall.cs index 3572cdf0da..ba9ae8279c 100644 --- a/Projectiles/Melee/UrchinBall.cs +++ b/Projectiles/Melee/UrchinBall.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using Terraria; @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Melee if (spike) { spike = false; - Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, Projectile.velocity.X, Projectile.velocity.Y, ModContent.ProjectileType(), (int)((double)Projectile.damage * 0.5), 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, Projectile.velocity.X, Projectile.velocity.Y, ModContent.ProjectileType(), (int)((double)Projectile.damage * 0.5), 0f, Main.myPlayer, 0f, 0f); } Projectile.usesLocalNPCImmunity = false; float num693 = vector62.Length(); @@ -108,8 +108,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { Vector2 mountedCenter = Main.player[Projectile.owner].MountedCenter; - Color transparent = Microsoft.Xna.Framework.Color.Transparent; - Texture2D texture2D2 = ModContent.Request("CalamityMod/ExtraTextures/Chains/UrchinFlailChain"); + Texture2D texture2D2 = ModContent.Request("CalamityMod/ExtraTextures/Chains/UrchinFlailChain").Value; Vector2 vector17 = Projectile.Center; Rectangle? sourceRectangle = null; Vector2 origin = new Vector2((float)texture2D2.Width * 0.5f, (float)texture2D2.Height * 0.5f); diff --git a/Projectiles/Melee/UrchinBallSpike.cs b/Projectiles/Melee/UrchinBallSpike.cs index 18e64b82f1..d7e2d3e7df 100644 --- a/Projectiles/Melee/UrchinBallSpike.cs +++ b/Projectiles/Melee/UrchinBallSpike.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.ignoreWater = true; Projectile.DamageType = DamageClass.Melee; Projectile.penetrate = -1; - aiType = ProjectileID.BoneJavelin; + AIType = ProjectileID.BoneJavelin; } public override void AI() diff --git a/Projectiles/Melee/ViolenceSlashProjectile.cs b/Projectiles/Melee/ViolenceSlashProjectile.cs index 8406404490..82653bee55 100644 --- a/Projectiles/Melee/ViolenceSlashProjectile.cs +++ b/Projectiles/Melee/ViolenceSlashProjectile.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using System.Collections.Generic; @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { // Fade in. - Projectile.Opacity = Utils.InverseLerp(0f, 15f, Time, true); + Projectile.Opacity = Utils.GetLerpValue(0f, 15f, Time, true); if (!Owner.channel) { @@ -83,13 +83,13 @@ namespace CalamityMod.Projectiles.Melee internal Color PrimitiveColorFunction(float completionRatio) { float averageRotation = Projectile.oldRot.Average(angle => MathHelper.WrapAngle(angle) + MathHelper.Pi); - float opacity = Projectile.Opacity * Utils.InverseLerp(0.75f, 0.45f, completionRatio, true) * 0.5f; - opacity *= Utils.InverseLerp(0.125f, 0.15f, Math.Abs(SwingSine), true); + float opacity = Projectile.Opacity * Utils.GetLerpValue(0.75f, 0.45f, completionRatio, true) * 0.5f; + opacity *= Utils.GetLerpValue(0.125f, 0.15f, Math.Abs(SwingSine), true); float rotationAdjusted = MathHelper.WrapAngle(Projectile.rotation) + MathHelper.Pi; float oldRotationAdjusted = MathHelper.WrapAngle(Projectile.oldRot[1]) + MathHelper.Pi; - return Color.Lerp(Color.Red * 1.1f, Color.DarkRed, Utils.InverseLerp(0f, 0.5f, completionRatio, true)) * opacity; + return Color.Lerp(Color.Red * 1.1f, Color.DarkRed, Utils.GetLerpValue(0f, 0.5f, completionRatio, true)) * opacity; } internal float PrimitiveWidthFunction(float completionRatio) => Projectile.height * 0.48f; @@ -99,7 +99,7 @@ namespace CalamityMod.Projectiles.Melee if (SliceAfterimageDrawer is null) SliceAfterimageDrawer = new PrimitiveTrail(PrimitiveWidthFunction, PrimitiveColorFunction, specialShader: GameShaders.Misc["CalamityMod:PhaseslayerRipEffect"]); - GameShaders.Misc["CalamityMod:PhaseslayerRipEffect"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/SwordSlashTexture")); + GameShaders.Misc["CalamityMod:PhaseslayerRipEffect"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/SwordSlashTexture").Value); Texture2D spearProjectile = ModContent.Request(Texture).Value; diff --git a/Projectiles/Melee/ViolenceThrownProjectile.cs b/Projectiles/Melee/ViolenceThrownProjectile.cs index b55946ce47..528e43306c 100644 --- a/Projectiles/Melee/ViolenceThrownProjectile.cs +++ b/Projectiles/Melee/ViolenceThrownProjectile.cs @@ -1,4 +1,4 @@ -using CalamityMod.Particles; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { // Fade in. - Projectile.Opacity = Utils.InverseLerp(0f, 15f, Time, true); + Projectile.Opacity = Utils.GetLerpValue(0f, 15f, Time, true); if (Owner.channel) { @@ -84,7 +84,7 @@ namespace CalamityMod.Projectiles.Melee { for (int i = 0; i < 75; i++) { - Dust fire = Dust.NewDustPerfect(Owner.Center, DustID.Fire); + Dust fire = Dust.NewDustPerfect(Owner.Center, 6); fire.velocity = (MathHelper.TwoPi * i / 75f).ToRotationVector2() * 4f - Vector2.UnitY * 3f; fire.scale = 1.4f; fire.noGravity = true; @@ -106,7 +106,7 @@ namespace CalamityMod.Projectiles.Melee // Play a splatter and impact sound. SoundEngine.PlaySound(SoundID.DD2_CrystalCartImpact, Projectile.Center); - float damageInterpolant = Utils.InverseLerp(950f, 2000f, damage, true); + float damageInterpolant = Utils.GetLerpValue(950f, 2000f, damage, true); float impactAngularVelocity = MathHelper.Lerp(0.08f, 0.2f, damageInterpolant); float impactParticleScale = MathHelper.Lerp(0.6f, 1f, damageInterpolant); impactAngularVelocity *= Main.rand.NextBool().ToDirectionInt() * Main.rand.NextFloat(0.75f, 1.25f); @@ -173,8 +173,8 @@ namespace CalamityMod.Projectiles.Melee internal float PrimitiveWidthFunction(float completionRatio) { - float tipWidthFactor = MathHelper.SmoothStep(0f, 1f, Utils.InverseLerp(0.01f, 0.04f, completionRatio)); - float bodyWidthFactor = (float)Math.Pow(Utils.InverseLerp(1f, 0.04f, completionRatio), 0.9D); + float tipWidthFactor = MathHelper.SmoothStep(0f, 1f, Utils.GetLerpValue(0.01f, 0.04f, completionRatio)); + float bodyWidthFactor = (float)Math.Pow(Utils.GetLerpValue(1f, 0.04f, completionRatio), 0.9D); return (float)Math.Pow(tipWidthFactor * bodyWidthFactor, 0.1D) * 30f; } @@ -198,7 +198,7 @@ namespace CalamityMod.Projectiles.Melee if (StreakDrawer is null) StreakDrawer = new PrimitiveTrail(PrimitiveWidthFunction, PrimitiveColorFunction, specialShader: GameShaders.Misc["CalamityMod:TrailStreak"]); - GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/FabstaffStreak")); + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/FabstaffStreak").Value); Texture2D spearProjectile = ModContent.Request(Texture).Value; @@ -225,7 +225,7 @@ namespace CalamityMod.Projectiles.Melee if (Owner.channel) rotation += 0.2f; - Color afterimageColor = Color.Lerp(lightColor, Color.Transparent, 1f - (float)Math.Pow(Utils.InverseLerp(0, 6, i), 1.4D)) * Projectile.Opacity; + Color afterimageColor = Color.Lerp(lightColor, Color.Transparent, 1f - (float)Math.Pow(Utils.GetLerpValue(0, 6, i), 1.4D)) * Projectile.Opacity; Main.EntitySpriteDraw(spearProjectile, drawPosition, null, afterimageColor, rotation, spearProjectile.Size() * 0.5f, Projectile.scale, SpriteEffects.None, 0); } diff --git a/Projectiles/Melee/VoidEssence.cs b/Projectiles/Melee/VoidEssence.cs index d7ac8a3f21..d838681238 100644 --- a/Projectiles/Melee/VoidEssence.cs +++ b/Projectiles/Melee/VoidEssence.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -42,8 +42,8 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - drawOffsetX = 1; - drawOriginOffsetY = 4; + DrawOffsetX = 1; + DrawOriginOffsetY = 4; // Update animation Projectile.frameCounter++; @@ -203,7 +203,7 @@ namespace CalamityMod.Projectiles.Melee ai1 *= Main.rand.NextBool() ? -1f : 1f; if (Projectile.owner == Main.myPlayer) - Projectile.NewProjectile(Projectile.Center, tentacleVelocity, ModContent.ProjectileType(), damage, kb, Projectile.owner, ai0, ai1); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, tentacleVelocity, ModContent.ProjectileType(), damage, kb, Projectile.owner, ai0, ai1); } } } diff --git a/Projectiles/Melee/VoidTentacle.cs b/Projectiles/Melee/VoidTentacle.cs index 4d1939a806..23be9a8f7f 100644 --- a/Projectiles/Melee/VoidTentacle.cs +++ b/Projectiles/Melee/VoidTentacle.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using System; using Terraria; using Terraria.ModLoader; @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.penetrate = -1; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 4; + Projectile.localNPCHitCooldown = Projectile.MaxUpdates * 10; } public override void AI() diff --git a/Projectiles/Melee/WhiteBoltAura.cs b/Projectiles/Melee/WhiteBoltAura.cs index b8eaccad86..ea00a315ac 100644 --- a/Projectiles/Melee/WhiteBoltAura.cs +++ b/Projectiles/Melee/WhiteBoltAura.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Melee { int num414 = (int)(Projectile.position.X + 14f + (float)Main.rand.Next(Projectile.width - 28)); int num415 = (int)(Projectile.position.Y + (float)Projectile.height + 4f); - Projectile.NewProjectile((float)num414, (float)num415, 0f, 5f, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), (float)num414, (float)num415, 0f, 5f, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Melee/WhiteBoltAuraBlah.cs b/Projectiles/Melee/WhiteBoltAuraBlah.cs index e7b7afa092..5fff283599 100644 --- a/Projectiles/Melee/WhiteBoltAuraBlah.cs +++ b/Projectiles/Melee/WhiteBoltAuraBlah.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Melee { int num414 = (int)(Projectile.position.X + 14f + (float)Main.rand.Next(Projectile.width - 28)); int num415 = (int)(Projectile.position.Y + (float)Projectile.height + 4f); - Projectile.NewProjectile((float)num414, (float)num415, 0f, 10f, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), (float)num414, (float)num415, 0f, 10f, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Melee/YateveoBloomProj.cs b/Projectiles/Melee/YateveoBloomProj.cs index 86197046c2..3c396ddd27 100644 --- a/Projectiles/Melee/YateveoBloomProj.cs +++ b/Projectiles/Melee/YateveoBloomProj.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using Terraria; @@ -186,8 +186,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { Vector2 mountedCenter = Main.player[Projectile.owner].MountedCenter; - Color transparent = Microsoft.Xna.Framework.Color.Transparent; - Texture2D texture2D2 = ModContent.Request("CalamityMod/ExtraTextures/Chains/YateveoBloomChain"); + Texture2D texture2D2 = ModContent.Request("CalamityMod/ExtraTextures/Chains/YateveoBloomChain").Value; Vector2 vector17 = Projectile.Center; Rectangle? sourceRectangle = null; Vector2 origin = new Vector2((float)texture2D2.Width * 0.5f, (float)texture2D2.Height * 0.5f); diff --git a/Projectiles/Melee/Yoyos/AzathothYoyo.cs b/Projectiles/Melee/Yoyos/AzathothYoyo.cs index 4de543196b..1374550d3c 100644 --- a/Projectiles/Melee/Yoyos/AzathothYoyo.cs +++ b/Projectiles/Melee/Yoyos/AzathothYoyo.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos if (Main.rand.NextBool(6)) { if (Projectile.owner == Main.myPlayer) - Projectile.NewProjectile(Projectile.Center, Projectile.velocity * 0.35f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, Projectile.velocity * 0.35f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); } if ((Projectile.position - Main.player[Projectile.owner].position).Length() > 3200f) //200 blocks Projectile.Kill(); diff --git a/Projectiles/Melee/Yoyos/ChaotrixYoyo.cs b/Projectiles/Melee/Yoyos/ChaotrixYoyo.cs index 4b5a41e273..c9210dfb64 100644 --- a/Projectiles/Melee/Yoyos/ChaotrixYoyo.cs +++ b/Projectiles/Melee/Yoyos/ChaotrixYoyo.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos target.AddBuff(BuffID.OnFire, 240); if (Projectile.owner == Main.myPlayer) { - int boom = Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + int boom = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); if (boom.WithinBounds(Main.maxProjectiles)) Main.projectile[boom].Calamity().forceMelee = true; } diff --git a/Projectiles/Melee/Yoyos/MicrowaveYoyo.cs b/Projectiles/Melee/Yoyos/MicrowaveYoyo.cs index 97393fe895..d8598dca4b 100644 --- a/Projectiles/Melee/Yoyos/MicrowaveYoyo.cs +++ b/Projectiles/Melee/Yoyos/MicrowaveYoyo.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Audio; @@ -51,10 +51,11 @@ namespace CalamityMod.Projectiles.Melee.Yoyos // Sound is done manually, so that it can loop correctly. if (mmmmmm is null) { - mmmmmm = ModContent.GetSound("CalamityMod/Sounds/Custom/MMMMMMMMMMMMM").CreateInstance(); + mmmmmm = ModContent.Request("CalamityMod/Sounds/Custom/MMMMMMMMMMMMM").Value.Sound.Value.CreateInstance(); mmmmmm.IsLooped = true; CalamityUtils.ApplySoundStats(ref mmmmmm, Projectile.Center); - Main.PlaySoundInstance(mmmmmm); + mmmmmm.Play(); + SoundInstanceGarbageCollector.Track(mmmmmm); } else if (!mmmmmm.IsDisposed) CalamityUtils.ApplySoundStats(ref mmmmmm, Projectile.Center); @@ -62,7 +63,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos // Spawn invisible but damaging aura projectile if (Projectile.owner == Main.myPlayer && !spawnedAura) { - Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.35), Projectile.knockBack, Projectile.owner, Projectile.identity, 0f); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.35), Projectile.knockBack, Projectile.owner, Projectile.identity, 0f); spawnedAura = true; } @@ -110,7 +111,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void PostDraw(Color lightColor) { Rectangle frame = new Rectangle(0, 0, 20, 16); - Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Projectiles/Melee/Yoyos/MicrowaveYoyoGlow"), Projectile.Center - Main.screenPosition, frame, Color.White, Projectile.rotation, Projectile.Size / 2, 1f, SpriteEffects.None, 0); + Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Projectiles/Melee/Yoyos/MicrowaveYoyoGlow").Value, Projectile.Center - Main.screenPosition, frame, Color.White, Projectile.rotation, Projectile.Size / 2, 1f, SpriteEffects.None, 0); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -118,7 +119,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos target.AddBuff(ModContent.BuffType(), 240); if (target.life <= 0 && soundCooldown <= 0) { - SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/MicrowaveBeep"), (int)Projectile.Center.X, (int)Projectile.Center.Y); + SoundEngine.PlaySound(SoundLoader.GetLegacySoundSlot(Mod, "Sounds/Custom/MicrowaveBeep"), (int)Projectile.Center.X, (int)Projectile.Center.Y); soundCooldown = 45; } } @@ -128,7 +129,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos target.AddBuff(ModContent.BuffType(), 240); if (target.statLife <= 0 && soundCooldown <= 0) { - SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/MicrowaveBeep"), (int)Projectile.Center.X, (int)Projectile.Center.Y); + SoundEngine.PlaySound(SoundLoader.GetLegacySoundSlot(Mod, "Sounds/Custom/MicrowaveBeep"), (int)Projectile.Center.X, (int)Projectile.Center.Y); soundCooldown = 45; } } diff --git a/Projectiles/Melee/Yoyos/ObliteratorYoyo.cs b/Projectiles/Melee/Yoyos/ObliteratorYoyo.cs index 7fde7a9c7c..5a4ec0c265 100644 --- a/Projectiles/Melee/Yoyos/ObliteratorYoyo.cs +++ b/Projectiles/Melee/Yoyos/ObliteratorYoyo.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System.Collections.Generic; using Terraria; @@ -103,7 +103,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos velocity = velocity.SafeNormalize(Vector2.Zero) * laserSpeed; if (Projectile.owner == Main.myPlayer) { - int proj = Projectile.NewProjectile(laserSpawnPosition, velocity, ModContent.ProjectileType(), laserDamage, laserKB, Projectile.owner); + int proj = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), laserSpawnPosition, velocity, ModContent.ProjectileType(), laserDamage, laserKB, Projectile.owner); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().forceMelee = true; } @@ -119,7 +119,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void PostDraw(Color lightColor) { Vector2 origin = new Vector2(10f, 10f); - Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Projectiles/Melee/Yoyos/ObliteratorYoyoGlow"), Projectile.Center - Main.screenPosition, null, Color.White, Projectile.rotation, origin, 2f, SpriteEffects.None, 0); + Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Projectiles/Melee/Yoyos/ObliteratorYoyoGlow").Value, Projectile.Center - Main.screenPosition, null, Color.White, Projectile.rotation, origin, 2f, SpriteEffects.None, 0); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Melee/Yoyos/OracleYoyo.cs b/Projectiles/Melee/Yoyos/OracleYoyo.cs index 407d76b2d2..ae521a24ff 100644 --- a/Projectiles/Melee/Yoyos/OracleYoyo.cs +++ b/Projectiles/Melee/Yoyos/OracleYoyo.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Items.Weapons.Melee; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -243,7 +243,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos int finalDamage = (int)(baseDamage * owner.MeleeDamage()); if (Projectile.owner == Main.myPlayer) { - Projectile p = Projectile.NewProjectileDirect(target.Center, Vector2.Zero, ModContent.ProjectileType(), finalDamage, 0f, Projectile.owner, i); + Projectile p = Projectile.NewProjectileDirect(Projectile.GetProjectileSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), finalDamage, 0f, Projectile.owner, i); if (p.whoAmI.WithinBounds(Main.maxProjectiles)) { p.DamageType = DamageClass.Melee; @@ -274,7 +274,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos velocity.Normalize(); velocity *= 18f; if (Projectile.owner == Main.myPlayer) - Projectile.NewProjectile(Projectile.Center + posVec, velocity, orbID, orbDamage, orbKB, Main.myPlayer, 0.0f, 0.0f); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center + posVec, velocity, orbID, orbDamage, orbKB, Main.myPlayer, 0.0f, 0.0f); } } } diff --git a/Projectiles/Melee/Yoyos/QuagmireYoyo.cs b/Projectiles/Melee/Yoyos/QuagmireYoyo.cs index 4c8ec6a57a..1b6ff61401 100644 --- a/Projectiles/Melee/Yoyos/QuagmireYoyo.cs +++ b/Projectiles/Melee/Yoyos/QuagmireYoyo.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos int proj; if (Main.rand.NextBool(10)) { - proj = Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, Projectile.velocity.X * 0.35f, Projectile.velocity.Y * 0.35f, ProjectileID.SporeGas, (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner); + proj = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, Projectile.velocity.X * 0.35f, Projectile.velocity.Y * 0.35f, ProjectileID.SporeGas, (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner); if (proj.WithinBounds(Main.maxProjectiles)) { Main.projectile[proj].Calamity().forceMelee = true; @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos } if (Main.rand.NextBool(30)) { - proj = Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f, ProjectileID.SporeGas2, (int)(Projectile.damage * 0.6), Projectile.knockBack, Projectile.owner); + proj = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f, ProjectileID.SporeGas2, (int)(Projectile.damage * 0.6), Projectile.knockBack, Projectile.owner); if (proj.WithinBounds(Main.maxProjectiles)) { Main.projectile[proj].Calamity().forceMelee = true; @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos } if (Main.rand.NextBool(50)) { - proj = Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, Projectile.velocity.X * 0.15f, Projectile.velocity.Y * 0.15f, ProjectileID.SporeGas3, (int)(Projectile.damage * 0.7), Projectile.knockBack, Projectile.owner); + proj = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, Projectile.velocity.X * 0.15f, Projectile.velocity.Y * 0.15f, ProjectileID.SporeGas3, (int)(Projectile.damage * 0.7), Projectile.knockBack, Projectile.owner); if (proj.WithinBounds(Main.maxProjectiles)) { Main.projectile[proj].Calamity().forceMelee = true; diff --git a/Projectiles/Melee/Yoyos/RiptideYoyo.cs b/Projectiles/Melee/Yoyos/RiptideYoyo.cs index 9873a860a3..d239084a9c 100644 --- a/Projectiles/Melee/Yoyos/RiptideYoyo.cs +++ b/Projectiles/Melee/Yoyos/RiptideYoyo.cs @@ -38,28 +38,28 @@ namespace CalamityMod.Projectiles.Melee.Yoyos switch (Main.rand.Next(1, 9)) { case 1: - Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, 0, -10, ModContent.ProjectileType(), 4, 0.0f, Projectile.owner, 1.2f/*X Increment*/, 0.2f/*Y Increment*/); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, 0, -10, ModContent.ProjectileType(), 4, 0.0f, Projectile.owner, 1.2f/*X Increment*/, 0.2f/*Y Increment*/); break; case 2: - Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, 5, -5, ModContent.ProjectileType(), 4, 0.0f, Projectile.owner, 0.7f/*X Increment*/, 0.7f/*Y Increment*/); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, 5, -5, ModContent.ProjectileType(), 4, 0.0f, Projectile.owner, 0.7f/*X Increment*/, 0.7f/*Y Increment*/); break; case 3: - Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, 10, 0, ModContent.ProjectileType(), 4, 0.0f, Projectile.owner, 0.2f/*X Increment*/, 1.2f/*Y Increment*/); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, 10, 0, ModContent.ProjectileType(), 4, 0.0f, Projectile.owner, 0.2f/*X Increment*/, 1.2f/*Y Increment*/); break; case 4: - Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, 5, 5, ModContent.ProjectileType(), 4, 0.0f, Projectile.owner, -0.7f/*X Increment*/, 0.7f/*Y Increment*/); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, 5, 5, ModContent.ProjectileType(), 4, 0.0f, Projectile.owner, -0.7f/*X Increment*/, 0.7f/*Y Increment*/); break; case 5: - Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, -0, 10, ModContent.ProjectileType(), 4, 0.0f, Projectile.owner, -1.2f/*X Increment*/, -0.2f/*Y Increment*/); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, -0, 10, ModContent.ProjectileType(), 4, 0.0f, Projectile.owner, -1.2f/*X Increment*/, -0.2f/*Y Increment*/); break; case 6: - Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, -5, 5, ModContent.ProjectileType(), 4, 0.0f, Projectile.owner, -0.7f/*X Increment*/, -0.7f/*Y Increment*/); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, -5, 5, ModContent.ProjectileType(), 4, 0.0f, Projectile.owner, -0.7f/*X Increment*/, -0.7f/*Y Increment*/); break; case 7: - Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, -10, -0, ModContent.ProjectileType(), 4, 0.0f, Projectile.owner, -0.2f/*X Increment*/, -1.2f/*Y Increment*/); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, -10, -0, ModContent.ProjectileType(), 4, 0.0f, Projectile.owner, -0.2f/*X Increment*/, -1.2f/*Y Increment*/); break; case 8: - Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, -10, -10, ModContent.ProjectileType(), 4, 0.0f, Projectile.owner, 0.7f/*X Increment*/, -0.7f/*Y Increment*/); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, -10, -10, ModContent.ProjectileType(), 4, 0.0f, Projectile.owner, 0.7f/*X Increment*/, -0.7f/*Y Increment*/); break; } } diff --git a/Projectiles/Melee/Yoyos/SolarFlareYoyo.cs b/Projectiles/Melee/Yoyos/SolarFlareYoyo.cs index a13281b25d..800037feb3 100644 --- a/Projectiles/Melee/Yoyos/SolarFlareYoyo.cs +++ b/Projectiles/Melee/Yoyos/SolarFlareYoyo.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos target.AddBuff(ModContent.BuffType(), 240); if (Projectile.owner == Main.myPlayer) { - int proj = Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.75), Projectile.knockBack, Projectile.owner); + int proj = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.75), Projectile.knockBack, Projectile.owner); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().forceMelee = true; } diff --git a/Projectiles/Melee/Yoyos/SulphurousGrabberYoyo.cs b/Projectiles/Melee/Yoyos/SulphurousGrabberYoyo.cs index 04c02a01dd..89a415be7d 100644 --- a/Projectiles/Melee/Yoyos/SulphurousGrabberYoyo.cs +++ b/Projectiles/Melee/Yoyos/SulphurousGrabberYoyo.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -89,7 +89,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos if (Main.rand.NextBool(10)) projType = ModContent.ProjectileType(); float angle = MathHelper.TwoPi / bubbleAmt * i + (float)Math.Sin(arbitraryTimer / 20f) * MathHelper.PiOver2; - Projectile.NewProjectile(Projectile.Center, angle.ToRotationVector2() * 8f, projType, Projectile.damage / 4, Projectile.knockBack / 4, Projectile.owner); + Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, angle.ToRotationVector2() * 8f, projType, Projectile.damage / 4, Projectile.knockBack / 4, Projectile.owner); } bubbleCounter = 0; } @@ -105,7 +105,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); if (bubbleStronk) { - tex = ModContent.Request("CalamityMod/Projectiles/Melee/Yoyos/SulphurousGrabberYoyoBubble"); + tex = ModContent.Request("CalamityMod/Projectiles/Melee/Yoyos/SulphurousGrabberYoyoBubble").Value; CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1, tex); } return false; diff --git a/Projectiles/Ranged/HandheldTankShell.cs b/Projectiles/Ranged/HandheldTankShell.cs index 5b10589e70..c1abc70cf6 100644 --- a/Projectiles/Ranged/HandheldTankShell.cs +++ b/Projectiles/Ranged/HandheldTankShell.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -26,9 +26,9 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - drawOffsetX = -8; - drawOriginOffsetY = 0; - drawOriginOffsetX = -2; + DrawOffsetX = -8; + DrawOriginOffsetY = 0; + DrawOriginOffsetX = -2; Projectile.rotation = Projectile.velocity.ToRotation(); Vector2 pos = Projectile.Center; Projectile.localAI[0] += 1f; diff --git a/Projectiles/Rogue/ButcherKnife.cs b/Projectiles/Rogue/ButcherKnife.cs index 2f8a216360..d91bbfb2df 100644 --- a/Projectiles/Rogue/ButcherKnife.cs +++ b/Projectiles/Rogue/ButcherKnife.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using Terraria; @@ -40,9 +40,9 @@ namespace CalamityMod.Projectiles.Rogue { Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 5, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } - drawOffsetX = -11; - drawOriginOffsetY = -10; - drawOriginOffsetX = 0; + DrawOffsetX = -11; + DrawOriginOffsetY = -10; + DrawOriginOffsetX = 0; // ai[0] stores whether the knife is returning. If 0, it isn't. If 1, it is. if (Projectile.ai[0] == 0f) diff --git a/Projectiles/Rogue/CinquedeaProj.cs b/Projectiles/Rogue/CinquedeaProj.cs index 50153e46f5..8679de8f75 100644 --- a/Projectiles/Rogue/CinquedeaProj.cs +++ b/Projectiles/Rogue/CinquedeaProj.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; @@ -33,8 +33,8 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { - drawOriginOffsetY = 11; - drawOffsetX = -22; + DrawOriginOffsetY = 11; + DrawOffsetX = -22; bool stealthstrike = Projectile.ai[1] == 1 && Projectile.penetrate == 1; if (Projectile.spriteDirection == 1) diff --git a/Projectiles/Rogue/GlaiveProj.cs b/Projectiles/Rogue/GlaiveProj.cs index 67464519d1..e54feb8d05 100644 --- a/Projectiles/Rogue/GlaiveProj.cs +++ b/Projectiles/Rogue/GlaiveProj.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Rogue; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -31,7 +31,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.tileCollide = true; Projectile.penetrate = 3; Projectile.timeLeft = Lifetime; - drawOffsetX = -10; + DrawOffsetX = -10; Projectile.Calamity().rogue = true; } diff --git a/Projectiles/Rogue/MonkeyDart.cs b/Projectiles/Rogue/MonkeyDart.cs index 69ed787fd4..fc65a2bba5 100644 --- a/Projectiles/Rogue/MonkeyDart.cs +++ b/Projectiles/Rogue/MonkeyDart.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Rogue; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -23,9 +23,9 @@ namespace CalamityMod.Projectiles.Rogue Projectile.height = 14; Projectile.friendly = true; Projectile.penetrate = 6; - drawOffsetX = -10; - drawOriginOffsetY = 0; - drawOriginOffsetX = 0; + DrawOffsetX = -10; + DrawOriginOffsetY = 0; + DrawOriginOffsetX = 0; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 40; Projectile.extraUpdates = 2; diff --git a/Projectiles/Rogue/NanoblackMain.cs b/Projectiles/Rogue/NanoblackMain.cs index a1eb019548..aeed1fb4b4 100644 --- a/Projectiles/Rogue/NanoblackMain.cs +++ b/Projectiles/Rogue/NanoblackMain.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Rogue; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -43,9 +43,9 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { - drawOffsetX = -11; - drawOriginOffsetY = -4; - drawOriginOffsetX = 0; + DrawOffsetX = -11; + DrawOriginOffsetY = -4; + DrawOriginOffsetX = 0; // Initialize the frame counter and random blade delay on the very first frame. if (Projectile.timeLeft == Lifetime) diff --git a/Projectiles/Rogue/NanoblackSplit.cs b/Projectiles/Rogue/NanoblackSplit.cs index 38220eb276..fde4a77c30 100644 --- a/Projectiles/Rogue/NanoblackSplit.cs +++ b/Projectiles/Rogue/NanoblackSplit.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using Terraria; @@ -46,9 +46,9 @@ namespace CalamityMod.Projectiles.Rogue // ai[1] = Current spin speed. Negative speeds are also allowed. public override void AI() { - drawOffsetX = -10; - drawOriginOffsetY = 0; - drawOriginOffsetX = 0; + DrawOffsetX = -10; + DrawOriginOffsetY = 0; + DrawOriginOffsetX = 0; // On the very first frame, clear any invalid starting target variable and create some dust. // Also grab the damage type based on ai[0]. diff --git a/Projectiles/Rogue/PenumbraBomb.cs b/Projectiles/Rogue/PenumbraBomb.cs index 01efedd8c4..daca841d1c 100644 --- a/Projectiles/Rogue/PenumbraBomb.cs +++ b/Projectiles/Rogue/PenumbraBomb.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; using Microsoft.Xna.Framework; @@ -37,13 +37,13 @@ namespace CalamityMod.Projectiles.Rogue //Hitbox Fixing if (Projectile.direction == 1) { - drawOffsetX = -4; - drawOriginOffsetX = -5; + DrawOffsetX = -4; + DrawOriginOffsetX = -5; } else { - drawOffsetX = -11; - drawOriginOffsetX = 5; + DrawOffsetX = -11; + DrawOriginOffsetX = 5; } //Alpha diff --git a/Projectiles/Rogue/PenumbraSoul.cs b/Projectiles/Rogue/PenumbraSoul.cs index 90a30e4022..68072a83e6 100644 --- a/Projectiles/Rogue/PenumbraSoul.cs +++ b/Projectiles/Rogue/PenumbraSoul.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Rogue; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -36,8 +36,8 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - drawOffsetX = 1; - drawOriginOffsetY = 4; + DrawOffsetX = 1; + DrawOriginOffsetY = 4; // Continuously trail dust int trailDust = 1; diff --git a/Projectiles/Rogue/ProfanedPartisanProj.cs b/Projectiles/Rogue/ProfanedPartisanProj.cs index 16c6420e59..d5bb714629 100644 --- a/Projectiles/Rogue/ProfanedPartisanProj.cs +++ b/Projectiles/Rogue/ProfanedPartisanProj.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -53,17 +53,17 @@ namespace CalamityMod.Projectiles.Rogue if (Projectile.spriteDirection == 1) { Projectile.rotation += MathHelper.ToRadians(45f); - drawOffsetX = -26; - drawOriginOffsetX = 13; - drawOriginOffsetY = 2; + DrawOffsetX = -26; + DrawOriginOffsetX = 13; + DrawOriginOffsetY = 2; } //Rotating 45 degrees if shooting right if (Projectile.spriteDirection == -1) { Projectile.rotation -= MathHelper.ToRadians(45f); - drawOffsetX = 2; - drawOriginOffsetX = -13; - drawOriginOffsetY = 2; + DrawOffsetX = 2; + DrawOriginOffsetX = -13; + DrawOriginOffsetY = 2; } if (Main.rand.NextBool(3)) diff --git a/Utilities/MiscUtils.cs b/Utilities/MiscUtils.cs index 2afbe1ebb4..660735ab08 100644 --- a/Utilities/MiscUtils.cs +++ b/Utilities/MiscUtils.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Tools.ClimateChange; using CalamityMod.NPCs.Abyss; using CalamityMod.NPCs.AcidRain; @@ -14,6 +14,7 @@ using CalamityMod.NPCs.SunkenSea; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Audio; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using System; using System.Collections.Generic; using System.Linq; @@ -36,7 +37,7 @@ namespace CalamityMod /// The path to the sound file. public static TerrariaAudio.CustomSoundStyle GetTrackableSound(string path) { - return new TerrariaAudio.CustomSoundStyle(CalamityMod.Instance.GetSound(path), TerrariaAudio.SoundType.Sound); + return new TerrariaAudio.CustomSoundStyle(ModContent.Request(path, AssetRequestMode.ImmediateLoad), TerrariaAudio.SoundType.Sound); } public static void DisplayLocalizedText(string key, Color? textColor = null)