From a22989177b7d5d28fa943bfce3b0fb1d1806147f Mon Sep 17 00:00:00 2001 From: Memes <114233643+Mr-Memes@users.noreply.github.com> Date: Sat, 5 Oct 2024 00:35:10 +0200 Subject: [PATCH] Made BaseSummonBuff abstract class. --- Buffs/Summon/AbandonedSlimeBuff.cs | 30 ++---------- Buffs/Summon/AncientMineralSharkBuff.cs | 28 ++---------- Buffs/Summon/AquaticStar.cs | 25 ++-------- Buffs/Summon/AstralProbeBuff.cs | 25 ++-------- Buffs/Summon/BabyBloodCrawlerBuff.cs | 29 ++---------- Buffs/Summon/BabySlimeGodBuff.cs | 32 ++----------- Buffs/Summon/BabyStormlionBuff.cs | 28 ++---------- Buffs/Summon/BaseSummonBuff.cs | 56 +++++++++++++++++++++++ Buffs/Summon/BelladonnaSpiritBuff.cs | 29 ++---------- Buffs/Summon/BlackHawkBuff.cs | 29 ++---------- Buffs/Summon/BrimseekerBuff.cs | 28 ++---------- Buffs/Summon/BrimstoneWaifu.cs | 29 ++---------- Buffs/Summon/BrittleStar.cs | 29 ++---------- Buffs/Summon/CalamarisLamentBuff.cs | 29 ++---------- Buffs/Summon/CausticStaffBuff.cs | 29 ++---------- Buffs/Summon/CinderBlossomBuff.cs | 29 ++---------- Buffs/Summon/CloudyWaifu.cs | 29 ++---------- Buffs/Summon/Corroslime.cs | 29 ++---------- Buffs/Summon/CorvidHarbringerBuff.cs | 29 ++---------- Buffs/Summon/CosmicEnergy.cs | 29 ++---------- Buffs/Summon/CosmicViperEngineBuff.cs | 29 ++---------- Buffs/Summon/CosmilampBuff.cs | 29 ++---------- Buffs/Summon/Crimslime.cs | 29 ++---------- Buffs/Summon/DaedalusCrystalBuff.cs | 28 ++---------- Buffs/Summon/DaedalusGolemBuff.cs | 28 ++---------- Buffs/Summon/DankCreeperBuff.cs | 29 ++---------- Buffs/Summon/DazzlingStabberBuff.cs | 29 ++---------- Buffs/Summon/DemonshadeSetDevilBuff.cs | 30 ++---------- Buffs/Summon/EndoCooperBuff.cs | 29 ++---------- Buffs/Summon/EndoHydraBuff.cs | 29 ++---------- Buffs/Summon/EntropysVigilBuff.cs | 28 ++---------- Buffs/Summon/EyeOfNightBuff.cs | 26 ++--------- Buffs/Summon/FieryDraconidBuff.cs | 28 ++---------- Buffs/Summon/FlarebatBuff.cs | 29 ++---------- Buffs/Summon/FleshBallBuff.cs | 25 ++-------- Buffs/Summon/FlowersOfMortalityBuff.cs | 27 ++--------- Buffs/Summon/FrostBlossomBuff.cs | 29 ++---------- Buffs/Summon/FrostbatBuff.cs | 29 ++---------- Buffs/Summon/FungalClumpBuff.cs | 31 ++----------- Buffs/Summon/GammaHydraBuff.cs | 28 ++---------- Buffs/Summon/GastricAberrationBuff.cs | 28 ++---------- Buffs/Summon/HauntedDishesBuff.cs | 29 ++---------- Buffs/Summon/HermitCrab.cs | 30 ++---------- Buffs/Summon/Herring.cs | 29 ++---------- Buffs/Summon/HowlTrio.cs | 32 ++----------- Buffs/Summon/HydrothermicVentBuff.cs | 28 ++---------- Buffs/Summon/IceClasperBuff.cs | 29 ++---------- Buffs/Summon/IgneousExaltationBuff.cs | 29 ++---------- Buffs/Summon/KalandraMirrorBuff.cs | 31 ++----------- Buffs/Summon/KingofConstellationsBuff.cs | 29 ++---------- Buffs/Summon/LegionofCelestiaBuff.cs | 29 ++---------- Buffs/Summon/LilPlaguebringerBuff.cs | 28 ++---------- Buffs/Summon/LiliesOfFinalityBuff.cs | 25 ++-------- Buffs/Summon/MagicHatBuff.cs | 31 ++----------- Buffs/Summon/Mechworm.cs | 29 ++---------- Buffs/Summon/MidnightSunBuff.cs | 29 ++---------- Buffs/Summon/MiniPlaguebringerBuff.cs | 28 ++---------- Buffs/Summon/MiniatureEyeofCthulhu.cs | 28 ++---------- Buffs/Summon/MoonFistBuff.cs | 26 ++--------- Buffs/Summon/MountedScannerBuff.cs | 31 ++----------- Buffs/Summon/MutatedTruffleBuff.cs | 30 ++---------- Buffs/Summon/PerditionBuff.cs | 28 ++---------- Buffs/Summon/Phantom.cs | 29 ++---------- Buffs/Summon/PlantationStaffBuff.cs | 30 ++---------- Buffs/Summon/PoleWarperBuff.cs | 31 ++----------- Buffs/Summon/PuffWarriorBuff.cs | 25 ++-------- Buffs/Summon/ResurrectionButterflyBuff.cs | 29 ++---------- Buffs/Summon/SageSpiritBuff.cs | 26 ++--------- Buffs/Summon/Sandnado.cs | 29 ++---------- Buffs/Summon/SandyHealingWaifu.cs | 29 ++---------- Buffs/Summon/SandyWaifu.cs | 29 ++---------- Buffs/Summon/SarosPossessionBuff.cs | 24 ++-------- Buffs/Summon/SeaSnailBuff.cs | 31 ++----------- Buffs/Summon/SepulcherMinionBuff.cs | 27 ++--------- Buffs/Summon/ShellfishBuff.cs | 29 ++---------- Buffs/Summon/SilvaCrystalBuff.cs | 28 ++---------- Buffs/Summon/SiriusBuff.cs | 29 ++---------- Buffs/Summon/SkeletalDragonsBuff.cs | 28 ++---------- Buffs/Summon/SmallSkeletonBuff.cs | 28 ++---------- Buffs/Summon/SnakeEyesBuff.cs | 31 ++----------- Buffs/Summon/SolarGodSpiritBuff.cs | 28 ++---------- Buffs/Summon/SolarSpirit.cs | 29 ++---------- Buffs/Summon/SoulSeekerBuff.cs | 27 ++--------- Buffs/Summon/StarSwallowerBuff.cs | 31 ++----------- Buffs/Summon/StellarTorusBuff.cs | 29 ++---------- Buffs/Summon/TacticalPlagueEngineBuff.cs | 29 ++---------- Buffs/Summon/TundraFlameBlossomsBuff.cs | 29 ++---------- Buffs/Summon/ValkyrieBuff.cs | 28 ++---------- Buffs/Summon/VileFeederBuff.cs | 29 ++---------- Buffs/Summon/ViridVanguardBuff.cs | 28 ++---------- Buffs/Summon/ViriliBuff.cs | 28 ++---------- Buffs/Summon/WaterWaifu.cs | 29 ++---------- Buffs/Summon/WitherBlossomsBuff.cs | 27 ++--------- Buffs/Summon/WulfrumDroidBuff.cs | 29 ++---------- 94 files changed, 345 insertions(+), 2372 deletions(-) create mode 100644 Buffs/Summon/BaseSummonBuff.cs diff --git a/Buffs/Summon/AbandonedSlimeBuff.cs b/Buffs/Summon/AbandonedSlimeBuff.cs index 7ffb20bb40..d8cf35e9ea 100644 --- a/Buffs/Summon/AbandonedSlimeBuff.cs +++ b/Buffs/Summon/AbandonedSlimeBuff.cs @@ -1,34 +1,12 @@ -using CalamityMod.CalPlayer; -using CalamityMod.Projectiles.Summon; -using Terraria; +using CalamityMod.Projectiles.Summon; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class AbandonedSlimeBuff : ModBuff + public class AbandonedSlimeBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.aSlime = true; - } - if (!modPlayer.aSlime) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.aSlime; } } diff --git a/Buffs/Summon/AncientMineralSharkBuff.cs b/Buffs/Summon/AncientMineralSharkBuff.cs index 14df6894cd..420894ce2e 100644 --- a/Buffs/Summon/AncientMineralSharkBuff.cs +++ b/Buffs/Summon/AncientMineralSharkBuff.cs @@ -1,34 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class AncientMineralSharkBuff : ModBuff + public class AncientMineralSharkBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.apexShark = true; - } - if (!modPlayer.apexShark) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.apexShark; } } diff --git a/Buffs/Summon/AquaticStar.cs b/Buffs/Summon/AquaticStar.cs index 114c4c7817..c5d53efb0a 100644 --- a/Buffs/Summon/AquaticStar.cs +++ b/Buffs/Summon/AquaticStar.cs @@ -1,31 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class AquaticStar : ModBuff + public class AquaticStar : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - modPlayer.aquaticStar = true; - if (!modPlayer.aquaticStar) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - player.buffTime[buffIndex] = 18000; - } + protected override ref bool MinionBool => ref BuffModdedOwner.aquaticStar; } } diff --git a/Buffs/Summon/AstralProbeBuff.cs b/Buffs/Summon/AstralProbeBuff.cs index fcd8bab67b..89795f563e 100644 --- a/Buffs/Summon/AstralProbeBuff.cs +++ b/Buffs/Summon/AstralProbeBuff.cs @@ -1,31 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class AstralProbeBuff : ModBuff + public class AstralProbeBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - modPlayer.astralProbe = true; - if (!modPlayer.astralProbe) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - player.buffTime[buffIndex] = 18000; - } + protected override ref bool MinionBool => ref BuffModdedOwner.astralProbe; } } diff --git a/Buffs/Summon/BabyBloodCrawlerBuff.cs b/Buffs/Summon/BabyBloodCrawlerBuff.cs index 5946f92508..6c7170b7b0 100644 --- a/Buffs/Summon/BabyBloodCrawlerBuff.cs +++ b/Buffs/Summon/BabyBloodCrawlerBuff.cs @@ -1,33 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; + namespace CalamityMod.Buffs.Summon { - public class BabyBloodCrawlerBuff : ModBuff + public class BabyBloodCrawlerBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.scabRipper = true; - } - if (!modPlayer.scabRipper) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.scabRipper; } } diff --git a/Buffs/Summon/BabySlimeGodBuff.cs b/Buffs/Summon/BabySlimeGodBuff.cs index 35346bdbdc..c596e06060 100644 --- a/Buffs/Summon/BabySlimeGodBuff.cs +++ b/Buffs/Summon/BabySlimeGodBuff.cs @@ -1,38 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class BabySlimeGodBuff : ModBuff + public class BabySlimeGodBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.sGod = true; - } - else if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.sGod = true; - } - if (!modPlayer.sGod) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.sGod; } } diff --git a/Buffs/Summon/BabyStormlionBuff.cs b/Buffs/Summon/BabyStormlionBuff.cs index 4de612baef..694c4dad63 100644 --- a/Buffs/Summon/BabyStormlionBuff.cs +++ b/Buffs/Summon/BabyStormlionBuff.cs @@ -1,34 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class BabyStormlionBuff : ModBuff + public class BabyStormlionBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.stormjaw = true; - } - if (!modPlayer.stormjaw) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.stormjaw; } } diff --git a/Buffs/Summon/BaseSummonBuff.cs b/Buffs/Summon/BaseSummonBuff.cs new file mode 100644 index 0000000000..9fede4e1a2 --- /dev/null +++ b/Buffs/Summon/BaseSummonBuff.cs @@ -0,0 +1,56 @@ +using CalamityMod.CalPlayer; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Summon +{ + /// + /// An abstract class that gives the baseline code needed to make a buff dedicated to a minion. + /// + public abstract class BaseSummonBuff : ModBuff + { + /// + /// The correspondent minion's ID of this buff. + /// + protected abstract int MinionProjectileType { get; } + + /// + /// The correspondent boolean field of this minion. + /// + protected abstract ref bool MinionBool { get; } + + /// + /// The that possesses this buff (Read-only). + /// + protected Player BuffOwner { get; private set; } + + /// + /// The that possesses this buff (Read-only). + /// + protected CalamityPlayer BuffModdedOwner { get; private set; } + + public override void SetStaticDefaults() + { + Main.buffNoTimeDisplay[Type] = true; + Main.buffNoSave[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + BuffOwner ??= player; + BuffModdedOwner ??= player.Calamity(); + + if (player.ownedProjectileCounts[MinionProjectileType] > 0) + MinionBool = true; + + if (!MinionBool) + { + player.DelBuff(buffIndex); + buffIndex--; + } + + else + player.buffTime[buffIndex] = 18000; + } + } +} diff --git a/Buffs/Summon/BelladonnaSpiritBuff.cs b/Buffs/Summon/BelladonnaSpiritBuff.cs index 61ba9bfa29..5ffac7dd80 100644 --- a/Buffs/Summon/BelladonnaSpiritBuff.cs +++ b/Buffs/Summon/BelladonnaSpiritBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class BelladonnaSpiritBuff : ModBuff + public class BelladonnaSpiritBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.belladonaSpirit = true; - } - if (!modPlayer.belladonaSpirit) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.belladonaSpirit; } } diff --git a/Buffs/Summon/BlackHawkBuff.cs b/Buffs/Summon/BlackHawkBuff.cs index 5ec4851c76..984828a8bc 100644 --- a/Buffs/Summon/BlackHawkBuff.cs +++ b/Buffs/Summon/BlackHawkBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class BlackHawkBuff : ModBuff + public class BlackHawkBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.blackhawk = true; - } - if (!modPlayer.blackhawk) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.blackhawk; } } diff --git a/Buffs/Summon/BrimseekerBuff.cs b/Buffs/Summon/BrimseekerBuff.cs index f8d9f9d31d..13d4d0a053 100644 --- a/Buffs/Summon/BrimseekerBuff.cs +++ b/Buffs/Summon/BrimseekerBuff.cs @@ -1,34 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class BrimseekerBuff : ModBuff + public class BrimseekerBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.brimseeker = true; - } - if (!modPlayer.brimseeker) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.brimseeker; } } diff --git a/Buffs/Summon/BrimstoneWaifu.cs b/Buffs/Summon/BrimstoneWaifu.cs index 73e099a09a..f6b12d5477 100644 --- a/Buffs/Summon/BrimstoneWaifu.cs +++ b/Buffs/Summon/BrimstoneWaifu.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class BrimstoneWaifu : ModBuff + public class BrimstoneWaifu : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.bWaifu = true; - } - if (!modPlayer.bWaifu) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.bWaifu; } } diff --git a/Buffs/Summon/BrittleStar.cs b/Buffs/Summon/BrittleStar.cs index 9104dec42f..34c1c8cd7e 100644 --- a/Buffs/Summon/BrittleStar.cs +++ b/Buffs/Summon/BrittleStar.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class BrittleStar : ModBuff + public class BrittleStar : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.brittleStar = true; - } - if (!modPlayer.brittleStar) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.brittleStar; } } diff --git a/Buffs/Summon/CalamarisLamentBuff.cs b/Buffs/Summon/CalamarisLamentBuff.cs index 1d02c46246..d29b919f3e 100644 --- a/Buffs/Summon/CalamarisLamentBuff.cs +++ b/Buffs/Summon/CalamarisLamentBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class CalamarisLamentBuff : ModBuff + public class CalamarisLamentBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.CalamarisLament = true; - } - if (!modPlayer.CalamarisLament) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.CalamarisLament; } } diff --git a/Buffs/Summon/CausticStaffBuff.cs b/Buffs/Summon/CausticStaffBuff.cs index 25a4672d32..9b817c2c00 100644 --- a/Buffs/Summon/CausticStaffBuff.cs +++ b/Buffs/Summon/CausticStaffBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class CausticStaffBuff : ModBuff + public class CausticStaffBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.causticDragon = true; - } - if (!modPlayer.causticDragon) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.causticDragon; } } diff --git a/Buffs/Summon/CinderBlossomBuff.cs b/Buffs/Summon/CinderBlossomBuff.cs index 8133494739..9e5f3e71a0 100644 --- a/Buffs/Summon/CinderBlossomBuff.cs +++ b/Buffs/Summon/CinderBlossomBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class CinderBlossomBuff : ModBuff + public class CinderBlossomBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.cinderBlossom = true; - } - if (!modPlayer.cinderBlossom) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.cinderBlossom; } } diff --git a/Buffs/Summon/CloudyWaifu.cs b/Buffs/Summon/CloudyWaifu.cs index 0cb6162e05..4b342af8c1 100644 --- a/Buffs/Summon/CloudyWaifu.cs +++ b/Buffs/Summon/CloudyWaifu.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class CloudyWaifu : ModBuff + public class CloudyWaifu : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.cWaifu = true; - } - if (!modPlayer.cWaifu) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.cWaifu; } } diff --git a/Buffs/Summon/Corroslime.cs b/Buffs/Summon/Corroslime.cs index c8c15edb91..ca5b6d02ee 100644 --- a/Buffs/Summon/Corroslime.cs +++ b/Buffs/Summon/Corroslime.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class Corroslime : ModBuff + public class Corroslime : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.cSlime = true; - } - if (!modPlayer.cSlime) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.cSlime; } } diff --git a/Buffs/Summon/CorvidHarbringerBuff.cs b/Buffs/Summon/CorvidHarbringerBuff.cs index 504458767f..7b44a698e1 100644 --- a/Buffs/Summon/CorvidHarbringerBuff.cs +++ b/Buffs/Summon/CorvidHarbringerBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class CorvidHarbringerBuff : ModBuff + public class CorvidHarbringerBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.powerfulRaven = true; - } - if (!modPlayer.powerfulRaven) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.powerfulRaven; } } diff --git a/Buffs/Summon/CosmicEnergy.cs b/Buffs/Summon/CosmicEnergy.cs index bd29028601..5cf78293ff 100644 --- a/Buffs/Summon/CosmicEnergy.cs +++ b/Buffs/Summon/CosmicEnergy.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class CosmicEnergy : ModBuff + public class CosmicEnergy : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.cEnergy = true; - } - if (!modPlayer.cEnergy) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.cEnergy; } } diff --git a/Buffs/Summon/CosmicViperEngineBuff.cs b/Buffs/Summon/CosmicViperEngineBuff.cs index 836dc2da24..a23c4e0a2a 100644 --- a/Buffs/Summon/CosmicViperEngineBuff.cs +++ b/Buffs/Summon/CosmicViperEngineBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class CosmicViperEngineBuff : ModBuff + public class CosmicViperEngineBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.cosmicViper = true; - } - if (!modPlayer.cosmicViper) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.cosmicViper; } } diff --git a/Buffs/Summon/CosmilampBuff.cs b/Buffs/Summon/CosmilampBuff.cs index 635914f27e..9333a1892d 100644 --- a/Buffs/Summon/CosmilampBuff.cs +++ b/Buffs/Summon/CosmilampBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class CosmilampBuff : ModBuff + public class CosmilampBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.cLamp = true; - } - if (!modPlayer.cLamp) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.cLamp; } } diff --git a/Buffs/Summon/Crimslime.cs b/Buffs/Summon/Crimslime.cs index b6d36ff83e..dc08297928 100644 --- a/Buffs/Summon/Crimslime.cs +++ b/Buffs/Summon/Crimslime.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class Crimslime : ModBuff + public class Crimslime : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.cSlime2 = true; - } - if (!modPlayer.cSlime2) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.cSlime2; } } diff --git a/Buffs/Summon/DaedalusCrystalBuff.cs b/Buffs/Summon/DaedalusCrystalBuff.cs index e6450fb54d..5d98c76e42 100644 --- a/Buffs/Summon/DaedalusCrystalBuff.cs +++ b/Buffs/Summon/DaedalusCrystalBuff.cs @@ -1,34 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class DaedalusCrystalBuff : ModBuff + public class DaedalusCrystalBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.dCrystal = true; - } - if (!modPlayer.dCrystal) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.dCrystal; } } diff --git a/Buffs/Summon/DaedalusGolemBuff.cs b/Buffs/Summon/DaedalusGolemBuff.cs index ca584568e4..ecab151fcb 100644 --- a/Buffs/Summon/DaedalusGolemBuff.cs +++ b/Buffs/Summon/DaedalusGolemBuff.cs @@ -1,34 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class DaedalusGolemBuff : ModBuff + public class DaedalusGolemBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.daedalusGolem = true; - } - if (!modPlayer.daedalusGolem) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.daedalusGolem; } } diff --git a/Buffs/Summon/DankCreeperBuff.cs b/Buffs/Summon/DankCreeperBuff.cs index bac55737b5..f9ad39b3e8 100644 --- a/Buffs/Summon/DankCreeperBuff.cs +++ b/Buffs/Summon/DankCreeperBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class DankCreeperBuff : ModBuff + public class DankCreeperBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.dCreeper = true; - } - if (!modPlayer.dCreeper) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.dCreeper; } } diff --git a/Buffs/Summon/DazzlingStabberBuff.cs b/Buffs/Summon/DazzlingStabberBuff.cs index a2a20e32df..b380a4f623 100644 --- a/Buffs/Summon/DazzlingStabberBuff.cs +++ b/Buffs/Summon/DazzlingStabberBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class DazzlingStabberBuff : ModBuff + public class DazzlingStabberBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.providenceStabber = true; - } - if (!modPlayer.providenceStabber) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.providenceStabber; } } diff --git a/Buffs/Summon/DemonshadeSetDevilBuff.cs b/Buffs/Summon/DemonshadeSetDevilBuff.cs index 506ed146eb..b9c589fc3a 100644 --- a/Buffs/Summon/DemonshadeSetDevilBuff.cs +++ b/Buffs/Summon/DemonshadeSetDevilBuff.cs @@ -1,34 +1,12 @@ -using CalamityMod.CalPlayer; -using CalamityMod.Projectiles.Typeless; -using Terraria; +using CalamityMod.Projectiles.Typeless; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class DemonshadeSetDevilBuff : ModBuff + public class DemonshadeSetDevilBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.rDevil = true; - } - if (!modPlayer.rDevil) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.rDevil; } } diff --git a/Buffs/Summon/EndoCooperBuff.cs b/Buffs/Summon/EndoCooperBuff.cs index 325948b2b1..0ec41d737c 100644 --- a/Buffs/Summon/EndoCooperBuff.cs +++ b/Buffs/Summon/EndoCooperBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class EndoCooperBuff : ModBuff + public class EndoCooperBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.endoCooper = true; - } - if (!modPlayer.endoCooper) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.endoCooper; } } diff --git a/Buffs/Summon/EndoHydraBuff.cs b/Buffs/Summon/EndoHydraBuff.cs index 0bb3a54736..9e4e9effa3 100644 --- a/Buffs/Summon/EndoHydraBuff.cs +++ b/Buffs/Summon/EndoHydraBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class EndoHydraBuff : ModBuff + public class EndoHydraBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.endoHydra = true; - } - if (!modPlayer.endoHydra) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.endoHydra; } } diff --git a/Buffs/Summon/EntropysVigilBuff.cs b/Buffs/Summon/EntropysVigilBuff.cs index 9020e0e294..9fe6f6ced4 100644 --- a/Buffs/Summon/EntropysVigilBuff.cs +++ b/Buffs/Summon/EntropysVigilBuff.cs @@ -1,34 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class EntropysVigilBuff : ModBuff + public class EntropysVigilBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.cEyes = true; - } - if (!modPlayer.cEyes) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.cEyes; } } diff --git a/Buffs/Summon/EyeOfNightBuff.cs b/Buffs/Summon/EyeOfNightBuff.cs index 871b2d486f..3e9945b097 100644 --- a/Buffs/Summon/EyeOfNightBuff.cs +++ b/Buffs/Summon/EyeOfNightBuff.cs @@ -1,32 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class EyeOfNightBuff : ModBuff + public class EyeOfNightBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - modPlayer.eyeOfNight = true; - - if (modPlayer.eyeOfNight) - player.buffTime[buffIndex] = 18000; - else - { - player.DelBuff(buffIndex); - buffIndex--; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.eyeOfNight; } } diff --git a/Buffs/Summon/FieryDraconidBuff.cs b/Buffs/Summon/FieryDraconidBuff.cs index 023fd17a96..ae9c404d43 100644 --- a/Buffs/Summon/FieryDraconidBuff.cs +++ b/Buffs/Summon/FieryDraconidBuff.cs @@ -1,34 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class FieryDraconidBuff : ModBuff + public class FieryDraconidBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.aChicken = true; - } - if (!modPlayer.aChicken) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.aChicken; } } diff --git a/Buffs/Summon/FlarebatBuff.cs b/Buffs/Summon/FlarebatBuff.cs index e1e2c6b14b..7be2c4732c 100644 --- a/Buffs/Summon/FlarebatBuff.cs +++ b/Buffs/Summon/FlarebatBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class FlarebatBuff : ModBuff + public class FlarebatBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.FlarebatBool = true; - } - - if (!modPlayer.FlarebatBool) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.FlarebatBool; } } diff --git a/Buffs/Summon/FleshBallBuff.cs b/Buffs/Summon/FleshBallBuff.cs index a4bcc5b39a..18f8fa6cc1 100644 --- a/Buffs/Summon/FleshBallBuff.cs +++ b/Buffs/Summon/FleshBallBuff.cs @@ -1,31 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class FleshBallBuff : ModBuff + public class FleshBallBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - modPlayer.fleshBall = true; - - if (modPlayer.fleshBall) - player.buffTime[buffIndex] = 18000; - else - { - player.DelBuff(buffIndex); - buffIndex--; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.fleshBall; } } diff --git a/Buffs/Summon/FlowersOfMortalityBuff.cs b/Buffs/Summon/FlowersOfMortalityBuff.cs index a89d37c19a..c1b03ad87a 100644 --- a/Buffs/Summon/FlowersOfMortalityBuff.cs +++ b/Buffs/Summon/FlowersOfMortalityBuff.cs @@ -1,33 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class FlowersOfMortalityBuff : ModBuff + public class FlowersOfMortalityBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - modPlayer.flowersOfMortality = true; - - if (!modPlayer.flowersOfMortality) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.flowersOfMortality; } } diff --git a/Buffs/Summon/FrostBlossomBuff.cs b/Buffs/Summon/FrostBlossomBuff.cs index 8f21d5f3e8..c7ecb20539 100644 --- a/Buffs/Summon/FrostBlossomBuff.cs +++ b/Buffs/Summon/FrostBlossomBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class FrostBlossomBuff : ModBuff + public class FrostBlossomBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.frostBlossom = true; - } - if (!modPlayer.frostBlossom) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.frostBlossom; } } diff --git a/Buffs/Summon/FrostbatBuff.cs b/Buffs/Summon/FrostbatBuff.cs index 3c2d57186f..6bc6421c8d 100644 --- a/Buffs/Summon/FrostbatBuff.cs +++ b/Buffs/Summon/FrostbatBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class FrostbatBuff : ModBuff + public class FrostbatBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.FrostbatBool = true; - } - - if (!modPlayer.FrostbatBool) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.FrostbatBool; } } diff --git a/Buffs/Summon/FungalClumpBuff.cs b/Buffs/Summon/FungalClumpBuff.cs index c8a3a4549e..789a4cb10c 100644 --- a/Buffs/Summon/FungalClumpBuff.cs +++ b/Buffs/Summon/FungalClumpBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; -using CalamityMod.Projectiles.Typeless; -using Terraria; +using CalamityMod.Projectiles.Typeless; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class FungalClumpBuff : ModBuff + public class FungalClumpBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.fClump = true; - } - if (!modPlayer.fClump) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.fClump; } } diff --git a/Buffs/Summon/GammaHydraBuff.cs b/Buffs/Summon/GammaHydraBuff.cs index df1f299ec1..c568d7cc91 100644 --- a/Buffs/Summon/GammaHydraBuff.cs +++ b/Buffs/Summon/GammaHydraBuff.cs @@ -1,34 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class GammaHydraBuff : ModBuff + public class GammaHydraBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.gammaHead = true; - } - if (!modPlayer.gammaHead) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.gammaHead; } } diff --git a/Buffs/Summon/GastricAberrationBuff.cs b/Buffs/Summon/GastricAberrationBuff.cs index e9b3abaf1a..647614065e 100644 --- a/Buffs/Summon/GastricAberrationBuff.cs +++ b/Buffs/Summon/GastricAberrationBuff.cs @@ -1,34 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class GastricAberrationBuff : ModBuff + public class GastricAberrationBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.gastricBelcher = true; - } - if (!modPlayer.gastricBelcher) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.gastricBelcher; } } diff --git a/Buffs/Summon/HauntedDishesBuff.cs b/Buffs/Summon/HauntedDishesBuff.cs index d46bd34697..786db9d8ba 100644 --- a/Buffs/Summon/HauntedDishesBuff.cs +++ b/Buffs/Summon/HauntedDishesBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class HauntedDishesBuff : ModBuff + public class HauntedDishesBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.hauntedDishes = true; - } - if (!modPlayer.hauntedDishes) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.hauntedDishes; } } diff --git a/Buffs/Summon/HermitCrab.cs b/Buffs/Summon/HermitCrab.cs index 56b92d5bea..8d154acb76 100644 --- a/Buffs/Summon/HermitCrab.cs +++ b/Buffs/Summon/HermitCrab.cs @@ -1,36 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class HermitCrab : ModBuff + public class HermitCrab : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.hCrab = true; - } - - if (!modPlayer.hCrab) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.hCrab; } } diff --git a/Buffs/Summon/Herring.cs b/Buffs/Summon/Herring.cs index 4824c98315..50b2a661e2 100644 --- a/Buffs/Summon/Herring.cs +++ b/Buffs/Summon/Herring.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class Herring : ModBuff + public class Herring : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.herring = true; - } - if (!modPlayer.herring) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.herring; } } diff --git a/Buffs/Summon/HowlTrio.cs b/Buffs/Summon/HowlTrio.cs index 262846cd50..c5b2aa85ba 100644 --- a/Buffs/Summon/HowlTrio.cs +++ b/Buffs/Summon/HowlTrio.cs @@ -1,38 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class HowlTrio : ModBuff + public class HowlTrio : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - int howl = ModContent.ProjectileType(); - int calcifer = ModContent.ProjectileType(); - int turnip = ModContent.ProjectileType(); - if (player.ownedProjectileCounts[howl] > 0 || player.ownedProjectileCounts[calcifer] > 0 || player.ownedProjectileCounts[turnip] > 0) - { - modPlayer.howlTrio = true; - } - if (!modPlayer.howlTrio) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.howlTrio; } } diff --git a/Buffs/Summon/HydrothermicVentBuff.cs b/Buffs/Summon/HydrothermicVentBuff.cs index a4e32b31e5..12b336d0d9 100644 --- a/Buffs/Summon/HydrothermicVentBuff.cs +++ b/Buffs/Summon/HydrothermicVentBuff.cs @@ -1,34 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class HydrothermicVentBuff : ModBuff + public class HydrothermicVentBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.cSpirit = true; - } - if (!modPlayer.cSpirit) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.cSpirit; } } diff --git a/Buffs/Summon/IceClasperBuff.cs b/Buffs/Summon/IceClasperBuff.cs index 8c25f49849..d5961ee0a2 100644 --- a/Buffs/Summon/IceClasperBuff.cs +++ b/Buffs/Summon/IceClasperBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class IceClasperBuff : ModBuff + public class IceClasperBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.IceClasperBool = true; - } - if (!modPlayer.IceClasperBool) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.IceClasperBool; } } diff --git a/Buffs/Summon/IgneousExaltationBuff.cs b/Buffs/Summon/IgneousExaltationBuff.cs index 3c12f97a0c..99c69b9529 100644 --- a/Buffs/Summon/IgneousExaltationBuff.cs +++ b/Buffs/Summon/IgneousExaltationBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class IgneousExaltationBuff : ModBuff + public class IgneousExaltationBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.igneousExaltation = true; - } - if (!modPlayer.providenceStabber) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.igneousExaltation; } } diff --git a/Buffs/Summon/KalandraMirrorBuff.cs b/Buffs/Summon/KalandraMirrorBuff.cs index 6882b77d11..ba298f547d 100644 --- a/Buffs/Summon/KalandraMirrorBuff.cs +++ b/Buffs/Summon/KalandraMirrorBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; -using CalamityMod.Projectiles.Summon.MirrorofKalandraMinions; -using Terraria; +using CalamityMod.Projectiles.Summon.MirrorofKalandraMinions; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class KalandraMirrorBuff : ModBuff + public class KalandraMirrorBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.KalandraMirror = true; - } - if (!modPlayer.KalandraMirror) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.KalandraMirror; } } diff --git a/Buffs/Summon/KingofConstellationsBuff.cs b/Buffs/Summon/KingofConstellationsBuff.cs index bb837dd790..8d26d427b6 100644 --- a/Buffs/Summon/KingofConstellationsBuff.cs +++ b/Buffs/Summon/KingofConstellationsBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Microsoft.Xna.Framework; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class KingofConstellationsBuff : ModBuff + public class KingofConstellationsBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0 || player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.celestialDragons = true; - } - if (!modPlayer.celestialDragons) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.celestialDragons; } } diff --git a/Buffs/Summon/LegionofCelestiaBuff.cs b/Buffs/Summon/LegionofCelestiaBuff.cs index 9157620388..507bc2ee3b 100644 --- a/Buffs/Summon/LegionofCelestiaBuff.cs +++ b/Buffs/Summon/LegionofCelestiaBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class LegionofCelestiaBuff : ModBuff + public class LegionofCelestiaBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.eAxe = true; - } - if (!modPlayer.eAxe) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.eAxe; } } diff --git a/Buffs/Summon/LilPlaguebringerBuff.cs b/Buffs/Summon/LilPlaguebringerBuff.cs index 2fee31b83f..cb8777825a 100644 --- a/Buffs/Summon/LilPlaguebringerBuff.cs +++ b/Buffs/Summon/LilPlaguebringerBuff.cs @@ -1,34 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class LilPlaguebringerBuff : ModBuff + public class LilPlaguebringerBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.plaguebringerPatronSummon = true; - } - if (!modPlayer.plaguebringerPatronSummon) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.plaguebringerPatronSummon; } } diff --git a/Buffs/Summon/LiliesOfFinalityBuff.cs b/Buffs/Summon/LiliesOfFinalityBuff.cs index 77fe068705..0ffd82caec 100644 --- a/Buffs/Summon/LiliesOfFinalityBuff.cs +++ b/Buffs/Summon/LiliesOfFinalityBuff.cs @@ -1,31 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class LiliesOfFinalityBuff : ModBuff + public class LiliesOfFinalityBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - modPlayer.LiliesOfFinalityBool = true; - - if (!modPlayer.LiliesOfFinalityBool) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - player.buffTime[buffIndex] = 18000; - } + protected override ref bool MinionBool => ref BuffModdedOwner.LiliesOfFinalityBool; } } diff --git a/Buffs/Summon/MagicHatBuff.cs b/Buffs/Summon/MagicHatBuff.cs index c0533f5edd..5a51f5acf6 100644 --- a/Buffs/Summon/MagicHatBuff.cs +++ b/Buffs/Summon/MagicHatBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; -using CalamityMod.Projectiles.Summon.Umbrella; -using Terraria; +using CalamityMod.Projectiles.Summon.Umbrella; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class MagicHatBuff : ModBuff + public class MagicHatBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.magicHat = true; - } - if (!modPlayer.magicHat) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.magicHat; } } diff --git a/Buffs/Summon/Mechworm.cs b/Buffs/Summon/Mechworm.cs index 8bfb0258da..56abef6ff2 100644 --- a/Buffs/Summon/Mechworm.cs +++ b/Buffs/Summon/Mechworm.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class Mechworm : ModBuff + public class Mechworm : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.mWorm = true; - } - if (!modPlayer.mWorm) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.mWorm; } } diff --git a/Buffs/Summon/MidnightSunBuff.cs b/Buffs/Summon/MidnightSunBuff.cs index 60b6001716..bf240c6dca 100644 --- a/Buffs/Summon/MidnightSunBuff.cs +++ b/Buffs/Summon/MidnightSunBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class MidnightSunBuff : ModBuff + public class MidnightSunBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.midnightUFO = true; - } - if (!modPlayer.midnightUFO) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.midnightUFO; } } diff --git a/Buffs/Summon/MiniPlaguebringerBuff.cs b/Buffs/Summon/MiniPlaguebringerBuff.cs index 2e983f4e9c..6a392f2b2b 100644 --- a/Buffs/Summon/MiniPlaguebringerBuff.cs +++ b/Buffs/Summon/MiniPlaguebringerBuff.cs @@ -1,34 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class MiniPlaguebringerBuff : ModBuff + public class MiniPlaguebringerBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.plaguebringerMK2 = true; - } - if (!modPlayer.plaguebringerMK2) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.plaguebringerMK2; } } diff --git a/Buffs/Summon/MiniatureEyeofCthulhu.cs b/Buffs/Summon/MiniatureEyeofCthulhu.cs index 26b7572d75..4a734fa477 100644 --- a/Buffs/Summon/MiniatureEyeofCthulhu.cs +++ b/Buffs/Summon/MiniatureEyeofCthulhu.cs @@ -1,34 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class MiniatureEyeofCthulhu : ModBuff + public class MiniatureEyeofCthulhu : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.deathstareEyeball = true; - } - if (!modPlayer.deathstareEyeball) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.deathstareEyeball; } } diff --git a/Buffs/Summon/MoonFistBuff.cs b/Buffs/Summon/MoonFistBuff.cs index 0b3203fd67..40a2b47adf 100644 --- a/Buffs/Summon/MoonFistBuff.cs +++ b/Buffs/Summon/MoonFistBuff.cs @@ -1,32 +1,12 @@ -using CalamityMod.CalPlayer; -using CalamityMod.Projectiles.DraedonsArsenal; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class MoonFistBuff : ModBuff + public class MoonFistBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - modPlayer.MoonFist = true; - - if (!modPlayer.MoonFist) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - player.buffTime[buffIndex] = 18000; - } + protected override ref bool MinionBool => ref BuffModdedOwner.MoonFist; } } diff --git a/Buffs/Summon/MountedScannerBuff.cs b/Buffs/Summon/MountedScannerBuff.cs index 9331a145d5..d19c356926 100644 --- a/Buffs/Summon/MountedScannerBuff.cs +++ b/Buffs/Summon/MountedScannerBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; -using CalamityMod.Projectiles.DraedonsArsenal; -using Terraria; +using CalamityMod.Projectiles.DraedonsArsenal; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class MountedScannerBuff : ModBuff + public class MountedScannerBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.mountedScanner = true; - } - if (!modPlayer.mountedScanner) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.mountedScanner; } } diff --git a/Buffs/Summon/MutatedTruffleBuff.cs b/Buffs/Summon/MutatedTruffleBuff.cs index 29d7821362..5cd530461c 100644 --- a/Buffs/Summon/MutatedTruffleBuff.cs +++ b/Buffs/Summon/MutatedTruffleBuff.cs @@ -1,36 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - [LegacyName("MiniOldDukeBuff")] - public class MutatedTruffleBuff : ModBuff + public class MutatedTruffleBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.MutatedTruffleBool = true; - } - if (!modPlayer.MutatedTruffleBool) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.MutatedTruffleBool; } } diff --git a/Buffs/Summon/PerditionBuff.cs b/Buffs/Summon/PerditionBuff.cs index adbde7de97..76e7264e60 100644 --- a/Buffs/Summon/PerditionBuff.cs +++ b/Buffs/Summon/PerditionBuff.cs @@ -1,34 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class PerditionBuff : ModBuff + public class PerditionBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - modPlayer.perditionBeacon = true; - - if (!modPlayer.perditionBeacon) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.perditionBeacon; } } diff --git a/Buffs/Summon/Phantom.cs b/Buffs/Summon/Phantom.cs index 3c81ee95a1..5d982724ee 100644 --- a/Buffs/Summon/Phantom.cs +++ b/Buffs/Summon/Phantom.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class Phantom : ModBuff + public class Phantom : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.pGuy = true; - } - if (!modPlayer.pGuy) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.pGuy; } } diff --git a/Buffs/Summon/PlantationStaffBuff.cs b/Buffs/Summon/PlantationStaffBuff.cs index 9e64b840e2..6e19a8e54e 100644 --- a/Buffs/Summon/PlantationStaffBuff.cs +++ b/Buffs/Summon/PlantationStaffBuff.cs @@ -1,36 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - [LegacyName("PlantationBuff")] - public class PlantationStaffBuff : ModBuff + public class PlantationStaffBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.PlantationSummon = true; - } - if (!modPlayer.PlantationSummon) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.PlantationSummon; } } diff --git a/Buffs/Summon/PoleWarperBuff.cs b/Buffs/Summon/PoleWarperBuff.cs index 476d028e59..cc5361b6c8 100644 --- a/Buffs/Summon/PoleWarperBuff.cs +++ b/Buffs/Summon/PoleWarperBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; -using CalamityMod.Projectiles.DraedonsArsenal; -using Terraria; +using CalamityMod.Projectiles.DraedonsArsenal; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class PoleWarperBuff : ModBuff + public class PoleWarperBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.poleWarper = true; - } - if (!modPlayer.poleWarper) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.poleWarper; } } diff --git a/Buffs/Summon/PuffWarriorBuff.cs b/Buffs/Summon/PuffWarriorBuff.cs index 9636a62808..8890252448 100644 --- a/Buffs/Summon/PuffWarriorBuff.cs +++ b/Buffs/Summon/PuffWarriorBuff.cs @@ -1,31 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class PuffWarriorBuff : ModBuff + public class PuffWarriorBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - modPlayer.puffWarrior = true; - - if (modPlayer.puffWarrior) - player.buffTime[buffIndex] = 18000; - else - { - player.DelBuff(buffIndex); - buffIndex--; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.puffWarrior; } } diff --git a/Buffs/Summon/ResurrectionButterflyBuff.cs b/Buffs/Summon/ResurrectionButterflyBuff.cs index 96a073b840..2642c412fc 100644 --- a/Buffs/Summon/ResurrectionButterflyBuff.cs +++ b/Buffs/Summon/ResurrectionButterflyBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class ResurrectionButterflyBuff : ModBuff + public class ResurrectionButterflyBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0 || player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.resButterfly = true; - } - if (!modPlayer.resButterfly) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.resButterfly; } } diff --git a/Buffs/Summon/SageSpiritBuff.cs b/Buffs/Summon/SageSpiritBuff.cs index d015b77085..878496cc6a 100644 --- a/Buffs/Summon/SageSpiritBuff.cs +++ b/Buffs/Summon/SageSpiritBuff.cs @@ -1,32 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class SageSpiritBuff : ModBuff + public class SageSpiritBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - modPlayer.sageSpirit = true; - - if (modPlayer.sageSpirit) - player.buffTime[buffIndex] = 18000; - else - { - player.DelBuff(buffIndex); - buffIndex--; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.sageSpirit; } } diff --git a/Buffs/Summon/Sandnado.cs b/Buffs/Summon/Sandnado.cs index 1d9377bc51..17cec419b3 100644 --- a/Buffs/Summon/Sandnado.cs +++ b/Buffs/Summon/Sandnado.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class Sandnado : ModBuff + public class Sandnado : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.sandnado = true; - } - if (!modPlayer.sandnado) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.sandnado; } } diff --git a/Buffs/Summon/SandyHealingWaifu.cs b/Buffs/Summon/SandyHealingWaifu.cs index 810741be2a..9d57de49d4 100644 --- a/Buffs/Summon/SandyHealingWaifu.cs +++ b/Buffs/Summon/SandyHealingWaifu.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class SandyHealingWaifu : ModBuff + public class SandyHealingWaifu : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.dWaifu = true; - } - if (!modPlayer.dWaifu) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.dWaifu; } } diff --git a/Buffs/Summon/SandyWaifu.cs b/Buffs/Summon/SandyWaifu.cs index 6fd6d1e31c..383abea36f 100644 --- a/Buffs/Summon/SandyWaifu.cs +++ b/Buffs/Summon/SandyWaifu.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class SandyWaifu : ModBuff + public class SandyWaifu : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.sWaifu = true; - } - if (!modPlayer.sWaifu) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.sWaifu; } } diff --git a/Buffs/Summon/SarosPossessionBuff.cs b/Buffs/Summon/SarosPossessionBuff.cs index f61ba0bcb5..74791c651f 100644 --- a/Buffs/Summon/SarosPossessionBuff.cs +++ b/Buffs/Summon/SarosPossessionBuff.cs @@ -1,30 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class SarosPossessionBuff : ModBuff + public class SarosPossessionBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - modPlayer.saros = true; - if (!modPlayer.saros) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - player.buffTime[buffIndex] = 18000; - } + protected override ref bool MinionBool => ref BuffModdedOwner.saros; } } diff --git a/Buffs/Summon/SeaSnailBuff.cs b/Buffs/Summon/SeaSnailBuff.cs index 0068dd0252..da471bc5ad 100644 --- a/Buffs/Summon/SeaSnailBuff.cs +++ b/Buffs/Summon/SeaSnailBuff.cs @@ -1,37 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class SeaSnailBuff : ModBuff + public class SeaSnailBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - - - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.victideSnail = true; - } - - if (!modPlayer.victideSnail) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.victideSnail; } } diff --git a/Buffs/Summon/SepulcherMinionBuff.cs b/Buffs/Summon/SepulcherMinionBuff.cs index 3e96b328fa..c86abb9f8a 100644 --- a/Buffs/Summon/SepulcherMinionBuff.cs +++ b/Buffs/Summon/SepulcherMinionBuff.cs @@ -1,33 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class SepulcherMinionBuff : ModBuff + public class SepulcherMinionBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - modPlayer.sepulcher = true; - - if (!modPlayer.sepulcher) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.sepulcher; } } diff --git a/Buffs/Summon/ShellfishBuff.cs b/Buffs/Summon/ShellfishBuff.cs index 816d6898ec..21f0239407 100644 --- a/Buffs/Summon/ShellfishBuff.cs +++ b/Buffs/Summon/ShellfishBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class ShellfishBuff : ModBuff + public class ShellfishBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.shellfish = true; - } - if (!modPlayer.shellfish) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.shellfish; } } diff --git a/Buffs/Summon/SilvaCrystalBuff.cs b/Buffs/Summon/SilvaCrystalBuff.cs index 4479924b97..b14e48e499 100644 --- a/Buffs/Summon/SilvaCrystalBuff.cs +++ b/Buffs/Summon/SilvaCrystalBuff.cs @@ -1,34 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class SilvaCrystalBuff : ModBuff + public class SilvaCrystalBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.sCrystal = true; - } - if (!modPlayer.sCrystal) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.sCrystal; } } diff --git a/Buffs/Summon/SiriusBuff.cs b/Buffs/Summon/SiriusBuff.cs index 8f4ebc9d7f..565ab99d06 100644 --- a/Buffs/Summon/SiriusBuff.cs +++ b/Buffs/Summon/SiriusBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class SiriusBuff : ModBuff + public class SiriusBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.sirius = true; - } - if (!modPlayer.sirius) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.sirius; } } diff --git a/Buffs/Summon/SkeletalDragonsBuff.cs b/Buffs/Summon/SkeletalDragonsBuff.cs index 36b2bd44d2..780d050c64 100644 --- a/Buffs/Summon/SkeletalDragonsBuff.cs +++ b/Buffs/Summon/SkeletalDragonsBuff.cs @@ -1,34 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class SkeletalDragonsBuff : ModBuff + public class SkeletalDragonsBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.dragonFamily = true; - } - if (!modPlayer.dragonFamily) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.dragonFamily; } } diff --git a/Buffs/Summon/SmallSkeletonBuff.cs b/Buffs/Summon/SmallSkeletonBuff.cs index 8c743ac30a..4c10193d9b 100644 --- a/Buffs/Summon/SmallSkeletonBuff.cs +++ b/Buffs/Summon/SmallSkeletonBuff.cs @@ -1,34 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class SmallSkeletonBuff : ModBuff + public class SmallSkeletonBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.necrosteocytesDudes = true; - } - if (!modPlayer.necrosteocytesDudes) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.necrosteocytesDudes; } } diff --git a/Buffs/Summon/SnakeEyesBuff.cs b/Buffs/Summon/SnakeEyesBuff.cs index ed4c1729cd..f1486caacd 100644 --- a/Buffs/Summon/SnakeEyesBuff.cs +++ b/Buffs/Summon/SnakeEyesBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; -using CalamityMod.Projectiles.DraedonsArsenal; -using Terraria; +using CalamityMod.Projectiles.DraedonsArsenal; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class SnakeEyesBuff : ModBuff + public class SnakeEyesBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.snakeEyes = true; - } - if (!modPlayer.snakeEyes) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.snakeEyes; } } diff --git a/Buffs/Summon/SolarGodSpiritBuff.cs b/Buffs/Summon/SolarGodSpiritBuff.cs index f085c6f8f5..1a35780269 100644 --- a/Buffs/Summon/SolarGodSpiritBuff.cs +++ b/Buffs/Summon/SolarGodSpiritBuff.cs @@ -1,34 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class SolarGodSpiritBuff : ModBuff + public class SolarGodSpiritBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.SPG = true; - } - if (!modPlayer.SPG) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.SPG; } } diff --git a/Buffs/Summon/SolarSpirit.cs b/Buffs/Summon/SolarSpirit.cs index c7f813a3eb..1deef86122 100644 --- a/Buffs/Summon/SolarSpirit.cs +++ b/Buffs/Summon/SolarSpirit.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class SolarSpirit : ModBuff + public class SolarSpirit : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.SP = true; - } - if (!modPlayer.SP) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.SP; } } diff --git a/Buffs/Summon/SoulSeekerBuff.cs b/Buffs/Summon/SoulSeekerBuff.cs index b4ffd374ba..92966b7398 100644 --- a/Buffs/Summon/SoulSeekerBuff.cs +++ b/Buffs/Summon/SoulSeekerBuff.cs @@ -1,33 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class SoulSeekerBuff : ModBuff + public class SoulSeekerBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - modPlayer.soulSeeker = true; - - if (!modPlayer.soulSeeker) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.soulSeeker; } } diff --git a/Buffs/Summon/StarSwallowerBuff.cs b/Buffs/Summon/StarSwallowerBuff.cs index dc4183712e..63d8e3765b 100644 --- a/Buffs/Summon/StarSwallowerBuff.cs +++ b/Buffs/Summon/StarSwallowerBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; -using CalamityMod.Projectiles.DraedonsArsenal; -using Terraria; +using CalamityMod.Projectiles.DraedonsArsenal; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class StarSwallowerBuff : ModBuff + public class StarSwallowerBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.starSwallowerPetFroge = true; - } - if (!modPlayer.starSwallowerPetFroge) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.starSwallowerPetFroge; } } diff --git a/Buffs/Summon/StellarTorusBuff.cs b/Buffs/Summon/StellarTorusBuff.cs index 76014bda39..41b25ab6b9 100644 --- a/Buffs/Summon/StellarTorusBuff.cs +++ b/Buffs/Summon/StellarTorusBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class StellarTorusBuff : ModBuff + public class StellarTorusBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.StellarTorus = true; - } - if (!modPlayer.StellarTorus) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.StellarTorus; } } diff --git a/Buffs/Summon/TacticalPlagueEngineBuff.cs b/Buffs/Summon/TacticalPlagueEngineBuff.cs index f4f6c8c00e..f1cccfd0e7 100644 --- a/Buffs/Summon/TacticalPlagueEngineBuff.cs +++ b/Buffs/Summon/TacticalPlagueEngineBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class TacticalPlagueEngineBuff : ModBuff + public class TacticalPlagueEngineBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.plagueEngine = true; - } - if (!modPlayer.plagueEngine) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.plagueEngine; } } diff --git a/Buffs/Summon/TundraFlameBlossomsBuff.cs b/Buffs/Summon/TundraFlameBlossomsBuff.cs index d9494c1f34..6758b79bb5 100644 --- a/Buffs/Summon/TundraFlameBlossomsBuff.cs +++ b/Buffs/Summon/TundraFlameBlossomsBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class TundraFlameBlossomsBuff : ModBuff + public class TundraFlameBlossomsBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.tundraFlameBlossom = true; - } - if (!modPlayer.tundraFlameBlossom) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.tundraFlameBlossom; } } diff --git a/Buffs/Summon/ValkyrieBuff.cs b/Buffs/Summon/ValkyrieBuff.cs index 374e2750e1..8f40f8cd7f 100644 --- a/Buffs/Summon/ValkyrieBuff.cs +++ b/Buffs/Summon/ValkyrieBuff.cs @@ -1,34 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class ValkyrieBuff : ModBuff + public class ValkyrieBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.aValkyrie = true; - } - if (!modPlayer.aValkyrie) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.aValkyrie; } } diff --git a/Buffs/Summon/VileFeederBuff.cs b/Buffs/Summon/VileFeederBuff.cs index abfd558b11..8620989cde 100644 --- a/Buffs/Summon/VileFeederBuff.cs +++ b/Buffs/Summon/VileFeederBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class VileFeederBuff : ModBuff + public class VileFeederBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.vileFeeder = true; - } - if (!modPlayer.vileFeeder) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.vileFeeder; } } diff --git a/Buffs/Summon/ViridVanguardBuff.cs b/Buffs/Summon/ViridVanguardBuff.cs index 8e26caefc8..51ea3391d7 100644 --- a/Buffs/Summon/ViridVanguardBuff.cs +++ b/Buffs/Summon/ViridVanguardBuff.cs @@ -1,34 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class ViridVanguardBuff : ModBuff + public class ViridVanguardBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.ViridVanguard = true; - } - if (!modPlayer.ViridVanguard) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.ViridVanguard; } } diff --git a/Buffs/Summon/ViriliBuff.cs b/Buffs/Summon/ViriliBuff.cs index 62b871cbff..58d382b1c6 100644 --- a/Buffs/Summon/ViriliBuff.cs +++ b/Buffs/Summon/ViriliBuff.cs @@ -1,34 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class ViriliBuff : ModBuff + public class ViriliBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.virili = true; - } - if (!modPlayer.virili) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.virili; } } diff --git a/Buffs/Summon/WaterWaifu.cs b/Buffs/Summon/WaterWaifu.cs index 49a08c65cd..413f5de434 100644 --- a/Buffs/Summon/WaterWaifu.cs +++ b/Buffs/Summon/WaterWaifu.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class WaterWaifu : ModBuff + public class WaterWaifu : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.slWaifu = true; - } - if (!modPlayer.slWaifu) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.slWaifu; } } diff --git a/Buffs/Summon/WitherBlossomsBuff.cs b/Buffs/Summon/WitherBlossomsBuff.cs index 297bb0468a..af59819366 100644 --- a/Buffs/Summon/WitherBlossomsBuff.cs +++ b/Buffs/Summon/WitherBlossomsBuff.cs @@ -1,33 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class WitherBlossomsBuff : ModBuff + public class WitherBlossomsBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - modPlayer.witherBlossom = true; - - if (!modPlayer.witherBlossom) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.witherBlossom; } } diff --git a/Buffs/Summon/WulfrumDroidBuff.cs b/Buffs/Summon/WulfrumDroidBuff.cs index feb60ab4a4..6f4cc17b5c 100644 --- a/Buffs/Summon/WulfrumDroidBuff.cs +++ b/Buffs/Summon/WulfrumDroidBuff.cs @@ -1,35 +1,12 @@ -using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Summon; -using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class WulfrumDroidBuff : ModBuff + public class WulfrumDroidBuff : BaseSummonBuff { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } + protected override int MinionProjectileType => ModContent.ProjectileType(); - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.wDroid = true; - } - if (!modPlayer.wDroid) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } + protected override ref bool MinionBool => ref BuffModdedOwner.wDroid; } }