From 55f277aaa7eb9a0f0dee5dadad66ffb152a6b17e Mon Sep 17 00:00:00 2001 From: Altixal <73398287+Altixal@users.noreply.github.com> Date: Mon, 18 Aug 2025 22:43:32 +0700 Subject: [PATCH] minion cleanup part 1 --- Items/Weapons/Summon/AbandonedSlimeStaff.cs | 18 ++---- Items/Weapons/Summon/AncientIceChunk.cs | 8 ++- Items/Weapons/Summon/BelladonnaSpiritStaff.cs | 10 +-- Items/Weapons/Summon/BlackHawkRemote.cs | 16 ++--- Items/Weapons/Summon/BrittleStarStaff.cs | 12 ++-- Items/Weapons/Summon/CalamarisLament.cs | 6 +- Items/Weapons/Summon/CausticStaff.cs | 14 ++-- Items/Weapons/Summon/CinderBlossomStaff.cs | 10 +-- Items/Weapons/Summon/CorroslimeStaff.cs | 16 ++--- Items/Weapons/Summon/CorvidHarbringerStaff.cs | 14 ++-- Items/Weapons/Summon/CosmicImmaterializer.cs | 11 ++-- Items/Weapons/Summon/CosmicViperEngine.cs | 26 ++++---- Items/Weapons/Summon/Cosmilamp.cs | 31 ++++----- Items/Weapons/Summon/CrimslimeStaff.cs | 16 ++--- Items/Weapons/Summon/DaedalusGolemStaff.cs | 15 ++--- Items/Weapons/Summon/DankStaff.cs | 17 ++--- Items/Weapons/Summon/DazzlingStabberStaff.cs | 17 +++-- Items/Weapons/Summon/DeathstareRod.cs | 11 ++-- Items/Weapons/Summon/DeepseaStaff.cs | 15 ++--- Items/Weapons/Summon/DragonbloodDisgorger.cs | 11 ++-- Items/Weapons/Summon/EnchantedConch.cs | 8 ++- Items/Weapons/Summon/EndoHydraStaff.cs | 64 +++++++++---------- Items/Weapons/Summon/Endogenesis.cs | 27 ++++---- Items/Weapons/Summon/EntropysVigil.cs | 16 +++-- Items/Weapons/Summon/EtherealSubjugator.cs | 8 ++- Items/Weapons/Summon/EyeOfNight.cs | 14 ++-- Items/Weapons/Summon/FlarebatStaff.cs | 8 ++- Items/Weapons/Summon/FleshOfInfidelity.cs | 7 +- Items/Weapons/Summon/FlowersOfMortality.cs | 5 +- Items/Weapons/Summon/ForgottenApexWand.cs | 17 ++--- Items/Weapons/Summon/FrostBlossomStaff.cs | 11 ++-- Items/Weapons/Summon/FrostbatStaff.cs | 8 ++- Items/Weapons/Summon/GammaHeart.cs | 14 ++-- Items/Weapons/Summon/GastricBelcherStaff.cs | 36 ++--------- Items/Weapons/Summon/GlacialEmbrace.cs | 8 +-- Items/Weapons/Summon/HauntedScroll.cs | 19 ++---- Items/Weapons/Summon/HerringStaff.cs | 13 ++-- Items/Weapons/Summon/IgneousExaltation.cs | 19 +++--- Items/Weapons/Summon/InfectedRemote.cs | 15 ++--- .../Summon/KingofConstellationsTenryu.cs | 27 ++++---- Items/Weapons/Summon/LegionofCelestia.cs | 17 ++--- Items/Weapons/Summon/LiliesOfFinality.cs | 11 +++- Items/Weapons/Summon/Metastasis.cs | 11 ++-- Items/Weapons/Summon/MirrorofKalandra.cs | 11 ++-- Items/Weapons/Summon/MutatedTruffle.cs | 15 +++-- Items/Weapons/Summon/Perdition.cs | 23 +++---- Items/Weapons/Summon/PlantationStaff.cs | 8 ++- Items/Weapons/Summon/PuffShroom.cs | 14 ++-- Items/Weapons/Summon/ResurrectionButterfly.cs | 16 ++--- Items/Weapons/Summon/SandSharknadoStaff.cs | 13 ++-- Items/Weapons/Summon/SarosPossession.cs | 10 +-- Items/Weapons/Summon/ScabRipper.cs | 16 ++--- Items/Weapons/Summon/SeashineHilt.cs | 8 ++- Items/Weapons/Summon/ShellfishStaff.cs | 14 ++-- Items/Weapons/Summon/Sirius.cs | 10 +-- Items/Weapons/Summon/StaffOfNecrosteocytes.cs | 16 ++--- Items/Weapons/Summon/StaffoftheMechworm.cs | 4 +- Items/Weapons/Summon/StarspawnHelixStaff.cs | 31 ++++----- Items/Weapons/Summon/StellarTorusStaff.cs | 12 ++-- Items/Weapons/Summon/StormjawStaff.cs | 14 ++-- Items/Weapons/Summon/SunSpiritStaff.cs | 10 +-- Items/Weapons/Summon/TacticalPlagueEngine.cs | 13 ++-- Items/Weapons/Summon/TemporalUmbrella.cs | 11 ++-- .../Summon/TundraFlameBlossomsStaff.cs | 5 +- Items/Weapons/Summon/VengefulSunStaff.cs | 10 +-- Items/Weapons/Summon/Vigilance.cs | 20 +++--- Items/Weapons/Summon/VileFeeder.cs | 8 ++- Items/Weapons/Summon/ViralSprout.cs | 30 ++++----- Items/Weapons/Summon/ViridVanguard.cs | 32 ++++------ .../Weapons/Summon/VoidConcentrationStaff.cs | 9 ++- Items/Weapons/Summon/WarloksMoonFist.cs | 20 +++--- Items/Weapons/Summon/WitherBlossomsStaff.cs | 6 +- Items/Weapons/Summon/WulfrumController.cs | 15 ++--- Items/Weapons/Summon/YharonsKindleStaff.cs | 15 ++--- .../en-US/Mods.CalamityMod.Buffs.hjson | 20 +++--- 75 files changed, 541 insertions(+), 595 deletions(-) diff --git a/Items/Weapons/Summon/AbandonedSlimeStaff.cs b/Items/Weapons/Summon/AbandonedSlimeStaff.cs index f29d97c52a..45fe58a160 100644 --- a/Items/Weapons/Summon/AbandonedSlimeStaff.cs +++ b/Items/Weapons/Summon/AbandonedSlimeStaff.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Buffs.Summon; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -25,8 +26,8 @@ namespace CalamityMod.Items.Weapons.Summon Item.damage = 56; Item.knockBack = 3f; Item.useAnimation = Item.useTime = 20; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; @@ -48,21 +49,16 @@ namespace CalamityMod.Items.Weapons.Summon slimeSlots = (int)(player.maxMinions - minionCount); } - public override bool CanUseItem(Player player) - { - return slimeSlots >= 1; - } + public override bool CanUseItem(Player player) => slimeSlots >= 1; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { + player.AddBuff(Item.buffType, 2); CalamityUtils.KillShootProjectiles(true, type, player); float damageMult = ((float)Math.Log(slimeSlots, 8f)) + 1f; - position = player.ClampedMouseWorld(); - velocity.X = 0; - velocity.Y = 0; - int slime = Projectile.NewProjectile(source, position, velocity, type, (int)(damage * damageMult), knockback, player.whoAmI); - Main.projectile[slime].originalDamage = (int)(Item.damage * damageMult); - Main.projectile[slime].minionSlots = slimeSlots; + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, (int)(damage * damageMult), knockback, player.whoAmI); + minion.originalDamage = (int)(Item.damage * damageMult); + minion.minionSlots = slimeSlots; return false; } } diff --git a/Items/Weapons/Summon/AncientIceChunk.cs b/Items/Weapons/Summon/AncientIceChunk.cs index 00bfcf39ee..3e00d8eb98 100644 --- a/Items/Weapons/Summon/AncientIceChunk.cs +++ b/Items/Weapons/Summon/AncientIceChunk.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Buffs.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -35,6 +36,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 50; Item.damage = 25; Item.DamageType = DamageClass.Summon; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.knockBack = 2f; @@ -50,7 +52,9 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile.NewProjectile(source, player.ClampedMouseWorld(), Main.rand.NextVector2Circular(1f, 1f), type, damage, knockback, player.whoAmI); + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Main.rand.NextVector2Circular(1f, 1f), type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } } diff --git a/Items/Weapons/Summon/BelladonnaSpiritStaff.cs b/Items/Weapons/Summon/BelladonnaSpiritStaff.cs index 18143c9703..542ee216fd 100644 --- a/Items/Weapons/Summon/BelladonnaSpiritStaff.cs +++ b/Items/Weapons/Summon/BelladonnaSpiritStaff.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Buffs.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -32,6 +33,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.knockBack = 1f; Item.mana = 10; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.useAnimation = Item.useTime = 35; @@ -45,9 +47,9 @@ namespace CalamityMod.Items.Weapons.Summon } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int belladonna = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(belladonna)) - Main.projectile[belladonna].originalDamage = Item.damage; + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } public override void AddRecipes() diff --git a/Items/Weapons/Summon/BlackHawkRemote.cs b/Items/Weapons/Summon/BlackHawkRemote.cs index 330d2f3e95..aff29efd63 100644 --- a/Items/Weapons/Summon/BlackHawkRemote.cs +++ b/Items/Weapons/Summon/BlackHawkRemote.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Buffs.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -23,6 +24,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.UseSound = SoundID.Item15; //phaseblade sound effect Item.autoReuse = true; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 6f; // Affects bullet speed Item.DamageType = DamageClass.Summon; @@ -31,15 +33,9 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.altFunctionUse != 2) - { - if (player.whoAmI == Main.myPlayer) - { - int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 1f); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; - } - } + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 1f); + minion.originalDamage = Item.damage; return false; } } diff --git a/Items/Weapons/Summon/BrittleStarStaff.cs b/Items/Weapons/Summon/BrittleStarStaff.cs index 4e39fe3f72..b6c15f5dd2 100644 --- a/Items/Weapons/Summon/BrittleStarStaff.cs +++ b/Items/Weapons/Summon/BrittleStarStaff.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Typeless; @@ -30,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.rare = ItemRarityID.Green; Item.UseSound = SoundID.Item44 with { Pitch = 0.5f }; Item.autoReuse = true; - Item.shootSpeed = 5; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.DamageType = DamageClass.Summon; } @@ -45,12 +46,9 @@ namespace CalamityMod.Items.Weapons.Summon if (player.altFunctionUse != 2) { Item.noUseGraphic = false; - position = player.ClampedMouseWorld(); - velocity = Vector2.Zero; int SummonNumber = player.ownedProjectileCounts[type]; - int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0, 0, SummonNumber); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI, 0, 0, SummonNumber); + minion.originalDamage = Item.damage; } if (player.altFunctionUse == 2) { diff --git a/Items/Weapons/Summon/CalamarisLament.cs b/Items/Weapons/Summon/CalamarisLament.cs index 8123714305..8aefe8f92c 100644 --- a/Items/Weapons/Summon/CalamarisLament.cs +++ b/Items/Weapons/Summon/CalamarisLament.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using CalamityMod.Buffs.Summon; using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; using Microsoft.Xna.Framework; @@ -45,6 +46,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.mana = 10; Item.useAnimation = Item.useTime = 10; Item.knockBack = 0.25f; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 1f; // This does nothing, it's just here so it's able to act like a staff. @@ -59,7 +61,9 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile.NewProjectile(source, player.ClampedMouseWorld(), velocity, type, damage, knockback, player.whoAmI); + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), velocity, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } diff --git a/Items/Weapons/Summon/CausticStaff.cs b/Items/Weapons/Summon/CausticStaff.cs index 88a22bfafb..87a955b692 100644 --- a/Items/Weapons/Summon/CausticStaff.cs +++ b/Items/Weapons/Summon/CausticStaff.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Buffs.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -17,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.mana = 10; Item.damage = 15; Item.useStyle = ItemUseStyleID.Swing; - Item.shootSpeed = 10f; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.UseSound = SoundID.Item77; Item.useAnimation = Item.useTime = 25; @@ -34,12 +35,9 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.altFunctionUse != 2) - { - int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 1f); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; - } + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 1f); + minion.originalDamage = Item.damage; return false; } diff --git a/Items/Weapons/Summon/CinderBlossomStaff.cs b/Items/Weapons/Summon/CinderBlossomStaff.cs index f048621794..335309e1eb 100644 --- a/Items/Weapons/Summon/CinderBlossomStaff.cs +++ b/Items/Weapons/Summon/CinderBlossomStaff.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Buffs.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -17,6 +18,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.damage = 16; Item.knockBack = 2f; Item.mana = 10; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.useAnimation = Item.useTime = 30; @@ -32,10 +34,10 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { + player.AddBuff(Item.buffType, 2); CalamityUtils.KillShootProjectiles(true, type, player); - int p = Projectile.NewProjectile(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; + var minion = Projectile.NewProjectileDirect(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } diff --git a/Items/Weapons/Summon/CorroslimeStaff.cs b/Items/Weapons/Summon/CorroslimeStaff.cs index de17dde940..edd2f9d35f 100644 --- a/Items/Weapons/Summon/CorroslimeStaff.cs +++ b/Items/Weapons/Summon/CorroslimeStaff.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Buffs.Summon; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -29,22 +29,16 @@ namespace CalamityMod.Items.Weapons.Summon Item.rare = ItemRarityID.LightRed; Item.UseSound = SoundID.Item44; Item.autoReuse = true; + Item.buffType = ModContent.BuffType(); 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 = player.ClampedMouseWorld(); - velocity.X = 0; - velocity.Y = 0; - int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; - } + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } } diff --git a/Items/Weapons/Summon/CorvidHarbringerStaff.cs b/Items/Weapons/Summon/CorvidHarbringerStaff.cs index d7254633f4..0926ff4cc5 100644 --- a/Items/Weapons/Summon/CorvidHarbringerStaff.cs +++ b/Items/Weapons/Summon/CorvidHarbringerStaff.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -27,8 +28,8 @@ namespace CalamityMod.Items.Weapons.Summon Item.noMelee = true; Item.UseSound = SoundID.DD2_BetsyFlyingCircleAttack; Item.autoReuse = true; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 13f; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.rare = ModContent.RarityType(); @@ -36,12 +37,9 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.altFunctionUse != 2) - { - int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; - } + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } diff --git a/Items/Weapons/Summon/CosmicImmaterializer.cs b/Items/Weapons/Summon/CosmicImmaterializer.cs index 3209dce26f..2a311d9066 100644 --- a/Items/Weapons/Summon/CosmicImmaterializer.cs +++ b/Items/Weapons/Summon/CosmicImmaterializer.cs @@ -1,4 +1,5 @@ -using CalamityMod.CalPlayer; +using CalamityMod.Buffs.Summon; +using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; @@ -27,8 +28,8 @@ namespace CalamityMod.Items.Weapons.Summon Item.mana = 10; Item.useAnimation = Item.useTime = 10; Item.knockBack = 0.25f; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; Item.UseSound = SoundID.Item60; Item.useStyle = ItemUseStyleID.Swing; @@ -42,10 +43,10 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { + player.AddBuff(Item.buffType, 2); CalamityUtils.KillShootProjectiles(true, type, player); - int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } diff --git a/Items/Weapons/Summon/CosmicViperEngine.cs b/Items/Weapons/Summon/CosmicViperEngine.cs index b6a4bf8f37..21fc2f864d 100644 --- a/Items/Weapons/Summon/CosmicViperEngine.cs +++ b/Items/Weapons/Summon/CosmicViperEngine.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Buffs.Summon; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Ores; using CalamityMod.Projectiles.Summon; @@ -27,6 +28,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.knockBack = 6f; Item.UseSound = SoundID.Item15; //phaseblade sound effect Item.autoReuse = true; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; // Affects bullet speed Item.DamageType = DamageClass.Summon; @@ -37,20 +39,18 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.altFunctionUse != 2) - { - float speed = Item.shootSpeed; - Vector2 spawnPos = player.RotatedRelativePoint(player.MountedCenter, true); - float xPos = Main.screenPosition.X + Main.mouseX - spawnPos.X; - float yPos = Main.screenPosition.Y + (player.gravDir == -1 ? Main.screenHeight - Main.mouseY : Main.mouseY) - spawnPos.Y; - Vector2 vel = new Vector2(xPos, yPos).SafeNormalize(Vector2.UnitX * player.direction) * speed; + player.AddBuff(Item.buffType, 2); - spawnPos = player.ClampedMouseWorld(); - vel = vel.RotatedBy(MathHelper.PiOver2); - int p = Projectile.NewProjectile(source, spawnPos + vel, vel, type, damage, knockback, player.whoAmI, 0f, 1f); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; - } + float speed = Item.shootSpeed; + Vector2 spawnPos = player.RotatedRelativePoint(player.MountedCenter, true); + float xPos = Main.screenPosition.X + Main.mouseX - spawnPos.X; + float yPos = Main.screenPosition.Y + (player.gravDir == -1 ? Main.screenHeight - Main.mouseY : Main.mouseY) - spawnPos.Y; + Vector2 vel = new Vector2(xPos, yPos).SafeNormalize(Vector2.UnitX * player.direction) * speed; + + spawnPos = player.ClampedMouseWorld(); + vel = vel.RotatedBy(MathHelper.PiOver2); + var minion = Projectile.NewProjectileDirect(source, spawnPos + vel, vel, type, damage, knockback, player.whoAmI, 0f, 1f); + minion.originalDamage = Item.damage; return false; } diff --git a/Items/Weapons/Summon/Cosmilamp.cs b/Items/Weapons/Summon/Cosmilamp.cs index b4c43ed83f..3a6cd6413e 100644 --- a/Items/Weapons/Summon/Cosmilamp.cs +++ b/Items/Weapons/Summon/Cosmilamp.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Buffs.Summon; using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; using Microsoft.Xna.Framework; @@ -40,8 +41,8 @@ namespace CalamityMod.Items.Weapons.Summon Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item44; Item.autoReuse = true; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; } @@ -49,26 +50,22 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.altFunctionUse != 2) - { - // Reset the timer for all lamps, to re-align the formation. - foreach (Projectile pro in Main.ActiveProjectiles) - { - if (pro.type == type && pro.owner == player.whoAmI) - { - pro.ModProjectile().Timer = 0f; - pro.netUpdate = true; - } - } + player.AddBuff(Item.buffType, 2); - int existingLamps = player.ownedProjectileCounts[type]; - int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) + // Reset the timer for all lamps, to re-align the formation. + foreach (Projectile pro in Main.ActiveProjectiles) + { + if (pro.type == type && pro.owner == player.whoAmI) { - Main.projectile[p].originalDamage = Item.damage; - Main.projectile[p].ai[0] = existingLamps; + pro.ModProjectile().Timer = 0f; + pro.netUpdate = true; } } + + int existingLamps = player.ownedProjectileCounts[type]; + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; + minion.ai[0] = existingLamps; return false; } } diff --git a/Items/Weapons/Summon/CrimslimeStaff.cs b/Items/Weapons/Summon/CrimslimeStaff.cs index 3e7129a037..467eaf14e4 100644 --- a/Items/Weapons/Summon/CrimslimeStaff.cs +++ b/Items/Weapons/Summon/CrimslimeStaff.cs @@ -1,5 +1,5 @@ using CalamityMod.Items.Weapons.Ranged; -using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Buffs.Summon; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -30,22 +30,16 @@ namespace CalamityMod.Items.Weapons.Summon Item.rare = ItemRarityID.LightRed; Item.UseSound = SoundID.Item44; Item.autoReuse = true; + Item.buffType = ModContent.BuffType(); 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 = player.ClampedMouseWorld(); - velocity.X = 0; - velocity.Y = 0; - int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; - } + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } } diff --git a/Items/Weapons/Summon/DaedalusGolemStaff.cs b/Items/Weapons/Summon/DaedalusGolemStaff.cs index ec0b92d270..9f0761011b 100644 --- a/Items/Weapons/Summon/DaedalusGolemStaff.cs +++ b/Items/Weapons/Summon/DaedalusGolemStaff.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -11,10 +12,6 @@ namespace CalamityMod.Items.Weapons.Summon public class DaedalusGolemStaff : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; - public override void SetStaticDefaults() - { - // Funny Hollow Knight reference. - } public override void SetDefaults() { @@ -27,8 +24,8 @@ namespace CalamityMod.Items.Weapons.Summon Item.knockBack = 3f; Item.UseSound = SoundID.Item67; Item.autoReuse = true; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; Item.value = CalamityGlobalItem.RarityPinkBuyPrice; @@ -36,13 +33,13 @@ namespace CalamityMod.Items.Weapons.Summon } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { + player.AddBuff(Item.buffType, 2); Vector2 mouse = player.ClampedMouseWorld(); Point mouseTileCoords = mouse.ToTileCoordinates(); if (!CalamityUtils.ParanoidTileRetrieval(mouseTileCoords.X, mouseTileCoords.Y).IsTileSolidGround()) { - int p = Projectile.NewProjectile(source, mouse, Vector2.UnitY * 4f, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; + var minion = Projectile.NewProjectileDirect(source, mouse, Vector2.UnitY * 4f, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; } return false; } diff --git a/Items/Weapons/Summon/DankStaff.cs b/Items/Weapons/Summon/DankStaff.cs index d67006f38b..f996dae50c 100644 --- a/Items/Weapons/Summon/DankStaff.cs +++ b/Items/Weapons/Summon/DankStaff.cs @@ -1,5 +1,4 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Buffs.Summon; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; @@ -31,22 +30,16 @@ namespace CalamityMod.Items.Weapons.Summon Item.rare = ItemRarityID.Orange; Item.UseSound = SoundID.Item44; Item.autoReuse = true; + Item.buffType = ModContent.BuffType(); 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 = player.ClampedMouseWorld(); - velocity.X = 0; - velocity.Y = 0; - int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; - } + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } } diff --git a/Items/Weapons/Summon/DazzlingStabberStaff.cs b/Items/Weapons/Summon/DazzlingStabberStaff.cs index 93cff97797..b36a388f5b 100644 --- a/Items/Weapons/Summon/DazzlingStabberStaff.cs +++ b/Items/Weapons/Summon/DazzlingStabberStaff.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; using Microsoft.Xna.Framework; @@ -31,8 +32,8 @@ namespace CalamityMod.Items.Weapons.Summon Item.knockBack = 2f; Item.autoReuse = true; Item.useAnimation = Item.useTime = 15; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 13f; Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); @@ -43,14 +44,12 @@ namespace CalamityMod.Items.Weapons.Summon } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.altFunctionUse != 2) + player.AddBuff(Item.buffType, 2); + + for (int i = 0; i < 3; i++) { - for (int i = 0; i < 3; i++) - { - int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI, 0, 0, i + 1); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; - } + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI, 0, 0, i + 1); + minion.originalDamage = Item.damage; } float angleMax = MathHelper.ToRadians(360f); if (CalamityUtils.CountOwnedProjectiles(type, player.whoAmI) == 1) diff --git a/Items/Weapons/Summon/DeathstareRod.cs b/Items/Weapons/Summon/DeathstareRod.cs index 8bd0029774..0eaba9f552 100644 --- a/Items/Weapons/Summon/DeathstareRod.cs +++ b/Items/Weapons/Summon/DeathstareRod.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Buffs.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -22,17 +23,17 @@ namespace CalamityMod.Items.Weapons.Summon Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.UseSound = SoundID.NPCHit8; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { + player.AddBuff(Item.buffType, 2); CalamityUtils.KillShootProjectiles(true, type, player); - int p = Projectile.NewProjectile(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; + var minion = Projectile.NewProjectileDirect(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } } diff --git a/Items/Weapons/Summon/DeepseaStaff.cs b/Items/Weapons/Summon/DeepseaStaff.cs index 07c7018c5d..f65d3f9ae6 100644 --- a/Items/Weapons/Summon/DeepseaStaff.cs +++ b/Items/Weapons/Summon/DeepseaStaff.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -28,20 +29,16 @@ namespace CalamityMod.Items.Weapons.Summon Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item44; Item.autoReuse = true; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); 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 = player.ClampedMouseWorld(); - velocity = Vector2.Zero; - int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; - } + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } } diff --git a/Items/Weapons/Summon/DragonbloodDisgorger.cs b/Items/Weapons/Summon/DragonbloodDisgorger.cs index c27c8fb840..b2429d03fa 100644 --- a/Items/Weapons/Summon/DragonbloodDisgorger.cs +++ b/Items/Weapons/Summon/DragonbloodDisgorger.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; using Microsoft.Xna.Framework; @@ -28,16 +29,16 @@ namespace CalamityMod.Items.Weapons.Summon Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.DD2_SkeletonDeath; + Item.buffType = ModContent.BuffType(); 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) { - int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } diff --git a/Items/Weapons/Summon/EnchantedConch.cs b/Items/Weapons/Summon/EnchantedConch.cs index 768ffed01d..c5d5a015f9 100644 --- a/Items/Weapons/Summon/EnchantedConch.cs +++ b/Items/Weapons/Summon/EnchantedConch.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Buffs.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -18,6 +19,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 26; Item.damage = 20; Item.DamageType = DamageClass.Summon; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.knockBack = 2f; @@ -33,7 +35,9 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile.NewProjectile(source, player.ClampedMouseWorld(), Main.rand.NextVector2CircularEdge(5f, 5f), type, damage, knockback, player.whoAmI); + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Main.rand.NextVector2CircularEdge(5f, 5f), type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } } diff --git a/Items/Weapons/Summon/EndoHydraStaff.cs b/Items/Weapons/Summon/EndoHydraStaff.cs index ed6a24735a..2d28fe5010 100644 --- a/Items/Weapons/Summon/EndoHydraStaff.cs +++ b/Items/Weapons/Summon/EndoHydraStaff.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -27,8 +28,8 @@ namespace CalamityMod.Items.Weapons.Summon Item.noMelee = true; Item.UseSound = SoundID.Item60; Item.autoReuse = true; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.rare = ModContent.RarityType(); @@ -36,41 +37,38 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.altFunctionUse != 2) + player.AddBuff(Item.buffType, 2); + + bool bodyExists = false; + int bodyIndex = -1; + foreach (Projectile p in Main.ActiveProjectiles) { - bool bodyExists = false; - int bodyIndex = -1; - foreach (Projectile p in Main.ActiveProjectiles) + if (p.type == type && p.owner == player.whoAmI) { - if (p.type == type && p.owner == player.whoAmI) - { - bodyIndex = p.whoAmI; - bodyExists = true; - break; - } + bodyIndex = p.whoAmI; + bodyExists = true; + break; } - if (bodyExists) + } + if (bodyExists) + { + var head = Projectile.NewProjectileDirect(source, player.Center, Main.rand.NextVector2Unit(), ModContent.ProjectileType(), damage, knockback, player.whoAmI, bodyIndex); + head.originalDamage = Item.damage; + } + else + { + bodyIndex = Projectile.NewProjectile(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI); + if (Main.projectile.IndexInRange(bodyIndex)) + Main.projectile[bodyIndex].originalDamage = Item.damage; + var head = Projectile.NewProjectileDirect(source, player.Center, Main.rand.NextVector2Unit(), ModContent.ProjectileType(), damage, knockback, player.whoAmI, bodyIndex); + head.originalDamage = Item.damage; + for (int i = 0; i < 72; i++) { - int p = Projectile.NewProjectile(source, player.Center, Main.rand.NextVector2Unit(), ModContent.ProjectileType(), damage, knockback, player.whoAmI, bodyIndex); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; - } - else - { - bodyIndex = Projectile.NewProjectile(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI); - int head = Projectile.NewProjectile(source, player.Center, Main.rand.NextVector2Unit(), ModContent.ProjectileType(), damage, knockback, player.whoAmI, bodyIndex); - if (Main.projectile.IndexInRange(bodyIndex)) - Main.projectile[bodyIndex].originalDamage = Item.damage; - if (Main.projectile.IndexInRange(head)) - Main.projectile[head].originalDamage = Item.damage; - for (int i = 0; i < 72; i++) - { - Dust dust = Dust.NewDustPerfect(Main.projectile[bodyIndex].Center, 113); - dust.velocity = (MathHelper.TwoPi * Vector2.Dot((i / 72f * MathHelper.TwoPi).ToRotationVector2(), player.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(i / 72f * -MathHelper.TwoPi))).ToRotationVector2(); - dust.velocity = dust.velocity.RotatedBy(i / 36f * MathHelper.TwoPi) * 8f; - dust.noGravity = true; - dust.scale = 1.9f; - } + Dust dust = Dust.NewDustPerfect(Main.projectile[bodyIndex].Center, 113); + dust.velocity = (MathHelper.TwoPi * Vector2.Dot((i / 72f * MathHelper.TwoPi).ToRotationVector2(), player.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(i / 72f * -MathHelper.TwoPi))).ToRotationVector2(); + dust.velocity = dust.velocity.RotatedBy(i / 36f * MathHelper.TwoPi) * 8f; + dust.noGravity = true; + dust.scale = 1.9f; } } return false; diff --git a/Items/Weapons/Summon/Endogenesis.cs b/Items/Weapons/Summon/Endogenesis.cs index 97942a9175..a9a41e73d4 100644 --- a/Items/Weapons/Summon/Endogenesis.cs +++ b/Items/Weapons/Summon/Endogenesis.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -33,8 +34,8 @@ namespace CalamityMod.Items.Weapons.Summon Item.knockBack = 4f; Item.autoReuse = true; Item.useAnimation = Item.useTime = 10; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; Item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; Item.rare = ModContent.RarityType(); @@ -45,21 +46,19 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.altFunctionUse != 2) + CalamityUtils.KillShootProjectileMany(player, new int[] { - CalamityUtils.KillShootProjectileMany(player, new int[] - { - type, - ModContent.ProjectileType(), - ModContent.ProjectileType() - }); + type, + ModContent.ProjectileType(), + ModContent.ProjectileType() + }); - SummonEndoCooper(source, AttackMode, player.ClampedMouseWorld(), damage, Item.damage, knockback, player, out _, out _); + player.AddBuff(Item.buffType, 2); + SummonEndoCooper(source, AttackMode, player.ClampedMouseWorld(), damage, Item.damage, knockback, player, out _, out _); - AttackMode++; - if (AttackMode > 3) - AttackMode = 0; - } + AttackMode++; + if (AttackMode > 3) + AttackMode = 0; return false; } diff --git a/Items/Weapons/Summon/EntropysVigil.cs b/Items/Weapons/Summon/EntropysVigil.cs index 286efcaa94..6b74919eb6 100644 --- a/Items/Weapons/Summon/EntropysVigil.cs +++ b/Items/Weapons/Summon/EntropysVigil.cs @@ -1,5 +1,5 @@ -using CalamityMod.Items.Weapons.Melee; -using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Weapons.Melee; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -27,6 +27,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 52; Item.damage = 42; Item.DamageType = DamageClass.Summon; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.knockBack = 2f; @@ -45,6 +46,8 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { + player.AddBuff(Item.buffType, 2); + Vector2 mouse = player.ClampedMouseWorld(); float randomAngleOffset = Main.rand.NextFloat(MathHelper.TwoPi); for (int i = 0; i < 3; i++) @@ -55,15 +58,18 @@ namespace CalamityMod.Items.Weapons.Summon switch (i) { case 0: - Projectile.NewProjectile(source, mouse, spawnVelocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + type = ModContent.ProjectileType(); break; case 1: - Projectile.NewProjectile(source, mouse, spawnVelocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + type = ModContent.ProjectileType(); break; case 2: - Projectile.NewProjectile(source, mouse, spawnVelocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + type = ModContent.ProjectileType(); break; } + + var minion = Projectile.NewProjectileDirect(source, mouse, spawnVelocity, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; } return false; diff --git a/Items/Weapons/Summon/EtherealSubjugator.cs b/Items/Weapons/Summon/EtherealSubjugator.cs index 9edd09c593..66dbca0b57 100644 --- a/Items/Weapons/Summon/EtherealSubjugator.cs +++ b/Items/Weapons/Summon/EtherealSubjugator.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; using Microsoft.Xna.Framework; @@ -23,6 +24,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 70; Item.damage = 200; Item.DamageType = DamageClass.Summon; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.knockBack = 1f; @@ -42,7 +44,9 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile.NewProjectile(source, player.ClampedMouseWorld(), Main.rand.NextVector2CircularEdge(5f, 5f), type, damage, knockback, player.whoAmI); + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Main.rand.NextVector2CircularEdge(5f, 5f), type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } } diff --git a/Items/Weapons/Summon/EyeOfNight.cs b/Items/Weapons/Summon/EyeOfNight.cs index 4dae0ecdb7..829421eadb 100644 --- a/Items/Weapons/Summon/EyeOfNight.cs +++ b/Items/Weapons/Summon/EyeOfNight.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -25,19 +26,16 @@ namespace CalamityMod.Items.Weapons.Summon Item.UseSound = SoundID.NPCHit1; Item.autoReuse = true; + Item.buffType = ModContent.BuffType(); 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, player.ClampedMouseWorld(), Vector2.UnitY * -3f, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; - } + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.UnitY * -3f, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } diff --git a/Items/Weapons/Summon/FlarebatStaff.cs b/Items/Weapons/Summon/FlarebatStaff.cs index 4ee88f1d16..91f6eb0365 100644 --- a/Items/Weapons/Summon/FlarebatStaff.cs +++ b/Items/Weapons/Summon/FlarebatStaff.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Buffs.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -15,6 +16,7 @@ namespace CalamityMod.Items.Weapons.Summon { Item.damage = 20; Item.DamageType = DamageClass.Summon; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.knockBack = 1f; @@ -31,7 +33,9 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } } diff --git a/Items/Weapons/Summon/FleshOfInfidelity.cs b/Items/Weapons/Summon/FleshOfInfidelity.cs index 671bec1cae..638e048448 100644 --- a/Items/Weapons/Summon/FleshOfInfidelity.cs +++ b/Items/Weapons/Summon/FleshOfInfidelity.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.Summon; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; @@ -22,6 +22,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 42; Item.damage = 20; Item.DamageType = DamageClass.Summon; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.knockBack = 1f; @@ -37,7 +38,9 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.UnitY * -1f, type, damage, knockback, player.whoAmI); + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.UnitY * -1f, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } } diff --git a/Items/Weapons/Summon/FlowersOfMortality.cs b/Items/Weapons/Summon/FlowersOfMortality.cs index ee43914ad1..247ab82b77 100644 --- a/Items/Weapons/Summon/FlowersOfMortality.cs +++ b/Items/Weapons/Summon/FlowersOfMortality.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -28,6 +29,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; Item.rare = ItemRarityID.Purple; Item.UseSound = SoundID.Item44; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; } @@ -36,6 +38,7 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { + player.AddBuff(Item.buffType, 2); CalamityUtils.KillShootProjectiles(false, type, player); for (int i = 0; i < 5; i++) { diff --git a/Items/Weapons/Summon/ForgottenApexWand.cs b/Items/Weapons/Summon/ForgottenApexWand.cs index 4fb966f134..ba73a0b486 100644 --- a/Items/Weapons/Summon/ForgottenApexWand.cs +++ b/Items/Weapons/Summon/ForgottenApexWand.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Buffs.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -26,21 +27,15 @@ namespace CalamityMod.Items.Weapons.Summon Item.mana = 10; Item.damage = 28; Item.useAnimation = Item.useTime = 25; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 12f; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.altFunctionUse != 2) - { - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - vector2.X = Main.mouseX + Main.screenPosition.X; - vector2.Y = Main.mouseY + Main.screenPosition.Y; - int p = Projectile.NewProjectile(source, vector2, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; - } + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } diff --git a/Items/Weapons/Summon/FrostBlossomStaff.cs b/Items/Weapons/Summon/FrostBlossomStaff.cs index 852b6cd188..026da729b3 100644 --- a/Items/Weapons/Summon/FrostBlossomStaff.cs +++ b/Items/Weapons/Summon/FrostBlossomStaff.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Buffs.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -23,17 +24,17 @@ namespace CalamityMod.Items.Weapons.Summon Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; Item.UseSound = SoundID.Item28; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { + player.AddBuff(Item.buffType, 2); CalamityUtils.KillShootProjectiles(true, type, player); - int p = Projectile.NewProjectile(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; + var minion = Projectile.NewProjectileDirect(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } public override void AddRecipes() diff --git a/Items/Weapons/Summon/FrostbatStaff.cs b/Items/Weapons/Summon/FrostbatStaff.cs index ade55ae2aa..a8148b1e5b 100644 --- a/Items/Weapons/Summon/FrostbatStaff.cs +++ b/Items/Weapons/Summon/FrostbatStaff.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Buffs.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -15,6 +16,7 @@ namespace CalamityMod.Items.Weapons.Summon { Item.damage = 22; Item.DamageType = DamageClass.Summon; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.knockBack = 1f; @@ -31,7 +33,9 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } } diff --git a/Items/Weapons/Summon/GammaHeart.cs b/Items/Weapons/Summon/GammaHeart.cs index 6ab12f05c7..b563bb8704 100644 --- a/Items/Weapons/Summon/GammaHeart.cs +++ b/Items/Weapons/Summon/GammaHeart.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Buffs.Summon; +using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; @@ -24,20 +25,17 @@ namespace CalamityMod.Items.Weapons.Summon Item.knockBack = 3f; Item.autoReuse = true; Item.useAnimation = Item.useTime = 14; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.rare = ModContent.RarityType(); } 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, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; - } + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } } diff --git a/Items/Weapons/Summon/GastricBelcherStaff.cs b/Items/Weapons/Summon/GastricBelcherStaff.cs index 0d23ca4774..7e7233f8cf 100644 --- a/Items/Weapons/Summon/GastricBelcherStaff.cs +++ b/Items/Weapons/Summon/GastricBelcherStaff.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Buffs.Summon; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; @@ -29,44 +30,17 @@ namespace CalamityMod.Items.Weapons.Summon Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item76; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; Item.autoReuse = true; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.altFunctionUse != 2) - { - Vector2 playerPos = player.RotatedRelativePoint(player.MountedCenter, true); - float directionX = Main.mouseX + Main.screenPosition.X - playerPos.X; - float directionY = Main.mouseY + Main.screenPosition.Y - playerPos.Y; - if (player.gravDir == -1f) - { - directionY = Main.screenPosition.Y + Main.screenHeight - Main.mouseY - playerPos.Y; - } - Vector2 spinningpoint = new Vector2(directionX, directionY); - float dist = spinningpoint.Length(); - if ((float.IsNaN(spinningpoint.X) && float.IsNaN(spinningpoint.Y)) || (spinningpoint.X == 0f && spinningpoint.Y == 0f)) - { - spinningpoint.X = player.direction; - spinningpoint.Y = 0f; - dist = Item.shootSpeed; - } - else - { - dist = Item.shootSpeed / dist; - } - spinningpoint.X *= dist; - spinningpoint.Y *= dist; - playerPos.X = Main.mouseX + Main.screenPosition.X; - playerPos.Y = Main.mouseY + Main.screenPosition.Y; - spinningpoint = spinningpoint.RotatedBy(Math.PI / 2D, default); - int p = Projectile.NewProjectile(source, playerPos + spinningpoint, spinningpoint, type, damage, knockback, player.whoAmI, 0f, 1f); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; - } + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Main.rand.NextVector2Circular(5f, 5f), type, damage, knockback, player.whoAmI, 0f, 1f); + minion.originalDamage = Item.damage; return false; } } diff --git a/Items/Weapons/Summon/GlacialEmbrace.cs b/Items/Weapons/Summon/GlacialEmbrace.cs index 00fc0f2f75..7f2827b342 100644 --- a/Items/Weapons/Summon/GlacialEmbrace.cs +++ b/Items/Weapons/Summon/GlacialEmbrace.cs @@ -24,6 +24,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.knockBack = 4.5f; Item.UseSound = SoundID.Item30; Item.autoReuse = true; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; @@ -44,11 +45,10 @@ namespace CalamityMod.Items.Weapons.Summon } if (player.altFunctionUse != 2 && totalMinionSlots < player.maxMinions) { - player.AddBuff(ModContent.BuffType(), 120, true); + player.AddBuff(Item.buffType, 2); position = player.ClampedMouseWorld(); - int p = Projectile.NewProjectile(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; int pointyThingCount = 0; foreach (Projectile pro in Main.ActiveProjectiles) { diff --git a/Items/Weapons/Summon/HauntedScroll.cs b/Items/Weapons/Summon/HauntedScroll.cs index 5ac5707364..001eafa166 100644 --- a/Items/Weapons/Summon/HauntedScroll.cs +++ b/Items/Weapons/Summon/HauntedScroll.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Buffs.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -30,23 +31,17 @@ namespace CalamityMod.Items.Weapons.Summon Item.rare = ItemRarityID.LightRed; Item.UseSound = SoundID.Item60; Item.autoReuse = true; + Item.buffType = ModContent.BuffType(); 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 = player.ClampedMouseWorld(); - velocity.X = 0; - velocity.Y = 0; - int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 30f); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; - //projectile.ai[1] is attack cooldown. Setting it here prevents immediate attacks - } + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 30f); + minion.originalDamage = Item.damage; + //projectile.ai[1] is attack cooldown. Setting it here prevents immediate attacks return false; } diff --git a/Items/Weapons/Summon/HerringStaff.cs b/Items/Weapons/Summon/HerringStaff.cs index 33f8bd5fbe..045c7353c3 100644 --- a/Items/Weapons/Summon/HerringStaff.cs +++ b/Items/Weapons/Summon/HerringStaff.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Buffs.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -17,6 +18,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.knockBack = 1.25f; Item.mana = 10; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.useAnimation = Item.useTime = 30; Item.DamageType = DamageClass.Summon; @@ -30,12 +32,9 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.altFunctionUse != 2) - { - int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; - } + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } } diff --git a/Items/Weapons/Summon/IgneousExaltation.cs b/Items/Weapons/Summon/IgneousExaltation.cs index e91c75a2c7..86d6a3d058 100644 --- a/Items/Weapons/Summon/IgneousExaltation.cs +++ b/Items/Weapons/Summon/IgneousExaltation.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -53,15 +54,14 @@ namespace CalamityMod.Items.Weapons.Summon Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item71; Item.autoReuse = true; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; } - public override bool AltFunctionUse(Player player) - { - return player.ownedProjectileCounts[Item.shoot] > 0; - } + public override bool AltFunctionUse(Player player) => player.ownedProjectileCounts[Item.shoot] > 0; + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.altFunctionUse == 2) @@ -77,12 +77,9 @@ namespace CalamityMod.Items.Weapons.Summon } else { - - int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 1f); - if (Main.projectile.IndexInRange(p)) - { - Main.projectile[p].originalDamage = Item.damage; - } + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 1f); + minion.originalDamage = Item.damage; int bladeIndex = 0; foreach (Projectile pro in Main.ActiveProjectiles) diff --git a/Items/Weapons/Summon/InfectedRemote.cs b/Items/Weapons/Summon/InfectedRemote.cs index a5391fa820..7410951304 100644 --- a/Items/Weapons/Summon/InfectedRemote.cs +++ b/Items/Weapons/Summon/InfectedRemote.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -37,8 +38,7 @@ namespace CalamityMod.Items.Weapons.Summon { ItemID.Sets.StaffMinionSlotsRequired[Type] = 3f; ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); - - } + } public override void SetDefaults() { @@ -51,8 +51,8 @@ namespace CalamityMod.Items.Weapons.Summon Item.noMelee = true; Item.knockBack = 5f; Item.UseSound = SoundID.Item15; //phaseblade sound effect + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; Item.value = CalamityGlobalItem.RarityYellowBuyPrice; @@ -64,11 +64,10 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { + player.AddBuff(Item.buffType, 2); CalamityUtils.KillShootProjectiles(true, type, player); - - int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } } diff --git a/Items/Weapons/Summon/KingofConstellationsTenryu.cs b/Items/Weapons/Summon/KingofConstellationsTenryu.cs index f8c677a7a7..e25f41c11f 100644 --- a/Items/Weapons/Summon/KingofConstellationsTenryu.cs +++ b/Items/Weapons/Summon/KingofConstellationsTenryu.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; @@ -23,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.mana = 10; Item.damage = 187; Item.useStyle = ItemUseStyleID.HoldUp; - Item.shootSpeed = 10f; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.UseSound = Flare.FlareSound; Item.useAnimation = Item.useTime = 25; @@ -38,10 +39,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.autoReuse = true; } - public override Vector2? HoldoutOffset() - { - return new Vector2(-20, 0); - } + public override Vector2? HoldoutOffset() => new Vector2(-20, 0); public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0 && player.maxMinions >= 4; @@ -49,20 +47,23 @@ namespace CalamityMod.Items.Weapons.Summon { Vector2 spawnPos = new Vector2(player.position.X - 200, player.position.Y - 200); Vector2 spawnPos2 = new Vector2(player.position.X + 200, player.position.Y - 200); - SpawnDragon(ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), spawnPos2, player, source, damage, knockback); - SpawnDragon(ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), spawnPos, player, source, damage, knockback); + player.AddBuff(Item.buffType, 2); + SpawnDragon(ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), spawnPos2, player, source, damage, Item.damage, knockback); + SpawnDragon(ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), spawnPos, player, source, damage, Item.damage, knockback); return false; } - public static void SpawnDragon(int head, int body, int tail, Vector2 spawnPos, Player player, EntitySource_ItemUse_WithAmmo source, int damage, float knockback) + public static void SpawnDragon(int headType, int bodyType, int tailType, Vector2 spawnPos, Player player, EntitySource_ItemUse_WithAmmo source, int damage, int originalDamage, float knockback) { // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction - Projectile.NewProjectile(source, spawnPos, player.DirectionTo(Main.MouseWorld) * 3, head, damage, knockback, player.whoAmI); - // okay but seriously why are you multiplying zero by three - Projectile.NewProjectile(source, spawnPos, Vector2.Zero * 3, tail, damage, knockback, player.whoAmI); + var head = Projectile.NewProjectileDirect(source, spawnPos, player.DirectionTo(Main.MouseWorld) * 3, headType, damage, knockback, player.whoAmI); + head.originalDamage = originalDamage; + var tail = Projectile.NewProjectileDirect(source, spawnPos, Vector2.Zero, tailType, damage, knockback, player.whoAmI); + tail.originalDamage = originalDamage; for (var i = 0; i < 20; i++) { - Projectile.NewProjectile(source, spawnPos, Vector2.Zero * 3, body, damage, knockback, player.whoAmI); + var body = Projectile.NewProjectileDirect(source, spawnPos, Vector2.Zero, bodyType, damage, knockback, player.whoAmI); + body.originalDamage = originalDamage; } } diff --git a/Items/Weapons/Summon/LegionofCelestia.cs b/Items/Weapons/Summon/LegionofCelestia.cs index 4e49f639e6..4978eebfd0 100644 --- a/Items/Weapons/Summon/LegionofCelestia.cs +++ b/Items/Weapons/Summon/LegionofCelestia.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -28,8 +29,8 @@ namespace CalamityMod.Items.Weapons.Summon Item.rare = ItemRarityID.Purple; Item.UseSound = SoundID.Item44; Item.autoReuse = true; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; } public override void UseStyle(Player player, Rectangle heldItemFrame) @@ -39,15 +40,9 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.altFunctionUse != 2) - { - position = player.ClampedMouseWorld(); - velocity.X = 0; - velocity.Y = 0; - int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; - } + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } diff --git a/Items/Weapons/Summon/LiliesOfFinality.cs b/Items/Weapons/Summon/LiliesOfFinality.cs index 968e79bbe8..8c78d3b917 100644 --- a/Items/Weapons/Summon/LiliesOfFinality.cs +++ b/Items/Weapons/Summon/LiliesOfFinality.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Buffs.Summon; +using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; @@ -40,6 +41,7 @@ namespace CalamityMod.Items.Weapons.Summon { Item.damage = 512; Item.DamageType = DamageClass.Summon; + Item.buffType = ModContent.BuffType(); Item.shoot = ProjectileType(); Item.knockBack = 5f; @@ -58,9 +60,12 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { + player.AddBuff(Item.buffType, 2); Vector2 mouse = player.ClampedMouseWorld(); - Projectile.NewProjectile(source, mouse, new Vector2(-1f, -1f) * 3f, type, damage, knockback, player.whoAmI); - Projectile.NewProjectile(source, mouse, new Vector2(1f, -1f) * 3f, ProjectileType(), damage, knockback, player.whoAmI); + var elster = Projectile.NewProjectileDirect(source, mouse, new Vector2(-1f, -1f) * 3f, type, damage, knockback, player.whoAmI); + elster.originalDamage = Item.damage; + var ariane = Projectile.NewProjectileDirect(source, mouse, new Vector2(1f, -1f) * 3f, ProjectileType(), damage, knockback, player.whoAmI); + ariane.originalDamage = Item.damage; if (Main.dedServ) return false; diff --git a/Items/Weapons/Summon/Metastasis.cs b/Items/Weapons/Summon/Metastasis.cs index dce121d6b1..51fa3ef810 100644 --- a/Items/Weapons/Summon/Metastasis.cs +++ b/Items/Weapons/Summon/Metastasis.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Buffs.Summon; +using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; @@ -31,8 +32,8 @@ namespace CalamityMod.Items.Weapons.Summon Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.DD2_BetsySummon; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; } @@ -40,9 +41,9 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), -Vector2.UnitY * 5f, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), -Vector2.UnitY * 5f, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } } diff --git a/Items/Weapons/Summon/MirrorofKalandra.cs b/Items/Weapons/Summon/MirrorofKalandra.cs index 9c6734e2f4..bdf70f8296 100644 --- a/Items/Weapons/Summon/MirrorofKalandra.cs +++ b/Items/Weapons/Summon/MirrorofKalandra.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon.MirrorofKalandraMinions; using CalamityMod.Rarities; using Microsoft.Xna.Framework; @@ -53,6 +54,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.useAnimation = Item.useTime = 30; Item.knockBack = 4f; Item.mana = 10; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.autoReuse = true; @@ -71,6 +73,7 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { + player.AddBuff(Item.buffType, 2); if (player.ownedProjectileCounts[ModContent.ProjectileType()] == 1) { type = ModContent.ProjectileType(); @@ -82,9 +85,9 @@ namespace CalamityMod.Items.Weapons.Summon type = ModContent.ProjectileType(); } - int minion = Projectile.NewProjectile(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(minion)) - Main.projectile[minion].rotation = -MathHelper.PiOver2; + var minion = Projectile.NewProjectileDirect(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.rotation = -MathHelper.PiOver2; + minion.originalDamage = Item.damage; return false; } diff --git a/Items/Weapons/Summon/MutatedTruffle.cs b/Items/Weapons/Summon/MutatedTruffle.cs index be68bf83a5..5b577b75d8 100644 --- a/Items/Weapons/Summon/MutatedTruffle.cs +++ b/Items/Weapons/Summon/MutatedTruffle.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; using Microsoft.Xna.Framework; @@ -42,6 +43,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 26; Item.damage = 275; Item.DamageType = DamageClass.Summon; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.knockBack = 5f; @@ -54,12 +56,15 @@ namespace CalamityMod.Items.Weapons.Summon Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; } + // Only one can be summoned. + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] < 1 && player.maxMinions >= 3; + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - // Only one can be summoned. - if (player.ownedProjectileCounts[type] < 1 && player.maxMinions >= 3) - Projectile.NewProjectile(source, player.ClampedMouseWorld(), Main.rand.NextVector2Circular(2f, 2f), type, damage, knockback, player.whoAmI); - + player.AddBuff(Item.buffType, 2); + CalamityUtils.KillShootProjectiles(true, type, player); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Main.rand.NextVector2Circular(2f, 2f), type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } } diff --git a/Items/Weapons/Summon/Perdition.cs b/Items/Weapons/Summon/Perdition.cs index af0f2d7571..338f86fb93 100644 --- a/Items/Weapons/Summon/Perdition.cs +++ b/Items/Weapons/Summon/Perdition.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Buffs.Summon; using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; using Microsoft.Xna.Framework; @@ -16,7 +16,6 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetStaticDefaults() { - ItemID.Sets.StaffMinionSlotsRequired[Type] = 5f; ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } @@ -25,7 +24,9 @@ namespace CalamityMod.Items.Weapons.Summon Item.width = Item.height = 56; Item.damage = 375; Item.DamageType = DamageClass.Summon; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); + Item.sentry = true; Item.knockBack = 4f; Item.useAnimation = Item.useTime = 10; // 9 because of useStyle 1. @@ -38,19 +39,15 @@ namespace CalamityMod.Items.Weapons.Summon Item.UseSound = SoundID.DD2_EtherianPortalOpen; } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] < 1; + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.altFunctionUse != 2) - { - if (player.ownedProjectileCounts[type] < 1) - Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); - } - else - { - // Play some demonic noises prior to a target being selected. - SoundEngine.PlaySound(SoundID.Zombie93, player.Center); - SoundEngine.PlaySound(SoundID.Item119, player.Center); - } + player.AddBuff(Item.buffType, 2); + CalamityUtils.KillShootProjectiles(true, type, player); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; + player.UpdateMaxTurrets(); return false; } } diff --git a/Items/Weapons/Summon/PlantationStaff.cs b/Items/Weapons/Summon/PlantationStaff.cs index f7ab0903ef..b967ef9731 100644 --- a/Items/Weapons/Summon/PlantationStaff.cs +++ b/Items/Weapons/Summon/PlantationStaff.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -41,6 +42,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 50; Item.damage = 58; Item.DamageType = DamageClass.Summon; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.knockBack = 1f; @@ -57,7 +59,9 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile.NewProjectile(source, player.ClampedMouseWorld(), Main.rand.NextVector2Circular(2f, 2f), type, damage, knockback, player.whoAmI); + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Main.rand.NextVector2Circular(2f, 2f), type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } diff --git a/Items/Weapons/Summon/PuffShroom.cs b/Items/Weapons/Summon/PuffShroom.cs index 99690d4f50..d12ee0ac1e 100644 --- a/Items/Weapons/Summon/PuffShroom.cs +++ b/Items/Weapons/Summon/PuffShroom.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -29,19 +30,16 @@ namespace CalamityMod.Items.Weapons.Summon Item.rare = ItemRarityID.Green; Item.UseSound = SoundID.Item42; Item.autoReuse = true; + Item.buffType = ModContent.BuffType(); 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 puffGuy = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(puffGuy)) - Main.projectile[puffGuy].originalDamage = Item.damage; - } + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } } diff --git a/Items/Weapons/Summon/ResurrectionButterfly.cs b/Items/Weapons/Summon/ResurrectionButterfly.cs index 98ff76631a..d99b51f0a3 100644 --- a/Items/Weapons/Summon/ResurrectionButterfly.cs +++ b/Items/Weapons/Summon/ResurrectionButterfly.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Buffs.Summon; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; @@ -29,22 +30,21 @@ namespace CalamityMod.Items.Weapons.Summon Item.UseSound = SoundID.Item44; Item.autoReuse = true; + Item.buffType = ModContent.BuffType(); 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) { + player.AddBuff(Item.buffType, 2); Vector2 clampedMouse = player.ClampedMouseWorld(); - Vector2 mouseDirection = Vector2.Normalize(clampedMouse - player.Center) * Item.shootSpeed; + Vector2 mouseDirection = Vector2.Normalize(clampedMouse - player.Center) * 10f; - int p = Projectile.NewProjectile(source, clampedMouse, mouseDirection.RotatedBy(MathHelper.PiOver2), ModContent.ProjectileType(), damage, knockback, Main.myPlayer, 0f, 0f); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; - p = Projectile.NewProjectile(source, clampedMouse, mouseDirection.RotatedBy(-MathHelper.PiOver2), ModContent.ProjectileType(), damage, knockback, Main.myPlayer, 0f, 0f); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; + var pink = Projectile.NewProjectileDirect(source, clampedMouse, mouseDirection.RotatedBy(MathHelper.PiOver2), ModContent.ProjectileType(), damage, knockback, Main.myPlayer, 0f, 0f); + pink.originalDamage = Item.damage; + var purple = Projectile.NewProjectileDirect(source, clampedMouse, mouseDirection.RotatedBy(-MathHelper.PiOver2), ModContent.ProjectileType(), damage, knockback, Main.myPlayer, 0f, 0f); + purple.originalDamage = Item.damage; return false; } diff --git a/Items/Weapons/Summon/SandSharknadoStaff.cs b/Items/Weapons/Summon/SandSharknadoStaff.cs index 262bb00eb2..beba2cc6f2 100644 --- a/Items/Weapons/Summon/SandSharknadoStaff.cs +++ b/Items/Weapons/Summon/SandSharknadoStaff.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -22,6 +23,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.knockBack = 2f; Item.mana = 10; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.useAnimation = Item.useTime = 20; Item.DamageType = DamageClass.Summon; @@ -35,12 +37,9 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.altFunctionUse != 2) - { - int sandnado = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(sandnado)) - Main.projectile[sandnado].originalDamage = Item.damage; - } + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } diff --git a/Items/Weapons/Summon/SarosPossession.cs b/Items/Weapons/Summon/SarosPossession.cs index e70b846278..0e143371a0 100644 --- a/Items/Weapons/Summon/SarosPossession.cs +++ b/Items/Weapons/Summon/SarosPossession.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -23,6 +24,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.knockBack = 4f; Item.mana = 10; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.useAnimation = Item.useTime = 10; Item.DamageType = DamageClass.Summon; @@ -37,10 +39,10 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { + player.AddBuff(Item.buffType, 2); CalamityUtils.KillShootProjectiles(true, type, player); - int p = Projectile.NewProjectile(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; + var minion = Projectile.NewProjectileDirect(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } diff --git a/Items/Weapons/Summon/ScabRipper.cs b/Items/Weapons/Summon/ScabRipper.cs index 9ddc38325c..2bee629707 100644 --- a/Items/Weapons/Summon/ScabRipper.cs +++ b/Items/Weapons/Summon/ScabRipper.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Buffs.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -27,6 +28,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.rare = ItemRarityID.Green; Item.UseSound = SoundID.Item83; Item.autoReuse = true; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.DamageType = DamageClass.Summon; @@ -36,15 +38,9 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.altFunctionUse != 2) - { - position = player.ClampedMouseWorld(); - velocity.X = 0; - velocity.Y = 0; - int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; - } + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } diff --git a/Items/Weapons/Summon/SeashineHilt.cs b/Items/Weapons/Summon/SeashineHilt.cs index 8168f5fff6..6ec21393a9 100644 --- a/Items/Weapons/Summon/SeashineHilt.cs +++ b/Items/Weapons/Summon/SeashineHilt.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Buffs.Summon; using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.SunkenSea; @@ -38,6 +39,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.shootSpeed = 12f; Item.mana = 10; Item.rare = ItemRarityID.Green; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); } public override bool AltFunctionUse(Player player) => true; @@ -90,11 +92,11 @@ namespace CalamityMod.Items.Weapons.Summon } else // Toss out the summon { + player.AddBuff(Item.buffType, 2); SoundEngine.PlaySound(SoundID.Item1, player.Center); - int pr = Projectile.NewProjectile(source, player.Center, velocity, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(pr)) - Main.projectile[pr].originalDamage = Item.damage; + var minion = Projectile.NewProjectileDirect(source, player.Center, velocity, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; float angleMax = MathHelper.ToRadians(360f); if (CalamityUtils.CountProjectiles(type) == 1) diff --git a/Items/Weapons/Summon/ShellfishStaff.cs b/Items/Weapons/Summon/ShellfishStaff.cs index acfa24fee7..01c8c17b73 100644 --- a/Items/Weapons/Summon/ShellfishStaff.cs +++ b/Items/Weapons/Summon/ShellfishStaff.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Buffs.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -27,19 +28,16 @@ namespace CalamityMod.Items.Weapons.Summon Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item44; Item.autoReuse = true; + Item.buffType = ModContent.BuffType(); 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, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; - } + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } } diff --git a/Items/Weapons/Summon/Sirius.cs b/Items/Weapons/Summon/Sirius.cs index 4c39a7837c..305abfe88a 100644 --- a/Items/Weapons/Summon/Sirius.cs +++ b/Items/Weapons/Summon/Sirius.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Ores; using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; @@ -23,6 +24,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.useAnimation = Item.useTime = 10; Item.mana = 10; Item.knockBack = 10f; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.DamageType = DamageClass.Summon; Item.useStyle = ItemUseStyleID.Swing; @@ -36,10 +38,10 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { + player.AddBuff(Item.buffType, 2); CalamityUtils.KillShootProjectiles(true, type, player); - int p = Projectile.NewProjectile(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; + var minion = Projectile.NewProjectileDirect(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } diff --git a/Items/Weapons/Summon/StaffOfNecrosteocytes.cs b/Items/Weapons/Summon/StaffOfNecrosteocytes.cs index 9bd042de78..607bbbe62d 100644 --- a/Items/Weapons/Summon/StaffOfNecrosteocytes.cs +++ b/Items/Weapons/Summon/StaffOfNecrosteocytes.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Buffs.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -24,22 +25,19 @@ namespace CalamityMod.Items.Weapons.Summon Item.rare = ItemRarityID.Orange; Item.UseSound = SoundID.Item44; Item.autoReuse = true; + Item.buffType = ModContent.BuffType(); 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) { - Point mouseTileCoords = position.ToTileCoordinates(); + player.AddBuff(Item.buffType, 2); + Point mouseTileCoords = player.ClampedMouseWorld().ToTileCoordinates(); if (WorldGen.SolidTile(mouseTileCoords.X, mouseTileCoords.Y)) return false; - if (player.altFunctionUse != 2) - { - int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; - } + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } } diff --git a/Items/Weapons/Summon/StaffoftheMechworm.cs b/Items/Weapons/Summon/StaffoftheMechworm.cs index 2968a2088d..83e6d27796 100644 --- a/Items/Weapons/Summon/StaffoftheMechworm.cs +++ b/Items/Weapons/Summon/StaffoftheMechworm.cs @@ -1,4 +1,5 @@ using System.Linq; +using CalamityMod.Buffs.Summon; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; @@ -31,8 +32,8 @@ namespace CalamityMod.Items.Weapons.Summon Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item113; Item.autoReuse = true; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; } @@ -104,6 +105,7 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { + player.AddBuff(Item.buffType, 2); int head = -1; int tail = -1; foreach (Projectile p in Main.ActiveProjectiles) diff --git a/Items/Weapons/Summon/StarspawnHelixStaff.cs b/Items/Weapons/Summon/StarspawnHelixStaff.cs index e687d10378..48701eb7dc 100644 --- a/Items/Weapons/Summon/StarspawnHelixStaff.cs +++ b/Items/Weapons/Summon/StarspawnHelixStaff.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -24,6 +25,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.knockBack = 1.25f; Item.mana = 10; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.useAnimation = Item.useTime = 20; Item.DamageType = DamageClass.Summon; @@ -37,24 +39,19 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.altFunctionUse != 2) - { - int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), velocity, type, damage, knockback, player.whoAmI, 0f, 1f); - if (Main.projectile.IndexInRange(p)) - { - Main.projectile[p].originalDamage = Item.damage; - Main.projectile[p].ModProjectile().ProbeIndex = player.ownedProjectileCounts[type]; - } + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 1f); + minion.originalDamage = Item.damage; + minion.ModProjectile().ProbeIndex = player.ownedProjectileCounts[type]; - int bladeIndex = 0; - foreach (Projectile pro in Main.ActiveProjectiles) + int bladeIndex = 0; + foreach (Projectile pro in Main.ActiveProjectiles) + { + if (pro.type == type && pro.owner == player.whoAmI) { - if (pro.type == type && pro.owner == player.whoAmI) - { - pro.ModProjectile().ProbeIndex = bladeIndex++; - pro.ModProjectile().AITimer = 0f; - pro.netUpdate = true; - } + pro.ModProjectile().ProbeIndex = bladeIndex++; + pro.ModProjectile().AITimer = 0f; + pro.netUpdate = true; } } diff --git a/Items/Weapons/Summon/StellarTorusStaff.cs b/Items/Weapons/Summon/StellarTorusStaff.cs index 23e2df9b9d..05344b0db5 100644 --- a/Items/Weapons/Summon/StellarTorusStaff.cs +++ b/Items/Weapons/Summon/StellarTorusStaff.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; using Microsoft.Xna.Framework; @@ -29,6 +30,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.useAnimation = Item.useTime = 20; Item.knockBack = 4f; Item.mana = 10; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.noMelee = true; @@ -43,11 +45,9 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int minion = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Main.rand.NextVector2Circular(2f, 2f), ModContent.ProjectileType(), damage, knockback, player.whoAmI); - - if (Main.projectile.IndexInRange(minion)) - Main.projectile[minion].originalDamage = Item.OriginalDamage; - + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Main.rand.NextVector2Circular(2f, 2f), ModContent.ProjectileType(), damage, knockback, player.whoAmI); + minion.originalDamage = Item.OriginalDamage; return false; } diff --git a/Items/Weapons/Summon/StormjawStaff.cs b/Items/Weapons/Summon/StormjawStaff.cs index 53c47e8b77..2780625a88 100644 --- a/Items/Weapons/Summon/StormjawStaff.cs +++ b/Items/Weapons/Summon/StormjawStaff.cs @@ -1,4 +1,5 @@ -using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.Buffs.Summon; +using CalamityMod.NPCs.NormalNPCs; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -25,19 +26,16 @@ namespace CalamityMod.Items.Weapons.Summon Item.rare = ItemRarityID.Green; Item.UseSound = Stormlion.DeathSound; Item.autoReuse = true; + Item.buffType = ModContent.BuffType(); 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, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; - } + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } } diff --git a/Items/Weapons/Summon/SunSpiritStaff.cs b/Items/Weapons/Summon/SunSpiritStaff.cs index fa04a52417..61403820f0 100644 --- a/Items/Weapons/Summon/SunSpiritStaff.cs +++ b/Items/Weapons/Summon/SunSpiritStaff.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -24,6 +25,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; Item.UseSound = SoundID.Item44; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.DamageType = DamageClass.Summon; } @@ -32,10 +34,10 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { + player.AddBuff(Item.buffType, 2); CalamityUtils.KillShootProjectiles(true, type, player); - int p = Projectile.NewProjectile(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; + var minion = Projectile.NewProjectileDirect(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } diff --git a/Items/Weapons/Summon/TacticalPlagueEngine.cs b/Items/Weapons/Summon/TacticalPlagueEngine.cs index 2a672d25f5..bbdbb624a9 100644 --- a/Items/Weapons/Summon/TacticalPlagueEngine.cs +++ b/Items/Weapons/Summon/TacticalPlagueEngine.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Buffs.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -27,18 +28,16 @@ namespace CalamityMod.Items.Weapons.Summon Item.UseSound = SoundID.Item14; Item.autoReuse = true; Item.DamageType = DamageClass.Summon; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 7f; // Affects bullet speed } 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, position, velocity, type, damage, knockback, player.whoAmI, 0f, 1f); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; - } + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 1f); + minion.originalDamage = Item.damage; return false; } diff --git a/Items/Weapons/Summon/TemporalUmbrella.cs b/Items/Weapons/Summon/TemporalUmbrella.cs index 592dea16b1..04b56eee01 100644 --- a/Items/Weapons/Summon/TemporalUmbrella.cs +++ b/Items/Weapons/Summon/TemporalUmbrella.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon.Umbrella; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -26,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.mana = 99; Item.useAnimation = Item.useTime = 10; Item.DamageType = DamageClass.Summon; - Item.shootSpeed = 0f; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.useStyle = ItemUseStyleID.Swing; @@ -41,10 +42,10 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { + player.AddBuff(Item.buffType, 2); CalamityUtils.KillShootProjectileMany(player, type, ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType()); - int p = Projectile.NewProjectile(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; + var minion = Projectile.NewProjectileDirect(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } diff --git a/Items/Weapons/Summon/TundraFlameBlossomsStaff.cs b/Items/Weapons/Summon/TundraFlameBlossomsStaff.cs index dcf2926b9a..c3879ce76f 100644 --- a/Items/Weapons/Summon/TundraFlameBlossomsStaff.cs +++ b/Items/Weapons/Summon/TundraFlameBlossomsStaff.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Buffs.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -23,6 +24,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item46; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.DamageType = DamageClass.Summon; } @@ -31,6 +33,7 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { + player.AddBuff(Item.buffType, 2); CalamityUtils.KillShootProjectiles(false, type, player); for (int i = 0; i < 3; i++) { diff --git a/Items/Weapons/Summon/VengefulSunStaff.cs b/Items/Weapons/Summon/VengefulSunStaff.cs index fc5250bf6d..6a6e9735c3 100644 --- a/Items/Weapons/Summon/VengefulSunStaff.cs +++ b/Items/Weapons/Summon/VengefulSunStaff.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -25,6 +26,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.value = CalamityGlobalItem.RarityLightPurpleBuyPrice; Item.rare = ItemRarityID.LightPurple; Item.UseSound = SoundID.Item44; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.DamageType = DamageClass.Summon; } @@ -33,10 +35,10 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { + player.AddBuff(Item.buffType, 2); CalamityUtils.KillShootProjectiles(true, type, player); - int p = Projectile.NewProjectile(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; + var minion = Projectile.NewProjectileDirect(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } diff --git a/Items/Weapons/Summon/Vigilance.cs b/Items/Weapons/Summon/Vigilance.cs index 5b731630f0..bd8f7d453a 100644 --- a/Items/Weapons/Summon/Vigilance.cs +++ b/Items/Weapons/Summon/Vigilance.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; using Microsoft.Xna.Framework; @@ -27,8 +28,8 @@ namespace CalamityMod.Items.Weapons.Summon Item.knockBack = 4f; Item.UseSound = SoundID.DD2_BetsySummon; Item.autoReuse = true; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; @@ -37,17 +38,12 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.altFunctionUse != 2) + if (player.maxMinions - player.slotsMinions >= 1f) { - if (player.maxMinions - player.slotsMinions >= 1f) - { - int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - { - Main.projectile[p].ai[0] = player.ownedProjectileCounts[type]; - Main.projectile[p].originalDamage = Item.damage; - } - } + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.ai[0] = player.ownedProjectileCounts[type]; + minion.originalDamage = Item.damage; } return false; } diff --git a/Items/Weapons/Summon/VileFeeder.cs b/Items/Weapons/Summon/VileFeeder.cs index db16a86ab9..9f7e9472ac 100644 --- a/Items/Weapons/Summon/VileFeeder.cs +++ b/Items/Weapons/Summon/VileFeeder.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Buffs.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -19,6 +20,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 36; Item.damage = 15; Item.DamageType = DamageClass.Summon; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.knockBack = 0.5f; @@ -37,7 +39,9 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile.NewProjectile(source, player.ClampedMouseWorld(), Main.rand.NextVector2CircularEdge(5f, 5f), type, damage, knockback, player.whoAmI); + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Main.rand.NextVector2CircularEdge(5f, 5f), type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } diff --git a/Items/Weapons/Summon/ViralSprout.cs b/Items/Weapons/Summon/ViralSprout.cs index 1c6f7c5669..a3cb6ee511 100644 --- a/Items/Weapons/Summon/ViralSprout.cs +++ b/Items/Weapons/Summon/ViralSprout.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -25,29 +26,26 @@ namespace CalamityMod.Items.Weapons.Summon Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item44; Item.autoReuse = true; + Item.buffType = ModContent.BuffType(); 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) + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; + + int minionCount = 0; + foreach (Projectile pro in Main.ActiveProjectiles) { - int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; + if (pro.type != type || pro.owner != player.whoAmI) + continue; - int minionCount = 0; - foreach (Projectile pro in Main.ActiveProjectiles) - { - if (pro.type != type || pro.owner != player.whoAmI) - continue; - - pro.localAI[0] = minionCount; - pro.netUpdate = true; - minionCount++; - } + pro.localAI[0] = minionCount; + pro.netUpdate = true; + minionCount++; } return false; } diff --git a/Items/Weapons/Summon/ViridVanguard.cs b/Items/Weapons/Summon/ViridVanguard.cs index affd241fee..6c1376707e 100644 --- a/Items/Weapons/Summon/ViridVanguard.cs +++ b/Items/Weapons/Summon/ViridVanguard.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; using Microsoft.Xna.Framework; @@ -47,33 +48,28 @@ namespace CalamityMod.Items.Weapons.Summon Item.rare = ItemRarityID.Red; Item.UseSound = SoundID.Item71; Item.autoReuse = true; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.rare = ModContent.RarityType(); } 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, position, velocity, type, damage, knockback, player.whoAmI, 0f, 1f); - if (Main.projectile.IndexInRange(p)) - { - Main.projectile[p].originalDamage = Item.damage; - Main.projectile[p].ModProjectile().BladeIndex = player.ownedProjectileCounts[type]; - } + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 1f); + minion.originalDamage = Item.damage; + minion.ModProjectile().BladeIndex = player.ownedProjectileCounts[type]; - int bladeIndex = 0; - foreach (Projectile pro in Main.ActiveProjectiles) + int bladeIndex = 0; + foreach (Projectile pro in Main.ActiveProjectiles) + { + if (pro.type == type && pro.owner == player.whoAmI) { - if (pro.type == type && pro.owner == player.whoAmI) - { - pro.ModProjectile().BladeIndex = bladeIndex++; - pro.ModProjectile().AITimer = 0f; - pro.netUpdate = true; - } + pro.ModProjectile().BladeIndex = bladeIndex++; + pro.ModProjectile().AITimer = 0f; + pro.netUpdate = true; } } - return false; } public override void AddRecipes() diff --git a/Items/Weapons/Summon/VoidConcentrationStaff.cs b/Items/Weapons/Summon/VoidConcentrationStaff.cs index 38ce3b2db3..e9263db742 100644 --- a/Items/Weapons/Summon/VoidConcentrationStaff.cs +++ b/Items/Weapons/Summon/VoidConcentrationStaff.cs @@ -33,8 +33,8 @@ namespace CalamityMod.Items.Weapons.Summon Item.damage = 105; Item.knockBack = 4f; Item.useAnimation = Item.useTime = 15; // 14 because of useStyle 1 + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); } @@ -50,10 +50,9 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.altFunctionUse != 2) { - int p = Projectile.NewProjectile(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; - player.AddBuff(ModContent.BuffType(), 120); + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; } return false; } diff --git a/Items/Weapons/Summon/WarloksMoonFist.cs b/Items/Weapons/Summon/WarloksMoonFist.cs index edc2b0338b..b06e055294 100644 --- a/Items/Weapons/Summon/WarloksMoonFist.cs +++ b/Items/Weapons/Summon/WarloksMoonFist.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Ores; using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; @@ -35,24 +36,19 @@ namespace CalamityMod.Items.Weapons.Summon Item.UseSound = SoundID.Item104; Item.autoReuse = true; Item.noUseGraphic = true; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; Item.Calamity().donorItem = true; } 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 existingFists = player.ownedProjectileCounts[type]; - int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - { - Main.projectile[p].originalDamage = Item.damage; - Main.projectile[p].ai[0] = existingFists; - } - } + player.AddBuff(Item.buffType, 2); + int existingFists = player.ownedProjectileCounts[type]; + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; + minion.ai[0] = existingFists; return false; } diff --git a/Items/Weapons/Summon/WitherBlossomsStaff.cs b/Items/Weapons/Summon/WitherBlossomsStaff.cs index e4ff0d39fd..4bd1b77d8d 100644 --- a/Items/Weapons/Summon/WitherBlossomsStaff.cs +++ b/Items/Weapons/Summon/WitherBlossomsStaff.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -27,8 +28,8 @@ namespace CalamityMod.Items.Weapons.Summon Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item46; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; } @@ -36,6 +37,7 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { + player.AddBuff(Item.buffType, 2); CalamityUtils.KillShootProjectiles(false, type, player); for (int i = 0; i < 4; i++) { diff --git a/Items/Weapons/Summon/WulfrumController.cs b/Items/Weapons/Summon/WulfrumController.cs index 9dff85b70b..4c3c3541a9 100644 --- a/Items/Weapons/Summon/WulfrumController.cs +++ b/Items/Weapons/Summon/WulfrumController.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Buffs.Summon; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; @@ -27,8 +28,8 @@ namespace CalamityMod.Items.Weapons.Summon Item.rare = ItemRarityID.Blue; Item.UseSound = SoundID.Item15; //phaseblade sound effect Item.autoReuse = true; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; } @@ -40,15 +41,9 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.altFunctionUse != 2) - { - position = player.ClampedMouseWorld(); - velocity.X = 0; - velocity.Y = 0; - int droid = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 1f); - if (Main.projectile.IndexInRange(droid)) - Main.projectile[droid].originalDamage = Item.damage; - } + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 1f); + minion.originalDamage = Item.damage; return false; } diff --git a/Items/Weapons/Summon/YharonsKindleStaff.cs b/Items/Weapons/Summon/YharonsKindleStaff.cs index cffe7f5fb8..724f7a5e09 100644 --- a/Items/Weapons/Summon/YharonsKindleStaff.cs +++ b/Items/Weapons/Summon/YharonsKindleStaff.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; using CalamityMod.Sounds; @@ -36,20 +37,16 @@ namespace CalamityMod.Items.Weapons.Summon Item.rare = ModContent.RarityType(); Item.UseSound = CommonCalamitySounds.FlareSound; Item.autoReuse = true; + Item.buffType = ModContent.BuffType(); 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 = player.ClampedMouseWorld(); - int dragon = Projectile.NewProjectile(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(dragon)) - Main.projectile[dragon].originalDamage = Item.damage; - } + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } } diff --git a/Localization/en-US/Mods.CalamityMod.Buffs.hjson b/Localization/en-US/Mods.CalamityMod.Buffs.hjson index efb1a1bdca..ed14a54750 100644 --- a/Localization/en-US/Mods.CalamityMod.Buffs.hjson +++ b/Localization/en-US/Mods.CalamityMod.Buffs.hjson @@ -1138,11 +1138,6 @@ CloudElemental: { Description: The Cloud Elemental will protect you } -GlacialEmbraceBuff: { - DisplayName: Glacial Embrace - Description: The magic of the ancient ice castle will aid you -} - Corroslime: { DisplayName: Corroslime Description: The corroslime will protect you @@ -1198,11 +1193,6 @@ DemonshadeSetDevilBuff: { Description: The red devil will protect you } -LegionofCelestiaBuff: { - DisplayName: Celestial Axe - Description: If only it was this good at chopping trees... -} - EndoCooperBuff: { DisplayName: Endo Cooper Description: The ascened Cooper will protect you @@ -1273,6 +1263,11 @@ GastricAberrationBuff: { Description: The aquatic aberration will protect you } +GlacialEmbraceBuff: { + DisplayName: Glacial Embrace + Description: The magic of the ancient ice castle will aid you +} + HauntedDishesBuff: { DisplayName: Haunted Dishes Description: The haunted dishes will protect you @@ -1323,6 +1318,11 @@ KingofConstellationsBuff: { Description: The celestial dragons will protect you } +LegionofCelestiaBuff: { + DisplayName: Celestial Axe + Description: If only it was this good at chopping trees... +} + LiliesOfFinalityBuff: { DisplayName: Finality Description: Remember our promise