From ce4f889aca0f485fbe68470e97f0025bc1e52d3f Mon Sep 17 00:00:00 2001 From: Dominic Date: Sun, 10 Apr 2022 15:29:55 -0500 Subject: [PATCH] Fixed a lot of summons. Jesus christ --- CalPlayer/CalamityPlayer.cs | 4 ++- CalPlayer/CalamityPlayerMiscEffects.cs | 3 ++ Items/Accessories/EyeoftheStorm.cs | 4 ++- Items/Accessories/FungalClump.cs | 4 ++- Items/Accessories/GladiatorsLocket.cs | 7 ++-- Items/Accessories/HeartoftheElements.cs | 20 ++++++++--- Items/Accessories/LureofEnthrallment.cs | 5 ++- Items/Accessories/MutatedTruffle.cs | 4 ++- Items/Accessories/RoseStone.cs | 4 ++- Items/Armor/AerospecHelmet.cs | 4 ++- Items/Armor/AtaxiaHelmet.cs | 4 ++- Items/Armor/AuricTeslaSpaceHelmet.cs | 4 ++- Items/Armor/DaedalusHeadgear.cs | 4 ++- Items/Armor/DemonshadeHelm.cs | 4 ++- Items/Armor/PlaguebringerVisor.cs | 4 ++- Items/Armor/SilvaHelmet.cs | 4 ++- Items/Armor/VictideHelmet.cs | 4 ++- Items/CalamityGlobalItem.cs | 3 ++ Items/PermanentBoosters/MiracleFruit.cs | 1 + .../Weapons/DraedonsArsenal/MountedScanner.cs | 4 ++- Items/Weapons/DraedonsArsenal/PoleWarper.cs | 2 ++ .../DraedonsArsenal/PulseTurretRemote.cs | 5 ++- Items/Weapons/Summon/AbandonedSlimeStaff.cs | 3 +- Items/Weapons/Summon/AncientIceChunk.cs | 7 ++-- Items/Weapons/Summon/AngryChickenStaff.cs | 4 ++- Items/Weapons/Summon/BelladonnaSpiritStaff.cs | 6 ++-- Items/Weapons/Summon/BensUmbrella.cs | 6 ++-- Items/Weapons/Summon/BlackHawkRemote.cs | 6 ++-- Items/Weapons/Summon/BlightedEyeStaff.cs | 12 +++++-- Items/Weapons/Summon/BloodClotStaff.cs | 6 ++-- Items/Weapons/Summon/BorealisBomber.cs | 4 ++- Items/Weapons/Summon/CadaverousCarrion.cs | 6 ++-- Items/Weapons/Summon/CalamarisLament.cs | 6 ++-- Items/Weapons/Summon/CausticCroakerStaff.cs | 6 ++-- Items/Weapons/Summon/CausticStaff.cs | 6 ++-- Items/Weapons/Summon/CinderBlossomStaff.cs | 6 ++-- Items/Weapons/Summon/CindersOfLament.cs | 6 ++-- Items/Weapons/Summon/ColdDivinity.cs | 4 ++- Items/Weapons/Summon/CorroslimeStaff.cs | 6 ++-- Items/Weapons/Summon/CorvidHarbringerStaff.cs | 6 ++-- Items/Weapons/Summon/CosmicImmaterializer.cs | 6 ++-- Items/Weapons/Summon/CosmicViperEngine.cs | 4 ++- Items/Weapons/Summon/Cosmilamp.cs | 6 ++-- Items/Weapons/Summon/CrimslimeStaff.cs | 6 ++-- Items/Weapons/Summon/CryogenicStaff.cs | 6 ++-- Items/Weapons/Summon/DaedalusGolemStaff.cs | 8 +++-- Items/Weapons/Summon/DankStaff.cs | 6 ++-- Items/Weapons/Summon/DazzlingStabberStaff.cs | 6 ++-- Items/Weapons/Summon/DeathstareRod.cs | 6 ++-- Items/Weapons/Summon/DeepseaStaff.cs | 6 ++-- Items/Weapons/Summon/DormantBrimseeker.cs | 6 ++-- Items/Weapons/Summon/DragonbloodDisgorger.cs | 6 ++-- Items/Weapons/Summon/DreadmineStaff.cs | 6 ++-- Items/Weapons/Summon/ElementalAxe.cs | 6 ++-- Items/Weapons/Summon/EndoHydraStaff.cs | 12 +++++-- Items/Weapons/Summon/Endogenesis.cs | 2 ++ Items/Weapons/Summon/EnergyStaff.cs | 6 ++-- Items/Weapons/Summon/EtherealSubjugator.cs | 4 ++- Items/Weapons/Summon/EyeOfNight.cs | 8 +++-- Items/Weapons/Summon/FleshOfInfidelity.cs | 16 ++++++++- Items/Weapons/Summon/FlowersOfMortality.cs | 3 +- Items/Weapons/Summon/ForgottenApexWand.cs | 6 ++-- Items/Weapons/Summon/FrostBlossomStaff.cs | 6 ++-- Items/Weapons/Summon/FuelCellBundle.cs | 6 ++-- Items/Weapons/Summon/GammaHeart.cs | 8 +++-- Items/Weapons/Summon/GastricBelcherStaff.cs | 6 ++-- Items/Weapons/Summon/GodspawnHelixStaff.cs | 6 ++-- Items/Weapons/Summon/HauntedScroll.cs | 6 ++-- Items/Weapons/Summon/HerringStaff.cs | 6 ++-- Items/Weapons/Summon/HivePod.cs | 6 ++-- Items/Weapons/Summon/IgneousExaltation.cs | 4 ++- Items/Weapons/Summon/InfectedRemote.cs | 6 ++-- Items/Weapons/Summon/LanternoftheSoul.cs | 6 ++-- Items/Weapons/Summon/MagicalConch.cs | 4 ++- Items/Weapons/Summon/Metastasis.cs | 6 ++-- Items/Weapons/Summon/MidnightSunBeacon.cs | 6 ++-- Items/Weapons/Summon/OrthoceraShell.cs | 6 ++-- Items/Weapons/Summon/Perdition.cs | 6 ++-- Items/Weapons/Summon/PlantationStaff.cs | 6 ++-- Items/Weapons/Summon/PolypLauncher.cs | 6 ++-- .../Weapons/Summon/PrototypeAndromechaRing.cs | 2 +- Items/Weapons/Summon/ResurrectionButterfly.cs | 8 +++-- Items/Weapons/Summon/RustyBeaconPrototype.cs | 6 ++-- Items/Weapons/Summon/SandSharknadoStaff.cs | 6 ++-- Items/Weapons/Summon/SarosPossession.cs | 6 ++-- Items/Weapons/Summon/ScabRipper.cs | 6 ++-- Items/Weapons/Summon/SeaboundStaff.cs | 6 ++-- Items/Weapons/Summon/ShellfishStaff.cs | 6 ++-- Items/Weapons/Summon/Sirius.cs | 6 ++-- Items/Weapons/Summon/SlimePuppetStaff.cs | 7 ++-- Items/Weapons/Summon/SpikecragStaff.cs | 6 ++-- Items/Weapons/Summon/SquirrelSquireStaff.cs | 7 ++-- Items/Weapons/Summon/StaffOfNecrosteocytes.cs | 6 ++-- Items/Weapons/Summon/StaffoftheMechworm.cs | 10 ++++++ Items/Weapons/Summon/StormjawStaff.cs | 6 ++-- Items/Weapons/Summon/SunGodStaff.cs | 6 ++-- Items/Weapons/Summon/SunSpiritStaff.cs | 6 ++-- Items/Weapons/Summon/TacticalPlagueEngine.cs | 8 +++-- .../Summon/TundraFlameBlossomsStaff.cs | 3 +- Items/Weapons/Summon/UniverseSplitter.cs | 6 ++-- Items/Weapons/Summon/Vigilance.cs | 6 ++-- Items/Weapons/Summon/VileFeeder.cs | 4 ++- Items/Weapons/Summon/ViralSprout.cs | 6 ++-- Items/Weapons/Summon/ViridVanguard.cs | 2 ++ .../Weapons/Summon/VoidConcentrationStaff.cs | 6 ++-- Items/Weapons/Summon/WitherBlossomsStaff.cs | 3 +- Items/Weapons/Summon/WulfrumController.cs | 6 ++-- Projectiles/CalamityGlobalProjectile.cs | 18 +--------- .../DraedonsArsenal/MountedScannerSummon.cs | 17 ---------- .../DraedonsArsenal/PoleWarperSummon.cs | 14 -------- Projectiles/DraedonsArsenal/PulseTurret.cs | 14 -------- .../DraedonsArsenal/SnakeEyesSummon.cs | 15 --------- .../DraedonsArsenal/StarSwallowerSummon.cs | 19 ----------- .../Summon/AngelicAllianceArchangel.cs | 14 ++------ Projectiles/Summon/ApexShark.cs | 9 ----- Projectiles/Summon/AquaticStarMinion.cs | 13 -------- Projectiles/Summon/AstrageldonSummon.cs | 13 ++------ Projectiles/Summon/AstralProbeSummon.cs | 9 ----- Projectiles/Summon/AureusBomber.cs | 9 ----- Projectiles/Summon/BabyBloodCrawler.cs | 9 ----- Projectiles/Summon/BelladonnaSpirit.cs | 17 ++++------ Projectiles/Summon/BlackHawkSummon.cs | 15 ++------- Projectiles/Summon/BloodClotMinion.cs | 9 ----- .../Summon/BrimstoneElementalMinion.cs | 13 ++------ Projectiles/Summon/BrittleStarMinion.cs | 13 -------- Projectiles/Summon/CalamariMinion.cs | 13 ++------ Projectiles/Summon/Calamitamini.cs | 12 ++----- Projectiles/Summon/Cataclymini.cs | 12 ++----- Projectiles/Summon/Catastromini.cs | 8 ----- Projectiles/Summon/CausticStaffSummon.cs | 13 ++------ Projectiles/Summon/ChaosSpirit.cs | 14 +++----- Projectiles/Summon/CinderBlossom.cs | 13 ++------ Projectiles/Summon/CloudElementalMinion.cs | 10 +----- Projectiles/Summon/ColdDivinityPointyThing.cs | 14 -------- Projectiles/Summon/CorroslimeMinion.cs | 9 ----- .../Summon/CorruptionSlimeGodMinion.cs | 9 ----- Projectiles/Summon/CosmicEnergySpiral.cs | 21 ++++-------- Projectiles/Summon/CosmicViperSummon.cs | 15 +++------ Projectiles/Summon/CosmilampMinion.cs | 9 ----- Projectiles/Summon/CrimslimeMinion.cs | 9 ----- Projectiles/Summon/CrimsonSlimeGodMinion.cs | 9 ----- Projectiles/Summon/DaedalusCrystal.cs | 13 ++------ Projectiles/Summon/DaedalusGolem.cs | 27 ++++----------- Projectiles/Summon/DankCreeperMinion.cs | 9 ----- Projectiles/Summon/DazzlingStabber.cs | 16 --------- Projectiles/Summon/DeathstareEyeball.cs | 19 ++++------- Projectiles/Summon/DormantBrimseekerBab.cs | 13 -------- .../Summon/DormantBrimseekerSummoner.cs | 4 ++- Projectiles/Summon/DreadmineTurret.cs | 18 ++-------- Projectiles/Summon/EXPLODINGFROG.cs | 33 +++++++++---------- Projectiles/Summon/ElementalAxeMinion.cs | 13 -------- Projectiles/Summon/EndoCooperBody.cs | 13 ++------ Projectiles/Summon/EndoCooperLimbs.cs | 26 +++++++-------- Projectiles/Summon/EndoHydraBody.cs | 14 -------- Projectiles/Summon/EndoHydraHead.cs | 17 +++------- Projectiles/Summon/EyeOfNightSummon.cs | 19 ++--------- Projectiles/Summon/FleshBallMinion.cs | 4 ++- Projectiles/Summon/FlowersOfMortalityPetal.cs | 13 ++------ Projectiles/Summon/FlyingOrthocera.cs | 15 +++------ Projectiles/Summon/FrostBlossom.cs | 13 ++------ Projectiles/Summon/FungalClumpMinion.cs | 13 +------- Projectiles/Summon/GammaHead.cs | 9 ++--- Projectiles/Summon/GastricBelcher.cs | 11 ------- Projectiles/Summon/GhostlyMine.cs | 11 +------ Projectiles/Summon/GiantIbanRobotOfDoom.cs | 18 +--------- Projectiles/Summon/HauntedDishes.cs | 8 ----- Projectiles/Summon/HermitCrabMinion.cs | 9 ----- Projectiles/Summon/HerringMinion.cs | 9 ----- Projectiles/Summon/Hive.cs | 18 ++-------- Projectiles/Summon/HowlsHeartHowl.cs | 11 ------- Projectiles/Summon/IceClasperMinion.cs | 9 ----- Projectiles/Summon/IceSentry.cs | 20 +++-------- Projectiles/Summon/IgneousBlade.cs | 17 ++-------- Projectiles/Summon/LanternSoul.cs | 18 ++-------- Projectiles/Summon/LuxorsGiftSummon.cs | 9 ----- Projectiles/Summon/MK2FlaskSummon.cs | 5 ++- Projectiles/Summon/MagicHat.cs | 12 ++----- Projectiles/Summon/MechwormHead.cs | 4 ++- Projectiles/Summon/MidnightSunBeaconProj.cs | 4 ++- Projectiles/Summon/MidnightSunUFO.cs | 17 ++++------ Projectiles/Summon/MiniSandShark.cs | 2 +- Projectiles/Summon/MortalityBeam.cs | 1 + Projectiles/Summon/OldDukeHeadCorpse.cs | 17 ++-------- Projectiles/Summon/PerditionBeacon.cs | 13 ++------ Projectiles/Summon/PhantomGuy.cs | 13 ++------ Projectiles/Summon/PinkButterfly.cs | 13 ++------ Projectiles/Summon/PlaguePrincess.cs | 15 +++------ Projectiles/Summon/PlaguebringerMK2.cs | 21 ++++-------- Projectiles/Summon/PlaguebringerSummon.cs | 14 -------- Projectiles/Summon/PlantSummon.cs | 25 +++++++------- Projectiles/Summon/PlantTentacle.cs | 13 -------- Projectiles/Summon/PolypLauncherProjectile.cs | 4 ++- Projectiles/Summon/PolypLauncherSentry.cs | 18 ++-------- Projectiles/Summon/PowerfulRaven.cs | 9 ----- Projectiles/Summon/ProfanedEnergy.cs | 9 ----- Projectiles/Summon/PurpleButterfly.cs | 9 ----- Projectiles/Summon/RadiantResolutionAura.cs | 32 +++++------------- Projectiles/Summon/RustyDrone.cs | 13 ++------ Projectiles/Summon/SageSpirit.cs | 4 ++- Projectiles/Summon/SandElementalHealer.cs | 9 ----- Projectiles/Summon/SandElementalMinion.cs | 13 ++------ Projectiles/Summon/SandnadoMinion.cs | 9 ----- Projectiles/Summon/SeekerSummonProj.cs | 4 ++- Projectiles/Summon/SepulcherMinion.cs | 17 ++-------- Projectiles/Summon/Shellfish.cs | 8 ----- Projectiles/Summon/SilvaCrystal.cs | 17 ++-------- Projectiles/Summon/SiriusBeam.cs | 4 ++- Projectiles/Summon/SiriusMinion.cs | 10 ++---- Projectiles/Summon/SkeletalDragonChild.cs | 18 ++-------- Projectiles/Summon/SkeletalDragonMother.cs | 17 ++++------ Projectiles/Summon/SlimePuppet.cs | 20 +---------- Projectiles/Summon/SmallSkeletonMinion.cs | 16 +++------ Projectiles/Summon/SolarGod.cs | 13 ++------ Projectiles/Summon/SolarPixie.cs | 12 ++----- Projectiles/Summon/SonOfYharon.cs | 12 +------ Projectiles/Summon/Spikecrag.cs | 18 ++-------- Projectiles/Summon/SquirrelSquireAcorn.cs | 2 +- Projectiles/Summon/SquirrelSquireMinion.cs | 14 ++------ Projectiles/Summon/StormjawBaby.cs | 9 ----- Projectiles/Summon/TacticalPlagueJet.cs | 15 ++------- Projectiles/Summon/TundraFlameBlossom.cs | 12 ++----- Projectiles/Summon/Urchin.cs | 10 +----- Projectiles/Summon/Valkyrie.cs | 9 ----- Projectiles/Summon/VileFeederSummon.cs | 9 ----- Projectiles/Summon/ViridVanguardBlade.cs | 13 -------- Projectiles/Summon/WaterElementalMinion.cs | 11 ++----- Projectiles/Summon/WitherBlossom.cs | 16 +++------ Projectiles/Summon/WulfrumDroid.cs | 9 +---- Projectiles/Summon/YoungDuke.cs | 19 ++--------- Projectiles/Typeless/DemonshadeRedDevil.cs | 12 ------- Projectiles/Typeless/GladiatorSword.cs | 16 +-------- Projectiles/Typeless/GladiatorSword2.cs | 16 +-------- 232 files changed, 718 insertions(+), 1508 deletions(-) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 72e9bfdcc0..c835162409 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -3495,7 +3495,9 @@ namespace CalamityMod.CalPlayer } if (Player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { - Projectile.NewProjectile(source, Player.Center, -Vector2.UnitY, ModContent.ProjectileType(), (int)(HowlsHeart.HowlDamage * Player.MinionDamage()), 1f, Player.whoAmI, 0f, 1f); + int p = Projectile.NewProjectile(source, Player.Center, -Vector2.UnitY, ModContent.ProjectileType(), (int)(HowlsHeart.HowlDamage * Player.MinionDamage()), 1f, Player.whoAmI, 0f, 1f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = HowlsHeart.HowlDamage; } if (Player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 159ff803ec..7d7d348178 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -2990,7 +2990,10 @@ namespace CalamityMod.CalPlayer int projectile = Projectile.NewProjectile(source, Player.Center.X + (float)(Math.Sin(I * 120) * 550), Player.Center.Y + (float)(Math.Cos(I * 120) * 550), 0f, 0f, ModContent.ProjectileType(), (int)(3750 * Player.MinionDamage()), 1f, Player.whoAmI, ai1, 0f); if (projectile.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[projectile].originalDamage = 3750; Main.projectile[projectile].Calamity().forceTypeless = true; + } } } } diff --git a/Items/Accessories/EyeoftheStorm.cs b/Items/Accessories/EyeoftheStorm.cs index 0281b9d207..6712f3ddb6 100644 --- a/Items/Accessories/EyeoftheStorm.cs +++ b/Items/Accessories/EyeoftheStorm.cs @@ -4,6 +4,7 @@ using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ModLoader; using Terraria.ID; +using Microsoft.Xna.Framework; namespace CalamityMod.Items.Accessories { @@ -47,7 +48,8 @@ namespace CalamityMod.Items.Accessories if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { var source = player.GetProjectileSource_Accessory(Item); - Projectile.NewProjectile(source, player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), (int)(45 * player.MinionDamage()), 2f, Main.myPlayer, 0f, 0f); + var p = Projectile.NewProjectileDirect(source, player.Center, -Vector2.UnitY, ModContent.ProjectileType(), (int)(45 * player.MinionDamage()), 2f, Main.myPlayer, 0f, 0f); + p.originalDamage = 45; } } } diff --git a/Items/Accessories/FungalClump.cs b/Items/Accessories/FungalClump.cs index e34ce9764b..594873db00 100644 --- a/Items/Accessories/FungalClump.cs +++ b/Items/Accessories/FungalClump.cs @@ -42,7 +42,9 @@ namespace CalamityMod.Items.Accessories if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { var source = player.GetProjectileSource_Accessory(Item); - Projectile.NewProjectile(source, player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), (int)(FungalClumpDamage * player.MinionDamage()), 1f, player.whoAmI, 0f, 0f); + int p = Projectile.NewProjectile(source, player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), (int)(FungalClumpDamage * player.MinionDamage()), 1f, player.whoAmI, 0f, 0f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = FungalClumpDamage; } } } diff --git a/Items/Accessories/GladiatorsLocket.cs b/Items/Accessories/GladiatorsLocket.cs index bb5c115e3f..022d7f2881 100644 --- a/Items/Accessories/GladiatorsLocket.cs +++ b/Items/Accessories/GladiatorsLocket.cs @@ -48,8 +48,11 @@ namespace CalamityMod.Items.Accessories var source = player.GetProjectileSource_Accessory(Item); if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { - Projectile.NewProjectile(source, player.Center, Vector2.Zero, ModContent.ProjectileType(), swordDmg, 2f, Main.myPlayer); - Projectile.NewProjectile(source, player.Center, Vector2.Zero, ModContent.ProjectileType(), swordDmg, 2f, Main.myPlayer); + var sword = Projectile.NewProjectileDirect(source, player.Center, Vector2.Zero, ModContent.ProjectileType(), swordDmg, 2f, Main.myPlayer); + sword.originalDamage = damage; + + sword = Projectile.NewProjectileDirect(source, player.Center, Vector2.Zero, ModContent.ProjectileType(), swordDmg, 2f, Main.myPlayer); + sword.originalDamage = damage; } } } diff --git a/Items/Accessories/HeartoftheElements.cs b/Items/Accessories/HeartoftheElements.cs index 52a88e49c8..db8931c9c3 100644 --- a/Items/Accessories/HeartoftheElements.cs +++ b/Items/Accessories/HeartoftheElements.cs @@ -74,23 +74,33 @@ namespace CalamityMod.Items.Accessories } if (player.ownedProjectileCounts[brimmy] < 1) { - Projectile.NewProjectile(source, player.Center, velocity, brimmy, elementalDmg, kBack, player.whoAmI); + int p = Projectile.NewProjectile(source, player.Center, velocity, brimmy, elementalDmg, kBack, player.whoAmI); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = 90; } if (player.ownedProjectileCounts[siren] < 1) { - Projectile.NewProjectile(source, player.Center, velocity, siren, elementalDmg, kBack, player.whoAmI); + int p = Projectile.NewProjectile(source, player.Center, velocity, siren, elementalDmg, kBack, player.whoAmI); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = 90; } if (player.ownedProjectileCounts[healer] < 1) { - Projectile.NewProjectile(source, player.Center, velocity, healer, elementalDmg, kBack, player.whoAmI); + int p = Projectile.NewProjectile(source, player.Center, velocity, healer, elementalDmg, kBack, player.whoAmI); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = 90; } if (player.ownedProjectileCounts[sandy] < 1) { - Projectile.NewProjectile(source, player.Center, velocity, sandy, elementalDmg, kBack, player.whoAmI); + int p = Projectile.NewProjectile(source, player.Center, velocity, sandy, elementalDmg, kBack, player.whoAmI); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = 90; } if (player.ownedProjectileCounts[cloudy] < 1) { - Projectile.NewProjectile(source, player.Center, velocity, cloudy, elementalDmg, kBack, player.whoAmI); + int p = Projectile.NewProjectile(source, player.Center, velocity, cloudy, elementalDmg, kBack, player.whoAmI); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = 90; } } } diff --git a/Items/Accessories/LureofEnthrallment.cs b/Items/Accessories/LureofEnthrallment.cs index c0e14a7345..d001764f89 100644 --- a/Items/Accessories/LureofEnthrallment.cs +++ b/Items/Accessories/LureofEnthrallment.cs @@ -4,6 +4,7 @@ using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ModLoader; using Terraria.ID; +using Microsoft.Xna.Framework; namespace CalamityMod.Items.Accessories { @@ -48,7 +49,9 @@ namespace CalamityMod.Items.Accessories } if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { - Projectile.NewProjectile(source, player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), (int)(65 * player.MinionDamage()), 2f, Main.myPlayer, 0f, 0f); + int anahita = Projectile.NewProjectile(source, player.Center, -Vector2.UnitY, ModContent.ProjectileType(), (int)(65 * player.MinionDamage()), 2f, Main.myPlayer); + if (Main.projectile.IndexInRange(anahita)) + Main.projectile[anahita].originalDamage = 65; } } } diff --git a/Items/Accessories/MutatedTruffle.cs b/Items/Accessories/MutatedTruffle.cs index ac51523134..9255ec0cf9 100644 --- a/Items/Accessories/MutatedTruffle.cs +++ b/Items/Accessories/MutatedTruffle.cs @@ -41,10 +41,12 @@ namespace CalamityMod.Items.Accessories const int damage = 1200; if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { - Projectile.NewProjectile(source, player.Center, Vector2.Zero, + var duke = Projectile.NewProjectileDirect(source, player.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(damage * player.MinionDamage()), 6.5f, Main.myPlayer, 0f, 0f); + + duke.originalDamage = damage; } } } diff --git a/Items/Accessories/RoseStone.cs b/Items/Accessories/RoseStone.cs index 73f8af2f4d..a7814a5f34 100644 --- a/Items/Accessories/RoseStone.cs +++ b/Items/Accessories/RoseStone.cs @@ -48,7 +48,9 @@ namespace CalamityMod.Items.Accessories } if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { - Projectile.NewProjectile(source, player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), (int)(60 * player.MinionDamage()), 2f, Main.myPlayer, 0f, 0f); + int p = Projectile.NewProjectile(source, player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), (int)(60 * player.MinionDamage()), 2f, Main.myPlayer, 0f, 0f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = 60; } } } diff --git a/Items/Armor/AerospecHelmet.cs b/Items/Armor/AerospecHelmet.cs index fecd03f454..e3722b9cfd 100644 --- a/Items/Armor/AerospecHelmet.cs +++ b/Items/Armor/AerospecHelmet.cs @@ -55,7 +55,9 @@ namespace CalamityMod.Items.Armor } if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { - Projectile.NewProjectile(source, player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), (int)(20 * player.MinionDamage()), 0f, Main.myPlayer, 0f, 0f); + int p = Projectile.NewProjectile(source, player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), (int)(20 * player.MinionDamage()), 0f, Main.myPlayer, 0f, 0f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = 20; } } player.GetDamage(DamageClass.Summon) += 0.11f; diff --git a/Items/Armor/AtaxiaHelmet.cs b/Items/Armor/AtaxiaHelmet.cs index 004d8ac137..fa543257bf 100644 --- a/Items/Armor/AtaxiaHelmet.cs +++ b/Items/Armor/AtaxiaHelmet.cs @@ -56,7 +56,9 @@ namespace CalamityMod.Items.Armor } if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { - Projectile.NewProjectile(source, player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), (int)(190f * player.MinionDamage()), 0f, Main.myPlayer, 38f, 0f); + int p = Projectile.NewProjectile(source, player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), (int)(190f * player.MinionDamage()), 0f, Main.myPlayer, 38f, 0f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = 190; } } player.GetDamage(DamageClass.Summon) += 0.4f; diff --git a/Items/Armor/AuricTeslaSpaceHelmet.cs b/Items/Armor/AuricTeslaSpaceHelmet.cs index b59c6af412..fa5b6c04ad 100644 --- a/Items/Armor/AuricTeslaSpaceHelmet.cs +++ b/Items/Armor/AuricTeslaSpaceHelmet.cs @@ -73,7 +73,9 @@ namespace CalamityMod.Items.Armor } if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { - Projectile.NewProjectile(source, player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), (int)(1200f * player.MinionDamage()), 0f, Main.myPlayer, -20f, 0f); + int p = Projectile.NewProjectile(source, player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), (int)(1200f * player.MinionDamage()), 0f, Main.myPlayer, -20f, 0f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = 1200; } } } diff --git a/Items/Armor/DaedalusHeadgear.cs b/Items/Armor/DaedalusHeadgear.cs index 82d2962b0d..40a65abab8 100644 --- a/Items/Armor/DaedalusHeadgear.cs +++ b/Items/Armor/DaedalusHeadgear.cs @@ -2,6 +2,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -52,7 +53,8 @@ namespace CalamityMod.Items.Armor } if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { - Projectile.NewProjectile(source, player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), (int)(95f * player.MinionDamage()), 0f, Main.myPlayer, 50f, 0f); + var p = Projectile.NewProjectileDirect(source, player.Center, -Vector2.UnitY, ModContent.ProjectileType(), (int)(95f * player.MinionDamage()), 0f, Main.myPlayer, 50f, 0f); + p.originalDamage = 95; } } player.GetDamage(DamageClass.Summon) += 0.2f; diff --git a/Items/Armor/DemonshadeHelm.cs b/Items/Armor/DemonshadeHelm.cs index efe9187faa..783b6efc5b 100644 --- a/Items/Armor/DemonshadeHelm.cs +++ b/Items/Armor/DemonshadeHelm.cs @@ -64,8 +64,10 @@ namespace CalamityMod.Items.Armor } if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { + int baseDamage = 10000; int damage = (int)(10000 * player.AverageDamage()); - Projectile.NewProjectile(source, player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + var devil = Projectile.NewProjectileDirect(source, player.Center, -Vector2.UnitY, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + devil.originalDamage = baseDamage; } } player.GetDamage(DamageClass.Summon) += 1f; diff --git a/Items/Armor/PlaguebringerVisor.cs b/Items/Armor/PlaguebringerVisor.cs index fc8f10df12..6502fd68e6 100644 --- a/Items/Armor/PlaguebringerVisor.cs +++ b/Items/Armor/PlaguebringerVisor.cs @@ -64,7 +64,9 @@ namespace CalamityMod.Items.Armor } if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { - Projectile.NewProjectile(source, player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), (int)(80 * player.MinionDamage()), 0f, player.whoAmI, 0f, 0f); + int p = Projectile.NewProjectile(source, player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), (int)(80 * player.MinionDamage()), 0f, player.whoAmI, 0f, 0f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = 80; } } diff --git a/Items/Armor/SilvaHelmet.cs b/Items/Armor/SilvaHelmet.cs index 5bb667d9bc..5dbc9e9315 100644 --- a/Items/Armor/SilvaHelmet.cs +++ b/Items/Armor/SilvaHelmet.cs @@ -60,7 +60,9 @@ namespace CalamityMod.Items.Armor } if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { - Projectile.NewProjectile(source, player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), (int)(600f * player.MinionDamage()), 0f, Main.myPlayer, -20f, 0f); + int p = Projectile.NewProjectile(source, player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), (int)(600f * player.MinionDamage()), 0f, Main.myPlayer, -20f, 0f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = 600; } } player.GetDamage(DamageClass.Summon) += 0.65f; diff --git a/Items/Armor/VictideHelmet.cs b/Items/Armor/VictideHelmet.cs index 32a5014fea..4cab70f741 100644 --- a/Items/Armor/VictideHelmet.cs +++ b/Items/Armor/VictideHelmet.cs @@ -52,7 +52,9 @@ namespace CalamityMod.Items.Armor var source = player.GetProjectileSource_Item(Item); if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { - Projectile.NewProjectile(source, player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), (int)(7f * (player.GetDamage().Additive + player.GetDamage(DamageClass.Summon) - 1f)), 0f, Main.myPlayer, 0f, 0f); + int p = Projectile.NewProjectile(source, player.Center.X, player.Center.Y, 0f, -1f, ModContent.ProjectileType(), (int)(7f * (player.GetDamage().Additive + player.GetDamage(DamageClass.Summon) - 1f)), 0f, Main.myPlayer, 0f, 0f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = 7; } } player.ignoreWater = true; diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 6331108fe9..b8e44ee3d6 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -243,7 +243,10 @@ namespace CalamityMod.Items { int projectile = Projectile.NewProjectile(source, position, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, player.whoAmI); if (projectile.WithinBounds(Main.maxProjectiles)) + { Main.projectile[projectile].Calamity().forceTypeless = true; + Main.projectile[projectile].originalDamage = item.damage; + } } } } diff --git a/Items/PermanentBoosters/MiracleFruit.cs b/Items/PermanentBoosters/MiracleFruit.cs index b5216669bc..b29a221d4e 100644 --- a/Items/PermanentBoosters/MiracleFruit.cs +++ b/Items/PermanentBoosters/MiracleFruit.cs @@ -4,6 +4,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.DataStructures; +using Terraria.GameContent.Creative; namespace CalamityMod.Items.PermanentBoosters { diff --git a/Items/Weapons/DraedonsArsenal/MountedScanner.cs b/Items/Weapons/DraedonsArsenal/MountedScanner.cs index a2cd2217ed..cbc600ef84 100644 --- a/Items/Weapons/DraedonsArsenal/MountedScanner.cs +++ b/Items/Weapons/DraedonsArsenal/MountedScanner.cs @@ -52,7 +52,9 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile.NewProjectile(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI); + var scanner = Projectile.NewProjectileDirect(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI); + scanner.originalDamage = Item.damage; + int totalOwnedScanners = player.ownedProjectileCounts[type]; int currentScannerIndex = 0; foreach (Projectile projectile in Main.projectile) diff --git a/Items/Weapons/DraedonsArsenal/PoleWarper.cs b/Items/Weapons/DraedonsArsenal/PoleWarper.cs index 74c823c44b..3a350918c8 100644 --- a/Items/Weapons/DraedonsArsenal/PoleWarper.cs +++ b/Items/Weapons/DraedonsArsenal/PoleWarper.cs @@ -56,6 +56,8 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal { Projectile north = Projectile.NewProjectileDirect(source, Main.MouseWorld + Vector2.UnitY * 30f, Vector2.Zero, type, damage, knockBack, player.whoAmI); Projectile south = Projectile.NewProjectileDirect(source, Main.MouseWorld - Vector2.UnitY * 30f, Vector2.Zero, type, damage, knockBack, player.whoAmI); + north.originalDamage = Item.damage; + south.originalDamage = Item.damage; north.ai[1] = 1f; south.ai[1] = 0f; diff --git a/Items/Weapons/DraedonsArsenal/PulseTurretRemote.cs b/Items/Weapons/DraedonsArsenal/PulseTurretRemote.cs index fbcd13ab2d..ae3a1f937a 100644 --- a/Items/Weapons/DraedonsArsenal/PulseTurretRemote.cs +++ b/Items/Weapons/DraedonsArsenal/PulseTurretRemote.cs @@ -55,7 +55,10 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { CalamityUtils.OnlyOneSentry(player, type); - Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + int turret = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + if (Main.projectile.IndexInRange(turret)) + Main.projectile[turret].originalDamage = Item.damage; + player.UpdateMaxTurrets(); return false; } diff --git a/Items/Weapons/Summon/AbandonedSlimeStaff.cs b/Items/Weapons/Summon/AbandonedSlimeStaff.cs index ce8ea70f50..0dcc17a2d4 100644 --- a/Items/Weapons/Summon/AbandonedSlimeStaff.cs +++ b/Items/Weapons/Summon/AbandonedSlimeStaff.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using System; @@ -71,6 +71,7 @@ namespace CalamityMod.Items.Weapons.Summon velocity.X = 0; velocity.Y = 0; int slime = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, (int)(damage * damageMult), knockback, player.whoAmI); + Main.projectile[slime].originalDamage = (int)(Item.damage * damageMult); Main.projectile[slime].minionSlots = slimeSlots; return false; } diff --git a/Items/Weapons/Summon/AncientIceChunk.cs b/Items/Weapons/Summon/AncientIceChunk.cs index de60f19518..21d40e9c79 100644 --- a/Items/Weapons/Summon/AncientIceChunk.cs +++ b/Items/Weapons/Summon/AncientIceChunk.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using System; @@ -59,7 +59,10 @@ namespace CalamityMod.Items.Weapons.Summon num79 = 0f; vector2.X = (float)Main.mouseX + Main.screenPosition.X; vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; - Projectile.NewProjectile(source, vector2.X, vector2.Y, num78, num79, type, damage, knockback, player.whoAmI, 0f, 0f); + int clasper = Projectile.NewProjectile(source, vector2.X, vector2.Y, num78, num79, type, damage, knockback, player.whoAmI, 0f, 0f); + if (Main.projectile.IndexInRange(clasper)) + Main.projectile[clasper].originalDamage = Item.damage; + return false; } } diff --git a/Items/Weapons/Summon/AngryChickenStaff.cs b/Items/Weapons/Summon/AngryChickenStaff.cs index 735e27b1e0..da2dc77c89 100644 --- a/Items/Weapons/Summon/AngryChickenStaff.cs +++ b/Items/Weapons/Summon/AngryChickenStaff.cs @@ -43,7 +43,9 @@ namespace CalamityMod.Items.Weapons.Summon if (player.altFunctionUse != 2) { position = Main.MouseWorld; - Projectile.NewProjectile(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI); + int dragon = Projectile.NewProjectile(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI); + if (Main.projectile.IndexInRange(dragon)) + Main.projectile[dragon].originalDamage = Item.damage; } return false; } diff --git a/Items/Weapons/Summon/BelladonnaSpiritStaff.cs b/Items/Weapons/Summon/BelladonnaSpiritStaff.cs index ac486e8e58..ea7f8c885f 100644 --- a/Items/Weapons/Summon/BelladonnaSpiritStaff.cs +++ b/Items/Weapons/Summon/BelladonnaSpiritStaff.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -35,7 +35,9 @@ namespace CalamityMod.Items.Weapons.Summon } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 0f); + int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 0f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; return false; } public override void AddRecipes() diff --git a/Items/Weapons/Summon/BensUmbrella.cs b/Items/Weapons/Summon/BensUmbrella.cs index 172871e47c..11eb77ef39 100644 --- a/Items/Weapons/Summon/BensUmbrella.cs +++ b/Items/Weapons/Summon/BensUmbrella.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -45,7 +45,9 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { CalamityUtils.KillShootProjectiles(true, type, player); - Projectile.NewProjectile(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; return false; } diff --git a/Items/Weapons/Summon/BlackHawkRemote.cs b/Items/Weapons/Summon/BlackHawkRemote.cs index 98081019d3..19797e914c 100644 --- a/Items/Weapons/Summon/BlackHawkRemote.cs +++ b/Items/Weapons/Summon/BlackHawkRemote.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -43,7 +43,9 @@ namespace CalamityMod.Items.Weapons.Summon position = Main.MouseWorld; velocity.X = 0; velocity.Y = 0; - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0f, 1f); + int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0f, 1f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; } } return false; diff --git a/Items/Weapons/Summon/BlightedEyeStaff.cs b/Items/Weapons/Summon/BlightedEyeStaff.cs index b0099a07a3..09dcfb31a0 100644 --- a/Items/Weapons/Summon/BlightedEyeStaff.cs +++ b/Items/Weapons/Summon/BlightedEyeStaff.cs @@ -65,11 +65,17 @@ namespace CalamityMod.Items.Weapons.Summon vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; Vector2 spinningpoint = new Vector2(num78, num79); spinningpoint = spinningpoint.RotatedBy(1.5707963705062866, default); - Projectile.NewProjectile(source, vector2.X + spinningpoint.X, vector2.Y + spinningpoint.Y, spinningpoint.X, spinningpoint.Y, ModContent.ProjectileType(), damage, knockback, i, 0f, 1f); + int p = Projectile.NewProjectile(source, vector2.X + spinningpoint.X, vector2.Y + spinningpoint.Y, spinningpoint.X, spinningpoint.Y, ModContent.ProjectileType(), damage, knockback, i, 0f, 1f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; spinningpoint = spinningpoint.RotatedBy(-3.1415927410125732, default); - Projectile.NewProjectile(source, vector2.X + spinningpoint.X, vector2.Y + spinningpoint.Y, spinningpoint.X, spinningpoint.Y, ModContent.ProjectileType(), damage, knockback, i, 0f, 0f); + p = Projectile.NewProjectile(source, vector2.X + spinningpoint.X, vector2.Y + spinningpoint.Y, spinningpoint.X, spinningpoint.Y, ModContent.ProjectileType(), damage, knockback, i, 0f, 0f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; spinningpoint = spinningpoint.RotatedBy(-5.1415927410125732, default); - Projectile.NewProjectile(source, vector2.X + spinningpoint.X, vector2.Y + spinningpoint.Y, spinningpoint.X, spinningpoint.Y, ModContent.ProjectileType(), damage, knockback, i, 0f, 1f); + p = Projectile.NewProjectile(source, vector2.X + spinningpoint.X, vector2.Y + spinningpoint.Y, spinningpoint.X, spinningpoint.Y, ModContent.ProjectileType(), damage, knockback, i, 0f, 1f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; return false; } } diff --git a/Items/Weapons/Summon/BloodClotStaff.cs b/Items/Weapons/Summon/BloodClotStaff.cs index b415617f2f..15c73b75c8 100644 --- a/Items/Weapons/Summon/BloodClotStaff.cs +++ b/Items/Weapons/Summon/BloodClotStaff.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; @@ -47,7 +47,9 @@ namespace CalamityMod.Items.Weapons.Summon position = Main.MouseWorld; velocity.X = 0; velocity.Y = 0; - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; } return false; } diff --git a/Items/Weapons/Summon/BorealisBomber.cs b/Items/Weapons/Summon/BorealisBomber.cs index 9578404ca5..7d0eb94d99 100644 --- a/Items/Weapons/Summon/BorealisBomber.cs +++ b/Items/Weapons/Summon/BorealisBomber.cs @@ -49,7 +49,9 @@ namespace CalamityMod.Items.Weapons.Summon position = Main.MouseWorld; velocity.X = 0; velocity.Y = 0; - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, Main.myPlayer); + int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, Main.myPlayer); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; } return false; } diff --git a/Items/Weapons/Summon/CadaverousCarrion.cs b/Items/Weapons/Summon/CadaverousCarrion.cs index 8ad1931bfe..cad65571ab 100644 --- a/Items/Weapons/Summon/CadaverousCarrion.cs +++ b/Items/Weapons/Summon/CadaverousCarrion.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -38,7 +38,9 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { //CalamityUtils.OnlyOneSentry(player, type); - Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; player.UpdateMaxTurrets(); return false; } diff --git a/Items/Weapons/Summon/CalamarisLament.cs b/Items/Weapons/Summon/CalamarisLament.cs index 9c01159439..c4dd0f4fb4 100644 --- a/Items/Weapons/Summon/CalamarisLament.cs +++ b/Items/Weapons/Summon/CalamarisLament.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -42,7 +42,9 @@ namespace CalamityMod.Items.Weapons.Summon position = Main.MouseWorld; velocity.X = 0; velocity.Y = 0; - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; } return false; } diff --git a/Items/Weapons/Summon/CausticCroakerStaff.cs b/Items/Weapons/Summon/CausticCroakerStaff.cs index 0366da2376..dd0617f00f 100644 --- a/Items/Weapons/Summon/CausticCroakerStaff.cs +++ b/Items/Weapons/Summon/CausticCroakerStaff.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -38,7 +38,9 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.altFunctionUse != 2) { - Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; player.UpdateMaxTurrets(); } return false; diff --git a/Items/Weapons/Summon/CausticStaff.cs b/Items/Weapons/Summon/CausticStaff.cs index 581c442f3b..076a440d71 100644 --- a/Items/Weapons/Summon/CausticStaff.cs +++ b/Items/Weapons/Summon/CausticStaff.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -42,7 +42,9 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.altFunctionUse != 2) { - Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 1f); + int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 1f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; } return false; } diff --git a/Items/Weapons/Summon/CinderBlossomStaff.cs b/Items/Weapons/Summon/CinderBlossomStaff.cs index 43c3866c9a..6ec9ccadbe 100644 --- a/Items/Weapons/Summon/CinderBlossomStaff.cs +++ b/Items/Weapons/Summon/CinderBlossomStaff.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -37,7 +37,9 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { CalamityUtils.KillShootProjectiles(true, type, player); - Projectile.NewProjectile(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 0f); + int p = Projectile.NewProjectile(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 0f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; return false; } public override void AddRecipes() diff --git a/Items/Weapons/Summon/CindersOfLament.cs b/Items/Weapons/Summon/CindersOfLament.cs index 63d446fbf2..1b005845e7 100644 --- a/Items/Weapons/Summon/CindersOfLament.cs +++ b/Items/Weapons/Summon/CindersOfLament.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -47,7 +47,9 @@ namespace CalamityMod.Items.Weapons.Summon { if (Main.rand.NextBool(2)) type = ModContent.ProjectileType(); - Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; } return false; } diff --git a/Items/Weapons/Summon/ColdDivinity.cs b/Items/Weapons/Summon/ColdDivinity.cs index d8074e106b..a5d52bf32b 100644 --- a/Items/Weapons/Summon/ColdDivinity.cs +++ b/Items/Weapons/Summon/ColdDivinity.cs @@ -54,7 +54,9 @@ namespace CalamityMod.Items.Weapons.Summon { player.AddBuff(ModContent.BuffType(), 120, true); position = Main.MouseWorld; - Projectile.NewProjectile(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; int pointyThingCount = 0; for (int i = 0; i < Main.projectile.Length; i++) { diff --git a/Items/Weapons/Summon/CorroslimeStaff.cs b/Items/Weapons/Summon/CorroslimeStaff.cs index 31c8822641..95d3180757 100644 --- a/Items/Weapons/Summon/CorroslimeStaff.cs +++ b/Items/Weapons/Summon/CorroslimeStaff.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -41,7 +41,9 @@ namespace CalamityMod.Items.Weapons.Summon position = Main.MouseWorld; velocity.X = 0; velocity.Y = 0; - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; } return false; } diff --git a/Items/Weapons/Summon/CorvidHarbringerStaff.cs b/Items/Weapons/Summon/CorvidHarbringerStaff.cs index 2f755dcc66..725b7e517f 100644 --- a/Items/Weapons/Summon/CorvidHarbringerStaff.cs +++ b/Items/Weapons/Summon/CorvidHarbringerStaff.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -43,7 +43,9 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.altFunctionUse != 2) { - Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; } return false; } diff --git a/Items/Weapons/Summon/CosmicImmaterializer.cs b/Items/Weapons/Summon/CosmicImmaterializer.cs index cabce977f5..ae2ec75ab7 100644 --- a/Items/Weapons/Summon/CosmicImmaterializer.cs +++ b/Items/Weapons/Summon/CosmicImmaterializer.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; @@ -47,7 +47,9 @@ namespace CalamityMod.Items.Weapons.Summon CalamityUtils.KillShootProjectiles(true, type, player); CalamityPlayer modPlayer = player.Calamity(); bool hasSummonerSet = modPlayer.WearingPostMLSummonerSet; - Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, (int)(damage * (hasSummonerSet ? 1 : 0.66)), knockback, player.whoAmI, 0f, 0f); + int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, (int)(damage * (hasSummonerSet ? 1 : 0.66)), knockback, player.whoAmI, 0f, 0f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = (int)(Item.damage * (hasSummonerSet ? 1f : 0.66f)); return false; } diff --git a/Items/Weapons/Summon/CosmicViperEngine.cs b/Items/Weapons/Summon/CosmicViperEngine.cs index c77db1a708..06a7e4869c 100644 --- a/Items/Weapons/Summon/CosmicViperEngine.cs +++ b/Items/Weapons/Summon/CosmicViperEngine.cs @@ -70,7 +70,9 @@ namespace CalamityMod.Items.Weapons.Summon vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; Vector2 spinningpoint = new Vector2(num78, num79); spinningpoint = spinningpoint.RotatedBy(MathHelper.PiOver2, default); - Projectile.NewProjectile(source, vector2.X + spinningpoint.X, vector2.Y + spinningpoint.Y, spinningpoint.X, spinningpoint.Y, type, damage, knockback, i, 0f, 1f); + int p = Projectile.NewProjectile(source, vector2.X + spinningpoint.X, vector2.Y + spinningpoint.Y, spinningpoint.X, spinningpoint.Y, type, damage, knockback, i, 0f, 1f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; } return false; } diff --git a/Items/Weapons/Summon/Cosmilamp.cs b/Items/Weapons/Summon/Cosmilamp.cs index f7b7af10fe..03d9f0f945 100644 --- a/Items/Weapons/Summon/Cosmilamp.cs +++ b/Items/Weapons/Summon/Cosmilamp.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using System; @@ -62,7 +62,9 @@ namespace CalamityMod.Items.Weapons.Summon num79 = 0f; vector2.X = (float)Main.mouseX + Main.screenPosition.X; vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; - Projectile.NewProjectile(source, vector2.X, vector2.Y, num78, num79, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); + int p = Projectile.NewProjectile(source, vector2.X, vector2.Y, num78, num79, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; return false; } } diff --git a/Items/Weapons/Summon/CrimslimeStaff.cs b/Items/Weapons/Summon/CrimslimeStaff.cs index 8401005feb..0313c90570 100644 --- a/Items/Weapons/Summon/CrimslimeStaff.cs +++ b/Items/Weapons/Summon/CrimslimeStaff.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -41,7 +41,9 @@ namespace CalamityMod.Items.Weapons.Summon position = Main.MouseWorld; velocity.X = 0; velocity.Y = 0; - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; } return false; } diff --git a/Items/Weapons/Summon/CryogenicStaff.cs b/Items/Weapons/Summon/CryogenicStaff.cs index dd674ea662..83d5ae751f 100644 --- a/Items/Weapons/Summon/CryogenicStaff.cs +++ b/Items/Weapons/Summon/CryogenicStaff.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -40,7 +40,9 @@ Fire rate and range increase the longer it targets an enemy"); public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; player.UpdateMaxTurrets(); return false; } diff --git a/Items/Weapons/Summon/DaedalusGolemStaff.cs b/Items/Weapons/Summon/DaedalusGolemStaff.cs index 153b4fc2c6..6595a01d6b 100644 --- a/Items/Weapons/Summon/DaedalusGolemStaff.cs +++ b/Items/Weapons/Summon/DaedalusGolemStaff.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; @@ -39,7 +39,11 @@ namespace CalamityMod.Items.Weapons.Summon { Point mouseTileCoords = Main.MouseWorld.ToTileCoordinates(); if (!CalamityUtils.ParanoidTileRetrieval(mouseTileCoords.X, mouseTileCoords.Y).IsTileSolidGround()) - Projectile.NewProjectile(source, Main.MouseWorld, Vector2.UnitY * 4f, type, damage, knockback, player.whoAmI, 0f, 0f); + { + int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.UnitY * 4f, type, damage, knockback, player.whoAmI, 0f, 0f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; + } return false; } diff --git a/Items/Weapons/Summon/DankStaff.cs b/Items/Weapons/Summon/DankStaff.cs index b7ed480702..1df81b2c73 100644 --- a/Items/Weapons/Summon/DankStaff.cs +++ b/Items/Weapons/Summon/DankStaff.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; @@ -48,7 +48,9 @@ namespace CalamityMod.Items.Weapons.Summon position = Main.MouseWorld; velocity.X = 0; velocity.Y = 0; - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; } return false; } diff --git a/Items/Weapons/Summon/DazzlingStabberStaff.cs b/Items/Weapons/Summon/DazzlingStabberStaff.cs index 2afb460776..c39854d5b6 100644 --- a/Items/Weapons/Summon/DazzlingStabberStaff.cs +++ b/Items/Weapons/Summon/DazzlingStabberStaff.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -40,7 +40,9 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.altFunctionUse != 2) { - Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; } float angleMax = MathHelper.ToRadians(45f); if (CalamityUtils.CountProjectiles(type) == 1) diff --git a/Items/Weapons/Summon/DeathstareRod.cs b/Items/Weapons/Summon/DeathstareRod.cs index 4faa5b4c1c..aee336e5ef 100644 --- a/Items/Weapons/Summon/DeathstareRod.cs +++ b/Items/Weapons/Summon/DeathstareRod.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -36,7 +36,9 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { CalamityUtils.KillShootProjectiles(true, type, player); - Projectile.NewProjectile(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 0f); + int p = Projectile.NewProjectile(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 0f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; return false; } } diff --git a/Items/Weapons/Summon/DeepseaStaff.cs b/Items/Weapons/Summon/DeepseaStaff.cs index 9029b526c7..9b32ede43d 100644 --- a/Items/Weapons/Summon/DeepseaStaff.cs +++ b/Items/Weapons/Summon/DeepseaStaff.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -41,7 +41,9 @@ namespace CalamityMod.Items.Weapons.Summon position = Main.MouseWorld; velocity.X = 0; velocity.Y = 0; - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; } return false; } diff --git a/Items/Weapons/Summon/DormantBrimseeker.cs b/Items/Weapons/Summon/DormantBrimseeker.cs index f1e3cd234f..6c4f4c312c 100644 --- a/Items/Weapons/Summon/DormantBrimseeker.cs +++ b/Items/Weapons/Summon/DormantBrimseeker.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -50,7 +50,9 @@ namespace CalamityMod.Items.Weapons.Summon } if (totalSlots < player.maxMinions) { - Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 0f); + int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 0f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; } else if (player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0f) { diff --git a/Items/Weapons/Summon/DragonbloodDisgorger.cs b/Items/Weapons/Summon/DragonbloodDisgorger.cs index 71f2a986e8..23a08b77d4 100644 --- a/Items/Weapons/Summon/DragonbloodDisgorger.cs +++ b/Items/Weapons/Summon/DragonbloodDisgorger.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; @@ -39,7 +39,9 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; return false; } diff --git a/Items/Weapons/Summon/DreadmineStaff.cs b/Items/Weapons/Summon/DreadmineStaff.cs index f7113e9d32..30fdf49e67 100644 --- a/Items/Weapons/Summon/DreadmineStaff.cs +++ b/Items/Weapons/Summon/DreadmineStaff.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.Summon; @@ -40,7 +40,9 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { //CalamityUtils.OnlyOneSentry(player, type); - Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; player.UpdateMaxTurrets(); return false; } diff --git a/Items/Weapons/Summon/ElementalAxe.cs b/Items/Weapons/Summon/ElementalAxe.cs index 6248ece035..21fb1c3d80 100644 --- a/Items/Weapons/Summon/ElementalAxe.cs +++ b/Items/Weapons/Summon/ElementalAxe.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; @@ -42,7 +42,9 @@ namespace CalamityMod.Items.Weapons.Summon position = Main.MouseWorld; velocity.X = 0; velocity.Y = 0; - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; } return false; } diff --git a/Items/Weapons/Summon/EndoHydraStaff.cs b/Items/Weapons/Summon/EndoHydraStaff.cs index a51e77c6bb..15fa8c52d5 100644 --- a/Items/Weapons/Summon/EndoHydraStaff.cs +++ b/Items/Weapons/Summon/EndoHydraStaff.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -56,12 +56,18 @@ namespace CalamityMod.Items.Weapons.Summon } if (bodyExists) { - Projectile.NewProjectileDirect(source, player.Center, Main.rand.NextVector2Unit(), ModContent.ProjectileType(), damage, knockback, player.whoAmI, bodyIndex); + int p = Projectile.NewProjectile(source, player.Center, Main.rand.NextVector2Unit(), ModContent.ProjectileType(), damage, knockback, player.whoAmI, bodyIndex); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; } else { bodyIndex = Projectile.NewProjectile(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI); - Projectile.NewProjectile(source, player.Center, Main.rand.NextVector2Unit(), ModContent.ProjectileType(), damage, knockback, player.whoAmI, bodyIndex); + int head = Projectile.NewProjectile(source, player.Center, Main.rand.NextVector2Unit(), ModContent.ProjectileType(), damage, knockback, player.whoAmI, bodyIndex); + if (Main.projectile.IndexInRange(bodyIndex)) + Main.projectile[bodyIndex].originalDamage = Item.damage; + if (Main.projectile.IndexInRange(head)) + Main.projectile[head].originalDamage = Item.damage; for (int i = 0; i < 72; i++) { Dust dust = Dust.NewDustPerfect(Main.projectile[bodyIndex].Center, 113); diff --git a/Items/Weapons/Summon/Endogenesis.cs b/Items/Weapons/Summon/Endogenesis.cs index 8e78933015..177e4d3030 100644 --- a/Items/Weapons/Summon/Endogenesis.cs +++ b/Items/Weapons/Summon/Endogenesis.cs @@ -91,6 +91,8 @@ namespace CalamityMod.Items.Weapons.Summon bodyIndex = Projectile.NewProjectile(source, spawnPosition, Vector2.Zero, ModContent.ProjectileType(), (int)(damage * dmgMult), knockback, owner.whoAmI, attackMode, 0f); limbsIndex = Projectile.NewProjectile(source, spawnPosition, Vector2.Zero, ModContent.ProjectileType(), (int)(damage * dmgMult), knockback, owner.whoAmI, attackMode, bodyIndex); Main.projectile[bodyIndex].ai[1] = limbsIndex; + Main.projectile[bodyIndex].originalDamage = (int)(damage * dmgMult); + Main.projectile[limbsIndex].originalDamage = (int)(damage * dmgMult); } public override void AddRecipes() diff --git a/Items/Weapons/Summon/EnergyStaff.cs b/Items/Weapons/Summon/EnergyStaff.cs index 68649fe00a..0dde90830f 100644 --- a/Items/Weapons/Summon/EnergyStaff.cs +++ b/Items/Weapons/Summon/EnergyStaff.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -37,7 +37,9 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { //CalamityUtils.OnlyOneSentry(player, type); - Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI, 16f); + int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI, 16f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; player.UpdateMaxTurrets(); return false; } diff --git a/Items/Weapons/Summon/EtherealSubjugator.cs b/Items/Weapons/Summon/EtherealSubjugator.cs index 9c2837d9fc..192446a2e8 100644 --- a/Items/Weapons/Summon/EtherealSubjugator.cs +++ b/Items/Weapons/Summon/EtherealSubjugator.cs @@ -74,7 +74,9 @@ namespace CalamityMod.Items.Weapons.Summon vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; Vector2 spinningpoint = new Vector2(num78, num79); spinningpoint = spinningpoint.RotatedBy(1.5707963705062866, default); - Projectile.NewProjectile(source, vector2.X + spinningpoint.X, vector2.Y + spinningpoint.Y, spinningpoint.X, spinningpoint.Y, type, damage, knockback, i, 0f, 1f); + int p = Projectile.NewProjectile(source, vector2.X + spinningpoint.X, vector2.Y + spinningpoint.Y, spinningpoint.X, spinningpoint.Y, type, damage, knockback, i, 0f, 1f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; } return false; } diff --git a/Items/Weapons/Summon/EyeOfNight.cs b/Items/Weapons/Summon/EyeOfNight.cs index 0070654122..74ad34d1c4 100644 --- a/Items/Weapons/Summon/EyeOfNight.cs +++ b/Items/Weapons/Summon/EyeOfNight.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using Terraria.ModLoader; using Terraria.ID; using CalamityMod.Projectiles.Summon; @@ -37,7 +37,11 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.altFunctionUse != 2) - Projectile.NewProjectile(source, Main.MouseWorld, Vector2.UnitY * -3f, type, damage, knockback, player.whoAmI); + { + int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.UnitY * -3f, type, damage, knockback, player.whoAmI); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; + } return false; } diff --git a/Items/Weapons/Summon/FleshOfInfidelity.cs b/Items/Weapons/Summon/FleshOfInfidelity.cs index aeffc1b04a..4cc40ff066 100644 --- a/Items/Weapons/Summon/FleshOfInfidelity.cs +++ b/Items/Weapons/Summon/FleshOfInfidelity.cs @@ -1,7 +1,10 @@ -using Terraria.ModLoader; +using Terraria.ModLoader; using Terraria.ID; using TerrariaAudio = Terraria.Audio; using CalamityMod.Projectiles.Summon; +using Terraria; +using Terraria.DataStructures; +using Microsoft.Xna.Framework; namespace CalamityMod.Items.Weapons.Summon { @@ -33,6 +36,17 @@ namespace CalamityMod.Items.Weapons.Summon Item.DamageType = DamageClass.Summon; } + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + if (player.altFunctionUse != 2) + { + int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.UnitY * -1f, type, damage, knockback, player.whoAmI); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; + } + return false; + } + public override void AddRecipes() { CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ItemID.ImpStaff).AddTile(TileID.DemonAltar).Register(); diff --git a/Items/Weapons/Summon/FlowersOfMortality.cs b/Items/Weapons/Summon/FlowersOfMortality.cs index cfe3d9e447..451d6e0774 100644 --- a/Items/Weapons/Summon/FlowersOfMortality.cs +++ b/Items/Weapons/Summon/FlowersOfMortality.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; @@ -45,6 +45,7 @@ namespace CalamityMod.Items.Weapons.Summon Projectile blossom = Projectile.NewProjectileDirect(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 0f); blossom.ai[0] = MathHelper.TwoPi * i / 5f; blossom.rotation = blossom.ai[0]; + blossom.originalDamage = Item.damage; } return false; } diff --git a/Items/Weapons/Summon/ForgottenApexWand.cs b/Items/Weapons/Summon/ForgottenApexWand.cs index a736788358..4e98a32260 100644 --- a/Items/Weapons/Summon/ForgottenApexWand.cs +++ b/Items/Weapons/Summon/ForgottenApexWand.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using Terraria.ModLoader; using Terraria.ID; using Terraria; @@ -49,7 +49,9 @@ namespace CalamityMod.Items.Weapons.Summon Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); vector2.X = Main.mouseX + Main.screenPosition.X; vector2.Y = Main.mouseY + Main.screenPosition.Y; - Projectile.NewProjectile(source, vector2, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); + int p = Projectile.NewProjectile(source, vector2, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; } return false; } diff --git a/Items/Weapons/Summon/FrostBlossomStaff.cs b/Items/Weapons/Summon/FrostBlossomStaff.cs index 4e832f1b39..7f4f134f8a 100644 --- a/Items/Weapons/Summon/FrostBlossomStaff.cs +++ b/Items/Weapons/Summon/FrostBlossomStaff.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -37,7 +37,9 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { CalamityUtils.KillShootProjectiles(true, type, player); - Projectile.NewProjectile(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 0f); + int p = Projectile.NewProjectile(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 0f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; return false; } public override void AddRecipes() diff --git a/Items/Weapons/Summon/FuelCellBundle.cs b/Items/Weapons/Summon/FuelCellBundle.cs index 0610c4378f..6bcf5d2da8 100644 --- a/Items/Weapons/Summon/FuelCellBundle.cs +++ b/Items/Weapons/Summon/FuelCellBundle.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -38,7 +38,9 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.altFunctionUse != 2) //throws a flask { - Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; } return false; } diff --git a/Items/Weapons/Summon/GammaHeart.cs b/Items/Weapons/Summon/GammaHeart.cs index 353627defd..18a8e84f03 100644 --- a/Items/Weapons/Summon/GammaHeart.cs +++ b/Items/Weapons/Summon/GammaHeart.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -38,7 +38,11 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.altFunctionUse != 2) - Projectile.NewProjectileDirect(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI); + { + int p = Projectile.NewProjectile(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; + } return false; } } diff --git a/Items/Weapons/Summon/GastricBelcherStaff.cs b/Items/Weapons/Summon/GastricBelcherStaff.cs index 1c0450f054..da838eb937 100644 --- a/Items/Weapons/Summon/GastricBelcherStaff.cs +++ b/Items/Weapons/Summon/GastricBelcherStaff.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using System; @@ -65,7 +65,9 @@ namespace CalamityMod.Items.Weapons.Summon playerPos.X = Main.mouseX + Main.screenPosition.X; playerPos.Y = Main.mouseY + Main.screenPosition.Y; spinningpoint = spinningpoint.RotatedBy(Math.PI / 2D, default); - Projectile.NewProjectile(source, playerPos + spinningpoint, spinningpoint, type, damage, knockback, player.whoAmI, 0f, 1f); + int p = Projectile.NewProjectile(source, playerPos + spinningpoint, spinningpoint, type, damage, knockback, player.whoAmI, 0f, 1f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; } return false; } diff --git a/Items/Weapons/Summon/GodspawnHelixStaff.cs b/Items/Weapons/Summon/GodspawnHelixStaff.cs index 473d334128..62dfe670e9 100644 --- a/Items/Weapons/Summon/GodspawnHelixStaff.cs +++ b/Items/Weapons/Summon/GodspawnHelixStaff.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -38,7 +38,9 @@ namespace CalamityMod.Items.Weapons.Summon position = Main.MouseWorld; velocity.X = 0; velocity.Y = 0; - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; return false; } } diff --git a/Items/Weapons/Summon/HauntedScroll.cs b/Items/Weapons/Summon/HauntedScroll.cs index 1b69e78282..a8e0a40701 100644 --- a/Items/Weapons/Summon/HauntedScroll.cs +++ b/Items/Weapons/Summon/HauntedScroll.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -41,7 +41,9 @@ namespace CalamityMod.Items.Weapons.Summon position = Main.MouseWorld; velocity.X = 0; velocity.Y = 0; - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0f, 30f); + int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0f, 30f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; //projectile.ai[1] is attack cooldown. Setting it here prevents immediate attacks } return false; diff --git a/Items/Weapons/Summon/HerringStaff.cs b/Items/Weapons/Summon/HerringStaff.cs index 9f47aa38ec..132873ba57 100644 --- a/Items/Weapons/Summon/HerringStaff.cs +++ b/Items/Weapons/Summon/HerringStaff.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -41,7 +41,9 @@ namespace CalamityMod.Items.Weapons.Summon position = Main.MouseWorld; velocity.X = 0; velocity.Y = 0; - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; } return false; } diff --git a/Items/Weapons/Summon/HivePod.cs b/Items/Weapons/Summon/HivePod.cs index 34655fa003..62bac7f694 100644 --- a/Items/Weapons/Summon/HivePod.cs +++ b/Items/Weapons/Summon/HivePod.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -37,7 +37,9 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { //CalamityUtils.OnlyOneSentry(player, type); - Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; player.UpdateMaxTurrets(); return false; } diff --git a/Items/Weapons/Summon/IgneousExaltation.cs b/Items/Weapons/Summon/IgneousExaltation.cs index 258420cf32..adfdb90ff7 100644 --- a/Items/Weapons/Summon/IgneousExaltation.cs +++ b/Items/Weapons/Summon/IgneousExaltation.cs @@ -49,7 +49,9 @@ namespace CalamityMod.Items.Weapons.Summon if (player.altFunctionUse != 2 && totalMinionSlots < player.maxMinions) { position = Main.MouseWorld; - Projectile.NewProjectile(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; int swordCount = 0; for (int i = 0; i < Main.maxProjectiles; i++) { diff --git a/Items/Weapons/Summon/InfectedRemote.cs b/Items/Weapons/Summon/InfectedRemote.cs index a159b73a06..ef7eebbc2f 100644 --- a/Items/Weapons/Summon/InfectedRemote.cs +++ b/Items/Weapons/Summon/InfectedRemote.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using System; @@ -68,7 +68,9 @@ namespace CalamityMod.Items.Weapons.Summon position = Main.MouseWorld; velocity.X = 0; velocity.Y = 0; - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, (int)(damage * damageMult), knockback, player.whoAmI, viruliSlots, 1f); + int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, (int)(damage * damageMult), knockback, player.whoAmI, viruliSlots, 1f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = (int)(Item.damage * damageMult); return false; } } diff --git a/Items/Weapons/Summon/LanternoftheSoul.cs b/Items/Weapons/Summon/LanternoftheSoul.cs index ae7a1e8142..0d381ab24c 100644 --- a/Items/Weapons/Summon/LanternoftheSoul.cs +++ b/Items/Weapons/Summon/LanternoftheSoul.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -39,7 +39,9 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { //CalamityUtils.OnlyOneSentry(player, type); - Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; player.UpdateMaxTurrets(); return false; } diff --git a/Items/Weapons/Summon/MagicalConch.cs b/Items/Weapons/Summon/MagicalConch.cs index eb871fcf3a..2f41392dc9 100644 --- a/Items/Weapons/Summon/MagicalConch.cs +++ b/Items/Weapons/Summon/MagicalConch.cs @@ -61,7 +61,9 @@ namespace CalamityMod.Items.Weapons.Summon num79 = 0f; vector2.X = (float)Main.mouseX + Main.screenPosition.X; vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; - Projectile.NewProjectile(source, vector2.X, vector2.Y, num78, num79, ModContent.ProjectileType(), num73, knockback, i, 0f, 0f); + int p = Projectile.NewProjectile(source, vector2.X, vector2.Y, num78, num79, ModContent.ProjectileType(), num73, knockback, i, 0f, 0f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; return false; } } diff --git a/Items/Weapons/Summon/Metastasis.cs b/Items/Weapons/Summon/Metastasis.cs index 91895d7d82..f41d391a3b 100644 --- a/Items/Weapons/Summon/Metastasis.cs +++ b/Items/Weapons/Summon/Metastasis.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -45,7 +45,9 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile.NewProjectile(source, Main.MouseWorld, -Vector2.UnitY * 5f, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, Main.MouseWorld, -Vector2.UnitY * 5f, type, damage, knockback, player.whoAmI); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; return false; } } diff --git a/Items/Weapons/Summon/MidnightSunBeacon.cs b/Items/Weapons/Summon/MidnightSunBeacon.cs index ca824a1c6e..539c13a954 100644 --- a/Items/Weapons/Summon/MidnightSunBeacon.cs +++ b/Items/Weapons/Summon/MidnightSunBeacon.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -41,7 +41,9 @@ namespace CalamityMod.Items.Weapons.Summon } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; return false; } public override void AddRecipes() diff --git a/Items/Weapons/Summon/OrthoceraShell.cs b/Items/Weapons/Summon/OrthoceraShell.cs index 02da2f9f51..a3c2849132 100644 --- a/Items/Weapons/Summon/OrthoceraShell.cs +++ b/Items/Weapons/Summon/OrthoceraShell.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -40,7 +40,9 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.whoAmI == Main.myPlayer) { - Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 1f); + int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 1f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; player.UpdateMaxTurrets(); } } diff --git a/Items/Weapons/Summon/Perdition.cs b/Items/Weapons/Summon/Perdition.cs index 002a600127..1e238e871f 100644 --- a/Items/Weapons/Summon/Perdition.cs +++ b/Items/Weapons/Summon/Perdition.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -46,7 +46,9 @@ namespace CalamityMod.Items.Weapons.Summon if (player.altFunctionUse != 2) { CalamityUtils.OnlyOneSentry(player, type); - Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; player.UpdateMaxTurrets(); } else diff --git a/Items/Weapons/Summon/PlantationStaff.cs b/Items/Weapons/Summon/PlantationStaff.cs index 4e6b24c3c6..dcd6c54733 100644 --- a/Items/Weapons/Summon/PlantationStaff.cs +++ b/Items/Weapons/Summon/PlantationStaff.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; @@ -77,7 +77,9 @@ namespace CalamityMod.Items.Weapons.Summon playerPos.X = (float)Main.mouseX + Main.screenPosition.X; playerPos.Y = (float)Main.mouseY + Main.screenPosition.Y; spinningpoint = spinningpoint.RotatedBy(MathHelper.PiOver2, default); - Projectile.NewProjectile(source, playerPos + spinningpoint, spinningpoint, type, damage, knockback, player.whoAmI, 0f, 0f); + int p = Projectile.NewProjectile(source, playerPos + spinningpoint, spinningpoint, type, damage, knockback, player.whoAmI, 0f, 0f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; } return false; } diff --git a/Items/Weapons/Summon/PolypLauncher.cs b/Items/Weapons/Summon/PolypLauncher.cs index d40627979d..2b06a861b7 100644 --- a/Items/Weapons/Summon/PolypLauncher.cs +++ b/Items/Weapons/Summon/PolypLauncher.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -37,7 +37,9 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { //CalamityUtils.OnlyOneSentry(player, type); - Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI, 20f); + int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI, 20f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; player.UpdateMaxTurrets(); return false; } diff --git a/Items/Weapons/Summon/PrototypeAndromechaRing.cs b/Items/Weapons/Summon/PrototypeAndromechaRing.cs index 143b8b6fa4..c49955737e 100644 --- a/Items/Weapons/Summon/PrototypeAndromechaRing.cs +++ b/Items/Weapons/Summon/PrototypeAndromechaRing.cs @@ -125,7 +125,7 @@ namespace CalamityMod.Items.Weapons.Summon { var source = player.GetProjectileSource_Item(item); int damage = player.Calamity().andromedaState == AndromedaPlayerState.SmallRobot ? GiantIbanRobotOfDoom.RegicideBaseDamageSmall : GiantIbanRobotOfDoom.RegicideBaseDamageLarge; - Projectile.NewProjectileDirect(source, robot.Center + (robot.spriteDirection > 0).ToDirectionInt() * robot.width / 2 * Vector2.UnitX, + Projectile.NewProjectile(source, robot.Center + (robot.spriteDirection > 0).ToDirectionInt() * robot.width / 2 * Vector2.UnitX, Vector2.Zero, ModContent.ProjectileType(), damage, 15f, player.whoAmI, Projectile.GetByUUID(robot.owner, robot.whoAmI)); } diff --git a/Items/Weapons/Summon/ResurrectionButterfly.cs b/Items/Weapons/Summon/ResurrectionButterfly.cs index e05f446191..afd8b97fcc 100644 --- a/Items/Weapons/Summon/ResurrectionButterfly.cs +++ b/Items/Weapons/Summon/ResurrectionButterfly.cs @@ -70,9 +70,13 @@ namespace CalamityMod.Items.Weapons.Summon vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; Vector2 spinningpoint = new Vector2(num78, num79); spinningpoint = spinningpoint.RotatedBy(1.5707963705062866, default); - Projectile.NewProjectile(source, vector2.X + spinningpoint.X, vector2.Y + spinningpoint.Y, spinningpoint.X, spinningpoint.Y, ModContent.ProjectileType(), damage, knockback, i, 0f, 0f); + int p = Projectile.NewProjectile(source, vector2.X + spinningpoint.X, vector2.Y + spinningpoint.Y, spinningpoint.X, spinningpoint.Y, ModContent.ProjectileType(), damage, knockback, i, 0f, 0f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; spinningpoint = spinningpoint.RotatedBy(-3.1415927410125732, default); - Projectile.NewProjectile(source, vector2.X + spinningpoint.X, vector2.Y + spinningpoint.Y, spinningpoint.X, spinningpoint.Y, ModContent.ProjectileType(), damage, knockback, i, 0f, 0f); + p = Projectile.NewProjectile(source, vector2.X + spinningpoint.X, vector2.Y + spinningpoint.Y, spinningpoint.X, spinningpoint.Y, ModContent.ProjectileType(), damage, knockback, i, 0f, 0f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; return false; } diff --git a/Items/Weapons/Summon/RustyBeaconPrototype.cs b/Items/Weapons/Summon/RustyBeaconPrototype.cs index 8c5e2a9dae..8e4e4749e6 100644 --- a/Items/Weapons/Summon/RustyBeaconPrototype.cs +++ b/Items/Weapons/Summon/RustyBeaconPrototype.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; @@ -39,7 +39,9 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.altFunctionUse != 2) { - Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 1f); + int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 1f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; } return false; } diff --git a/Items/Weapons/Summon/SandSharknadoStaff.cs b/Items/Weapons/Summon/SandSharknadoStaff.cs index 32e972531a..1cf0d2fe08 100644 --- a/Items/Weapons/Summon/SandSharknadoStaff.cs +++ b/Items/Weapons/Summon/SandSharknadoStaff.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; @@ -42,7 +42,9 @@ namespace CalamityMod.Items.Weapons.Summon position = Main.MouseWorld; velocity.X = 0; velocity.Y = 0; - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0f, 1f); + int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0f, 1f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; } return false; } diff --git a/Items/Weapons/Summon/SarosPossession.cs b/Items/Weapons/Summon/SarosPossession.cs index d4b3286a8a..111db76ea2 100644 --- a/Items/Weapons/Summon/SarosPossession.cs +++ b/Items/Weapons/Summon/SarosPossession.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -65,7 +65,9 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { CalamityUtils.KillShootProjectiles(true, type, player); - Projectile.NewProjectile(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI, radianceSlots); + int p = Projectile.NewProjectile(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI, radianceSlots); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; return false; } diff --git a/Items/Weapons/Summon/ScabRipper.cs b/Items/Weapons/Summon/ScabRipper.cs index 8b58753acd..d1321527a9 100644 --- a/Items/Weapons/Summon/ScabRipper.cs +++ b/Items/Weapons/Summon/ScabRipper.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -41,7 +41,9 @@ namespace CalamityMod.Items.Weapons.Summon position = Main.MouseWorld; velocity.X = 0; velocity.Y = 0; - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; } return false; } diff --git a/Items/Weapons/Summon/SeaboundStaff.cs b/Items/Weapons/Summon/SeaboundStaff.cs index 06b475778d..c849aed097 100644 --- a/Items/Weapons/Summon/SeaboundStaff.cs +++ b/Items/Weapons/Summon/SeaboundStaff.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -42,7 +42,9 @@ namespace CalamityMod.Items.Weapons.Summon position = Main.MouseWorld; velocity.X = 0; velocity.Y = 0; - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; } return false; } diff --git a/Items/Weapons/Summon/ShellfishStaff.cs b/Items/Weapons/Summon/ShellfishStaff.cs index b08ff96fef..c479cdd361 100644 --- a/Items/Weapons/Summon/ShellfishStaff.cs +++ b/Items/Weapons/Summon/ShellfishStaff.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -39,7 +39,9 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.altFunctionUse != 2) { - Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; } return false; } diff --git a/Items/Weapons/Summon/Sirius.cs b/Items/Weapons/Summon/Sirius.cs index 6a0ef3293b..36727caf62 100644 --- a/Items/Weapons/Summon/Sirius.cs +++ b/Items/Weapons/Summon/Sirius.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using CalamityMod.Items.Placeables.Ores; @@ -64,7 +64,9 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { CalamityUtils.KillShootProjectiles(true, type, player); - Projectile.NewProjectile(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI, siriusSlots, 30f); + int p = Projectile.NewProjectile(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI, siriusSlots, 30f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; return false; } diff --git a/Items/Weapons/Summon/SlimePuppetStaff.cs b/Items/Weapons/Summon/SlimePuppetStaff.cs index d37c27e857..c2a7b39d7b 100644 --- a/Items/Weapons/Summon/SlimePuppetStaff.cs +++ b/Items/Weapons/Summon/SlimePuppetStaff.cs @@ -41,8 +41,11 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.altFunctionUse != 2) - Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, Main.myPlayer); - + { + int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, Main.myPlayer); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; + } return false; } } diff --git a/Items/Weapons/Summon/SpikecragStaff.cs b/Items/Weapons/Summon/SpikecragStaff.cs index 59b2180eed..b5d5512aa8 100644 --- a/Items/Weapons/Summon/SpikecragStaff.cs +++ b/Items/Weapons/Summon/SpikecragStaff.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -38,7 +38,9 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { //CalamityUtils.OnlyOneSentry(player, type); - Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI, 120f, 0f); + int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI, 120f, 0f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; player.UpdateMaxTurrets(); return false; } diff --git a/Items/Weapons/Summon/SquirrelSquireStaff.cs b/Items/Weapons/Summon/SquirrelSquireStaff.cs index afd94d2fd3..296aae42ff 100644 --- a/Items/Weapons/Summon/SquirrelSquireStaff.cs +++ b/Items/Weapons/Summon/SquirrelSquireStaff.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -42,7 +42,10 @@ namespace CalamityMod.Items.Weapons.Summon position = Main.MouseWorld; velocity.X = 0; velocity.Y = 0; - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0f, 30f); + int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0f, 30f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; + player.UpdateMaxTurrets(); //projectile.ai[1] is attack cooldown. Setting it here prevents immediate attacks } diff --git a/Items/Weapons/Summon/StaffOfNecrosteocytes.cs b/Items/Weapons/Summon/StaffOfNecrosteocytes.cs index a04faf20a8..b1e8002f3f 100644 --- a/Items/Weapons/Summon/StaffOfNecrosteocytes.cs +++ b/Items/Weapons/Summon/StaffOfNecrosteocytes.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -42,7 +42,9 @@ namespace CalamityMod.Items.Weapons.Summon return false; if (player.altFunctionUse != 2) { - Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; } return false; } diff --git a/Items/Weapons/Summon/StaffoftheMechworm.cs b/Items/Weapons/Summon/StaffoftheMechworm.cs index 81457661ac..222f4a96fd 100644 --- a/Items/Weapons/Summon/StaffoftheMechworm.cs +++ b/Items/Weapons/Summon/StaffoftheMechworm.cs @@ -65,11 +65,17 @@ namespace CalamityMod.Items.Weapons.Summon int curr = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, owner.whoAmI, 0f, 0f); curr = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, owner.whoAmI, Main.projectile[curr].identity, 0f); + if (Main.projectile.IndexInRange(curr)) + Main.projectile[curr].originalDamage = damage; int prev = curr; curr = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, owner.whoAmI, Main.projectile[curr].identity, 0f); + if (Main.projectile.IndexInRange(curr)) + Main.projectile[curr].originalDamage = damage; Main.projectile[prev].localAI[1] = curr; prev = curr; curr = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, owner.whoAmI, Main.projectile[curr].identity, 0f); + if (Main.projectile.IndexInRange(curr)) + Main.projectile[curr].originalDamage = damage; Main.projectile[prev].localAI[1] = curr; tailIndex = curr; @@ -89,6 +95,10 @@ namespace CalamityMod.Items.Weapons.Summon var m = Main.projectileIdentity; Main.projectile[tailIndex].ai[0] = Main.projectile[body].identity; Main.projectile[tailIndex].netUpdate = true; + if (Main.projectile.IndexInRange(body)) + Main.projectile[body].originalDamage = damage; + if (Main.projectile.IndexInRange(body2)) + Main.projectile[body2].originalDamage = damage; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) diff --git a/Items/Weapons/Summon/StormjawStaff.cs b/Items/Weapons/Summon/StormjawStaff.cs index 7c02f84b7a..1f48b722ce 100644 --- a/Items/Weapons/Summon/StormjawStaff.cs +++ b/Items/Weapons/Summon/StormjawStaff.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -39,7 +39,9 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.altFunctionUse != 2) { - Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; } return false; } diff --git a/Items/Weapons/Summon/SunGodStaff.cs b/Items/Weapons/Summon/SunGodStaff.cs index 831cda0d18..96a795bb76 100644 --- a/Items/Weapons/Summon/SunGodStaff.cs +++ b/Items/Weapons/Summon/SunGodStaff.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; @@ -44,7 +44,9 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { CalamityUtils.KillShootProjectiles(true, type, player); - Projectile.NewProjectile(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; return false; } } diff --git a/Items/Weapons/Summon/SunSpiritStaff.cs b/Items/Weapons/Summon/SunSpiritStaff.cs index 6ebdc82e22..d1a72dab26 100644 --- a/Items/Weapons/Summon/SunSpiritStaff.cs +++ b/Items/Weapons/Summon/SunSpiritStaff.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; @@ -44,7 +44,9 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { CalamityUtils.KillShootProjectiles(true, type, player); - Projectile.NewProjectile(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; return false; } } diff --git a/Items/Weapons/Summon/TacticalPlagueEngine.cs b/Items/Weapons/Summon/TacticalPlagueEngine.cs index 5ad6c69891..e99d56356a 100644 --- a/Items/Weapons/Summon/TacticalPlagueEngine.cs +++ b/Items/Weapons/Summon/TacticalPlagueEngine.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; @@ -40,7 +40,11 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.altFunctionUse != 2) - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0f, 1f); + { + int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0f, 1f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; + } return false; } diff --git a/Items/Weapons/Summon/TundraFlameBlossomsStaff.cs b/Items/Weapons/Summon/TundraFlameBlossomsStaff.cs index 30993778b8..a39f0cd016 100644 --- a/Items/Weapons/Summon/TundraFlameBlossomsStaff.cs +++ b/Items/Weapons/Summon/TundraFlameBlossomsStaff.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -44,6 +44,7 @@ namespace CalamityMod.Items.Weapons.Summon Projectile blossom = Projectile.NewProjectileDirect(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 0f); blossom.ai[1] = (int)(MathHelper.TwoPi / 3f * i * 32f); blossom.rotation = blossom.ai[1] / 32f; + blossom.originalDamage = Item.damage; } return false; } diff --git a/Items/Weapons/Summon/UniverseSplitter.cs b/Items/Weapons/Summon/UniverseSplitter.cs index 3c29b0b17c..a699ab3af5 100644 --- a/Items/Weapons/Summon/UniverseSplitter.cs +++ b/Items/Weapons/Summon/UniverseSplitter.cs @@ -58,7 +58,9 @@ namespace CalamityMod.Items.Weapons.Summon if (!player.HasCooldown(Cooldowns.UniverseSplitter.ID)) { player.AddCooldown(Cooldowns.UniverseSplitter.ID, CalamityUtils.SecondsToFrames(45)); - Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; for (int i = 0; i < 36; i++) { float angle = MathHelper.TwoPi / 36f * i + Main.rand.NextFloat(MathHelper.TwoPi / 36f); @@ -78,9 +80,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void AddRecipes() { - // TODO -- Draedon's remote appears to not exist as of 1.4 porting. Is this intentional or did something go wrong? CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 5).AddTile(ModContent.TileType()).Register(); - //CreateRecipe(1).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType()).AddIngredient(ModContent.ItemType(), 5).AddTile(ModContent.TileType()).Register(); } } } diff --git a/Items/Weapons/Summon/Vigilance.cs b/Items/Weapons/Summon/Vigilance.cs index 149cc8cf47..d4405efa84 100644 --- a/Items/Weapons/Summon/Vigilance.cs +++ b/Items/Weapons/Summon/Vigilance.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -49,7 +49,9 @@ namespace CalamityMod.Items.Weapons.Summon totalSeekers++; } - Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; for (int i = 0; i < Main.maxProjectiles; i++) { diff --git a/Items/Weapons/Summon/VileFeeder.cs b/Items/Weapons/Summon/VileFeeder.cs index f069641f40..3fb9e7b99f 100644 --- a/Items/Weapons/Summon/VileFeeder.cs +++ b/Items/Weapons/Summon/VileFeeder.cs @@ -68,7 +68,9 @@ namespace CalamityMod.Items.Weapons.Summon vector2.Y = (float)Main.mouseY + Main.screenPosition.Y; Vector2 spinningpoint = new Vector2(num78, num79); spinningpoint = spinningpoint.RotatedBy(MathHelper.PiOver2, default); - Projectile.NewProjectile(source, vector2.X + spinningpoint.X, vector2.Y + spinningpoint.Y, spinningpoint.X, spinningpoint.Y, type, damage, knockback, i, 0f, 0f); + int p = Projectile.NewProjectile(source, vector2.X + spinningpoint.X, vector2.Y + spinningpoint.Y, spinningpoint.X, spinningpoint.Y, type, damage, knockback, i, 0f, 0f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; } return false; } diff --git a/Items/Weapons/Summon/ViralSprout.cs b/Items/Weapons/Summon/ViralSprout.cs index 2f9d27fa7a..34d9004c0a 100644 --- a/Items/Weapons/Summon/ViralSprout.cs +++ b/Items/Weapons/Summon/ViralSprout.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; @@ -40,7 +40,9 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.altFunctionUse != 2) { - Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, type, damage, knockback, player.whoAmI); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; int minionCount = 0; for (int i = 0; i < Main.maxProjectiles; i++) diff --git a/Items/Weapons/Summon/ViridVanguard.cs b/Items/Weapons/Summon/ViridVanguard.cs index 4aa6759bbd..3a07ea38c3 100644 --- a/Items/Weapons/Summon/ViridVanguard.cs +++ b/Items/Weapons/Summon/ViridVanguard.cs @@ -69,11 +69,13 @@ namespace CalamityMod.Items.Weapons.Summon Projectile newBlade = Projectile.NewProjectileDirect(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI); (newBlade.ModProjectile as ViridVanguardBlade).AltTexture = swordCount % 2 == 1; + newBlade.originalDamage = Item.damage; newBlade.netUpdate = true; swordCount++; newBlade = Projectile.NewProjectileDirect(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI); (newBlade.ModProjectile as ViridVanguardBlade).AltTexture = swordCount % 2 == 1; + newBlade.originalDamage = Item.damage; newBlade.netUpdate = true; swordCount++; diff --git a/Items/Weapons/Summon/VoidConcentrationStaff.cs b/Items/Weapons/Summon/VoidConcentrationStaff.cs index 8d223a8464..23b79f3d3e 100644 --- a/Items/Weapons/Summon/VoidConcentrationStaff.cs +++ b/Items/Weapons/Summon/VoidConcentrationStaff.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Buffs.Summon; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; @@ -50,7 +50,9 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.altFunctionUse != 2) { - Projectile.NewProjectile(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; player.AddBuff(ModContent.BuffType(), 120); } return false; diff --git a/Items/Weapons/Summon/WitherBlossomsStaff.cs b/Items/Weapons/Summon/WitherBlossomsStaff.cs index a03824a19e..ab6405fc28 100644 --- a/Items/Weapons/Summon/WitherBlossomsStaff.cs +++ b/Items/Weapons/Summon/WitherBlossomsStaff.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; @@ -45,6 +45,7 @@ namespace CalamityMod.Items.Weapons.Summon Projectile blossom = Projectile.NewProjectileDirect(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 0f); blossom.ai[0] = MathHelper.TwoPi * i / 4f; blossom.rotation = blossom.ai[0]; + blossom.originalDamage = Item.damage; } return false; } diff --git a/Items/Weapons/Summon/WulfrumController.cs b/Items/Weapons/Summon/WulfrumController.cs index 2f6ce3c80b..9ddd5e5a72 100644 --- a/Items/Weapons/Summon/WulfrumController.cs +++ b/Items/Weapons/Summon/WulfrumController.cs @@ -1,4 +1,4 @@ -using Terraria.DataStructures; +using Terraria.DataStructures; using CalamityMod.Projectiles.Summon; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; @@ -42,7 +42,9 @@ namespace CalamityMod.Items.Weapons.Summon position = Main.MouseWorld; velocity.X = 0; velocity.Y = 0; - Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI, 0f, 1f); + int droid = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 1f); + if (Main.projectile.IndexInRange(droid)) + Main.projectile[droid].originalDamage = Item.damage; } return false; } diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index d8846da35f..0c6698294c 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.CalPlayer; using CalamityMod.Events; @@ -54,10 +54,8 @@ namespace CalamityMod.Projectiles // Damage Adjusters private bool setDamageValues = true; - public float spawnedPlayerMinionDamageValue = 1f; public float PierceResistHarshness = 0.12f; public float PierceResistCap = 0.8f; - public int spawnedPlayerMinionProjectileDamageValue = 0; public int defDamage = 0; // Enables "supercrits". When crit is over 100%, projectiles with this bool enabled can "supercrit". @@ -1878,20 +1876,6 @@ namespace CalamityMod.Projectiles if (projectile.ModProjectile != null && projectile.ModProjectile.Mod.Name.Equals("CalamityMod")) goto SKIP_CALAMITY; - if ((projectile.minion || projectile.sentry) && !ProjectileID.Sets.StardustDragon[projectile.type]) //For all other mods and vanilla, exclude dragon due to bugs - { - if (setDamageValues) - { - spawnedPlayerMinionDamageValue = player.MinionDamage(); - spawnedPlayerMinionProjectileDamageValue = projectile.damage; - setDamageValues = false; - } - if (player.MinionDamage() != spawnedPlayerMinionDamageValue) - { - int damage2 = (int)(spawnedPlayerMinionProjectileDamageValue / spawnedPlayerMinionDamageValue * player.MinionDamage()); - projectile.damage = damage2; - } - } SKIP_CALAMITY: // If rogue projectiles are not internally throwing while in-flight, they can never critically strike. diff --git a/Projectiles/DraedonsArsenal/MountedScannerSummon.cs b/Projectiles/DraedonsArsenal/MountedScannerSummon.cs index 26a1d1a30f..b7868af3a5 100644 --- a/Projectiles/DraedonsArsenal/MountedScannerSummon.cs +++ b/Projectiles/DraedonsArsenal/MountedScannerSummon.cs @@ -45,12 +45,6 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { Player player = Main.player[Projectile.owner]; Projectile.Center = player.Center + AngularOffsetRelativeToPlayer.ToRotationVector2() * OffsetDistanceFromPlayer; - if (Projectile.localAI[0] == 0f) - { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; - } - AdjustDamage(player); GrantBuffs(player); NPC potentialTarget = Projectile.Center.MinionHoming(960f, player); @@ -66,17 +60,6 @@ namespace CalamityMod.Projectiles.DraedonsArsenal } Time++; } - // While this projectile cannot attack, the projectiles it shoots derive from the damage. - public void AdjustDamage(Player player) - { - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int trueDamage = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = trueDamage; - } - } public void GrantBuffs(Player player) { bool isCorrectProjectile = Projectile.type == ModContent.ProjectileType(); diff --git a/Projectiles/DraedonsArsenal/PoleWarperSummon.cs b/Projectiles/DraedonsArsenal/PoleWarperSummon.cs index dd3a676957..fb064f97d8 100644 --- a/Projectiles/DraedonsArsenal/PoleWarperSummon.cs +++ b/Projectiles/DraedonsArsenal/PoleWarperSummon.cs @@ -73,8 +73,6 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public void Initialize(Player player) { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; for (int i = 0; i < 45; i++) { float angle = MathHelper.TwoPi / 45f * i; @@ -84,18 +82,6 @@ namespace CalamityMod.Projectiles.DraedonsArsenal } } - // While this projectile cannot attack, the projectiles it shoots derive from the damage. - public void AdjustDamage(Player player) - { - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int trueDamage = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = trueDamage; - } - } - public void GrantBuffs(Player player) { bool isCorrectProjectile = Projectile.type == ModContent.ProjectileType(); diff --git a/Projectiles/DraedonsArsenal/PulseTurret.cs b/Projectiles/DraedonsArsenal/PulseTurret.cs index 8031bb16b5..bbf7fe571e 100644 --- a/Projectiles/DraedonsArsenal/PulseTurret.cs +++ b/Projectiles/DraedonsArsenal/PulseTurret.cs @@ -29,20 +29,6 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void AI() { Player player = Main.player[Projectile.owner]; - if (Projectile.localAI[0] == 0f) - { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; - Projectile.localAI[0] = 1; - } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int trueDamage = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = trueDamage; - } - if (Projectile.velocity.Y < 12f) { Projectile.velocity.Y += 0.5f; diff --git a/Projectiles/DraedonsArsenal/SnakeEyesSummon.cs b/Projectiles/DraedonsArsenal/SnakeEyesSummon.cs index aa52c96ef7..74a62c31c9 100644 --- a/Projectiles/DraedonsArsenal/SnakeEyesSummon.cs +++ b/Projectiles/DraedonsArsenal/SnakeEyesSummon.cs @@ -70,7 +70,6 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Initialize(player); Projectile.localAI[0] = 1f; } - AdjustDamage(player); GrantBuffs(player); NPC potentialTarget = Projectile.Center.MinionHoming(820f, player); if (potentialTarget == null || SufferingFromSeparationAnxiety) @@ -111,8 +110,6 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public void Initialize(Player player) { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; Destination = Projectile.Center - Vector2.UnitY * 180f; for (int i = 0; i < 45; i++) { @@ -123,18 +120,6 @@ namespace CalamityMod.Projectiles.DraedonsArsenal } } - // While this projectile cannot attack, the projectiles it shoots derive from the damage. - public void AdjustDamage(Player player) - { - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int trueDamage = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = trueDamage; - } - } - public void GrantBuffs(Player player) { bool isCorrectProjectile = Projectile.type == ModContent.ProjectileType(); diff --git a/Projectiles/DraedonsArsenal/StarSwallowerSummon.cs b/Projectiles/DraedonsArsenal/StarSwallowerSummon.cs index 30f8876c31..7bdf5db666 100644 --- a/Projectiles/DraedonsArsenal/StarSwallowerSummon.cs +++ b/Projectiles/DraedonsArsenal/StarSwallowerSummon.cs @@ -113,8 +113,6 @@ namespace CalamityMod.Projectiles.DraedonsArsenal } } - AdjustDamage(player); - // Gravity effect. Projectile.velocity.Y = MathHelper.Clamp(Projectile.velocity.Y + 0.4f, -11f, 11f); @@ -145,23 +143,6 @@ namespace CalamityMod.Projectiles.DraedonsArsenal ManipulateFrames(minimumFrame, maximumFrame); } - public void AdjustDamage(Player player) - { - if (Projectile.localAI[0] == 0f) - { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; - Projectile.localAI[0] += 1f; - } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int newDamage = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = newDamage; - } - } - public void HandleHop(Vector2 targetPosition) { if (HopCooldown <= 0f && Projectile.oldPosition.Y == Projectile.position.Y) diff --git a/Projectiles/Summon/AngelicAllianceArchangel.cs b/Projectiles/Summon/AngelicAllianceArchangel.cs index 246d16baf9..16b571d1d8 100644 --- a/Projectiles/Summon/AngelicAllianceArchangel.cs +++ b/Projectiles/Summon/AngelicAllianceArchangel.cs @@ -52,22 +52,12 @@ namespace CalamityMod.Projectiles.Summon // Initialization and dust if (Projectile.localAI[0] == 0f) { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; for (int i = 0; i < 10; i++) { Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.ProfanedFire, 0f, 0f, 100, default, 2f); } Projectile.localAI[0] += 1f; } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = damage2; - } - // Rotate around the player double deg = Projectile.ai[1]; double rad = deg * (Math.PI / 180); @@ -118,7 +108,9 @@ namespace CalamityMod.Projectiles.Summon if (Main.myPlayer == Projectile.owner) { int type = ModContent.ProjectileType(); - Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, direction * 0.5f, type, Projectile.damage, Projectile.knockBack, Projectile.owner); + int p = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, direction * 0.5f, type, Projectile.damage, Projectile.knockBack, Projectile.owner); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Projectile.originalDamage; } Projectile.ai[0] = 0f; Projectile.netUpdate = true; diff --git a/Projectiles/Summon/ApexShark.cs b/Projectiles/Summon/ApexShark.cs index 19bb9119c9..41cd9b093b 100644 --- a/Projectiles/Summon/ApexShark.cs +++ b/Projectiles/Summon/ApexShark.cs @@ -46,8 +46,6 @@ namespace CalamityMod.Projectiles.Summon Player player = Main.player[Projectile.owner]; if (Projectile.localAI[0] == 0f) { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { @@ -60,13 +58,6 @@ namespace CalamityMod.Projectiles.Summon } Projectile.localAI[0]++; } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = damage2; - } Projectile.frameCounter++; if (Projectile.frameCounter > 6) { diff --git a/Projectiles/Summon/AquaticStarMinion.cs b/Projectiles/Summon/AquaticStarMinion.cs index 1b5bd010f4..abc6b3c3ba 100644 --- a/Projectiles/Summon/AquaticStarMinion.cs +++ b/Projectiles/Summon/AquaticStarMinion.cs @@ -34,19 +34,6 @@ namespace CalamityMod.Projectiles.Summon { Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (Projectile.localAI[0] == 0f) - { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; - Projectile.localAI[0] += 1f; - } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = damage2; - } bool flag64 = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (flag64) diff --git a/Projectiles/Summon/AstrageldonSummon.cs b/Projectiles/Summon/AstrageldonSummon.cs index 0496f8f6b6..e8637643d4 100644 --- a/Projectiles/Summon/AstrageldonSummon.cs +++ b/Projectiles/Summon/AstrageldonSummon.cs @@ -67,8 +67,6 @@ namespace CalamityMod.Projectiles.Summon //on spawn effects and flexible minions if (!dust) { - modProj.spawnedPlayerMinionDamageValue = player.MinionDamage(); - modProj.spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int dustAmt = 16; for (int dustIndex = 0; dustIndex < dustAmt; dustIndex++) { @@ -83,13 +81,6 @@ namespace CalamityMod.Projectiles.Summon dust = true; } - if (player.MinionDamage() != modProj.spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)modProj.spawnedPlayerMinionProjectileDamageValue / - modProj.spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = damage2; - } //Bool setup bool flag64 = Projectile.type == ModContent.ProjectileType(); @@ -212,7 +203,9 @@ namespace CalamityMod.Projectiles.Summon if (Main.myPlayer == Projectile.owner) { Vector2 laserVel = Projectile.SafeDirectionTo(objectivepos) * laserSpeed; - Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, laserVel, projType, Projectile.damage, 0f, Projectile.owner); + int p = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, laserVel, projType, Projectile.damage, 0f, Projectile.owner); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Projectile.originalDamage; Projectile.netUpdate = true; } } diff --git a/Projectiles/Summon/AstralProbeSummon.cs b/Projectiles/Summon/AstralProbeSummon.cs index c7b45e762e..3b459c0a7d 100644 --- a/Projectiles/Summon/AstralProbeSummon.cs +++ b/Projectiles/Summon/AstralProbeSummon.cs @@ -41,9 +41,6 @@ namespace CalamityMod.Projectiles.Summon CalamityPlayer modPlayer = player.Calamity(); if (Projectile.localAI[0] == 0f) { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; - rotationVariation = Main.rand.NextDouble() * 0.015; int dustAmt = 36; @@ -58,12 +55,6 @@ namespace CalamityMod.Projectiles.Summon } Projectile.localAI[0] += 1f; } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - Projectile.damage = damage2; - } bool correctMinion = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (correctMinion) diff --git a/Projectiles/Summon/AureusBomber.cs b/Projectiles/Summon/AureusBomber.cs index f1d259fe54..01e03fdf33 100644 --- a/Projectiles/Summon/AureusBomber.cs +++ b/Projectiles/Summon/AureusBomber.cs @@ -47,8 +47,6 @@ namespace CalamityMod.Projectiles.Summon //on spawn effects && minion flexibility if (Projectile.localAI[0] == 0f) { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { @@ -62,13 +60,6 @@ namespace CalamityMod.Projectiles.Summon } Projectile.localAI[0] += 1f; } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = damage2; - } //anti sticking movement Projectile.MinionAntiClump(); diff --git a/Projectiles/Summon/BabyBloodCrawler.cs b/Projectiles/Summon/BabyBloodCrawler.cs index 9dbb77fb1e..dfe57befc7 100644 --- a/Projectiles/Summon/BabyBloodCrawler.cs +++ b/Projectiles/Summon/BabyBloodCrawler.cs @@ -62,8 +62,6 @@ namespace CalamityMod.Projectiles.Summon if (dust == 0f) { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int num226 = 16; for (int num227 = 0; num227 < num226; num227++) { @@ -77,13 +75,6 @@ namespace CalamityMod.Projectiles.Summon } dust += 1f; } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = damage2; - } bool flag64 = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (flag64) diff --git a/Projectiles/Summon/BelladonnaSpirit.cs b/Projectiles/Summon/BelladonnaSpirit.cs index afc0f05960..e60d20f487 100644 --- a/Projectiles/Summon/BelladonnaSpirit.cs +++ b/Projectiles/Summon/BelladonnaSpirit.cs @@ -52,13 +52,6 @@ namespace CalamityMod.Projectiles.Summon Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Projectile.type]; Projectile.frameCounter = 0; } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int trueDamage = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = trueDamage; - } bool isCorrectProjectile = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (isCorrectProjectile) @@ -92,8 +85,6 @@ namespace CalamityMod.Projectiles.Summon } public void Initialize(Player player) { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; for (int i = 0; i < 45; i++) { float angle = MathHelper.TwoPi / 45f * i; @@ -147,7 +138,9 @@ namespace CalamityMod.Projectiles.Summon float angle = Main.rand.NextFloat(-0.1f, 0.1f) + i * 0.05f; Vector2 petalSpawnPosition = Projectile.Center - Vector2.UnitY * 6f; Vector2 petalShootVelocity = Projectile.SafeDirectionTo(target.Center).RotatedBy(angle) * 7.5f; - Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), petalSpawnPosition, petalShootVelocity, petalID, Projectile.damage, Projectile.knockBack, Projectile.owner); + int p = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), petalSpawnPosition, petalShootVelocity, petalID, Projectile.damage, Projectile.knockBack, Projectile.owner); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Projectile.originalDamage; } } @@ -158,7 +151,9 @@ namespace CalamityMod.Projectiles.Summon float angle = MathHelper.Lerp(MathHelper.ToRadians(-Main.rand.NextFloat(30f, 36f)), MathHelper.ToRadians(Main.rand.NextFloat(30f, 36f)), i / 4f); Vector2 petalSpawnPosition = Projectile.Center - Vector2.UnitY * 6f; Vector2 petalShootVelocity = -Vector2.UnitY.RotatedBy(angle) * 9f; - Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), petalSpawnPosition, petalShootVelocity, petalID, Projectile.damage, Projectile.knockBack, Projectile.owner); + int p = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), petalSpawnPosition, petalShootVelocity, petalID, Projectile.damage, Projectile.knockBack, Projectile.owner); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Projectile.originalDamage; } } } diff --git a/Projectiles/Summon/BlackHawkSummon.cs b/Projectiles/Summon/BlackHawkSummon.cs index b71519d823..6b86d6a84f 100644 --- a/Projectiles/Summon/BlackHawkSummon.cs +++ b/Projectiles/Summon/BlackHawkSummon.cs @@ -44,9 +44,6 @@ namespace CalamityMod.Projectiles.Summon //On spawn effects if (Projectile.localAI[0] == 0f) { - //Set constants - modProj.spawnedPlayerMinionDamageValue = player.MinionDamage(); - modProj.spawnedPlayerMinionProjectileDamageValue = Projectile.damage; //Spawn dust int dustAmt = 36; for (int dustIndex = 0; dustIndex < dustAmt; dustIndex++) @@ -61,14 +58,6 @@ namespace CalamityMod.Projectiles.Summon Projectile.localAI[0] += 1f; } - //Flexible minion damage update - if (player.MinionDamage() != modProj.spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)modProj.spawnedPlayerMinionProjectileDamageValue / - modProj.spawnedPlayerMinionDamageValue * player.MinionDamage()); - Projectile.damage = damage2; - } - //Update frames Projectile.frameCounter++; if (Projectile.frameCounter >= 4) @@ -259,7 +248,9 @@ namespace CalamityMod.Projectiles.Summon Vector2 velocity = targetVec - Projectile.Center; velocity.Normalize(); velocity *= projSpeed; - Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, velocity, projType, Projectile.damage, Projectile.knockBack, Projectile.owner); + int p = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, velocity, projType, Projectile.damage, Projectile.knockBack, Projectile.owner); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Projectile.originalDamage; Projectile.netUpdate = true; } } diff --git a/Projectiles/Summon/BloodClotMinion.cs b/Projectiles/Summon/BloodClotMinion.cs index 1ef5e24bdb..138b10d4ca 100644 --- a/Projectiles/Summon/BloodClotMinion.cs +++ b/Projectiles/Summon/BloodClotMinion.cs @@ -40,8 +40,6 @@ namespace CalamityMod.Projectiles.Summon CalamityPlayer modPlayer = player.Calamity(); if (Projectile.localAI[0] == 0f) { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { @@ -55,13 +53,6 @@ namespace CalamityMod.Projectiles.Summon } Projectile.localAI[0] += 1f; } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = damage2; - } int num1262 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 5, 0f, 0f, 0, default, 1f); Main.dust[num1262].velocity *= 0.1f; Main.dust[num1262].scale = 0.7f; diff --git a/Projectiles/Summon/BrimstoneElementalMinion.cs b/Projectiles/Summon/BrimstoneElementalMinion.cs index 61989a2a2e..8cd45468b9 100644 --- a/Projectiles/Summon/BrimstoneElementalMinion.cs +++ b/Projectiles/Summon/BrimstoneElementalMinion.cs @@ -61,8 +61,6 @@ namespace CalamityMod.Projectiles.Summon dust--; if (dust >= 0) { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int num501 = 50; for (int num502 = 0; num502 < num501; num502++) { @@ -71,13 +69,6 @@ namespace CalamityMod.Projectiles.Summon Main.dust[num503].scale *= 1.15f; } } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = damage2; - } Projectile.frameCounter++; if (Projectile.frameCounter > 16) { @@ -207,7 +198,9 @@ namespace CalamityMod.Projectiles.Summon if (Main.myPlayer == Projectile.owner && Collision.CanHitLine(Projectile.position, Projectile.width, Projectile.height, targetCenter, 0, 0)) { Vector2 fireballshootVelocity = Projectile.SafeDirectionTo(targetCenter) * fireballShootSpeed; - Projectile.NewProjectile(Projectile.GetItemSource_FromThis(), Projectile.Center, fireballshootVelocity, num658, Projectile.damage, 0f, Projectile.owner, 0f, 0f); + int p = Projectile.NewProjectile(Projectile.GetItemSource_FromThis(), Projectile.Center, fireballshootVelocity, num658, Projectile.damage, 0f, Projectile.owner, 0f, 0f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Projectile.originalDamage; Projectile.netUpdate = true; } } diff --git a/Projectiles/Summon/BrittleStarMinion.cs b/Projectiles/Summon/BrittleStarMinion.cs index 3222f01fa4..97f1e1c779 100644 --- a/Projectiles/Summon/BrittleStarMinion.cs +++ b/Projectiles/Summon/BrittleStarMinion.cs @@ -35,19 +35,6 @@ namespace CalamityMod.Projectiles.Summon { Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (Projectile.localAI[0] == 0f) - { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; - Projectile.localAI[0] += 1f; - } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = damage2; - } bool flag64 = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (flag64) diff --git a/Projectiles/Summon/CalamariMinion.cs b/Projectiles/Summon/CalamariMinion.cs index 3e25a34dd0..c9770268c5 100644 --- a/Projectiles/Summon/CalamariMinion.cs +++ b/Projectiles/Summon/CalamariMinion.cs @@ -48,8 +48,6 @@ namespace CalamityMod.Projectiles.Summon CalamityPlayer modPlayer = player.Calamity(); if (Projectile.localAI[1] == 0f) { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); //66% = 1.66 - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; //300 * 1.66 = 498 (new value) int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { @@ -63,13 +61,6 @@ namespace CalamityMod.Projectiles.Summon } Projectile.localAI[1] += 1f; } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) //15% = 1.15 != 1.66 - { - int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / //498 - Projectile.Calamity().spawnedPlayerMinionDamageValue * //1.66 498 / 1.66 = 300 (original value) - player.MinionDamage()); //300 * 1.15 = 345 (new value) - Projectile.damage = damage2; - } Projectile.frameCounter++; if (Projectile.frameCounter > 8) { @@ -322,7 +313,9 @@ namespace CalamityMod.Projectiles.Summon { SoundEngine.PlaySound(SoundID.Item111, (int)Projectile.position.X, (int)Projectile.position.Y); Vector2 inkShootVelocity = Projectile.SafeDirectionTo(shootPosition, Vector2.UnitY) * inkShootSpeed; - Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center + Vector2.UnitY * 20f, inkShootVelocity, projID, Projectile.damage, 0f, Main.myPlayer, targetIndex, 0f); + int p = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center + Vector2.UnitY * 20f, inkShootVelocity, projID, Projectile.damage, 0f, Main.myPlayer, targetIndex, 0f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Projectile.originalDamage; Projectile.netUpdate = true; } } diff --git a/Projectiles/Summon/Calamitamini.cs b/Projectiles/Summon/Calamitamini.cs index 801ad8164d..27a7c6ed92 100644 --- a/Projectiles/Summon/Calamitamini.cs +++ b/Projectiles/Summon/Calamitamini.cs @@ -45,8 +45,6 @@ namespace CalamityMod.Projectiles.Summon if (Projectile.localAI[0] == 0f) { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int dustAmt = 36; for (int d = 0; d < dustAmt; d++) { @@ -59,12 +57,6 @@ namespace CalamityMod.Projectiles.Summon } Projectile.localAI[0] += 1f; } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - Projectile.damage = damage2; - } bool correctMinion = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); @@ -235,7 +227,9 @@ namespace CalamityMod.Projectiles.Summon Vector2 velocity = targetVec - Projectile.Center; velocity.Normalize(); velocity *= projSpeed; - Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, velocity, projType, Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + int p = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, velocity, projType, Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Projectile.originalDamage; Projectile.netUpdate = true; } } diff --git a/Projectiles/Summon/Cataclymini.cs b/Projectiles/Summon/Cataclymini.cs index 9e3827de60..c20cb763be 100644 --- a/Projectiles/Summon/Cataclymini.cs +++ b/Projectiles/Summon/Cataclymini.cs @@ -39,8 +39,6 @@ namespace CalamityMod.Projectiles.Summon if (Projectile.localAI[0] == 0f) { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int dustAmt = 36; for (int d = 0; d < dustAmt; d++) { @@ -53,12 +51,6 @@ namespace CalamityMod.Projectiles.Summon } Projectile.localAI[0] += 1f; } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - Projectile.damage = damage2; - } bool correctMinion = Projectile.type == ModContent.ProjectileType(); if (correctMinion) @@ -229,7 +221,9 @@ namespace CalamityMod.Projectiles.Summon Vector2 velocity = targetVec - Projectile.Center; velocity.Normalize(); velocity *= projSpeed; - Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, velocity, projType, Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + int p = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, velocity, projType, Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Projectile.originalDamage; Projectile.netUpdate = true; } } diff --git a/Projectiles/Summon/Catastromini.cs b/Projectiles/Summon/Catastromini.cs index 6a520d8798..635aa72e1e 100644 --- a/Projectiles/Summon/Catastromini.cs +++ b/Projectiles/Summon/Catastromini.cs @@ -40,8 +40,6 @@ namespace CalamityMod.Projectiles.Summon CalamityPlayer modPlayer = player.Calamity(); if (Projectile.localAI[0] == 0f) { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int dustAmt = 36; for (int d = 0; d < dustAmt; d++) { @@ -54,12 +52,6 @@ namespace CalamityMod.Projectiles.Summon } Projectile.localAI[0] += 1f; } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - Projectile.damage = damage2; - } bool correctMinion = Projectile.type == ModContent.ProjectileType(); if (correctMinion) { diff --git a/Projectiles/Summon/CausticStaffSummon.cs b/Projectiles/Summon/CausticStaffSummon.cs index b4a28bba2a..35fe01fcba 100644 --- a/Projectiles/Summon/CausticStaffSummon.cs +++ b/Projectiles/Summon/CausticStaffSummon.cs @@ -41,8 +41,6 @@ namespace CalamityMod.Projectiles.Summon //Spawn dust and record initial damage values if (!initialized) { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int dustAmt = 36; for (int dustIndex = 0; dustIndex < dustAmt; dustIndex++) { @@ -57,15 +55,6 @@ namespace CalamityMod.Projectiles.Summon initialized = true; } - //if minion damage changes, update it - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = damage2; - } - //If the correct minion, set bools and apply buffs bool correctMinion = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); @@ -287,6 +276,8 @@ namespace CalamityMod.Projectiles.Summon targetVec.Normalize(); targetVec *= speedMult; int spike = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, targetVec, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, debuffToInflict, 0f); + if (Main.projectile.IndexInRange(spike)) + Main.projectile[spike].originalDamage = Projectile.originalDamage; debuffToInflict++; if (debuffToInflict >= 5f) debuffToInflict = 0f; diff --git a/Projectiles/Summon/ChaosSpirit.cs b/Projectiles/Summon/ChaosSpirit.cs index 00769ec7d2..a92afca90c 100644 --- a/Projectiles/Summon/ChaosSpirit.cs +++ b/Projectiles/Summon/ChaosSpirit.cs @@ -58,8 +58,6 @@ namespace CalamityMod.Projectiles.Summon dust--; if (dust >= 0) { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int num501 = 50; for (int num502 = 0; num502 < num501; num502++) { @@ -68,13 +66,6 @@ namespace CalamityMod.Projectiles.Summon Main.dust[num503].scale *= 1.15f; } } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = damage2; - } Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 1f / 255f, (255 - Projectile.alpha) * 0.35f / 255f, (255 - Projectile.alpha) * 0f / 255f); Projectile.frameCounter++; if (Projectile.frameCounter > 9) @@ -162,7 +153,9 @@ namespace CalamityMod.Projectiles.Summon targetDist = speed / targetDist; velocity.X *= targetDist; velocity.Y *= targetDist; - Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), source, velocity, projectileType, Projectile.damage, 5f, Projectile.owner, 0f, 0f); + int p = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), source, velocity, projectileType, Projectile.damage, 5f, Projectile.owner, 0f, 0f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Projectile.originalDamage; SoundEngine.PlaySound(SoundID.Item20, Projectile.position); Projectile.ai[0] = 10f; } @@ -178,6 +171,7 @@ namespace CalamityMod.Projectiles.Summon velocityY *= -1f; int flame = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.oldPosition.X + (Projectile.width / 2), Projectile.oldPosition.Y + (Projectile.height / 2), velocityX, velocityY, projectileType, Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); Main.projectile[flame].aiStyle = 1; + Main.projectile[flame].originalDamage = Projectile.originalDamage; } SoundEngine.PlaySound(SoundID.Item20, Projectile.position); Projectile.ai[0] = 20f; diff --git a/Projectiles/Summon/CinderBlossom.cs b/Projectiles/Summon/CinderBlossom.cs index 9f19d5e209..5104c668e8 100644 --- a/Projectiles/Summon/CinderBlossom.cs +++ b/Projectiles/Summon/CinderBlossom.cs @@ -65,13 +65,6 @@ namespace CalamityMod.Projectiles.Summon Initialize(player); Projectile.localAI[0] = 1f; } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int trueDamage = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = trueDamage; - } if (Projectile.owner == Main.myPlayer) { NPC potentialTarget = Projectile.Center.MinionHoming(700f, player); @@ -80,7 +73,9 @@ namespace CalamityMod.Projectiles.Summon if (Time++ % 35f == 34f && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, potentialTarget.position, potentialTarget.width, potentialTarget.height)) { Vector2 velocity = Projectile.SafeDirectionTo(potentialTarget.Center) * Main.rand.NextFloat(10f, 18f); - Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + int p = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Projectile.originalDamage; } } } @@ -88,8 +83,6 @@ namespace CalamityMod.Projectiles.Summon } public void Initialize(Player player) { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; for (int i = 0; i < 36; i++) { Dust dust = Dust.NewDustPerfect(Projectile.Center, 6); diff --git a/Projectiles/Summon/CloudElementalMinion.cs b/Projectiles/Summon/CloudElementalMinion.cs index 4ebec94e46..60d35f67f5 100644 --- a/Projectiles/Summon/CloudElementalMinion.cs +++ b/Projectiles/Summon/CloudElementalMinion.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using System; using Terraria; @@ -60,8 +60,6 @@ namespace CalamityMod.Projectiles.Summon dust--; if (dust >= 0) { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int dustAmt = 50; for (int d = 0; d < dustAmt; d++) { @@ -70,12 +68,6 @@ namespace CalamityMod.Projectiles.Summon Main.dust[index].scale *= 1.15f; } } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - Projectile.damage = damage2; - } if (Math.Abs(Projectile.velocity.X) > 0.2f) { Projectile.spriteDirection = -Projectile.direction; diff --git a/Projectiles/Summon/ColdDivinityPointyThing.cs b/Projectiles/Summon/ColdDivinityPointyThing.cs index 2c7cf47ec4..cd95e8e7f1 100644 --- a/Projectiles/Summon/ColdDivinityPointyThing.cs +++ b/Projectiles/Summon/ColdDivinityPointyThing.cs @@ -146,20 +146,6 @@ namespace CalamityMod.Projectiles.Summon { Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (Projectile.localAI[0] == 0f) - { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; - Projectile.localAI[0] = 1f; - } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int trueDamage = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = trueDamage; - } - if (player.dead) { modPlayer.coldDivinity = false; diff --git a/Projectiles/Summon/CorroslimeMinion.cs b/Projectiles/Summon/CorroslimeMinion.cs index fe87873ad8..6dde422a6c 100644 --- a/Projectiles/Summon/CorroslimeMinion.cs +++ b/Projectiles/Summon/CorroslimeMinion.cs @@ -51,8 +51,6 @@ namespace CalamityMod.Projectiles.Summon CalamityPlayer modPlayer = player.Calamity(); if (dust == 0f) { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int num226 = 16; for (int num227 = 0; num227 < num226; num227++) { @@ -66,13 +64,6 @@ namespace CalamityMod.Projectiles.Summon } dust += 1f; } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = damage2; - } bool flag64 = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (flag64) diff --git a/Projectiles/Summon/CorruptionSlimeGodMinion.cs b/Projectiles/Summon/CorruptionSlimeGodMinion.cs index fc19823543..a10c69a340 100644 --- a/Projectiles/Summon/CorruptionSlimeGodMinion.cs +++ b/Projectiles/Summon/CorruptionSlimeGodMinion.cs @@ -49,8 +49,6 @@ namespace CalamityMod.Projectiles.Summon CalamityPlayer modPlayer = player.Calamity(); if (dust == 0f) { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int num226 = 16; for (int num227 = 0; num227 < num226; num227++) { @@ -64,13 +62,6 @@ namespace CalamityMod.Projectiles.Summon } dust += 1f; } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = damage2; - } bool flag64 = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (!modPlayer.slimeGod) diff --git a/Projectiles/Summon/CosmicEnergySpiral.cs b/Projectiles/Summon/CosmicEnergySpiral.cs index 99d00a9162..47286ae8d7 100644 --- a/Projectiles/Summon/CosmicEnergySpiral.cs +++ b/Projectiles/Summon/CosmicEnergySpiral.cs @@ -41,19 +41,6 @@ namespace CalamityMod.Projectiles.Summon Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); Lighting.AddLight((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16, (float)Main.DiscoR / 255f, (float)Main.DiscoG / 255f, (float)Main.DiscoB / 255f); - if (Projectile.localAI[0] == 0f) - { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; - Projectile.localAI[0] += 1f; - } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = damage2; - } bool flag64 = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (flag64) @@ -219,7 +206,9 @@ namespace CalamityMod.Projectiles.Summon for (int b = 0; b < blastAmt; b++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), 2f, Projectile.owner, (float)target, 0f); + int p2 = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), 2f, Projectile.owner, (float)target, 0f); + if (Main.projectile.IndexInRange(p2)) + Main.projectile[p2].originalDamage = Projectile.originalDamage / 2; } float speed = 15f; float num404 = num396 - Projectile.Center.X; @@ -228,7 +217,9 @@ namespace CalamityMod.Projectiles.Summon num406 = speed / num406; num404 *= num406; num405 *= num406; - Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, num404, num405, ModContent.ProjectileType(), Projectile.damage, 3f, Projectile.owner, (float)target, 0f); + int p = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, num404, num405, ModContent.ProjectileType(), Projectile.damage, 3f, Projectile.owner, (float)target, 0f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Projectile.originalDamage; Projectile.ai[0] = 100f; } } diff --git a/Projectiles/Summon/CosmicViperSummon.cs b/Projectiles/Summon/CosmicViperSummon.cs index 2ddc98f6b8..f8d6e88b5a 100644 --- a/Projectiles/Summon/CosmicViperSummon.cs +++ b/Projectiles/Summon/CosmicViperSummon.cs @@ -41,8 +41,6 @@ namespace CalamityMod.Projectiles.Summon if (Projectile.localAI[0] == 0f) { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int dustAmt = 36; for (int dustIndex = 0; dustIndex < dustAmt; dustIndex++) { @@ -56,13 +54,6 @@ namespace CalamityMod.Projectiles.Summon } Projectile.localAI[0] += 1f; } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = damage2; - } Projectile.frameCounter++; if (Projectile.frameCounter >= 4) @@ -265,7 +256,9 @@ namespace CalamityMod.Projectiles.Summon velocity.Y += Main.rand.NextFloat(-30f, 30f) * 0.05f; velocity.X += Main.rand.NextFloat(-30f, 30f) * 0.05f; - Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, velocity, projType, (int)(Projectile.damage * dmgMult), Projectile.knockBack, Projectile.owner, targetIndex, 0f); + int p = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, velocity, projType, (int)(Projectile.damage * dmgMult), Projectile.knockBack, Projectile.owner, targetIndex, 0f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = (int)(Projectile.originalDamage * dmgMult); Projectile.netUpdate = true; } } @@ -283,7 +276,7 @@ namespace CalamityMod.Projectiles.Summon if (Projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; - Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, frameHeight)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, frameHeight / 2f), Projectile.scale, SpriteEffects.None, 0); + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, frameHeight)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, frameHeight / 2f), Projectile.scale, spriteEffects, 0); return false; } diff --git a/Projectiles/Summon/CosmilampMinion.cs b/Projectiles/Summon/CosmilampMinion.cs index a050dfd897..b40f1e9cab 100644 --- a/Projectiles/Summon/CosmilampMinion.cs +++ b/Projectiles/Summon/CosmilampMinion.cs @@ -43,8 +43,6 @@ namespace CalamityMod.Projectiles.Summon CalamityPlayer modPlayer = player.Calamity(); if (Projectile.localAI[0] == 0f) { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { @@ -58,13 +56,6 @@ namespace CalamityMod.Projectiles.Summon } Projectile.localAI[0] += 1f; } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = damage2; - } Projectile.frameCounter++; if (Projectile.frameCounter >= 4) diff --git a/Projectiles/Summon/CrimslimeMinion.cs b/Projectiles/Summon/CrimslimeMinion.cs index ce202ee6bf..955c66c1e0 100644 --- a/Projectiles/Summon/CrimslimeMinion.cs +++ b/Projectiles/Summon/CrimslimeMinion.cs @@ -51,8 +51,6 @@ namespace CalamityMod.Projectiles.Summon CalamityPlayer modPlayer = player.Calamity(); if (dust == 0f) { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int num226 = 16; for (int num227 = 0; num227 < num226; num227++) { @@ -66,13 +64,6 @@ namespace CalamityMod.Projectiles.Summon } dust += 1f; } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = damage2; - } bool flag64 = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (flag64) diff --git a/Projectiles/Summon/CrimsonSlimeGodMinion.cs b/Projectiles/Summon/CrimsonSlimeGodMinion.cs index 627f63d810..9e31576f7c 100644 --- a/Projectiles/Summon/CrimsonSlimeGodMinion.cs +++ b/Projectiles/Summon/CrimsonSlimeGodMinion.cs @@ -49,8 +49,6 @@ namespace CalamityMod.Projectiles.Summon CalamityPlayer modPlayer = player.Calamity(); if (dust == 0f) { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int num226 = 16; for (int num227 = 0; num227 < num226; num227++) { @@ -64,13 +62,6 @@ namespace CalamityMod.Projectiles.Summon } dust += 1f; } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = damage2; - } bool flag64 = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (!modPlayer.slimeGod) diff --git a/Projectiles/Summon/DaedalusCrystal.cs b/Projectiles/Summon/DaedalusCrystal.cs index bf7a6f6f95..346c38d65d 100644 --- a/Projectiles/Summon/DaedalusCrystal.cs +++ b/Projectiles/Summon/DaedalusCrystal.cs @@ -57,8 +57,6 @@ namespace CalamityMod.Projectiles.Summon dust--; if (dust >= 0) { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int num501 = 50; for (int num502 = 0; num502 < num501; num502++) { @@ -67,13 +65,6 @@ namespace CalamityMod.Projectiles.Summon Main.dust[num503].scale *= 1.15f; } } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = damage2; - } Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.35f / 255f, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.75f / 255f); Projectile.Center = player.Center + Vector2.UnitY * (player.gfxOffY - 60f); if (player.gravDir == -1f) @@ -151,7 +142,9 @@ namespace CalamityMod.Projectiles.Summon num406 = num403 / num406; num404 *= num406; num405 *= num406; - Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X - 4f, Projectile.Center.Y, num404, num405, projectileType, Projectile.damage, 5f, Projectile.owner, 0f, 0f); + int p = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X - 4f, Projectile.Center.Y, num404, num405, projectileType, Projectile.damage, 5f, Projectile.owner, 0f, 0f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Projectile.originalDamage; Projectile.ai[0] = 50f; } } diff --git a/Projectiles/Summon/DaedalusGolem.cs b/Projectiles/Summon/DaedalusGolem.cs index 49efe0426f..b47b48d5f8 100644 --- a/Projectiles/Summon/DaedalusGolem.cs +++ b/Projectiles/Summon/DaedalusGolem.cs @@ -73,8 +73,6 @@ namespace CalamityMod.Projectiles.Summon Projectile.timeLeft = 2; } - AdjustMinionDamage(); - // Fall down. if (Projectile.velocity.Y < 15f) Projectile.velocity.Y += Gravity; @@ -150,14 +148,18 @@ namespace CalamityMod.Projectiles.Summon if (Main.rand.NextBool(2)) initialVelocity = initialVelocity.RotatedByRandom(0.4f); float initialAngle = initialVelocity.ToRotation(); - Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), ArmPosition, initialVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, initialAngle, Main.rand.Next(100)); + int p = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), ArmPosition, initialVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, initialAngle, Main.rand.Next(100)); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Projectile.originalDamage; } } } else if (!UsingChargedLaserAttack && AttackTimer == ChargedPelletAttackTime / 2 && Main.myPlayer == Projectile.owner) { Vector2 initialVelocity = Projectile.SafeDirectionTo(potentialTarget.Center + potentialTarget.velocity * 15f) * 19f; - Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), ArmPosition, initialVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + int p = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), ArmPosition, initialVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Projectile.originalDamage; } } else if (potentialTarget is null && AttackTimer != 0) @@ -167,23 +169,6 @@ namespace CalamityMod.Projectiles.Summon } } - public void AdjustMinionDamage() - { - if (Projectile.localAI[0] == 0f) - { - Projectile.Calamity().spawnedPlayerMinionDamageValue = Owner.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; - Projectile.localAI[0] += 1f; - } - if (Owner.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int newDamage = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - Owner.MinionDamage()); - Projectile.damage = newDamage; - } - } - public bool MoveToDestination(Vector2 destination) { Tile tileBelow = CalamityUtils.ParanoidTileRetrieval((int)(Projectile.Bottom.X / 16), (int)(Projectile.Bottom.Y / 16)); diff --git a/Projectiles/Summon/DankCreeperMinion.cs b/Projectiles/Summon/DankCreeperMinion.cs index 2e11ed0103..53150ca0b1 100644 --- a/Projectiles/Summon/DankCreeperMinion.cs +++ b/Projectiles/Summon/DankCreeperMinion.cs @@ -40,8 +40,6 @@ namespace CalamityMod.Projectiles.Summon CalamityPlayer modPlayer = player.Calamity(); if (Projectile.localAI[0] == 0f) { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { @@ -55,13 +53,6 @@ namespace CalamityMod.Projectiles.Summon } Projectile.localAI[0] += 1f; } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = damage2; - } bool flag64 = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (flag64) diff --git a/Projectiles/Summon/DazzlingStabber.cs b/Projectiles/Summon/DazzlingStabber.cs index ac802405a1..4a1ebc47f0 100644 --- a/Projectiles/Summon/DazzlingStabber.cs +++ b/Projectiles/Summon/DazzlingStabber.cs @@ -45,7 +45,6 @@ namespace CalamityMod.Projectiles.Summon Lighting.AddLight(Projectile.Center, Color.White.ToVector3()); ApplyPlayerBuffs(); - AdjustDamageDynamically(); UpdateFrames(); NPC potentialTarget = Projectile.Center.MinionHoming(1100f, Owner); @@ -68,21 +67,6 @@ namespace CalamityMod.Projectiles.Summon } } - public void AdjustDamageDynamically() - { - if (Projectile.localAI[0] == 0f) - { - Projectile.Calamity().spawnedPlayerMinionDamageValue = Owner.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; - Projectile.localAI[0] = 1f; - } - if (Owner.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int trueDamage = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / Projectile.Calamity().spawnedPlayerMinionDamageValue * Owner.MinionDamage()); - Projectile.damage = trueDamage; - } - } - public void UpdateFrames() { Projectile.frameCounter++; diff --git a/Projectiles/Summon/DeathstareEyeball.cs b/Projectiles/Summon/DeathstareEyeball.cs index abb0ac0a34..d244a92bf6 100644 --- a/Projectiles/Summon/DeathstareEyeball.cs +++ b/Projectiles/Summon/DeathstareEyeball.cs @@ -73,14 +73,6 @@ namespace CalamityMod.Projectiles.Summon Initialize(Owner); Projectile.ai[0] = 1f; } - if (Owner.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int trueDamage = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - Owner.MinionDamage()); - Projectile.damage = trueDamage; - } - NPC potentialTarget = Projectile.Center.MinionHoming(720f, Owner); if (potentialTarget is null) @@ -123,8 +115,12 @@ namespace CalamityMod.Projectiles.Summon { Vector2 velocity = (target.Center - Projectile.Center) / 15f; int beam = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), target.Center, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); - Main.projectile[beam].ai[0] = Projectile.GetByUUID(Projectile.owner, Projectile.whoAmI); - Main.projectile[beam].Damage(); + if (Main.projectile.IndexInRange(beam)) + { + Main.projectile[beam].originalDamage = Projectile.originalDamage; + Main.projectile[beam].ai[0] = Projectile.GetByUUID(Projectile.owner, Projectile.whoAmI); + Main.projectile[beam].Damage(); + } } PupilScale = 1.5f; } @@ -144,9 +140,6 @@ namespace CalamityMod.Projectiles.Summon public void Initialize(Player player) { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; - if (!Main.dedServ) return; diff --git a/Projectiles/Summon/DormantBrimseekerBab.cs b/Projectiles/Summon/DormantBrimseekerBab.cs index 861c7c7ecf..4948e881c7 100644 --- a/Projectiles/Summon/DormantBrimseekerBab.cs +++ b/Projectiles/Summon/DormantBrimseekerBab.cs @@ -56,19 +56,6 @@ namespace CalamityMod.Projectiles.Summon { Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (Projectile.localAI[0] == 0f) - { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; - Projectile.localAI[0] = 1f; - } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int trueDamage = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = trueDamage; - } bool isProperProjectile = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (isProperProjectile) diff --git a/Projectiles/Summon/DormantBrimseekerSummoner.cs b/Projectiles/Summon/DormantBrimseekerSummoner.cs index dbe353981f..f09d296cb2 100644 --- a/Projectiles/Summon/DormantBrimseekerSummoner.cs +++ b/Projectiles/Summon/DormantBrimseekerSummoner.cs @@ -54,7 +54,9 @@ namespace CalamityMod.Projectiles.Summon public override void Kill(int timeLeft) { - Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, Vector2.UnitY * 7f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + int p = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, Vector2.UnitY * 7f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Projectile.originalDamage; } } } diff --git a/Projectiles/Summon/DreadmineTurret.cs b/Projectiles/Summon/DreadmineTurret.cs index 3df838984d..1836eeab68 100644 --- a/Projectiles/Summon/DreadmineTurret.cs +++ b/Projectiles/Summon/DreadmineTurret.cs @@ -29,20 +29,6 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - Player player = Main.player[Projectile.owner]; - if (Projectile.localAI[0] == 0f) - { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; - Projectile.localAI[0] += 1f; - } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = damage2; - } Projectile.frameCounter++; if (Projectile.frameCounter > 6) { @@ -119,7 +105,9 @@ namespace CalamityMod.Projectiles.Summon } if (flag && Main.myPlayer == Projectile.owner) { - Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + int p = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Projectile.originalDamage; } } } diff --git a/Projectiles/Summon/EXPLODINGFROG.cs b/Projectiles/Summon/EXPLODINGFROG.cs index d7322ccdc8..b9826409b0 100644 --- a/Projectiles/Summon/EXPLODINGFROG.cs +++ b/Projectiles/Summon/EXPLODINGFROG.cs @@ -41,19 +41,6 @@ namespace CalamityMod.Projectiles.Summon Projectile.frame = 0; } Player player = Main.player[Projectile.owner]; - if (Projectile.localAI[0] == 0f) - { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; - Projectile.localAI[0] = 1; - } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int trueDamage = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = trueDamage; - } bool canExplode = Projectile.Center.ClosestNPCAt(MinExplodeDistance) != null; if (player.HasMinionAttackTargetNPC) { @@ -68,22 +55,32 @@ namespace CalamityMod.Projectiles.Summon // Goop projectiles for (int i = 0; i < 3; i++) { - Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, + int p = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, new Vector2(0f, -Main.rand.NextFloat(6f, 10f)).RotatedByRandom(ExplosionAngleVariance), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); - Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Projectile.originalDamage; + p = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, new Vector2(0f, -Main.rand.NextFloat(6f, 10f)).RotatedByRandom(ExplosionAngleVariance), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Projectile.originalDamage; } - Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, + int p2 = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, new Vector2(0f, -Main.rand.NextFloat(6f, 10f)).RotatedByRandom(ExplosionAngleVariance), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); - Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, + if (Main.projectile.IndexInRange(p2)) + Main.projectile[p2].originalDamage = Projectile.originalDamage; + p2 = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, new Vector2(0f, -Main.rand.NextFloat(6f, 10f)).RotatedByRandom(ExplosionAngleVariance), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); - Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, + if (Main.projectile.IndexInRange(p2)) + Main.projectile[p2].originalDamage = Projectile.originalDamage; + p2 = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, new Vector2(0f, -Main.rand.NextFloat(6f, 10f)).RotatedByRandom(ExplosionAngleVariance), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + if (Main.projectile.IndexInRange(p2)) + Main.projectile[p2].originalDamage = Projectile.originalDamage; } // WoF vomit sound. SoundEngine.PlaySound(SoundID.NPCKilled, Projectile.Center, 13); diff --git a/Projectiles/Summon/ElementalAxeMinion.cs b/Projectiles/Summon/ElementalAxeMinion.cs index 2986b7a712..8f3850b45f 100644 --- a/Projectiles/Summon/ElementalAxeMinion.cs +++ b/Projectiles/Summon/ElementalAxeMinion.cs @@ -40,19 +40,6 @@ namespace CalamityMod.Projectiles.Summon { Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (Projectile.localAI[0] == 0f) - { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; - Projectile.localAI[0] += 1f; - } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = damage2; - } bool flag64 = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (flag64) diff --git a/Projectiles/Summon/EndoCooperBody.cs b/Projectiles/Summon/EndoCooperBody.cs index f95a41af50..ca5a6bdf9e 100644 --- a/Projectiles/Summon/EndoCooperBody.cs +++ b/Projectiles/Summon/EndoCooperBody.cs @@ -77,8 +77,6 @@ namespace CalamityMod.Projectiles.Summon //Spawn effects if (Projectile.localAI[0] == 0f) { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; AttackMode = (int)Projectile.ai[0]; LimbID = (int)Projectile.ai[1]; Projectile.ai[0] = 0f; @@ -98,13 +96,6 @@ namespace CalamityMod.Projectiles.Summon } Projectile.localAI[1] = AttackMode; - //Damage Update - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - Projectile.damage = damage2; - } //Variables float mindistance = 2000f; float longdistance = AttackMode != 2 ? 1300f : 1200f; @@ -295,7 +286,9 @@ namespace CalamityMod.Projectiles.Summon aimlaser = aimlaser.RotatedBy(MathHelper.ToRadians(30 * -laserdirection)); float angularChange = (MathHelper.Pi / 180f) * 1.1f * laserdirection; //aimlaser *= 12f; - Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, aimlaser, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner, angularChange, (float)Projectile.whoAmI); + int p = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, aimlaser, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner, angularChange, (float)Projectile.whoAmI); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Projectile.originalDamage; laserdirection *= -1; break; diff --git a/Projectiles/Summon/EndoCooperLimbs.cs b/Projectiles/Summon/EndoCooperLimbs.cs index c8444affc2..490350fa60 100644 --- a/Projectiles/Summon/EndoCooperLimbs.cs +++ b/Projectiles/Summon/EndoCooperLimbs.cs @@ -66,8 +66,6 @@ namespace CalamityMod.Projectiles.Summon //Spawn effects if (Projectile.localAI[0] == 0f) { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; Projectile.localAI[0] += 1f; AttackMode = (int)Projectile.ai[0]; Projectile.ai[0] = 0f; @@ -88,14 +86,6 @@ namespace CalamityMod.Projectiles.Summon Projectile.rotation += rotation * body.direction; } - //Damage Update - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - Projectile.damage = damage2; - } - //Keep the limbs in place if (body.type != ModContent.ProjectileType() || !body.active) @@ -170,11 +160,19 @@ namespace CalamityMod.Projectiles.Summon { float dmgmult = 0.8f; Vector2 pspeed1 = new Vector2(Main.rand.NextFloat(3f, 8f), Main.rand.NextFloat(3f, 8f)).RotatedBy(MathHelper.ToRadians(i + 20 + MathHelper.ToDegrees(Projectile.rotation))); - Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, pspeed1, ModContent.ProjectileType(), (int)(Projectile.damage * dmgmult), 1f, Projectile.owner, 0f, 0f); + int[] projectiles = new int[3]; + + projectiles[0] = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, pspeed1, ModContent.ProjectileType(), (int)(Projectile.damage * dmgmult), 1f, Projectile.owner, 0f, 0f); Vector2 pspeed2 = pspeed1.RotatedBy(MathHelper.ToRadians(Main.rand.Next(5, 13))) * Main.rand.NextFloat(0.6f, 1.3f); - Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, pspeed2, ModContent.ProjectileType(), (int)(Projectile.damage * dmgmult), 1f, Projectile.owner, 0f, 0f); + projectiles[1] = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, pspeed2, ModContent.ProjectileType(), (int)(Projectile.damage * dmgmult), 1f, Projectile.owner, 0f, 0f); Vector2 pspeed3 = pspeed1.RotatedBy(MathHelper.ToRadians(Main.rand.Next(-12, -1))) * Main.rand.NextFloat(0.6f, 1.3f); - Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, pspeed3, ModContent.ProjectileType(), (int)(Projectile.damage * dmgmult), 1f, Projectile.owner, 0f, 0f); + projectiles[2] = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, pspeed3, ModContent.ProjectileType(), (int)(Projectile.damage * dmgmult), 1f, Projectile.owner, 0f, 0f); + + for (int j = 0; j < projectiles.Length; j++) + { + if (Main.projectile.IndexInRange(projectiles[j])) + Main.projectile[projectiles[j]].originalDamage = Projectile.originalDamage; + } } } } @@ -203,6 +201,8 @@ namespace CalamityMod.Projectiles.Summon float dmgmult = 0.9f; Vector2 pspeed1 = new Vector2(0.9f, 0.9f).RotatedBy(MathHelper.ToRadians(i + 20 + MathHelper.ToDegrees(Projectile.rotation))); int flame = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, pspeed1, ModContent.ProjectileType(), (int)(Projectile.damage * dmgmult), 1f, Projectile.owner, 0f, 0f); + if (Main.projectile.IndexInRange(flame)) + Main.projectile[flame].originalDamage = Projectile.originalDamage; } } } diff --git a/Projectiles/Summon/EndoHydraBody.cs b/Projectiles/Summon/EndoHydraBody.cs index baffe3d78d..04c5a57fc5 100644 --- a/Projectiles/Summon/EndoHydraBody.cs +++ b/Projectiles/Summon/EndoHydraBody.cs @@ -44,20 +44,6 @@ namespace CalamityMod.Projectiles.Summon { Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (Projectile.localAI[0] == 0f) - { - TargetNPCIndex = -1; - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; - Projectile.localAI[0] = 1f; - } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int trueDamage = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = trueDamage; - } bool isProperProjectile = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (isProperProjectile) diff --git a/Projectiles/Summon/EndoHydraHead.cs b/Projectiles/Summon/EndoHydraHead.cs index d9ef64219e..f16fc9a563 100644 --- a/Projectiles/Summon/EndoHydraHead.cs +++ b/Projectiles/Summon/EndoHydraHead.cs @@ -76,9 +76,6 @@ namespace CalamityMod.Projectiles.Summon if (Projectile.localAI[0] == 0f) { DeltaPosition = DeltaPositionMoving = new Vector2(Main.rand.NextFloat(-72f - 8f * totalHeads, 72f + 8f * totalHeads), -Main.rand.NextFloat(8f, 84f + 4f * totalHeads)); - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; - Projectile.netUpdate = true; if (!Main.dedServ) @@ -94,14 +91,6 @@ namespace CalamityMod.Projectiles.Summon Projectile.localAI[0] = 1f; } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int trueDamage = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = trueDamage; - } - Time++; if (Time % (60f + totalHeads * 6f) == 59f + totalHeads * 6f) @@ -119,7 +108,11 @@ namespace CalamityMod.Projectiles.Summon if (targetAliveAndInLineOfSight && target.CanBeChasedBy() && Main.myPlayer == Projectile.owner) { if (Time % 40f == 24f) - Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, Projectile.SafeDirectionTo(target.Center) * 6f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + { + int p = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, Projectile.SafeDirectionTo(target.Center) * 6f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Projectile.originalDamage; + } if (Time % 40f >= 33f) Projectile.frame = Main.projFrames[Projectile.type] - 1; diff --git a/Projectiles/Summon/EyeOfNightSummon.cs b/Projectiles/Summon/EyeOfNightSummon.cs index bc2c19cc87..d13494c35f 100644 --- a/Projectiles/Summon/EyeOfNightSummon.cs +++ b/Projectiles/Summon/EyeOfNightSummon.cs @@ -39,7 +39,6 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { ProvidePlayerMinionBuffs(); - DynamicallyUpdateDamage(); GenerateVisuals(); NPC potentialTarget = Projectile.Center.MinionHoming(750f, Owner); if (potentialTarget is null) @@ -63,20 +62,6 @@ namespace CalamityMod.Projectiles.Summon Projectile.timeLeft = 2; } - internal void DynamicallyUpdateDamage() - { - if (Projectile.localAI[0] == 0f) - { - Projectile.Calamity().spawnedPlayerMinionDamageValue = Owner.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; - Projectile.localAI[0] = 1f; - } - if (Owner.MinionDamage() == Projectile.Calamity().spawnedPlayerMinionDamageValue) - return; - int trueDamage = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / Projectile.Calamity().spawnedPlayerMinionDamageValue * Owner.MinionDamage()); - Projectile.damage = trueDamage; - } - internal void GenerateVisuals() { // The code within this method is visual. There is no need to waste resources executing it on the server. @@ -110,7 +95,9 @@ namespace CalamityMod.Projectiles.Summon { if (Main.myPlayer == Projectile.owner && HoverTime % 70f == 69f) { - Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, Projectile.SafeDirectionTo(target.Center) * 8f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + int p = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, Projectile.SafeDirectionTo(target.Center) * 8f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Projectile.originalDamage; HoverTime++; } diff --git a/Projectiles/Summon/FleshBallMinion.cs b/Projectiles/Summon/FleshBallMinion.cs index bc9b8c92df..3cbf5e3d61 100644 --- a/Projectiles/Summon/FleshBallMinion.cs +++ b/Projectiles/Summon/FleshBallMinion.cs @@ -137,7 +137,9 @@ namespace CalamityMod.Projectiles.Summon for (int i = 0; i < 2; i++) { Vector2 shootVelocity = -Vector2.UnitY.RotatedByRandom(0.3f) * Main.rand.NextFloat(6f, 11f); - int blood = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Top, shootVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + int p = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Top, shootVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Projectile.originalDamage; } } diff --git a/Projectiles/Summon/FlowersOfMortalityPetal.cs b/Projectiles/Summon/FlowersOfMortalityPetal.cs index 73f8aeb537..5aeb013406 100644 --- a/Projectiles/Summon/FlowersOfMortalityPetal.cs +++ b/Projectiles/Summon/FlowersOfMortalityPetal.cs @@ -57,7 +57,9 @@ namespace CalamityMod.Projectiles.Summon if (Time % 50f == 49f && Main.myPlayer == Projectile.owner && potentialTarget != null) { Vector2 shootVelocity = Projectile.SafeDirectionTo(potentialTarget.Center) * 10f; - Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, shootVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + int p = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, shootVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Projectile.originalDamage; } Projectile.Center = player.Center + OffsetAngle.ToRotationVector2() * (150f + (float)Math.Sin(Time * 0.08f) * 15f); Projectile.rotation += MathHelper.ToRadians(7f); @@ -68,8 +70,6 @@ namespace CalamityMod.Projectiles.Summon { if (Projectile.localAI[0] == 0f) { - Projectile.Calamity().spawnedPlayerMinionDamageValue = Owner.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; for (int i = 0; i < 36; i++) { Dust dust = Dust.NewDustPerfect(Projectile.Center, 261); @@ -79,13 +79,6 @@ namespace CalamityMod.Projectiles.Summon } Projectile.localAI[0] += 1f; } - if (Owner.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int trueDamage = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - Owner.MinionDamage()); - Projectile.damage = trueDamage; - } } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Summon/FlyingOrthocera.cs b/Projectiles/Summon/FlyingOrthocera.cs index dd33f88214..78f228339c 100644 --- a/Projectiles/Summon/FlyingOrthocera.cs +++ b/Projectiles/Summon/FlyingOrthocera.cs @@ -32,8 +32,6 @@ namespace CalamityMod.Projectiles.Summon Player player = Main.player[Projectile.owner]; if (Projectile.localAI[0] == 0f) { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; for (int i = 0; i < 56; i++) { float angle = MathHelper.TwoPi / 56f * i; @@ -44,13 +42,6 @@ namespace CalamityMod.Projectiles.Summon } Projectile.localAI[0] += 1f; } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int trueDamage = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = trueDamage; - } Projectile.frameCounter++; if (Projectile.frameCounter % 5f == 4f) { @@ -68,7 +59,11 @@ namespace CalamityMod.Projectiles.Summon if (Projectile.ai[0]++ % 30f == 29f) { if (Projectile.owner == Main.myPlayer) - Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, Projectile.SafeDirectionTo(potentialTarget.Center, Vector2.UnitY) * 11f, ModContent.ProjectileType(), Projectile.damage, 4f, Projectile.owner); + { + int p = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, Projectile.SafeDirectionTo(potentialTarget.Center, Vector2.UnitY) * 11f, ModContent.ProjectileType(), Projectile.damage, 4f, Projectile.owner); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Projectile.originalDamage; + } } } else diff --git a/Projectiles/Summon/FrostBlossom.cs b/Projectiles/Summon/FrostBlossom.cs index bddc9a0c48..8cd06cb934 100644 --- a/Projectiles/Summon/FrostBlossom.cs +++ b/Projectiles/Summon/FrostBlossom.cs @@ -65,8 +65,6 @@ namespace CalamityMod.Projectiles.Summon Projectile.Opacity = 1f - (float)Math.Sin(Projectile.ai[1] / 45f) * 0.075f - 0.075f; // Range of 1f to 0.85f if (Projectile.localAI[0] == 0f) { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; for (int i = 0; i < 36; i++) { Dust dust = Dust.NewDustPerfect(Projectile.Center, 113); @@ -75,13 +73,6 @@ namespace CalamityMod.Projectiles.Summon } Projectile.localAI[0] += 1f; } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int trueDamage = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = trueDamage; - } if (Projectile.owner == Main.myPlayer) { NPC potentialTarget = Projectile.Center.MinionHoming(500f, player); @@ -89,7 +80,9 @@ namespace CalamityMod.Projectiles.Summon { if (Projectile.ai[1]++ % 35f == 34f && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, potentialTarget.position, potentialTarget.width, potentialTarget.height)) { - Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, Projectile.SafeDirectionTo(potentialTarget.Center) * 20f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + int p = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, Projectile.SafeDirectionTo(potentialTarget.Center) * 20f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Projectile.originalDamage; } } } diff --git a/Projectiles/Summon/FungalClumpMinion.cs b/Projectiles/Summon/FungalClumpMinion.cs index def3709a94..a616e0750f 100644 --- a/Projectiles/Summon/FungalClumpMinion.cs +++ b/Projectiles/Summon/FungalClumpMinion.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Healing; using Microsoft.Xna.Framework; using System; @@ -61,8 +61,6 @@ namespace CalamityMod.Projectiles.Summon //Initializing dust and damage if (Projectile.localAI[0] == 0f) { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { @@ -77,15 +75,6 @@ namespace CalamityMod.Projectiles.Summon Projectile.localAI[0] += 1f; } - //Flexible damage correction - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = damage2; - } - //Periodically create dust if (Main.rand.NextBool(16)) { diff --git a/Projectiles/Summon/GammaHead.cs b/Projectiles/Summon/GammaHead.cs index 7b43af3c24..c8dda414a0 100644 --- a/Projectiles/Summon/GammaHead.cs +++ b/Projectiles/Summon/GammaHead.cs @@ -98,9 +98,6 @@ namespace CalamityMod.Projectiles.Summon { int totalHeads = CalamityUtils.CountProjectiles(Projectile.type); CurrentPositionOffset = IdealPositionOffset = new Vector2(Main.rand.NextFloat(-72f - 8f * totalHeads, 72f + 8f * totalHeads), -Main.rand.NextFloat(8f, 84f + 4f * totalHeads)); - Projectile.Calamity().spawnedPlayerMinionDamageValue = Owner.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; - Projectile.netUpdate = true; if (Main.dedServ) @@ -157,7 +154,11 @@ namespace CalamityMod.Projectiles.Summon // Shoot the actual canister. if (Main.myPlayer == Projectile.owner && Time % canisterShootRate == canisterShootRate - 1) - Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), spawnPosition, shootVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + { + int p = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), spawnPosition, shootVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Projectile.originalDamage; + } } public void MoveTowardsDestination(Vector2 returnPosition) diff --git a/Projectiles/Summon/GastricBelcher.cs b/Projectiles/Summon/GastricBelcher.cs index 6f18bc4b55..87c628de18 100644 --- a/Projectiles/Summon/GastricBelcher.cs +++ b/Projectiles/Summon/GastricBelcher.cs @@ -47,9 +47,6 @@ namespace CalamityMod.Projectiles.Summon //On spawn effects if (!initialized) { - //Set constants - modProj.spawnedPlayerMinionDamageValue = player.MinionDamage(); - modProj.spawnedPlayerMinionProjectileDamageValue = Projectile.damage; //Spawn dust int dustAmt = 36; for (int dustIndex = 0; dustIndex < dustAmt; dustIndex++) @@ -69,14 +66,6 @@ namespace CalamityMod.Projectiles.Summon initialized = true; } - //Flexible minion damage update - if (player.MinionDamage() != modProj.spawnedPlayerMinionDamageValue) - { - int damage2 = (int)(modProj.spawnedPlayerMinionProjectileDamageValue / - modProj.spawnedPlayerMinionDamageValue * player.MinionDamage()); - Projectile.damage = damage2; - } - //Update frames if (Projectile.frameCounter++ % 6 == 0) { diff --git a/Projectiles/Summon/GhostlyMine.cs b/Projectiles/Summon/GhostlyMine.cs index 4e09047ff7..2f85ee14cd 100644 --- a/Projectiles/Summon/GhostlyMine.cs +++ b/Projectiles/Summon/GhostlyMine.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using System; using Terraria; using Terraria.ID; @@ -37,19 +37,10 @@ namespace CalamityMod.Projectiles.Summon Player player = Main.player[Projectile.owner]; if (start) { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; SoundEngine.PlaySound(SoundID.Item20, Projectile.position); Projectile.ai[1] = Projectile.ai[0]; start = false; } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = damage2; - } double deg = (double)Projectile.ai[1]; double rad = deg * (Math.PI / 180); double dist = 550; diff --git a/Projectiles/Summon/GiantIbanRobotOfDoom.cs b/Projectiles/Summon/GiantIbanRobotOfDoom.cs index 9944076bb6..6c7aa23ab9 100644 --- a/Projectiles/Summon/GiantIbanRobotOfDoom.cs +++ b/Projectiles/Summon/GiantIbanRobotOfDoom.cs @@ -73,7 +73,6 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { Player player = Main.player[Projectile.owner]; - InitializeValues(player); HandleCooldowns(player); ManipulatePlayerValues(player); RegisterRightClick(player); @@ -81,22 +80,6 @@ namespace CalamityMod.Projectiles.Summon SetSpriteDirection(player); player.AddBuff(LeftIconActive ? ModContent.BuffType() : ModContent.BuffType(), 2); } - public void InitializeValues(Player player) - { - if (Projectile.localAI[0] == 0f) - { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; - Projectile.localAI[0] = 1f; - } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int trueDamage = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = trueDamage; - } - } public void HandleCooldowns(Player player) { if (RightIconCooldown > 0 && RightIconActive) @@ -388,6 +371,7 @@ namespace CalamityMod.Projectiles.Summon 8f, Projectile.owner, Projectile.whoAmI); + deathLaser.originalDamage = damage; if (player.HeldItem != null && deathLaser.whoAmI.WithinBounds(Main.maxProjectiles)) { if (player.HeldItem.CountsAsClass()) diff --git a/Projectiles/Summon/HauntedDishes.cs b/Projectiles/Summon/HauntedDishes.cs index b05d1d92aa..40739bcf4f 100644 --- a/Projectiles/Summon/HauntedDishes.cs +++ b/Projectiles/Summon/HauntedDishes.cs @@ -42,8 +42,6 @@ namespace CalamityMod.Projectiles.Summon CalamityGlobalProjectile modProj = Projectile.Calamity(); if (dust == 0f) { - modProj.spawnedPlayerMinionDamageValue = player.MinionDamage(); - modProj.spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int dustAmt = 36; for (int num227 = 0; num227 < dustAmt; num227++) { @@ -57,12 +55,6 @@ namespace CalamityMod.Projectiles.Summon } dust += 1f; } - if (player.MinionDamage() != modProj.spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)modProj.spawnedPlayerMinionProjectileDamageValue / - modProj.spawnedPlayerMinionDamageValue * player.MinionDamage()); - Projectile.damage = damage2; - } bool projTypeCheck = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (projTypeCheck) diff --git a/Projectiles/Summon/HermitCrabMinion.cs b/Projectiles/Summon/HermitCrabMinion.cs index 37bc8c0ef6..83cee4dbd6 100644 --- a/Projectiles/Summon/HermitCrabMinion.cs +++ b/Projectiles/Summon/HermitCrabMinion.cs @@ -47,8 +47,6 @@ namespace CalamityMod.Projectiles.Summon CalamityPlayer modPlayer = player.Calamity(); if (spawnDust) { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int num501 = 20; for (int num502 = 0; num502 < num501; num502++) { @@ -58,13 +56,6 @@ namespace CalamityMod.Projectiles.Summon } spawnDust = false; } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = damage2; - } bool flag64 = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (flag64) diff --git a/Projectiles/Summon/HerringMinion.cs b/Projectiles/Summon/HerringMinion.cs index aca4bc0469..3ce4042494 100644 --- a/Projectiles/Summon/HerringMinion.cs +++ b/Projectiles/Summon/HerringMinion.cs @@ -42,8 +42,6 @@ namespace CalamityMod.Projectiles.Summon CalamityPlayer modPlayer = player.Calamity(); if (dust > 0) { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { @@ -56,13 +54,6 @@ namespace CalamityMod.Projectiles.Summon } dust--; } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = damage2; - } if (Math.Abs(Projectile.velocity.X) > 0.2f) { Projectile.spriteDirection = Projectile.direction; diff --git a/Projectiles/Summon/Hive.cs b/Projectiles/Summon/Hive.cs index 5f14dcfe23..eeaeed8008 100644 --- a/Projectiles/Summon/Hive.cs +++ b/Projectiles/Summon/Hive.cs @@ -29,20 +29,6 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { Player player = Main.player[Projectile.owner]; - if (Projectile.localAI[0] == 0f) - { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; - Projectile.localAI[0] += 1f; - } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = damage2; - } - Projectile.frameCounter++; if (Projectile.frameCounter > 5) { @@ -110,7 +96,9 @@ namespace CalamityMod.Projectiles.Summon { float velocityX = Main.rand.NextFloat(-0.4f, 0.4f); float velocityY = Main.rand.NextFloat(-0.3f, -0.5f); - Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, velocityX, velocityY, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, (float)target, 0f); + int p = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, velocityX, velocityY, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, (float)target, 0f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Projectile.originalDamage; } } } diff --git a/Projectiles/Summon/HowlsHeartHowl.cs b/Projectiles/Summon/HowlsHeartHowl.cs index b4223aebca..418f272ab7 100644 --- a/Projectiles/Summon/HowlsHeartHowl.cs +++ b/Projectiles/Summon/HowlsHeartHowl.cs @@ -40,8 +40,6 @@ namespace CalamityMod.Projectiles.Summon //Spawn dust and record initial damage values if (!initialized) { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int dustAmt = 36; for (int dustIndex = 0; dustIndex < dustAmt; dustIndex++) { @@ -56,15 +54,6 @@ namespace CalamityMod.Projectiles.Summon initialized = true; } - //if minion damage changes, update it - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = damage2; - } - //If the correct minion, set bools bool correctMinion = Projectile.type == ModContent.ProjectileType(); if (!modPlayer.howlsHeart && !modPlayer.howlsHeartVanity || !player.active) diff --git a/Projectiles/Summon/IceClasperMinion.cs b/Projectiles/Summon/IceClasperMinion.cs index ff49094762..6cda1e8c30 100644 --- a/Projectiles/Summon/IceClasperMinion.cs +++ b/Projectiles/Summon/IceClasperMinion.cs @@ -43,8 +43,6 @@ namespace CalamityMod.Projectiles.Summon CalamityPlayer modPlayer = player.Calamity(); if (dust > 0) { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { @@ -57,13 +55,6 @@ namespace CalamityMod.Projectiles.Summon } dust--; } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = damage2; - } Projectile.frameCounter++; if (Projectile.frameCounter > 6) { diff --git a/Projectiles/Summon/IceSentry.cs b/Projectiles/Summon/IceSentry.cs index 2d52a9b6ba..7d6e1a0f2a 100644 --- a/Projectiles/Summon/IceSentry.cs +++ b/Projectiles/Summon/IceSentry.cs @@ -30,20 +30,6 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { Player player = Main.player[Projectile.owner]; - if (setDamage) - { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; - setDamage = false; - } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = damage2; - } - Projectile.velocity = Vector2.Zero; Projectile.frameCounter++; @@ -75,6 +61,8 @@ namespace CalamityMod.Projectiles.Summon speed.Normalize(); speed *= 15f; int shard = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center + speed, speed, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack / 2, Projectile.owner); + if (Main.projectile.IndexInRange(shard)) + Main.projectile[shard].originalDamage = Projectile.originalDamage / 2; } } } @@ -113,7 +101,9 @@ namespace CalamityMod.Projectiles.Summon speed *= 8f; if (Projectile.ai[1] >= 300f) speed = speed.RotatedBy(MathHelper.ToRadians(Main.rand.Next(-5, 6))) * 1.5f + npc.velocity / 2f; - Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, speed + npc.velocity / 2f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + int p = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, speed + npc.velocity / 2f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Projectile.originalDamage; } } } diff --git a/Projectiles/Summon/IgneousBlade.cs b/Projectiles/Summon/IgneousBlade.cs index 98724057bb..7433690259 100644 --- a/Projectiles/Summon/IgneousBlade.cs +++ b/Projectiles/Summon/IgneousBlade.cs @@ -47,19 +47,6 @@ namespace CalamityMod.Projectiles.Summon { Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (Projectile.localAI[0] == 0f) - { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; - Projectile.localAI[0] = 1f; - } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int trueDamage = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = trueDamage; - } bool isProperProjectile = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (isProperProjectile) @@ -113,8 +100,10 @@ namespace CalamityMod.Projectiles.Summon for (int i = 0; i < 3; i++) { Vector2 spawnPosition = target.Center - new Vector2(0f, 550f).RotatedByRandom(MathHelper.ToRadians(8f)); - Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), spawnPosition, Vector2.Normalize(target.Center - spawnPosition) * 24f, ModContent.ProjectileType(), + int p = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), spawnPosition, Vector2.Normalize(target.Center - spawnPosition) * 24f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.666), Projectile.knockBack, Projectile.owner); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Projectile.originalDamage; } for (int i = 0; i < Main.rand.Next(28, 41); i++) { diff --git a/Projectiles/Summon/LanternSoul.cs b/Projectiles/Summon/LanternSoul.cs index 43a89da2fa..1e3af2ed9e 100644 --- a/Projectiles/Summon/LanternSoul.cs +++ b/Projectiles/Summon/LanternSoul.cs @@ -42,20 +42,6 @@ namespace CalamityMod.Projectiles.Summon } Player player = Main.player[Projectile.owner]; - if (count == 0f) - { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; - count += 1f; - } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = damage2; - } - Projectile.velocity = new Vector2(0f, (float)Math.Sin((double)(6.28318548f * Projectile.ai[0] / 300f)) * 0.5f); Projectile.ai[0] += 1f; if (Projectile.ai[0] >= 300f) @@ -85,7 +71,9 @@ namespace CalamityMod.Projectiles.Summon float startOffsetY = Main.rand.NextFloat(15f, 200f) * (Main.rand.NextBool() ? -1f : 1f); Vector2 startPos = new Vector2(Projectile.position.X + startOffsetX, Projectile.position.Y + startOffsetY); Vector2 speed = new Vector2(0f, 0f); - Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), startPos, speed, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + int p = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), startPos, speed, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Projectile.originalDamage; } } } diff --git a/Projectiles/Summon/LuxorsGiftSummon.cs b/Projectiles/Summon/LuxorsGiftSummon.cs index 2ca6454807..b653a1132c 100644 --- a/Projectiles/Summon/LuxorsGiftSummon.cs +++ b/Projectiles/Summon/LuxorsGiftSummon.cs @@ -42,8 +42,6 @@ namespace CalamityMod.Projectiles.Summon CalamityPlayer modPlayer = player.Calamity(); if (dust > 0) { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { @@ -56,13 +54,6 @@ namespace CalamityMod.Projectiles.Summon } dust--; } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = damage2; - } if (Projectile.localAI[0] == 0f) { Projectile.scale -= 0.01f; diff --git a/Projectiles/Summon/MK2FlaskSummon.cs b/Projectiles/Summon/MK2FlaskSummon.cs index f7651f20d1..114993956a 100644 --- a/Projectiles/Summon/MK2FlaskSummon.cs +++ b/Projectiles/Summon/MK2FlaskSummon.cs @@ -45,7 +45,10 @@ namespace CalamityMod.Projectiles.Summon Utils.NextVector2Unit(Main.rand) * Main.rand.NextFloat(1f, 4f)); } SoundEngine.PlaySound(SoundID.Item107, Projectile.Center); - Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, Vector2.UnitY * 6f, ModContent.ProjectileType(), Projectile.damage, 4f, Projectile.owner); + int p = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, Vector2.UnitY * 6f, ModContent.ProjectileType(), Projectile.damage, 4f, Projectile.owner); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Projectile.originalDamage; + int beeArrayIndex = 0; for (int i = 0; i < Main.projectile.Length; i++) { diff --git a/Projectiles/Summon/MagicHat.cs b/Projectiles/Summon/MagicHat.cs index e772908699..1be6ceadd6 100644 --- a/Projectiles/Summon/MagicHat.cs +++ b/Projectiles/Summon/MagicHat.cs @@ -84,16 +84,8 @@ namespace CalamityMod.Projectiles.Summon Main.dust[dustEffects].velocity *= 2f; Main.dust[dustEffects].scale *= 1.15f; } - modProj.spawnedPlayerMinionDamageValue = player.MinionDamage(); - modProj.spawnedPlayerMinionProjectileDamageValue = Projectile.damage; Projectile.localAI[0] += 1f; } - if (player.MinionDamage() != modProj.spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)modProj.spawnedPlayerMinionProjectileDamageValue / - modProj.spawnedPlayerMinionDamageValue * player.MinionDamage()); - Projectile.damage = damage2; - } //finding an enemy, then shooting projectiles if it's detected if (Projectile.owner == Main.myPlayer) @@ -133,7 +125,9 @@ namespace CalamityMod.Projectiles.Summon }); float velocityX = Main.rand.NextFloat(-10f, 10f); float velocityY = Main.rand.NextFloat(-15f, -8f); - Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.oldPosition.X + (float)(Projectile.width / 2), Projectile.oldPosition.Y + (float)(Projectile.height / 2), velocityX, velocityY, projType, Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + int p = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.oldPosition.X + (float)(Projectile.width / 2), Projectile.oldPosition.Y + (float)(Projectile.height / 2), velocityX, velocityY, projType, Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Projectile.originalDamage; } } } diff --git a/Projectiles/Summon/MechwormHead.cs b/Projectiles/Summon/MechwormHead.cs index cd1cef7020..3a70088e52 100644 --- a/Projectiles/Summon/MechwormHead.cs +++ b/Projectiles/Summon/MechwormHead.cs @@ -303,7 +303,9 @@ namespace CalamityMod.Projectiles.Summon for (int i = 0; i < 3; i++) { Vector2 perturbedSpeed = Projectile.velocity.RotatedBy(MathHelper.Lerp(-0.15f, 0.15f, i / 3f)) * 0.3f; - Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, perturbedSpeed, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + int p = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, perturbedSpeed, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Projectile.originalDamage; } } diff --git a/Projectiles/Summon/MidnightSunBeaconProj.cs b/Projectiles/Summon/MidnightSunBeaconProj.cs index 79cb6b382f..669107de54 100644 --- a/Projectiles/Summon/MidnightSunBeaconProj.cs +++ b/Projectiles/Summon/MidnightSunBeaconProj.cs @@ -39,8 +39,10 @@ namespace CalamityMod.Projectiles.Summon if (Projectile.ai[1] == 1f) { - Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, Vector2.UnitY * 30f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, + int p = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, Vector2.UnitY * 30f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Projectile.originalDamage; Projectile.Kill(); } if (Projectile.ai[1] > 0) diff --git a/Projectiles/Summon/MidnightSunUFO.cs b/Projectiles/Summon/MidnightSunUFO.cs index 241ec6dd5c..96ec49ae9b 100644 --- a/Projectiles/Summon/MidnightSunUFO.cs +++ b/Projectiles/Summon/MidnightSunUFO.cs @@ -47,8 +47,6 @@ namespace CalamityMod.Projectiles.Summon if (Projectile.localAI[0] == 0f) { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; Projectile.velocity.Y = Main.rand.NextFloat(8f, 11f) * Main.rand.NextBool(2).ToDirectionInt(); Projectile.velocity.Y = Main.rand.NextFloat(3f, 5f) * Main.rand.NextBool(2).ToDirectionInt(); @@ -56,13 +54,6 @@ namespace CalamityMod.Projectiles.Summon Projectile.localAI[0] = Main.rand.Next(1, (int)MidnightSunBeacon.MachineGunRate); } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int trueDamage = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = trueDamage; - } bool isProperProjectile = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (isProperProjectile) @@ -103,7 +94,9 @@ namespace CalamityMod.Projectiles.Summon if (Projectile.ai[0] % MidnightSunBeacon.MachineGunRate == Projectile.localAI[0] && potentialTarget.Top.Y > Projectile.Bottom.Y) { Vector2 laserVelocity = Projectile.SafeDirectionTo(potentialTarget.Center, Vector2.UnitY).RotatedByRandom(0.15f) * 25f; - Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Bottom, laserVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + int p = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Bottom, laserVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Projectile.originalDamage; } Projectile.MinionAntiClump(0.35f); Projectile.ai[1] = 0f; @@ -122,7 +115,9 @@ namespace CalamityMod.Projectiles.Summon { SoundEngine.PlaySound(SoundID.Item122, Projectile.Center); Vector2 laserVelocity = Projectile.velocity.RotatedBy(MathHelper.PiOver2).SafeNormalize(Vector2.UnitY); - Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, laserVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, Projectile.whoAmI); + int p = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, laserVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, Projectile.whoAmI); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Projectile.originalDamage; } } } diff --git a/Projectiles/Summon/MiniSandShark.cs b/Projectiles/Summon/MiniSandShark.cs index 4b83a5db4a..f4a831cfdc 100644 --- a/Projectiles/Summon/MiniSandShark.cs +++ b/Projectiles/Summon/MiniSandShark.cs @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Summon { SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; Texture2D texture = ModContent.Request(Texture).Value; - 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, texture.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); + 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, texture.Size() / 2f, Projectile.scale, spriteEffects, 0); return false; } diff --git a/Projectiles/Summon/MortalityBeam.cs b/Projectiles/Summon/MortalityBeam.cs index 311b507c6c..fd2b462326 100644 --- a/Projectiles/Summon/MortalityBeam.cs +++ b/Projectiles/Summon/MortalityBeam.cs @@ -72,6 +72,7 @@ namespace CalamityMod.Projectiles.Summon float blueHue = Main.rgbToHsl(Color.Blue).X; Vector2 spawnPosition = Projectile.Center + Main.rand.NextVector2CircularEdge(10f, 10f); Projectile bolt = Projectile.NewProjectileDirect(Projectile.GetProjectileSource_FromThis(), spawnPosition, Main.rand.NextVector2CircularEdge(9f, 9f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + bolt.originalDamage = Projectile.originalDamage; bolt.localAI[0] = Utils.SelectRandom(Main.rand, redHue, greenHue, blueHue); } } diff --git a/Projectiles/Summon/OldDukeHeadCorpse.cs b/Projectiles/Summon/OldDukeHeadCorpse.cs index 0566594fad..8b13e15f76 100644 --- a/Projectiles/Summon/OldDukeHeadCorpse.cs +++ b/Projectiles/Summon/OldDukeHeadCorpse.cs @@ -28,19 +28,6 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { Player player = Main.player[Projectile.owner]; - if (Projectile.localAI[0] == 0f) - { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; - Projectile.localAI[0] = 1; - } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int trueDamage = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = trueDamage; - } NPC target = Projectile.Center.MinionHoming(845f, player, false); // No sense in targeting something below this sentry. if (target != null) @@ -59,10 +46,12 @@ namespace CalamityMod.Projectiles.Summon { float angle = (float)Math.Atan(Math.Abs(target.Center.X - Projectile.Center.X) / 450f); angle *= Math.Sign(target.Center.X - Projectile.Center.X); - Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Top + Vector2.UnitY * 7f, + int p = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Top + Vector2.UnitY * 7f, new Vector2(0f, -Main.rand.NextFloat(21f, 30.5f)).RotatedBy(angle), ModContent.ProjectileType(), Projectile.damage, 5f, Projectile.owner); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Projectile.originalDamage; } } Projectile.velocity.Y += 0.5f; diff --git a/Projectiles/Summon/PerditionBeacon.cs b/Projectiles/Summon/PerditionBeacon.cs index 2b7eca15f9..d4293d1eba 100644 --- a/Projectiles/Summon/PerditionBeacon.cs +++ b/Projectiles/Summon/PerditionBeacon.cs @@ -48,13 +48,6 @@ namespace CalamityMod.Projectiles.Summon Projectile.localAI[0] = 1f; } - // Dynamically adjust damage of the minion. - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int newDamage = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - Projectile.damage = newDamage; - } - // Fade in. Projectile.alpha = Utils.Clamp(Projectile.alpha - 8, 0, 255); @@ -78,9 +71,6 @@ namespace CalamityMod.Projectiles.Summon internal void DoInitializationEffects() { - Projectile.Calamity().spawnedPlayerMinionDamageValue = Owner.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; - // Release a burst of fire dust on spawn. if (Main.dedServ) return; @@ -154,7 +144,10 @@ namespace CalamityMod.Projectiles.Summon Vector2 shootVelocity = (Target.Center - spawnPosition).SafeNormalize(-Vector2.UnitY).RotatedByRandom(0.09f) * Main.rand.NextFloat(19f, 31f); int soul = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), spawnPosition, shootVelocity, rng.Get(), Projectile.damage, Projectile.knockBack, Projectile.owner); if (Main.projectile.IndexInRange(soul)) + { + Main.projectile[soul].originalDamage = Projectile.originalDamage; Main.projectile[soul].Calamity().forceMinion = true; + } } public override void PostDraw(Color lightColor) diff --git a/Projectiles/Summon/PhantomGuy.cs b/Projectiles/Summon/PhantomGuy.cs index 899680ae1c..4a2e1eaa5a 100644 --- a/Projectiles/Summon/PhantomGuy.cs +++ b/Projectiles/Summon/PhantomGuy.cs @@ -41,8 +41,6 @@ namespace CalamityMod.Projectiles.Summon CalamityPlayer modPlayer = player.Calamity(); if (Projectile.localAI[0] == 0f) { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { @@ -55,13 +53,6 @@ namespace CalamityMod.Projectiles.Summon } Projectile.localAI[0] += 1f; } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = damage2; - } bool flag64 = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (flag64) @@ -213,7 +204,9 @@ namespace CalamityMod.Projectiles.Summon Vector2 value19 = vector46 - Projectile.Center; value19.Normalize(); value19 *= scaleFactor3; - Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, value19.X, value19.Y, num658, Projectile.damage, 0f, Main.myPlayer, 0f, 0f); + int p = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, value19.X, value19.Y, num658, Projectile.damage, 0f, Main.myPlayer, 0f, 0f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Projectile.originalDamage; Projectile.netUpdate = true; } } diff --git a/Projectiles/Summon/PinkButterfly.cs b/Projectiles/Summon/PinkButterfly.cs index 83ef8b455a..51f6d3348f 100644 --- a/Projectiles/Summon/PinkButterfly.cs +++ b/Projectiles/Summon/PinkButterfly.cs @@ -40,8 +40,6 @@ namespace CalamityMod.Projectiles.Summon CalamityPlayer modPlayer = player.Calamity(); if (Projectile.localAI[0] == 0f) { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { @@ -53,13 +51,6 @@ namespace CalamityMod.Projectiles.Summon } Projectile.localAI[0] += 1f; } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = damage2; - } if (Math.Abs(Projectile.velocity.X) > 0.2f) { Projectile.spriteDirection = -Projectile.direction; @@ -239,7 +230,9 @@ namespace CalamityMod.Projectiles.Summon for (int i = 0; i < numProj + 1; i++) { Vector2 perturbedSpeed = value19.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1))); - Projectile.NewProjectile(Projectile.GetItemSource_FromThis(), Projectile.Center, perturbedSpeed, projectileType, Projectile.damage / 2, Projectile.knockBack * 0.5f, Projectile.owner, targetIndex, 0f); + int p = Projectile.NewProjectile(Projectile.GetItemSource_FromThis(), Projectile.Center, perturbedSpeed, projectileType, Projectile.damage / 2, Projectile.knockBack * 0.5f, Projectile.owner, targetIndex, 0f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Projectile.originalDamage; } Projectile.netUpdate = true; } diff --git a/Projectiles/Summon/PlaguePrincess.cs b/Projectiles/Summon/PlaguePrincess.cs index c73f30a003..9a6668f161 100644 --- a/Projectiles/Summon/PlaguePrincess.cs +++ b/Projectiles/Summon/PlaguePrincess.cs @@ -67,8 +67,6 @@ namespace CalamityMod.Projectiles.Summon //dust and flexible damage if (dust) { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int num501 = 50; for (int num502 = 0; num502 < num501; num502++) { @@ -78,13 +76,6 @@ namespace CalamityMod.Projectiles.Summon } dust = false; } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = damage2; - } //framing Projectile.frameCounter++; @@ -316,7 +307,9 @@ namespace CalamityMod.Projectiles.Summon Vector2 projVect = targetLocation - Projectile.Center; projVect.Normalize(); projVect *= scaleFactor4; - Projectile.NewProjectile(Projectile.GetItemSource_FromThis(), Projectile.Center, projVect, projType, (int)(Projectile.damage * 0.6f), 0f, Main.myPlayer, 0f, 0f); + int p = Projectile.NewProjectile(Projectile.GetItemSource_FromThis(), Projectile.Center, projVect, projType, (int)(Projectile.damage * 0.6f), 0f, Main.myPlayer, 0f, 0f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = (int)(Projectile.originalDamage * 0.6); Projectile.netUpdate = true; } } @@ -344,6 +337,8 @@ namespace CalamityMod.Projectiles.Summon { Main.projectile[bee].frame = 2; } + if (Main.projectile.IndexInRange(bee)) + Main.projectile[bee].originalDamage = (int)(Projectile.originalDamage * 0.8f); Projectile.netUpdate = true; } } diff --git a/Projectiles/Summon/PlaguebringerMK2.cs b/Projectiles/Summon/PlaguebringerMK2.cs index 6c12e39159..3f4a7ad1ab 100644 --- a/Projectiles/Summon/PlaguebringerMK2.cs +++ b/Projectiles/Summon/PlaguebringerMK2.cs @@ -36,19 +36,6 @@ namespace CalamityMod.Projectiles.Summon { Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (Projectile.localAI[0] == 0f) - { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; - Projectile.localAI[0] = 1f; - } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int trueDamage = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = trueDamage; - } bool isProperProjectile = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (isProperProjectile) @@ -81,18 +68,22 @@ namespace CalamityMod.Projectiles.Summon int timeNeeded = (int)MathHelper.Lerp(60f, 18f, MathHelper.Clamp(Projectile.localAI[1] / 320f, 0f, 1f)); if (Projectile.ai[0] >= timeNeeded && Main.myPlayer == Projectile.owner) { - Projectile.NewProjectile(Projectile.GetItemSource_FromThis(), Projectile.Center, + int p = Projectile.NewProjectile(Projectile.GetItemSource_FromThis(), Projectile.Center, Projectile.SafeDirectionTo(potentialTarget.Center) * 14f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.9), 3f, Projectile.owner); - Projectile.NewProjectile(Projectile.GetItemSource_FromThis(), Projectile.Center, + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Projectile.originalDamage; + p = Projectile.NewProjectile(Projectile.GetItemSource_FromThis(), Projectile.Center, Projectile.SafeDirectionTo(potentialTarget.Center) * 11.5f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.9), 3f, Projectile.owner); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Projectile.originalDamage; Projectile.ai[0] = 0; } else Projectile.ai[0]++; diff --git a/Projectiles/Summon/PlaguebringerSummon.cs b/Projectiles/Summon/PlaguebringerSummon.cs index 2ba854bdc1..628fc2aa7b 100644 --- a/Projectiles/Summon/PlaguebringerSummon.cs +++ b/Projectiles/Summon/PlaguebringerSummon.cs @@ -52,20 +52,6 @@ namespace CalamityMod.Projectiles.Summon Projectile.frame = 0; } - if (Projectile.localAI[0] == 0f) - { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; - Projectile.localAI[0] += 1f; - } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = damage2; - } - bool correctMinion = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (correctMinion) diff --git a/Projectiles/Summon/PlantSummon.cs b/Projectiles/Summon/PlantSummon.cs index 2b865cb921..38934512f3 100644 --- a/Projectiles/Summon/PlantSummon.cs +++ b/Projectiles/Summon/PlantSummon.cs @@ -68,19 +68,10 @@ namespace CalamityMod.Projectiles.Summon if (!initialized) { - modProj.spawnedPlayerMinionDamageValue = player.MinionDamage(); - modProj.spawnedPlayerMinionProjectileDamageValue = Projectile.damage; SpawnDust(); SpawnTentacles(); initialized = true; } - if (player.MinionDamage() != modProj.spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)modProj.spawnedPlayerMinionProjectileDamageValue / - modProj.spawnedPlayerMinionDamageValue * player.MinionDamage()); - Projectile.damage = damage2; - } - bool correctMinion = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (correctMinion) @@ -186,7 +177,9 @@ namespace CalamityMod.Projectiles.Summon velocity.Normalize(); velocity *= projSpeed; velocity *= speedMult; - Projectile.NewProjectile(Projectile.GetItemSource_FromThis(), Projectile.Center, velocity, projType, projDmg, Projectile.knockBack, Projectile.owner, 0f, 0f); + int p = Projectile.NewProjectile(Projectile.GetItemSource_FromThis(), Projectile.Center, velocity, projType, projDmg, Projectile.knockBack, Projectile.owner, 0f, 0f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Projectile.originalDamage; } Projectile.netUpdate = true; } @@ -283,7 +276,9 @@ namespace CalamityMod.Projectiles.Summon { Vector2 projVelocity = whereIsTarget * 2f; int projDmg = (int)(Projectile.damage * 1.5f); - Projectile.NewProjectile(Projectile.GetItemSource_FromThis(), Projectile.Center, projVelocity, projType, projDmg, Projectile.knockBack, Projectile.owner, 0f, 1f); + int p = Projectile.NewProjectile(Projectile.GetItemSource_FromThis(), Projectile.Center, projVelocity, projType, projDmg, Projectile.knockBack, Projectile.owner, 0f, 1f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Projectile.originalDamage; } if (Main.rand.NextBool(3)) { @@ -407,7 +402,9 @@ namespace CalamityMod.Projectiles.Summon for (int i = -8; i <= 8; i += 8) { Vector2 perturbedSpeed = projVelocity.RotatedBy(MathHelper.ToRadians(i)); - Projectile.NewProjectile(Projectile.GetItemSource_FromThis(), Projectile.Center, perturbedSpeed, projType, projDmg, Projectile.knockBack * attackMult, Projectile.owner, Main.rand.Next(3), 1f); + int p = Projectile.NewProjectile(Projectile.GetItemSource_FromThis(), Projectile.Center, perturbedSpeed, projType, projDmg, Projectile.knockBack * attackMult, Projectile.owner, Main.rand.Next(3), 1f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Projectile.originalDamage; } } @@ -466,7 +463,9 @@ namespace CalamityMod.Projectiles.Summon int tentacleAmt = 6; for (int tentacleIndex = 0; tentacleIndex < tentacleAmt; tentacleIndex++) { - Projectile.NewProjectile(Projectile.GetItemSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, tentacleIndex, Projectile.GetByUUID(Projectile.owner, Projectile.whoAmI)); + int p = Projectile.NewProjectile(Projectile.GetItemSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, tentacleIndex, Projectile.GetByUUID(Projectile.owner, Projectile.whoAmI)); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Projectile.originalDamage; } } } diff --git a/Projectiles/Summon/PlantTentacle.cs b/Projectiles/Summon/PlantTentacle.cs index 093f2c1e1b..5a56ce5d32 100644 --- a/Projectiles/Summon/PlantTentacle.cs +++ b/Projectiles/Summon/PlantTentacle.cs @@ -64,19 +64,6 @@ namespace CalamityMod.Projectiles.Summon Projectile.frame = 0; } - if (!initialized) - { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; - initialized = true; - } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int trueDamage = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - Projectile.damage = trueDamage; - } - if (player.Calamity().plantera) { Projectile.timeLeft = 2; diff --git a/Projectiles/Summon/PolypLauncherProjectile.cs b/Projectiles/Summon/PolypLauncherProjectile.cs index 2a252a2c14..cf01f06d10 100644 --- a/Projectiles/Summon/PolypLauncherProjectile.cs +++ b/Projectiles/Summon/PolypLauncherProjectile.cs @@ -72,7 +72,9 @@ namespace CalamityMod.Projectiles.Summon Vector2 shardSpeed = new Vector2(shardspeedX, shardspeedY); //Spawn the projectile - int shard = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center + shardSpeed, shardSpeed, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack / 2f, Projectile.owner, Main.rand.Next(3)); + int p = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center + shardSpeed, shardSpeed, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack / 2f, Projectile.owner, Main.rand.Next(3)); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Projectile.originalDamage; split += 1; } } diff --git a/Projectiles/Summon/PolypLauncherSentry.cs b/Projectiles/Summon/PolypLauncherSentry.cs index 806116c459..6151ab0f08 100644 --- a/Projectiles/Summon/PolypLauncherSentry.cs +++ b/Projectiles/Summon/PolypLauncherSentry.cs @@ -29,20 +29,6 @@ namespace CalamityMod.Projectiles.Summon { Player player = Main.player[Projectile.owner]; - if (Projectile.localAI[0] == 0f) - { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; - Projectile.localAI[0] += 1f; - } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = damage2; - } - Projectile.frameCounter++; if (Projectile.frameCounter > 4) { @@ -85,7 +71,9 @@ namespace CalamityMod.Projectiles.Summon Vector2 velocity = new Vector2(0f, -shootSpeed).RotatedBy(angle).RotatedByRandom(0.1f); velocity.X *= (potentialTarget.Center.X - Projectile.Center.X < 0).ToDirectionInt(); - Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), spawnPosition, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + int p = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), spawnPosition, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Projectile.originalDamage; Projectile.ai[1] = 0f; Projectile.netUpdate = true; } diff --git a/Projectiles/Summon/PowerfulRaven.cs b/Projectiles/Summon/PowerfulRaven.cs index 1cb3d20463..adef1d393d 100644 --- a/Projectiles/Summon/PowerfulRaven.cs +++ b/Projectiles/Summon/PowerfulRaven.cs @@ -44,18 +44,9 @@ namespace CalamityMod.Projectiles.Summon CalamityPlayer modPlayer = player.Calamity(); if (Projectile.localAI[0] == 0f) { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; Projectile.ai[0] = -1f; Projectile.localAI[0] = 1f; } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int trueDamage = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = trueDamage; - } bool isProperProjectile = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (isProperProjectile) diff --git a/Projectiles/Summon/ProfanedEnergy.cs b/Projectiles/Summon/ProfanedEnergy.cs index c897331aae..67221b3072 100644 --- a/Projectiles/Summon/ProfanedEnergy.cs +++ b/Projectiles/Summon/ProfanedEnergy.cs @@ -47,8 +47,6 @@ namespace CalamityMod.Projectiles.Summon } if (count == 0f) { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); for (int i = 0; i < 5; i++) { @@ -73,13 +71,6 @@ namespace CalamityMod.Projectiles.Summon } count += 1f; } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = damage2; - } if (Projectile.owner == Main.myPlayer) { if (Projectile.ai[0] != 0f) diff --git a/Projectiles/Summon/PurpleButterfly.cs b/Projectiles/Summon/PurpleButterfly.cs index ab8c5260ad..e25f4c5811 100644 --- a/Projectiles/Summon/PurpleButterfly.cs +++ b/Projectiles/Summon/PurpleButterfly.cs @@ -41,8 +41,6 @@ namespace CalamityMod.Projectiles.Summon CalamityPlayer modPlayer = player.Calamity(); if (dust > 0) { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int num226 = 36; for (int num227 = 0; num227 < num226; num227++) { @@ -54,13 +52,6 @@ namespace CalamityMod.Projectiles.Summon } dust--; } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = damage2; - } if (Math.Abs(Projectile.velocity.X) > 0.2f) { Projectile.spriteDirection = -Projectile.direction; diff --git a/Projectiles/Summon/RadiantResolutionAura.cs b/Projectiles/Summon/RadiantResolutionAura.cs index 15bcc80670..8a96eaf14c 100644 --- a/Projectiles/Summon/RadiantResolutionAura.cs +++ b/Projectiles/Summon/RadiantResolutionAura.cs @@ -45,9 +45,6 @@ namespace CalamityMod.Projectiles.Summon // Ensure that the projectile using this AI is the correct projectile and that the owner has the appropriate buffs. VerifyIdentityOfCaller(); - // Handle dynamic minion damage. - HandleDynamicMinionDamage(); - // Store the allocated slots in the minionSlots field so that the amount of slots the projectile is holding // is always correct. Projectile.minionSlots = Projectile.ai[0]; @@ -95,23 +92,6 @@ namespace CalamityMod.Projectiles.Summon } } - public void HandleDynamicMinionDamage() - { - if (Projectile.localAI[0] == 0f) - { - Projectile.Calamity().spawnedPlayerMinionDamageValue = Owner.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; - Projectile.localAI[0] += 1f; - } - if (Owner.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int trueDamage = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - Owner.MinionDamage()); - Projectile.damage = trueDamage; - } - } - public void AttackTarget(NPC target, int radiantOrbAppearRate, int radiantOrbDamage) { if (GeneralTimer % 35f == 34f) @@ -120,7 +100,9 @@ namespace CalamityMod.Projectiles.Summon { float angle = MathHelper.Lerp(-MathHelper.ToRadians(20f), MathHelper.ToRadians(20f), i / 2f); Vector2 fireVelocity = Projectile.SafeDirectionTo(target.Center).RotatedBy(angle) * 15f; - Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, fireVelocity, ModContent.ProjectileType(), radiantOrbDamage / 2, Projectile.knockBack, Projectile.owner); + int p = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, fireVelocity, ModContent.ProjectileType(), radiantOrbDamage / 2, Projectile.knockBack, Projectile.owner); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = radiantOrbDamage / 2; } } @@ -128,12 +110,16 @@ namespace CalamityMod.Projectiles.Summon { Vector2 spawnPosition = Projectile.Center + Main.rand.NextVector2Unit() * Main.rand.NextFloat(100f, 360f); Vector2 bootlegRadianceOrbVelocity = Projectile.SafeDirectionTo(target.Center) * 2f; - Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), spawnPosition, bootlegRadianceOrbVelocity, ModContent.ProjectileType(), radiantOrbDamage, Projectile.knockBack * 4f, Projectile.owner); + int p2 = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), spawnPosition, bootlegRadianceOrbVelocity, ModContent.ProjectileType(), radiantOrbDamage, Projectile.knockBack * 4f, Projectile.owner); + if (Main.projectile.IndexInRange(p2)) + Main.projectile[p2].originalDamage = radiantOrbDamage; for (int i = 0; i < 3; i++) { float angle = MathHelper.Lerp(-MathHelper.ToRadians(30f), MathHelper.ToRadians(30f), i / 3f); Vector2 fireVelocity = Projectile.SafeDirectionTo(target.Center).RotatedBy(angle) * 19f; - Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, fireVelocity, ModContent.ProjectileType(), radiantOrbDamage / 2, Projectile.knockBack, Projectile.owner); + int p = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, fireVelocity, ModContent.ProjectileType(), radiantOrbDamage / 2, Projectile.knockBack, Projectile.owner); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = radiantOrbDamage / 2; } } } diff --git a/Projectiles/Summon/RustyDrone.cs b/Projectiles/Summon/RustyDrone.cs index 9adfe18ed4..061241100c 100644 --- a/Projectiles/Summon/RustyDrone.cs +++ b/Projectiles/Summon/RustyDrone.cs @@ -58,8 +58,6 @@ namespace CalamityMod.Projectiles.Summon Projectile.damage = 1; // For the initial tiny prick effect Projectile.Damage(); Projectile.damage = oldDamage; - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; Projectile.Center -= Vector2.UnitY * 1400f; Projectile.localAI[0] += 1f; } @@ -68,13 +66,6 @@ namespace CalamityMod.Projectiles.Summon Projectile.alpha = (int)MathHelper.Lerp(Projectile.alpha, 0f, 0.02f); Projectile.velocity = Vector2.UnitY * 10f; } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int trueDamage = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = trueDamage; - } Projectile.frameCounter++; if (Projectile.frameCounter > 8) { @@ -138,8 +129,10 @@ namespace CalamityMod.Projectiles.Summon Utils.PoofOfSmoke(Projectile.Center); for (int i = 0; i < 4; i++) { - Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi) * 8f, ModContent.ProjectileType(), + int p = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi) * 8f, ModContent.ProjectileType(), (int)(ExplosionShrapnelBaseDamage * player.MinionDamage()), 2f, Projectile.owner); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Projectile.originalDamage; } Projectile.Kill(); } diff --git a/Projectiles/Summon/SageSpirit.cs b/Projectiles/Summon/SageSpirit.cs index 912918f187..f9bc4741d5 100644 --- a/Projectiles/Summon/SageSpirit.cs +++ b/Projectiles/Summon/SageSpirit.cs @@ -186,7 +186,9 @@ namespace CalamityMod.Projectiles.Summon for (int i = 0; i < 3; i++) { Vector2 spikeVelocity = -Vector2.UnitY.RotatedBy(MathHelper.Lerp(-0.43f, 0.43f, i / 3f)) * 6f; - Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Top, spikeVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + int p = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Top, spikeVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Projectile.originalDamage; } } } diff --git a/Projectiles/Summon/SandElementalHealer.cs b/Projectiles/Summon/SandElementalHealer.cs index b7ecef3c00..147486c78c 100644 --- a/Projectiles/Summon/SandElementalHealer.cs +++ b/Projectiles/Summon/SandElementalHealer.cs @@ -65,8 +65,6 @@ namespace CalamityMod.Projectiles.Summon dust--; if (dust >= 0) { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int dustAmt = 50; for (int d = 0; d < dustAmt; d++) { @@ -75,13 +73,6 @@ namespace CalamityMod.Projectiles.Summon Main.dust[sand].scale *= 1.15f; } } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = damage2; - } Projectile.frameCounter++; if (Projectile.frameCounter > 16) diff --git a/Projectiles/Summon/SandElementalMinion.cs b/Projectiles/Summon/SandElementalMinion.cs index a6203ad421..6ed103cad4 100644 --- a/Projectiles/Summon/SandElementalMinion.cs +++ b/Projectiles/Summon/SandElementalMinion.cs @@ -60,8 +60,6 @@ namespace CalamityMod.Projectiles.Summon dust--; if (dust >= 0) { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int num501 = 50; for (int num502 = 0; num502 < num501; num502++) { @@ -70,13 +68,6 @@ namespace CalamityMod.Projectiles.Summon Main.dust[num503].scale *= 1.15f; } } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = damage2; - } if (Math.Abs(Projectile.velocity.X) > 0.2f) { Projectile.spriteDirection = -Projectile.direction; @@ -253,7 +244,9 @@ namespace CalamityMod.Projectiles.Summon Vector2 value19 = vector46 - Projectile.Center; value19.Normalize(); value19 *= scaleFactor3; - Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, value19, num658, Projectile.damage, 0f, Main.myPlayer, 0f, 0f); + int p = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, value19, num658, Projectile.damage, 0f, Main.myPlayer, 0f, 0f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Projectile.originalDamage; Projectile.netUpdate = true; } } diff --git a/Projectiles/Summon/SandnadoMinion.cs b/Projectiles/Summon/SandnadoMinion.cs index 37b50504ca..886b2a9a69 100644 --- a/Projectiles/Summon/SandnadoMinion.cs +++ b/Projectiles/Summon/SandnadoMinion.cs @@ -40,8 +40,6 @@ namespace CalamityMod.Projectiles.Summon CalamityPlayer modPlayer = player.Calamity(); if (Projectile.localAI[1] == 0f) { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int dustAmt = 36; for (int d = 0; d < dustAmt; d++) { @@ -55,13 +53,6 @@ namespace CalamityMod.Projectiles.Summon } Projectile.localAI[1] += 1f; } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = damage2; - } bool correctMinion = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (correctMinion) diff --git a/Projectiles/Summon/SeekerSummonProj.cs b/Projectiles/Summon/SeekerSummonProj.cs index 537f744331..dd9ceef243 100644 --- a/Projectiles/Summon/SeekerSummonProj.cs +++ b/Projectiles/Summon/SeekerSummonProj.cs @@ -135,7 +135,9 @@ namespace CalamityMod.Projectiles.Summon Projectile.spriteDirection = (shootVelocity.X > 0f).ToDirectionInt(); if (Main.netMode != NetmodeID.MultiplayerClient) { - Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), eyePosition, shootVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + int dart = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), eyePosition, shootVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + if (Main.projectile.IndexInRange(dart)) + Main.projectile[dart].originalDamage = Projectile.originalDamage; } } return; diff --git a/Projectiles/Summon/SepulcherMinion.cs b/Projectiles/Summon/SepulcherMinion.cs index ba79823d0e..5c6ca63cea 100644 --- a/Projectiles/Summon/SepulcherMinion.cs +++ b/Projectiles/Summon/SepulcherMinion.cs @@ -173,7 +173,6 @@ namespace CalamityMod.Projectiles.Summon { Initialize(); HandleBuffs(); - HandleFlexibleDamage(); UpdateSegments(); // Fade in rapidly. @@ -271,8 +270,6 @@ namespace CalamityMod.Projectiles.Summon for (int i = 0; i < Segments.Length; i++) Segments[i].CurrentPosition = Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.UnitY) * i * 0.2f; - Projectile.Calamity().spawnedPlayerMinionDamageValue = Owner.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; Projectile.ai[1] = 1f; if (Main.myPlayer == Projectile.owner) { @@ -299,16 +296,6 @@ namespace CalamityMod.Projectiles.Summon Projectile.timeLeft = 2; } - public void HandleFlexibleDamage() - { - // Adjust the damage of this projectile if the owner's current minion damage factor has changed for any reason. - if (Owner.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int trueDamage = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / Projectile.Calamity().spawnedPlayerMinionDamageValue * Owner.MinionDamage()); - Projectile.damage = trueDamage; - } - } - public void UpdateSegments() { float aheadRotation = Projectile.rotation; @@ -418,7 +405,9 @@ namespace CalamityMod.Projectiles.Summon int segmentToFireFrom = 60 - AttackTimer % 60; Vector2 spawnPosition = Segments[segmentToFireFrom].CurrentPosition; Vector2 shootVelocity = (target.Center - spawnPosition).SafeNormalize(Vector2.UnitY) * 8f; - Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), spawnPosition, shootVelocity, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack, Projectile.owner); + int p = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), spawnPosition, shootVelocity, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack, Projectile.owner); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Projectile.originalDamage; } if (Main.myPlayer == Projectile.owner && AttackTimer > 430) diff --git a/Projectiles/Summon/Shellfish.cs b/Projectiles/Summon/Shellfish.cs index 07e9c389e5..13cefc6ea7 100644 --- a/Projectiles/Summon/Shellfish.cs +++ b/Projectiles/Summon/Shellfish.cs @@ -50,8 +50,6 @@ namespace CalamityMod.Projectiles.Summon CalamityGlobalProjectile modProj = Projectile.Calamity(); if (spawnDust) { - modProj.spawnedPlayerMinionDamageValue = player.MinionDamage(); - modProj.spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int dustAmt = 20; for (int d = 0; d < dustAmt; d++) { @@ -61,12 +59,6 @@ namespace CalamityMod.Projectiles.Summon } spawnDust = false; } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)modProj.spawnedPlayerMinionProjectileDamageValue / - modProj.spawnedPlayerMinionDamageValue * player.MinionDamage()); - Projectile.damage = damage2; - } bool correctMinion = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); diff --git a/Projectiles/Summon/SilvaCrystal.cs b/Projectiles/Summon/SilvaCrystal.cs index 96a7d866d5..b0cd2b808e 100644 --- a/Projectiles/Summon/SilvaCrystal.cs +++ b/Projectiles/Summon/SilvaCrystal.cs @@ -37,19 +37,6 @@ namespace CalamityMod.Projectiles.Summon { Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (Projectile.localAI[1] == 0f) - { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; - Projectile.localAI[1] += 1f; - } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = damage2; - } bool flag64 = Projectile.type == ModContent.ProjectileType(); if (!modPlayer.silvaSummon) { @@ -180,7 +167,9 @@ namespace CalamityMod.Projectiles.Summon vector156 = Projectile.Center + vector155.RotatedByRandom(0.78539818525314331) * (Main.rand.NextFloat() * 0.5f + 0.75f); } float x4 = Main.rgbToHsl(new Color(Main.DiscoR, 203, 103)).X; - Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), vector156, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, x4, (float)Projectile.whoAmI); + int p = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), vector156, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, x4, (float)Projectile.whoAmI); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Projectile.originalDamage; num31 = num1083; } return; diff --git a/Projectiles/Summon/SiriusBeam.cs b/Projectiles/Summon/SiriusBeam.cs index 96ea15f581..a77b266902 100644 --- a/Projectiles/Summon/SiriusBeam.cs +++ b/Projectiles/Summon/SiriusBeam.cs @@ -53,7 +53,9 @@ namespace CalamityMod.Projectiles.Summon { target.AddBuff(ModContent.BuffType(), 180); float x4 = Main.rgbToHsl(new Color(103, 203, Main.DiscoB)).X; - Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, x4, Projectile.whoAmI); + int p = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, x4, Projectile.whoAmI); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Projectile.originalDamage; } } } diff --git a/Projectiles/Summon/SiriusMinion.cs b/Projectiles/Summon/SiriusMinion.cs index d8faee46f8..13c13708a3 100644 --- a/Projectiles/Summon/SiriusMinion.cs +++ b/Projectiles/Summon/SiriusMinion.cs @@ -72,8 +72,6 @@ namespace CalamityMod.Projectiles.Summon if (Projectile.localAI[0] == 0f) { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int dustAmt = 50; for (int d = 0; d < dustAmt; d++) { @@ -84,12 +82,6 @@ namespace CalamityMod.Projectiles.Summon Projectile.localAI[0] += 1f; } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - Projectile.damage = damage2; - } if (Projectile.owner == Main.myPlayer) { if (Projectile.ai[1] != 0f) @@ -142,6 +134,8 @@ namespace CalamityMod.Projectiles.Summon velocity.Y *= targetDist; float damageMult = ((float)Math.Log(Projectile.ai[0], MathHelper.E)) + 1f; int beam = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), source, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * damageMult), Projectile.knockBack, Projectile.owner); + if (Main.projectile.IndexInRange(beam)) + Main.projectile[beam].originalDamage = Projectile.originalDamage; Main.projectile[beam].penetrate = (int)Projectile.ai[0]; Projectile.ai[1] = 30f; } diff --git a/Projectiles/Summon/SkeletalDragonChild.cs b/Projectiles/Summon/SkeletalDragonChild.cs index 9748847298..19f895a8c2 100644 --- a/Projectiles/Summon/SkeletalDragonChild.cs +++ b/Projectiles/Summon/SkeletalDragonChild.cs @@ -35,20 +35,6 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { Player player = Main.player[Projectile.owner]; - if (Projectile.localAI[0] == 0f) - { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; - Projectile.localAI[0] = 1f; - } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int trueDamage = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = trueDamage; - } - if (Projectile.ai[0] < 0 || Projectile.ai[0] >= Main.projectile.Length) { Projectile.Kill(); @@ -70,7 +56,9 @@ namespace CalamityMod.Projectiles.Summon Projectile.ai[1]++; if (Projectile.ai[1] % 55f == 54f && Main.myPlayer == Projectile.owner) { - Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, Projectile.SafeDirectionTo(target.Center) * 19f, ModContent.ProjectileType(), mother.damage, mother.knockBack, mother.owner); + int p = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, Projectile.SafeDirectionTo(target.Center) * 19f, ModContent.ProjectileType(), mother.damage, mother.knockBack, mother.owner); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Projectile.originalDamage; } } diff --git a/Projectiles/Summon/SkeletalDragonMother.cs b/Projectiles/Summon/SkeletalDragonMother.cs index 84551f245c..21885f6ff8 100644 --- a/Projectiles/Summon/SkeletalDragonMother.cs +++ b/Projectiles/Summon/SkeletalDragonMother.cs @@ -40,22 +40,15 @@ namespace CalamityMod.Projectiles.Summon CalamityPlayer modPlayer = player.Calamity(); if (Projectile.localAI[0] == 0f) { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; for (int i = 0; i < 2; i++) { - Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center + Utils.RandomVector2(Main.rand, -24f, 24f), + int p = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center + Utils.RandomVector2(Main.rand, -24f, 24f), Main.rand.NextVector2CircularEdge(4f, 4f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, player.whoAmI, Projectile.whoAmI); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Projectile.originalDamage; } Projectile.localAI[0] = 1f; } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int trueDamage = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = trueDamage; - } bool isProperProjectile = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (isProperProjectile) @@ -106,7 +99,9 @@ namespace CalamityMod.Projectiles.Summon { if (Projectile.owner == player.whoAmI && Projectile.spriteDirection == (Projectile.SafeDirectionTo(target.Center).X > 0).ToDirectionInt()) { - Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, Projectile.SafeDirectionTo(target.Center) * 11.5f, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner); + int p = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, Projectile.SafeDirectionTo(target.Center) * 11.5f, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Projectile.originalDamage; } } } diff --git a/Projectiles/Summon/SlimePuppet.cs b/Projectiles/Summon/SlimePuppet.cs index 698fb3424d..afdf477c09 100644 --- a/Projectiles/Summon/SlimePuppet.cs +++ b/Projectiles/Summon/SlimePuppet.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using Terraria; @@ -35,8 +35,6 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - ResetDamage(); - // Prevent clumping of other slime puppets near this one. Projectile.MinionAntiClump(); @@ -73,22 +71,6 @@ namespace CalamityMod.Projectiles.Summon Projectile.ai[0] = 50f; } - public void ResetDamage() - { - // Initialize minion damage values the moment the projectile is spawned. - if (Projectile.localAI[0] == 0f) - { - Projectile.Calamity().spawnedPlayerMinionDamageValue = Owner.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; - Projectile.localAI[0] = 1f; - } - if (Owner.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int trueDamage = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / Projectile.Calamity().spawnedPlayerMinionDamageValue * Owner.MinionDamage()); - Projectile.damage = trueDamage; - } - } - public override void Kill(int timeLeft) { CalamityGlobalProjectile.ExpandHitboxBy(Projectile, 100); diff --git a/Projectiles/Summon/SmallSkeletonMinion.cs b/Projectiles/Summon/SmallSkeletonMinion.cs index 8903c5d0fc..e9e71753fa 100644 --- a/Projectiles/Summon/SmallSkeletonMinion.cs +++ b/Projectiles/Summon/SmallSkeletonMinion.cs @@ -50,20 +50,10 @@ namespace CalamityMod.Projectiles.Summon if (Projectile.localAI[0] == 0f) { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; Variant = Main.rand.Next(3); Projectile.netUpdate = true; Projectile.localAI[0] += 1f; } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int trueDamage = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = trueDamage; - } - Projectile.frameCounter++; if (Projectile.frameCounter % 6f == 5f) { @@ -110,7 +100,9 @@ namespace CalamityMod.Projectiles.Summon if (Projectile.ai[0] % 60f == 59f && Main.myPlayer == Projectile.owner) { int type = Utils.SelectRandom(Main.rand, ModContent.ProjectileType(), ModContent.ProjectileType()); - Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, Vector2.Zero, type, Projectile.damage, Projectile.knockBack, Projectile.owner); + int p = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, Vector2.Zero, type, Projectile.damage, Projectile.knockBack, Projectile.owner); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Projectile.originalDamage; } if (potentialTarget is null) { @@ -181,7 +173,7 @@ namespace CalamityMod.Projectiles.Summon { Rectangle frame = new Rectangle(Variant * Projectile.width, Projectile.frame * Projectile.height, Projectile.width, Projectile.height); SpriteEffects spriteEffects = (Projectile.spriteDirection == 1) ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - Main.EntitySpriteDraw(ModContent.Request(Texture).Value, Projectile.Center - Main.screenPosition, frame, Color.White, Projectile.rotation, Projectile.Size / 2f, 1f, SpriteEffects.None, 0); + Main.EntitySpriteDraw(ModContent.Request(Texture).Value, Projectile.Center - Main.screenPosition, frame, Color.White, Projectile.rotation, Projectile.Size / 2f, 1f, spriteEffects, 0); return false; } diff --git a/Projectiles/Summon/SolarGod.cs b/Projectiles/Summon/SolarGod.cs index d51bccd509..8a0ed92fbf 100644 --- a/Projectiles/Summon/SolarGod.cs +++ b/Projectiles/Summon/SolarGod.cs @@ -65,8 +65,6 @@ namespace CalamityMod.Projectiles.Summon Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0f / 255f); if (Projectile.localAI[0] == 0f) { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int dustAmt = 50; for (int d = 0; d < dustAmt; d++) { @@ -76,13 +74,6 @@ namespace CalamityMod.Projectiles.Summon } Projectile.localAI[0] += 1f; } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = damage2; - } if (Projectile.owner == Main.myPlayer) { if (Projectile.ai[0] != 0f) @@ -130,8 +121,10 @@ namespace CalamityMod.Projectiles.Summon Vector2 velocity = targetPos - source; velocity.Normalize(); velocity *= shootSpeed; - Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), source, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + int beam = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), source, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); Projectile.ai[0] = 20f; + if (Main.projectile.IndexInRange(beam)) + Main.projectile[beam].originalDamage = Projectile.originalDamage; } } } diff --git a/Projectiles/Summon/SolarPixie.cs b/Projectiles/Summon/SolarPixie.cs index d3ff8d3e8e..899e83edc7 100644 --- a/Projectiles/Summon/SolarPixie.cs +++ b/Projectiles/Summon/SolarPixie.cs @@ -65,8 +65,6 @@ namespace CalamityMod.Projectiles.Summon Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.25f / 255f, (255 - Projectile.alpha) * 0.25f / 255f, (255 - Projectile.alpha) * 0f / 255f); if (Projectile.localAI[0] == 0f) { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int dustAmt = 25; for (int d = 0; d < dustAmt; d++) { @@ -76,13 +74,6 @@ namespace CalamityMod.Projectiles.Summon } Projectile.localAI[0] += 1f; } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = damage2; - } if (Projectile.owner == Main.myPlayer) { if (Projectile.ai[0] != 0f) @@ -132,7 +123,10 @@ namespace CalamityMod.Projectiles.Summon velocity *= shootSpeed; int beam = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), source, velocity, ProjectileID.HeatRay, Projectile.damage, Projectile.knockBack, Projectile.owner); if (beam.WithinBounds(Main.maxProjectiles)) + { Main.projectile[beam].Calamity().forceMinion = true; + Main.projectile[beam].originalDamage = Projectile.originalDamage; + } Projectile.ai[0] = 50f; } } diff --git a/Projectiles/Summon/SonOfYharon.cs b/Projectiles/Summon/SonOfYharon.cs index 1531fe6db1..737b2c6153 100644 --- a/Projectiles/Summon/SonOfYharon.cs +++ b/Projectiles/Summon/SonOfYharon.cs @@ -61,13 +61,6 @@ namespace CalamityMod.Projectiles.Summon // Perform minion checks. PerformMinionChecks(); - // Dynamically adjust damage if it changes. - if (Owner.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int trueDamage = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / Projectile.Calamity().spawnedPlayerMinionDamageValue * Owner.MinionDamage()); - Projectile.damage = trueDamage; - } - // Handle frame logic. if (Projectile.FinalExtraUpdate()) Projectile.frameCounter++; @@ -126,9 +119,6 @@ namespace CalamityMod.Projectiles.Summon public void PerformInitialization() { - Projectile.Calamity().spawnedPlayerMinionDamageValue = Owner.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; - for (int i = 0; i < 45; i++) { Dust fire = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(55f, 55f), 244); @@ -248,7 +238,7 @@ namespace CalamityMod.Projectiles.Summon Texture2D texture2D13 = ModContent.Request(Texture).Value; int num214 = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; int y6 = num214 * Projectile.frame; - Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Rectangle(0, y6, texture2D13.Width, num214), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture2D13.Width / 2f, num214 / 2f), Projectile.scale, SpriteEffects.None, 0); + Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Rectangle(0, y6, texture2D13.Width, num214), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture2D13.Width / 2f, num214 / 2f), Projectile.scale, spriteEffects, 0); return false; } } diff --git a/Projectiles/Summon/Spikecrag.cs b/Projectiles/Summon/Spikecrag.cs index a57c0182ef..cd6a2df372 100644 --- a/Projectiles/Summon/Spikecrag.cs +++ b/Projectiles/Summon/Spikecrag.cs @@ -29,20 +29,6 @@ namespace CalamityMod.Projectiles.Summon { Player player = Main.player[Projectile.owner]; - if (Projectile.localAI[0] == 0f) - { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; - Projectile.localAI[0] += 1f; - } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = damage2; - } - Projectile.frameCounter++; if (Projectile.frameCounter > 4) { @@ -95,7 +81,9 @@ namespace CalamityMod.Projectiles.Summon { float velocityX = Main.rand.NextFloat(-10f, 10f); float velocityY = Main.rand.NextFloat(-15f, -8f); - Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.oldPosition.X + (Projectile.width / 2), Projectile.oldPosition.Y + (Projectile.height / 2), velocityX, velocityY, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + int spike = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.oldPosition.X + (Projectile.width / 2), Projectile.oldPosition.Y + (Projectile.height / 2), velocityX, velocityY, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + if (Main.projectile.IndexInRange(spike)) + Main.projectile[spike].originalDamage = Projectile.originalDamage; } } } diff --git a/Projectiles/Summon/SquirrelSquireAcorn.cs b/Projectiles/Summon/SquirrelSquireAcorn.cs index 720cd2e49d..3bfa249d41 100644 --- a/Projectiles/Summon/SquirrelSquireAcorn.cs +++ b/Projectiles/Summon/SquirrelSquireAcorn.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Projectiles/Summon/SquirrelSquireMinion.cs b/Projectiles/Summon/SquirrelSquireMinion.cs index 1f8d5d1f28..d50a3bff65 100644 --- a/Projectiles/Summon/SquirrelSquireMinion.cs +++ b/Projectiles/Summon/SquirrelSquireMinion.cs @@ -60,13 +60,6 @@ namespace CalamityMod.Projectiles.Summon Projectile.localAI[0] = 1f; } - // Re-adjust damage as needed. - if (Owner.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int trueDamage = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / Projectile.Calamity().spawnedPlayerMinionDamageValue * Owner.MinionDamage()); - Projectile.damage = trueDamage; - } - Projectile.velocity.Y = MathHelper.Clamp(Projectile.velocity.Y + 0.004f, -12f, 12f); Projectile.frameCounter++; @@ -112,9 +105,6 @@ namespace CalamityMod.Projectiles.Summon public void DoInitializationEffects() { - Projectile.Calamity().spawnedPlayerMinionDamageValue = Owner.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; - int dustQuantity = 36; for (int d = 0; d < dustQuantity; d++) { @@ -148,7 +138,9 @@ namespace CalamityMod.Projectiles.Summon if (Projectile.WithinRange(target.Center, 200f)) acornShootVelocity = (target.Center - acornSpawnPosition).SafeNormalize(-Vector2.UnitY) * acornShootSpeed; - Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), acornSpawnPosition, acornShootVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + int acorn = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), acornSpawnPosition, acornShootVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + if (Main.projectile.IndexInRange(acorn)) + Main.projectile[acorn].originalDamage = Projectile.originalDamage; } } diff --git a/Projectiles/Summon/StormjawBaby.cs b/Projectiles/Summon/StormjawBaby.cs index 1ff63acf3a..36770861a8 100644 --- a/Projectiles/Summon/StormjawBaby.cs +++ b/Projectiles/Summon/StormjawBaby.cs @@ -60,8 +60,6 @@ namespace CalamityMod.Projectiles.Summon // Handle stuff on spawn & variable damage if (dust == 0f) { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int dustAmt = 36; for (int d = 0; d < dustAmt; d++) { @@ -79,13 +77,6 @@ namespace CalamityMod.Projectiles.Summon private void SummonChecks() { - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - Projectile.damage = damage2; - } - bool projTypeCheck = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (projTypeCheck) diff --git a/Projectiles/Summon/TacticalPlagueJet.cs b/Projectiles/Summon/TacticalPlagueJet.cs index fcd18e41ce..fafc3d1487 100644 --- a/Projectiles/Summon/TacticalPlagueJet.cs +++ b/Projectiles/Summon/TacticalPlagueJet.cs @@ -57,9 +57,6 @@ namespace CalamityMod.Projectiles.Summon // Frame 1 spawning effects. if (Projectile.localAI[0] == 0f) { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; - // Spawn dust. for (int i = 0; i < 45; i++) { @@ -84,15 +81,6 @@ namespace CalamityMod.Projectiles.Summon if (Projectile.frame >= Main.projFrames[Projectile.type]) Projectile.frame = 0; - // Correct for minion damage changes every single frame. - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int trueDamage = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = trueDamage; - } - player.AddBuff(ModContent.BuffType(), 3600); bool isCorrectProjectile = Projectile.type == ModContent.ProjectileType(); if (isCorrectProjectile) @@ -192,7 +180,10 @@ namespace CalamityMod.Projectiles.Summon // Regardless of what was fired, force it to be a summon projectile so that summon accessories work. if (projIndex.WithinBounds(Main.maxProjectiles)) + { Main.projectile[projIndex].Calamity().forceMinion = true; + Main.projectile[projIndex].originalDamage = Projectile.originalDamage; + } } // Prevent minion clumping while firing. diff --git a/Projectiles/Summon/TundraFlameBlossom.cs b/Projectiles/Summon/TundraFlameBlossom.cs index fd019d9e0b..971a79c666 100644 --- a/Projectiles/Summon/TundraFlameBlossom.cs +++ b/Projectiles/Summon/TundraFlameBlossom.cs @@ -54,8 +54,6 @@ namespace CalamityMod.Projectiles.Summon Projectile.rotation += MathHelper.ToRadians(5f); if (Projectile.localAI[0] == 0f) { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; for (int i = 0; i < 36; i++) { Dust dust = Dust.NewDustPerfect(Projectile.Center, 179); @@ -64,13 +62,6 @@ namespace CalamityMod.Projectiles.Summon } Projectile.localAI[0] += 1f; } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int trueDamage = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = trueDamage; - } int fireRate = 130; float fireSpeed = 6f; if (Projectile.owner == Main.myPlayer) @@ -91,8 +82,9 @@ namespace CalamityMod.Projectiles.Summon int count = Projectile.ai[1] % (2 * fireRate) == (2 * fireRate - 1) ? 4 : 3; for (int i = 0; i < count; i++) { - Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, -Vector2.UnitY.RotatedBy(MathHelper.TwoPi / count * i + Projectile.ai[0]) * fireSpeed, + int orb = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, -Vector2.UnitY.RotatedBy(MathHelper.TwoPi / count * i + Projectile.ai[0]) * fireSpeed, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Main.projectile[orb].originalDamage = Projectile.originalDamage; } } } diff --git a/Projectiles/Summon/Urchin.cs b/Projectiles/Summon/Urchin.cs index 60c104d817..e604fc6f78 100644 --- a/Projectiles/Summon/Urchin.cs +++ b/Projectiles/Summon/Urchin.cs @@ -56,8 +56,6 @@ namespace CalamityMod.Projectiles.Summon dust--; if (dust >= 0) { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int dustAmt = 50; for (int d = 0; d < dustAmt; d++) { @@ -66,13 +64,6 @@ namespace CalamityMod.Projectiles.Summon Main.dust[index].scale *= 1.15f; } } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = damage2; - } float scalar = (float)Main.mouseTextColor / 200f - 0.35f; scalar *= 0.2f; Projectile.scale = scalar + 0.95f; @@ -119,6 +110,7 @@ namespace CalamityMod.Projectiles.Summon int spore = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), source, velocity, ModContent.ProjectileType(), Projectile.damage, 1f, Projectile.owner, 0f, 0f); Main.projectile[spore].minion = true; Main.projectile[spore].minionSlots = 0f; + Main.projectile[spore].originalDamage = Projectile.originalDamage; } SoundEngine.PlaySound(SoundID.Item42, Projectile.position); Projectile.ai[0] = 60f; diff --git a/Projectiles/Summon/Valkyrie.cs b/Projectiles/Summon/Valkyrie.cs index 6afb7fb3d2..7f8c8190ce 100644 --- a/Projectiles/Summon/Valkyrie.cs +++ b/Projectiles/Summon/Valkyrie.cs @@ -58,8 +58,6 @@ namespace CalamityMod.Projectiles.Summon } if (Projectile.localAI[0] == 0f) { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int num501 = 30; for (int num502 = 0; num502 < num501; num502++) { @@ -69,13 +67,6 @@ namespace CalamityMod.Projectiles.Summon } Projectile.localAI[0] += 1f; } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = damage2; - } //Adjust sprite direction so it faces correctly if (Math.Abs(Projectile.velocity.X) > 0.2f) diff --git a/Projectiles/Summon/VileFeederSummon.cs b/Projectiles/Summon/VileFeederSummon.cs index c85447de4c..3fb0d44b14 100644 --- a/Projectiles/Summon/VileFeederSummon.cs +++ b/Projectiles/Summon/VileFeederSummon.cs @@ -54,8 +54,6 @@ namespace CalamityMod.Projectiles.Summon if (spawnDust) { Projectile.Calamity().lineColor = -1; - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int dustAmt = 36; for (int d = 0; d < dustAmt; d++) { @@ -68,13 +66,6 @@ namespace CalamityMod.Projectiles.Summon } spawnDust = false; } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = damage2; - } bool correctMinion = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); diff --git a/Projectiles/Summon/ViridVanguardBlade.cs b/Projectiles/Summon/ViridVanguardBlade.cs index a5e76af511..1f4c2447c1 100644 --- a/Projectiles/Summon/ViridVanguardBlade.cs +++ b/Projectiles/Summon/ViridVanguardBlade.cs @@ -64,19 +64,6 @@ namespace CalamityMod.Projectiles.Summon Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); Projectile.spriteDirection = AltTexture.ToDirectionInt(); - if (Projectile.localAI[0] == 0f) - { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; - Projectile.localAI[0] = 1f; - } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int trueDamage = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = trueDamage; - } bool isProperProjectile = Projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); if (isProperProjectile) diff --git a/Projectiles/Summon/WaterElementalMinion.cs b/Projectiles/Summon/WaterElementalMinion.cs index dbd8447da1..1b59bbd3fc 100644 --- a/Projectiles/Summon/WaterElementalMinion.cs +++ b/Projectiles/Summon/WaterElementalMinion.cs @@ -57,8 +57,6 @@ namespace CalamityMod.Projectiles.Summon } if (dust > 0) { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int num501 = 50; for (int num502 = 0; num502 < num501; num502++) { @@ -68,12 +66,6 @@ namespace CalamityMod.Projectiles.Summon } dust--; } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - Projectile.damage = damage2; - } Lighting.AddLight(Projectile.Center, 0f, 0.25f, 1.5f); Projectile.frameCounter++; if (Projectile.frameCounter > 8) @@ -178,7 +170,8 @@ namespace CalamityMod.Projectiles.Summon num406 = num403 / num406; num404 *= num406; num405 *= num406; - Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X - 4f, Projectile.Center.Y, num404, num405, projectileType, Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + int proj = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X - 4f, Projectile.Center.Y, num404, num405, projectileType, Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + Main.projectile[proj].originalDamage = Projectile.originalDamage; Projectile.ai[0] = 12f; } } diff --git a/Projectiles/Summon/WitherBlossom.cs b/Projectiles/Summon/WitherBlossom.cs index abaab3f748..a0b977e77c 100644 --- a/Projectiles/Summon/WitherBlossom.cs +++ b/Projectiles/Summon/WitherBlossom.cs @@ -45,26 +45,25 @@ namespace CalamityMod.Projectiles.Summon Projectile.timeLeft = 2; } - SetProjectileDamage(); + Initialize(); Time++; NPC potentialTarget = Projectile.Center.MinionHoming(950f, Owner); if (Time % 50 == 49 && Main.myPlayer == Projectile.owner && potentialTarget != null) { Vector2 shootVelocity = Projectile.SafeDirectionTo(potentialTarget.Center).RotatedByRandom(0.25f) * 8f; - Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, shootVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + int bolt = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, shootVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Main.projectile[bolt].originalDamage = Projectile.originalDamage; } Projectile.Center = player.Center + OffsetAngle.ToRotationVector2() * 150f; Projectile.rotation += MathHelper.ToRadians(5f); OffsetAngle += MathHelper.ToRadians(4f); } - public void SetProjectileDamage() + public void Initialize() { if (Projectile.localAI[0] == 0f) { - Projectile.Calamity().spawnedPlayerMinionDamageValue = Owner.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; for (int i = 0; i < 36; i++) { Dust dust = Dust.NewDustPerfect(Projectile.Center, 179); @@ -73,13 +72,6 @@ namespace CalamityMod.Projectiles.Summon } Projectile.localAI[0] += 1f; } - if (Owner.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int trueDamage = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - Owner.MinionDamage()); - Projectile.damage = trueDamage; - } } public override bool? CanDamage() => false; diff --git a/Projectiles/Summon/WulfrumDroid.cs b/Projectiles/Summon/WulfrumDroid.cs index efbddba2d5..d7dcc30320 100644 --- a/Projectiles/Summon/WulfrumDroid.cs +++ b/Projectiles/Summon/WulfrumDroid.cs @@ -40,8 +40,6 @@ namespace CalamityMod.Projectiles.Summon CalamityPlayer modPlayer = player.Calamity(); if (dust == 0f) { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; int dustAmt = 36; for (int dustIndex = 0; dustIndex < dustAmt; dustIndex++) { @@ -55,12 +53,6 @@ namespace CalamityMod.Projectiles.Summon } dust += 1f; } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); - Projectile.damage = damage2; - } Projectile.frameCounter++; if (Projectile.frameCounter > 8) { @@ -207,6 +199,7 @@ namespace CalamityMod.Projectiles.Summon velocity.Normalize(); velocity *= 10f; int bolt = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Main.projectile[bolt].originalDamage = Projectile.originalDamage; Main.projectile[bolt].netUpdate = true; Projectile.netUpdate = true; } diff --git a/Projectiles/Summon/YoungDuke.cs b/Projectiles/Summon/YoungDuke.cs index 99298b7c4e..1cb0418d38 100644 --- a/Projectiles/Summon/YoungDuke.cs +++ b/Projectiles/Summon/YoungDuke.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -54,22 +54,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.timeLeft = 2; } } - - // Adjust damage as needed - if (Projectile.localAI[0] == 0f) - { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; - Projectile.localAI[0] = 1f; - } - if (player.MinionDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int trueDamage = (int)(Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); - Projectile.damage = trueDamage; - } - + bool playerHalfLife = player.statLife <= player.statLifeMax2 * 0.5f; // Frames diff --git a/Projectiles/Typeless/DemonshadeRedDevil.cs b/Projectiles/Typeless/DemonshadeRedDevil.cs index ddeee61ad2..23becd5161 100644 --- a/Projectiles/Typeless/DemonshadeRedDevil.cs +++ b/Projectiles/Typeless/DemonshadeRedDevil.cs @@ -56,11 +56,6 @@ namespace CalamityMod.Projectiles.Typeless } } dust--; - if (dust == 2) - { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.AverageDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; - } if (dust >= 0) { int num501 = 50; @@ -71,13 +66,6 @@ namespace CalamityMod.Projectiles.Typeless Main.dust[num503].scale *= 1.15f; } } - if (player.AverageDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.AverageDamage()); - Projectile.damage = damage2; - } Projectile.frameCounter++; if (Projectile.frameCounter > 8) { diff --git a/Projectiles/Typeless/GladiatorSword.cs b/Projectiles/Typeless/GladiatorSword.cs index ef1fe109e3..6659e9e8aa 100644 --- a/Projectiles/Typeless/GladiatorSword.cs +++ b/Projectiles/Typeless/GladiatorSword.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -35,20 +35,6 @@ namespace CalamityMod.Projectiles.Typeless Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (Projectile.localAI[0] == 0f) - { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.AverageDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; - Projectile.localAI[0] += 1f; - } - if (player.AverageDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.AverageDamage()); - Projectile.damage = damage2; - } - if (!modPlayer.gladiatorSword) { Projectile.active = false; diff --git a/Projectiles/Typeless/GladiatorSword2.cs b/Projectiles/Typeless/GladiatorSword2.cs index 53285386f4..db4a56b5fd 100644 --- a/Projectiles/Typeless/GladiatorSword2.cs +++ b/Projectiles/Typeless/GladiatorSword2.cs @@ -1,4 +1,4 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -36,20 +36,6 @@ namespace CalamityMod.Projectiles.Typeless Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (Projectile.localAI[0] == 0f) - { - Projectile.Calamity().spawnedPlayerMinionDamageValue = player.AverageDamage(); - Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = Projectile.damage; - Projectile.localAI[0] += 1f; - } - if (player.AverageDamage() != Projectile.Calamity().spawnedPlayerMinionDamageValue) - { - int damage2 = (int)((float)Projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - Projectile.Calamity().spawnedPlayerMinionDamageValue * - player.AverageDamage()); - Projectile.damage = damage2; - } - if (!modPlayer.gladiatorSword) { Projectile.active = false;