diff --git a/Items/Accessories/TheSponge.cs b/Items/Accessories/TheSponge.cs index 99a96e5c64..d6d5e03a1f 100644 --- a/Items/Accessories/TheSponge.cs +++ b/Items/Accessories/TheSponge.cs @@ -33,9 +33,9 @@ namespace CalamityMod.Items.Accessories public static int ShieldRechargeDelay = CalamityUtils.SecondsToFrames(9); // was 6 public static int TotalShieldRechargeTime = CalamityUtils.SecondsToFrames(6); - // While active, The Sponge gives 30 defense and 30% DR + // While active, The Sponge gives 30 defense and 10% DR public static int ShieldActiveDefense = 30; - public static float ShieldActiveDamageReduction = 0.3f; + public static float ShieldActiveDamageReduction = 0.1f; public override void SetStaticDefaults() diff --git a/Items/CalamityGlobalItemTweaks.cs b/Items/CalamityGlobalItemTweaks.cs index 86967f443a..847c08c62b 100644 --- a/Items/CalamityGlobalItemTweaks.cs +++ b/Items/CalamityGlobalItemTweaks.cs @@ -189,6 +189,7 @@ namespace CalamityMod.Items { ItemID.RedRyder, Do(PointBlank, DamageExact(24)) }, { ItemID.RocketIII, Do(DamageRatio(0.75f)) }, { ItemID.RocketIV, Do(DamageRatio(0.75f)) }, + { ItemID.Sandgun, Do(PointBlank, DamageExact(22), UseExact(20)) }, { ItemID.SapphireStaff, Do(DamageExact(25)) }, { ItemID.Seedler, Do(UseMeleeSpeed, DamageRatio(1.5f)) }, { ItemID.ShadowbeamStaff, Do(DamageExact(100)) }, @@ -431,7 +432,6 @@ namespace CalamityMod.Items { ItemID.QuadBarrelShotgun, pointBlank }, { ItemID.Revolver, Do(PointBlank, AutoReuse) }, { ItemID.RichMahoganyBow, pointBlank }, - { ItemID.Sandgun, pointBlank }, { ItemID.SDMG, pointBlank }, { ItemID.ShadewoodBow, pointBlank }, { ItemID.SilverBow, pointBlank }, diff --git a/Items/TreasureBags/PerforatorBag.cs b/Items/TreasureBags/PerforatorBag.cs index d7441cbec8..e227cb4e02 100644 --- a/Items/TreasureBags/PerforatorBag.cs +++ b/Items/TreasureBags/PerforatorBag.cs @@ -74,7 +74,7 @@ namespace CalamityMod.Items.TreasureBags ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), + ModContent.ItemType(), new WeightedItemStack(ModContent.ItemType(), 1f, 50, 75), })); diff --git a/Items/Weapons/Magic/CarnageRay.cs b/Items/Weapons/Magic/CarnageRay.cs deleted file mode 100644 index 5715458b8d..0000000000 --- a/Items/Weapons/Magic/CarnageRay.cs +++ /dev/null @@ -1,50 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Magic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Magic -{ - public class CarnageRay : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Weapons.Magic"; - public override void SetStaticDefaults() - { - Item.staff[Item.type] = true; - } - - public override void SetDefaults() - { - Item.damage = 24; - Item.DamageType = DamageClass.Magic; - Item.mana = 10; - Item.width = 44; - Item.height = 46; - Item.useTime = 20; - Item.useAnimation = 20; - Item.useStyle = ItemUseStyleID.Shoot; - Item.noMelee = true; - Item.knockBack = 3.25f; - Item.value = CalamityGlobalItem.Rarity4BuyPrice; - Item.rare = ItemRarityID.LightRed; - Item.UseSound = SoundID.Item72; - Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 6f; - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(ItemID.CrimsonRod). - AddIngredient(ItemID.MagicMissile). - AddIngredient(ItemID.WandofSparking). - AddIngredient(ItemID.AmberStaff). - AddIngredient(10). - AddTile(TileID.DemonAltar). - Register(); - } - } -} diff --git a/Items/Weapons/Magic/TerraRay.cs b/Items/Weapons/Magic/TerraRay.cs index 3101d05973..0250a56571 100644 --- a/Items/Weapons/Magic/TerraRay.cs +++ b/Items/Weapons/Magic/TerraRay.cs @@ -52,12 +52,6 @@ namespace CalamityMod.Items.Weapons.Magic AddIngredient(12). AddTile(TileID.MythrilAnvil). Register(); - CreateRecipe(). - AddIngredient(). - AddIngredient(). - AddIngredient(12). - AddTile(TileID.MythrilAnvil). - Register(); } } } diff --git a/Items/Weapons/Summon/BloodClotStaff.cs b/Items/Weapons/Summon/BloodClotStaff.cs deleted file mode 100644 index 0636ef149b..0000000000 --- a/Items/Weapons/Summon/BloodClotStaff.cs +++ /dev/null @@ -1,57 +0,0 @@ -using Terraria.DataStructures; -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Summon; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Summon -{ - public class BloodClotStaff : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Weapons.Summon"; - public override void SetDefaults() - { - Item.damage = 9; - Item.mana = 10; - Item.width = 58; - Item.height = 64; - Item.useTime = Item.useAnimation = 30; - Item.useStyle = ItemUseStyleID.Swing; - Item.noMelee = true; - Item.knockBack = 2.25f; - Item.value = CalamityGlobalItem.Rarity3BuyPrice; - Item.rare = ItemRarityID.Orange; - Item.UseSound = SoundID.Item44; - Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; - Item.DamageType = DamageClass.Summon; - } - - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - if (player.altFunctionUse != 2) - { - position = Main.MouseWorld; - velocity.X = 0; - velocity.Y = 0; - int p = Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; - } - return false; - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(ItemID.CrimtaneBar, 4). - AddIngredient(12). - AddIngredient(ItemID.Vertebrae, 4). - AddTile(TileID.DemonAltar). - Register(); - } - } -} diff --git a/Items/Weapons/Summon/BloodClotStaff.png b/Items/Weapons/Summon/BloodClotStaff.png deleted file mode 100644 index 8951c39fb4..0000000000 Binary files a/Items/Weapons/Summon/BloodClotStaff.png and /dev/null differ diff --git a/Items/Weapons/Summon/FleshOfInfidelity.cs b/Items/Weapons/Summon/FleshOfInfidelity.cs index 810bd22662..c4bb6b9df8 100644 --- a/Items/Weapons/Summon/FleshOfInfidelity.cs +++ b/Items/Weapons/Summon/FleshOfInfidelity.cs @@ -1,53 +1,48 @@ -using Terraria.ModLoader; -using Terraria.ID; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; +using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; -using Microsoft.Xna.Framework; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Summon { public class FleshOfInfidelity : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; + public override void SetDefaults() { Item.damage = 27; - Item.mana = 10; - Item.width = Item.height = 48; - Item.useTime = Item.useAnimation = 30; - Item.useStyle = ItemUseStyleID.Swing; - Item.noMelee = true; + Item.DamageType = DamageClass.Summon; + Item.shoot = ModContent.ProjectileType(); Item.knockBack = 1f; + + Item.useTime = Item.useAnimation = 10; + Item.mana = 10; + Item.width = 42; + Item.height = 42; + Item.noMelee = true; + Item.autoReuse = true; Item.value = CalamityGlobalItem.Rarity3BuyPrice; Item.rare = ItemRarityID.Orange; + Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.Zombie24; - Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; - Item.DamageType = DamageClass.Summon; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.altFunctionUse != 2) - { - int p = Projectile.NewProjectile(source, Main.MouseWorld, Vector2.UnitY * -1f, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; - } + Projectile.NewProjectile(source, Main.MouseWorld, Vector2.UnitY * -1f, type, damage, knockback, player.whoAmI); return false; } public override void AddRecipes() { CreateRecipe(). - AddIngredient(). - AddIngredient(). - AddIngredient(). - AddIngredient(ItemID.ImpStaff). - AddIngredient(10). + AddIngredient(ItemID.CrimtaneBar, 4). + AddIngredient(12). + AddIngredient(ItemID.Vertebrae, 4). AddTile(TileID.DemonAltar). Register(); } diff --git a/Localization/en-US/Mods.CalamityMod.Buffs.hjson b/Localization/en-US/Mods.CalamityMod.Buffs.hjson index c6c7386e63..9fc7656c46 100644 --- a/Localization/en-US/Mods.CalamityMod.Buffs.hjson +++ b/Localization/en-US/Mods.CalamityMod.Buffs.hjson @@ -988,12 +988,12 @@ WitherDebuff: { AbandonedSlimeBuff: { DisplayName: Astral Jelly - Description: The mini astrageldon slime will protect you + Description: Back from the heavens just to protect you! } AncientMineralSharkBuff: { DisplayName: Ancient Mineral Shark - Description: Ancient yet so dangerous + Description: So ancient yet just as powerful } AquaticStar: { @@ -1499,4 +1499,4 @@ AbsorberRegen: { AbsorberAffliction: { DisplayName: Absorber Affliction Description: Damn nature, you scary! -} \ No newline at end of file +} diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index 817e700068..bbe8188d87 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -1822,7 +1822,7 @@ TheSponge: { Tooltip: ''' Projects a quantum foam barrier that absorbs up to 180 damage - The barrier grants 30 defense and reduces damage taken by 30% while active + The barrier grants 30 defense and reduces damage taken by 10% while active The barrier starts recharging 9 seconds after being hit Recharging from zero to full charge takes 6 seconds Being hit again while recharging restarts the charge timer diff --git a/ModSupport/WeakReferenceSupport.cs b/ModSupport/WeakReferenceSupport.cs index 698a5be58f..9f327f595c 100644 --- a/ModSupport/WeakReferenceSupport.cs +++ b/ModSupport/WeakReferenceSupport.cs @@ -1086,7 +1086,6 @@ namespace CalamityMod RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); - RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); diff --git a/NPCs/CalamityGlobalTownNPC.cs b/NPCs/CalamityGlobalTownNPC.cs index 94969bc081..582042accb 100644 --- a/NPCs/CalamityGlobalTownNPC.cs +++ b/NPCs/CalamityGlobalTownNPC.cs @@ -24,7 +24,6 @@ using Terraria.GameContent; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; -using CalamityMod.Items.Placeables.Walls; using static Terraria.ModLoader.ModContent; namespace CalamityMod.NPCs @@ -324,18 +323,22 @@ namespace CalamityMod.NPCs // Annoyingly, because npc.GivenName is a property, it can't be passed as a ref parameter. private string ChooseName(ref bool alreadySet, string currentName, int numVanillaNames, string[] patreonNames, string[] globalNames) { - if (alreadySet || patreonNames is null || patreonNames.Length == 0) + if (alreadySet) { alreadySet = true; return currentName; } alreadySet = true; - int index = Main.rand.Next(numVanillaNames + patreonNames.Length + globalNames.Length); - + // PatreonNames can be null, so can global names, it short circuits in the next step if so + int combinedLength = (patreonNames?.Length ?? 0) + (globalNames?.Length ?? 0); + int index = Main.rand.Next(numVanillaNames + combinedLength); + // If the roll isn't low enough, then a "vanilla name" was picked, meaning we change nothing. - if (index >= patreonNames.Length + globalNames.Length) + if (index >= combinedLength) return currentName; + + // Change the name to be a randomly selected Patreon name if the roll is low enough. if (index >= globalNames.Length) return patreonNames[index - globalNames.Length]; @@ -378,22 +381,22 @@ namespace CalamityMod.NPCs switch (npc.townNpcVariationIndex) { case 0: - npc.GivenName = ChooseName(ref CalamityWorld.catName, npc.GivenName, TownDogLabradorVanillaNames, TownDogLabradorNames, TownDogNames); + npc.GivenName = ChooseName(ref CalamityWorld.dogName, npc.GivenName, TownDogLabradorVanillaNames, TownDogLabradorNames, TownDogNames); break; case 1: - npc.GivenName = ChooseName(ref CalamityWorld.catName, npc.GivenName, TownDogPitBullVanillaNames, TownDogPitBullNames, TownDogNames); + npc.GivenName = ChooseName(ref CalamityWorld.dogName, npc.GivenName, TownDogPitBullVanillaNames, TownDogPitBullNames, TownDogNames); break; case 2: - npc.GivenName = ChooseName(ref CalamityWorld.catName, npc.GivenName, TownDogBeagleVanillaNames, TownDogBeagleNames, TownDogNames); + npc.GivenName = ChooseName(ref CalamityWorld.dogName, npc.GivenName, TownDogBeagleVanillaNames, TownDogBeagleNames, TownDogNames); break; case 3: - npc.GivenName = ChooseName(ref CalamityWorld.catName, npc.GivenName, TownDogCorgiVanillaNames, TownDogCorgiNames, TownDogNames); + npc.GivenName = ChooseName(ref CalamityWorld.dogName, npc.GivenName, TownDogCorgiVanillaNames, TownDogCorgiNames, TownDogNames); break; case 4: - npc.GivenName = ChooseName(ref CalamityWorld.catName, npc.GivenName, TownDogDalmatianVanillaNames, TownDogDalmatianNames, TownDogNames); + npc.GivenName = ChooseName(ref CalamityWorld.dogName, npc.GivenName, TownDogDalmatianVanillaNames, TownDogDalmatianNames, TownDogNames); break; case 5: - npc.GivenName = ChooseName(ref CalamityWorld.catName, npc.GivenName, TownDogHuskyVanillaNames, TownDogHuskyNames, TownDogNames); + npc.GivenName = ChooseName(ref CalamityWorld.dogName, npc.GivenName, TownDogHuskyVanillaNames, TownDogHuskyNames, TownDogNames); break; default: break; @@ -403,22 +406,22 @@ namespace CalamityMod.NPCs switch (npc.townNpcVariationIndex) { case 0: - npc.GivenName = ChooseName(ref CalamityWorld.catName, npc.GivenName, TownBunnyWhiteVanillaNames, TownBunnyWhiteNames, TownBunnyNames); + npc.GivenName = ChooseName(ref CalamityWorld.bunnyName, npc.GivenName, TownBunnyWhiteVanillaNames, TownBunnyWhiteNames, TownBunnyNames); break; case 1: - npc.GivenName = ChooseName(ref CalamityWorld.catName, npc.GivenName, TownBunnyAngoraVanillaNames, TownBunnyAngoraNames, TownBunnyNames); + npc.GivenName = ChooseName(ref CalamityWorld.bunnyName, npc.GivenName, TownBunnyAngoraVanillaNames, TownBunnyAngoraNames, TownBunnyNames); break; case 2: - npc.GivenName = ChooseName(ref CalamityWorld.catName, npc.GivenName, TownBunnyDutchVanillaNames, TownBunnyDutchNames, TownBunnyNames); + npc.GivenName = ChooseName(ref CalamityWorld.bunnyName, npc.GivenName, TownBunnyDutchVanillaNames, TownBunnyDutchNames, TownBunnyNames); break; case 3: - npc.GivenName = ChooseName(ref CalamityWorld.catName, npc.GivenName, TownBunnyFlemishVanillaNames, TownBunnyFlemishNames, TownBunnyNames); + npc.GivenName = ChooseName(ref CalamityWorld.bunnyName, npc.GivenName, TownBunnyFlemishVanillaNames, TownBunnyFlemishNames, TownBunnyNames); break; case 4: - npc.GivenName = ChooseName(ref CalamityWorld.catName, npc.GivenName, TownBunnyLopVanillaNames, TownBunnyLopNames, TownBunnyNames); + npc.GivenName = ChooseName(ref CalamityWorld.bunnyName, npc.GivenName, TownBunnyLopVanillaNames, TownBunnyLopNames, TownBunnyNames); break; case 5: - npc.GivenName = ChooseName(ref CalamityWorld.catName, npc.GivenName, TownBunnySilverVanillaNames, TownBunnySilverNames, TownBunnyNames); + npc.GivenName = ChooseName(ref CalamityWorld.bunnyName, npc.GivenName, TownBunnySilverVanillaNames, TownBunnySilverNames, TownBunnyNames); break; default: break; @@ -530,7 +533,7 @@ namespace CalamityMod.NPCs break; // This function doesn't work with Town Pets currently - /*case NPCID.TownCat: + case NPCID.TownCat: AddNewNames(nameList, TownCatNames); switch (npc.townNpcVariationIndex) { @@ -607,7 +610,7 @@ namespace CalamityMod.NPCs default: break; } - break;*/ + break; default: break; diff --git a/NPCs/Perforator/PerforatorHive.cs b/NPCs/Perforator/PerforatorHive.cs index 33c7751f91..3ffbb331b2 100644 --- a/NPCs/Perforator/PerforatorHive.cs +++ b/NPCs/Perforator/PerforatorHive.cs @@ -549,7 +549,7 @@ namespace CalamityMod.NPCs.Perforator ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), + ModContent.ItemType(), new WeightedItemStack(ModContent.ItemType(), 1f, 30, 50), })); diff --git a/NPCs/VanillaNPCOverrides/Bosses/SkeletronAI.cs b/NPCs/VanillaNPCOverrides/Bosses/SkeletronAI.cs index 1d8caef8c7..271967206e 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/SkeletronAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/SkeletronAI.cs @@ -281,10 +281,10 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses float num158 = bossRush ? 10f : phase2 ? (60f - (death ? 30f * (1f - lifeRatio) : 0f)) : 75f; if (Main.getGoodWorld) num158 *= 0.8f; + num158 = (float)Math.Ceiling(num158); - if (Main.netMode != NetmodeID.MultiplayerClient && calamityGlobalNPC.newAI[1] >= num158) + if (Main.netMode != NetmodeID.MultiplayerClient && calamityGlobalNPC.newAI[1] % num158 == 0f && calamityGlobalNPC.newAI[1] > 45f) { - calamityGlobalNPC.newAI[1] = 0f; Vector2 vector18 = npc.Center; float num159 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector18.X; float num160 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector18.Y; @@ -292,8 +292,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (Collision.CanHit(vector18, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) { float num162 = phase2 ? (5f + (death ? 3f * (1f - lifeRatio) : 0f)) : 4f; - float num163 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector18.X + Main.rand.Next(-20, 21); - float num164 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector18.Y + Main.rand.Next(-20, 21); + float num163 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector18.X; + float num164 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector18.Y; float num165 = (float)Math.Sqrt(num163 * num163 + num164 * num164); num165 = num162 / num165; num163 *= num165; diff --git a/Projectiles/BaseProjectiles/BaseMinionProjectile.cs b/Projectiles/BaseProjectiles/BaseMinionProjectile.cs index dbc891df24..18752d5124 100644 --- a/Projectiles/BaseProjectiles/BaseMinionProjectile.cs +++ b/Projectiles/BaseProjectiles/BaseMinionProjectile.cs @@ -51,7 +51,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles /// Multiplied by so changing won't affect this.
/// Defaults to 10. /// - public int IFrames { get; set; } = 10; + public int IFrames { get => Projectile.localNPCHitCooldown / Projectile.MaxUpdates; set => Projectile.localNPCHitCooldown = value * Projectile.MaxUpdates; } /// /// If , makes the minion only be able to detect and attack enemies through tiles only when there are any bosses alive.
@@ -101,7 +101,6 @@ namespace CalamityMod.Projectiles.BaseProjectiles { Projectile.DamageType = DamageClass.Summon; Projectile.minionSlots = MinionSlots; - Projectile.localNPCHitCooldown = IFrames * Projectile.MaxUpdates; Projectile.penetrate = -1; Projectile.friendly = true; diff --git a/Projectiles/Summon/FleshBallMinion.cs b/Projectiles/Summon/FleshBallMinion.cs index bcef28f3bf..8997f26b4d 100644 --- a/Projectiles/Summon/FleshBallMinion.cs +++ b/Projectiles/Summon/FleshBallMinion.cs @@ -1,52 +1,43 @@ -using CalamityMod.Buffs.Summon; -using CalamityMod.CalPlayer; +using System; +using CalamityMod.Buffs.Summon; +using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; -using System; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Summon { - public class FleshBallMinion : ModProjectile, ILocalizedModType + public class FleshBallMinion : BaseMinionProjectile { - public new string LocalizationCategory => "Projectiles.Summon"; - public Player Owner => Main.player[Projectile.owner]; - public NPC Target => Owner.Center.MinionHoming(950f, Owner, CalamityPlayer.areThereAnyDamnBosses); - public bool SittingOnGround => Math.Abs(Projectile.velocity.X) < 1.55f && Projectile.velocity.Y == 0f; + public override int AssociatedProjectileTypeID => ModContent.ProjectileType(); + public override int AssociatedBuffTypeID => ModContent.BuffType(); + public override ref bool AssociatedMinionBool => ref ModdedOwner.fleshBall; + public override bool PreHardmodeMinionTileVision => true; + public ref float HopTimer => ref Projectile.ai[0]; public ref float HopAmount => ref Projectile.ai[1]; + public bool SittingOnGround => Math.Abs(Projectile.velocity.X) < 1.55f && Projectile.velocity.Y == 0f; public const float Gravity = 0.25f; public const float MaxFallSpeed = 12f; + public override void SetStaticDefaults() { - Main.projFrames[Projectile.type] = 6; - ProjectileID.Sets.MinionSacrificable[Projectile.type] = true; - ProjectileID.Sets.MinionTargettingFeature[Projectile.type] = true; + base.SetStaticDefaults(); + Main.projFrames[Type] = 6; } public override void SetDefaults() { + base.SetDefaults(); Projectile.width = 46; Projectile.height = 38; - Projectile.netImportant = true; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.minionSlots = 1f; - Projectile.timeLeft = 90000; - Projectile.penetrate = -1; Projectile.extraUpdates = 1; - Projectile.tileCollide = false; - Projectile.minion = true; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 60; - Projectile.DamageType = DamageClass.Summon; } - public override void AI() + public override void MinionAI() { - ProvidePlayerMinionBuffs(); - DetermineFrames(); GenerateVisuals(); HopTimer++; @@ -58,27 +49,7 @@ namespace CalamityMod.Projectiles.Summon EnforceGravity(); } - internal void ProvidePlayerMinionBuffs() - { - Owner.AddBuff(ModContent.BuffType(), 3600); - - // Verify player/minion state integrity. The minion cannot stay alive if the - // owner is dead or if the caller of the AI is invalid. - if (Projectile.type != ModContent.ProjectileType()) - return; - - if (Owner.dead) - Owner.Calamity().fleshBall = false; - if (Owner.Calamity().fleshBall) - Projectile.timeLeft = 2; - } - - internal void DetermineFrames() - { - Projectile.frameCounter++; - if (Projectile.frameCounter % 5 == 6) - Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Projectile.type]; - } + #region AI Methods internal void EnforceGravity() { @@ -152,6 +123,10 @@ namespace CalamityMod.Projectiles.Summon } } + #endregion + + public override void OnSpawn(IEntitySource source) => IFrames = 30; + // Prevent immediate death on tile collision, and slow down on tile collision. public override bool OnTileCollide(Vector2 oldVelocity) {