diff --git a/Items/DraedonMisc/EncryptedSchematicPlanetoid.cs b/Items/DraedonMisc/EncryptedSchematicPlanetoid.cs index fb7e5cccf1..6703ab71bd 100644 --- a/Items/DraedonMisc/EncryptedSchematicPlanetoid.cs +++ b/Items/DraedonMisc/EncryptedSchematicPlanetoid.cs @@ -64,7 +64,7 @@ namespace CalamityMod.Items.DraedonMisc rangedDisplay.OverrideColor = new Color(149, 243, 43); list.Insert(insertIndex + 2, rangedDisplay); - int mageItem = ModContent.ItemType(); + int mageItem = ModContent.ItemType(); TooltipLine mageDisplay = new TooltipLine(this.Mod, "CalamityMod:MageDisplay", $"[i:{mageItem}] {CalamityUtils.GetItemName(mageItem)}"); mageDisplay.OverrideColor = new Color(236, 255, 31); list.Insert(insertIndex + 3, mageDisplay); diff --git a/Items/Weapons/DraedonsArsenal/GaussPistol.cs b/Items/Weapons/DraedonsArsenal/GaussPistol.cs deleted file mode 100644 index 445df79e74..0000000000 --- a/Items/Weapons/DraedonsArsenal/GaussPistol.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System; -using System.Collections.Generic; -using CalamityMod.CustomRecipes; -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.DraedonsArsenal; -using CalamityMod.Sounds; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.DraedonsArsenal -{ - public class GaussPistol : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Weapons.DraedonsArsenal"; - public override void SetDefaults() - { - CalamityGlobalItem modItem = Item.Calamity(); - - Item.width = 40; - Item.height = 22; - Item.DamageType = DamageClass.Magic; - Item.mana = 6; - Item.damage = 150; - Item.knockBack = 11f; - Item.useAnimation = Item.useTime = 20; - Item.autoReuse = true; - - Item.useStyle = ItemUseStyleID.Shoot; - Item.UseSound = CommonCalamitySounds.GaussWeaponFire; - Item.noMelee = true; - - Item.value = CalamityGlobalItem.RarityPinkBuyPrice; - Item.rare = ItemRarityID.Pink; - - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 14f; - - modItem.MaxCharge = 85f; - modItem.UsesCharge = true; - modItem.ChargePerUse = 0.05f; - } - - public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 2); - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(12). - AddIngredient(8). - AddRecipeGroup("AnyMythrilBar", 10). - AddIngredient(ItemID.SoulofMight, 20). - AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(2, out Func condition), condition). - AddTile(TileID.MythrilAnvil). - Register(); - } - } -} diff --git a/Items/Weapons/DraedonsArsenal/GaussPistol.png b/Items/Weapons/DraedonsArsenal/GaussPistol.png deleted file mode 100644 index d68e739419..0000000000 Binary files a/Items/Weapons/DraedonsArsenal/GaussPistol.png and /dev/null differ diff --git a/Items/Weapons/DraedonsArsenal/Vulcan.cs b/Items/Weapons/DraedonsArsenal/Vulcan.cs new file mode 100644 index 0000000000..5c7a7f9f4f --- /dev/null +++ b/Items/Weapons/DraedonsArsenal/Vulcan.cs @@ -0,0 +1,77 @@ +using System; +using System.Collections.Generic; +using CalamityMod.CustomRecipes; +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.DraedonsArsenal; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.DraedonsArsenal +{ + [LegacyName("GaussPistol")] + public class Vulcan : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Weapons.DraedonsArsenal"; + public override void SetDefaults() + { + Item.width = 28; + Item.height = 34; + Item.DamageType = DamageClass.Magic; + Item.mana = 11; + Item.damage = 40; + Item.knockBack = 11f; + Item.useAnimation = Item.useTime = 11; + Item.autoReuse = true; + + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.channel = true; + Item.noUseGraphic = true; + + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; + Item.rare = ItemRarityID.Pink; + + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 14f; + } + + public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 2); + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; + public override bool AltFunctionUse(Player player) => true; + public override void HoldItem(Player player) + { + if (Main.myPlayer == player.whoAmI) + player.Calamity().rightClickListener = true; + player.Calamity().mouseWorldListener = true; + } + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/DraedonsArsenal/VulcanGlow").Value); + } + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + float gunType = 0; + if (player.Calamity().mouseRight && player.whoAmI == Main.myPlayer && !Main.mapFullscreen && !Main.blockMouse && player.Calamity().arsenalCooldown <= 0) + gunType = 5; + Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, type, damage, knockback, player.whoAmI, 0, 0, gunType); + + holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero); + return false; + } + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(12). + AddIngredient(8). + AddRecipeGroup("AnyMythrilBar", 10). + AddIngredient(ItemID.SoulofMight, 20). + AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(2, out Func condition), condition). + AddTile(TileID.MythrilAnvil). + Register(); + } + } +} diff --git a/Items/Weapons/DraedonsArsenal/Vulcan.png b/Items/Weapons/DraedonsArsenal/Vulcan.png new file mode 100644 index 0000000000..975227e30f Binary files /dev/null and b/Items/Weapons/DraedonsArsenal/Vulcan.png differ diff --git a/Items/Weapons/DraedonsArsenal/VulcanGlow.png b/Items/Weapons/DraedonsArsenal/VulcanGlow.png new file mode 100644 index 0000000000..8a4e160b58 Binary files /dev/null and b/Items/Weapons/DraedonsArsenal/VulcanGlow.png differ diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.DraedonsArsenal.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.DraedonsArsenal.hjson index 9c176472a5..9b151deb0d 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.DraedonsArsenal.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.DraedonsArsenal.hjson @@ -39,16 +39,6 @@ GaussDagger: { ''' } -GaussPistol: { - DisplayName: Gauss Pistol - Tooltip: - ''' - Fires a devastating high-velocity blast with extreme knockback - [c/1FFBFF:'Though this arcane pistol may seem mundane, it is deceivingly powerful.] - [c/1FFBFF:One of the many advantages of magical firearms is that size does not equal power.'] - ''' -} - HolofiberImmolator: { DisplayName: R-PMA: Holofiber Immolator Tooltip: @@ -265,3 +255,16 @@ WavePounder: { Stealth strikes emit absurdly powerful shockwaves ''' } + +Vulcan: { + DisplayName: R-GSS: Vulcan + Tooltip: + ''' + A mana-fueled Gatling cannon that fires in bursts + Press to launch a magnetic harpoon which attracts your shots + Launching a harpoon makes burst fire mode last longer + When a harpoon expires, all magnetized shots launch at nearby enemies with increased damage + [c/1FFBFF:'Originally a ceiling mounted mining beam, the removal of its battery reduced its heft only marginally.] + [c/1FFBFF:It saw little use and many complaints from the battlemage corps.'] + ''' +} diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Misc.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Misc.hjson index a72179f460..8d9d17c9c7 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Misc.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Misc.hjson @@ -46,6 +46,8 @@ SystemBaneProjectile.DisplayName: System Bane TeslaCannonShot.DisplayName: Tesla Beam UnstableMatter.DisplayName: Unstable Matter VoltageStream.DisplayName: Voltage Stream +VulcanProjectile.DisplayName: Vulcan Shot +VulcanSpear.DisplayName: Vulcanite Lance WavePounderBoom.DisplayName: Explosion WavePounderProjectile.DisplayName: Wave Pounder // Environmental diff --git a/Projectiles/DraedonsArsenal/VulcanFlash.png b/Projectiles/DraedonsArsenal/VulcanFlash.png new file mode 100644 index 0000000000..3fc2d1e1d9 Binary files /dev/null and b/Projectiles/DraedonsArsenal/VulcanFlash.png differ diff --git a/Projectiles/DraedonsArsenal/VulcanHoldout.cs b/Projectiles/DraedonsArsenal/VulcanHoldout.cs new file mode 100644 index 0000000000..c2805e2ff1 --- /dev/null +++ b/Projectiles/DraedonsArsenal/VulcanHoldout.cs @@ -0,0 +1,268 @@ +using System; +using CalamityMod.Cooldowns; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.DraedonsArsenal; +using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Utilities; +using Terraria; +using Terraria.Audio; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.DraedonsArsenal +{ + public class VulcanHoldout : BaseGunHoldoutProjectile + { + public new string LocalizationCategory => "Projectiles.Misc"; + public override int AssociatedItemID => ModContent.ItemType(); + + public float offsetBase = 35; + public override float MaxOffsetLengthFromArm => offsetBase; + public override float RecoilResolveSpeed => 0.2f; + public override float OffsetXUpwards => 0f; + public override float BaseOffsetY => 0f; + public override float OffsetYDownwards => 0f; + public override float WeaponTurnSpeed => (shootingTimer < 0 ? 0 : 0.35f); + public bool firingSpear => Projectile.ai[2] == 5; + public ref float shootingTimer => ref Projectile.ai[0]; + public ref float fireRate => ref Projectile.ai[1]; + public int time = 0; + public int maxShots = 25; + public int shotsToFire = 0; + public bool playRampDown = false; + public int shotsFired = 0; + public float heatVis = 0; + public float flashVis1 = 0; + public float flashVis2 = 0; + public float spearVis = 1; + public int cooldownGiven = 180; + public bool failedManaCheck = false; + public int spearFakeCooldown = 0; + + + public override void KillHoldoutLogic() + { + + } + public override void HoldoutAI() + { + if (flashVis1 > 0) flashVis1 -= 0.2f; if (flashVis1 < 0) flashVis1 = 0; + if (flashVis2 > 0) flashVis2 -= 0.2f; if (flashVis2 < 0) flashVis2 = 0; + + if (time == 0) + { + if (Owner.Calamity().arsenalCooldown > 0) + spearVis = 0; + shootingTimer = -20; + fireRate = Owner.HeldItem.useAnimation; + shotsToFire = maxShots; + OffsetLengthFromArm = offsetBase; + } + if (shootingTimer < 0) + { + // Light cooldown after firing + if (shootingTimer == -20 || shootingTimer == -1) + { + if ((!Main.mouseLeft && !firingSpear) || failedManaCheck) + { + Projectile.Kill(); + return; + } + } + if (playRampDown) + { + SoundStyle sound = new("CalamityMod/Sounds/Item/VulcanRampDown"); + for (int i = 0; i < 2; i++) + SoundEngine.PlaySound(sound with { Volume = 0.9f, MaxInstances = -1 }, Projectile.Center); + playRampDown = false; + } + if (shootingTimer == -20) + { + SoundStyle sound2 = new("CalamityMod/Sounds/Item/VulcanRampUp"); + for (int i = 0; i < 2; i++) + SoundEngine.PlaySound(sound2 with { Volume = 0.9f, MaxInstances = -1 }, Projectile.Center); + } + if (shootingTimer == -1) + { + if (!firingSpear) + shootingTimer = fireRate; + else + shootingTimer = 0; + shotsToFire = maxShots; + fireRate = Owner.HeldItem.useAnimation; + shotsFired = 0; + playRampDown = true; + } + Projectile.velocity = Owner.Center.DirectionTo(Owner.Calamity().mouseWorld); + } + if (Owner.Calamity().mouseRight && Owner.Calamity().arsenalCooldown <= 0) + { + Projectile.ai[2] = 5; + } + if (firingSpear && time > 20 && spearFakeCooldown <= 0) + { + Shoot(true); + spearFakeCooldown = 5; + shotsToFire = maxShots; + Projectile.ai[2] = 0; + Owner.Calamity().arsenalCooldown = cooldownGiven; + Owner.AddCooldown(ArsenalPower.ID, cooldownGiven); + } + if (shootingTimer >= 0) + { + if (!Main.mouseLeft && !firingSpear) + shotsToFire = 0; + + if (!firingSpear) + { + if (shotsToFire <= 0) + shootingTimer = -50; + else if (shootingTimer >= fireRate) + { + if (Owner.CheckMana(HeldItem, -1, true, false)) + { + Shoot(false); + + if (shotsFired % 2 == 0) flashVis1 = 1; + else flashVis2 = 1; + + shootingTimer = -1; + if (shotsToFire > maxShots * 0.2f) + { + fireRate -= 1; + if (fireRate < 3) + fireRate = 3; + } + else if (fireRate < Owner.HeldItem.useAnimation) + fireRate += 1; + if (fireRate > Owner.HeldItem.useAnimation) + fireRate = Owner.HeldItem.useAnimation; + + } + else + { + failedManaCheck = true; + shotsToFire = 0; + } + + shotsToFire--; + shotsFired++; + if (shotsToFire <= 0) + { + shootingTimer = -50; + } + } + } + } + if (shotsFired > 0 && shotsToFire > 0) + { + heatVis = MathHelper.Lerp(heatVis, 1, 0.007f); + } + else + heatVis = MathHelper.Lerp(heatVis, 0, 0.085f); + + spearVis = Utils.GetLerpValue(cooldownGiven / 2, 0, Owner.Calamity().arsenalCooldown, true); + spearFakeCooldown--; + + time++; + shootingTimer++; + } + public void Shoot(bool isSpear) + { + if (isSpear) + { + Vector2 spearPos = GunTipPosition + Projectile.velocity.RotatedBy(MathHelper.PiOver2 * Projectile.direction) * 12 - Projectile.velocity * 8; + Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedByRandom(0f) * 6f; + Owner.Calamity().GeneralScreenShakePower = 3.5f; + OffsetLengthFromArm -= 16; + SoundStyle sound = new("CalamityMod/Sounds/Item/GunShotHeavy"); + SoundEngine.PlaySound(sound with { Volume = 0.8f, Pitch = 0.8f }, Projectile.Center); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), spearPos, shootVelocity, ModContent.ProjectileType(), Projectile.damage * 5, 0, Projectile.owner); + } + else + { + Owner.Calamity().GeneralScreenShakePower = 1f; + OffsetLengthFromArm -= 7; + SoundStyle sound = new("CalamityMod/Sounds/Item/VulcanShot"); + SoundEngine.PlaySound(sound with { Volume = 0.6f, Pitch = Main.rand.NextFloat(-0.1f, 0), MaxInstances = 1 }, Projectile.Center); + + Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedByRandom(0f) * 6f; + Vector2 position = GunTipPosition + Projectile.velocity.RotatedBy(MathHelper.PiOver2 * (shotsFired % 2 == 0 ? -1 : 1)) * 4; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), position, shootVelocity, ModContent.ProjectileType(), Projectile.damage, 0, Projectile.owner); + + for (int i = 0; i < 4; i++) + { + Dust dust = Dust.NewDustPerfect(position, Main.rand.NextBool(3) ? ModContent.DustType() : Effects.ArsenalEffects.ArsenalGaussDust, (shootVelocity * 4).RotatedByRandom(0.05f) * Main.rand.NextFloat(0.1f, 0.8f), 0, default, Main.rand.NextFloat(0.7f, 1.1f)); + dust.noGravity = true; + dust.color = Effects.ArsenalEffects.ArsenalGaussColor; + } + } + } + public override bool PreDraw(ref Color lightColor) + { + if (time < 2) + return false; + + Texture2D texture = ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/VulcanHoldout").Value; + Texture2D glow = ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/VulcanHoldoutGlow").Value; + Texture2D flash = ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/VulcanFlash").Value; + Texture2D spear = ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/VulcanSpear").Value; + Texture2D spearGlow = ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/VulcanSpearGlow").Value; + Texture2D heat = ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/VulcanHoldoutHeatedTip").Value; + if (Owner.Calamity().arsenalCooldown <= 0 && false) + { + texture = ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/VulcanHoldoutSpear").Value; + glow = ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/VulcanHoldoutSpearGlow").Value; + } + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Vector2 vel = Projectile.rotation.ToRotationVector2(); + + float randSize = Main.rand.NextFloat(0.9f, 1f); + Color drawColor = Projectile.GetAlpha(lightColor); + float drawRotation = Projectile.rotation + (Projectile.direction == -1 ? MathHelper.Pi : 0f); + Vector2 rotationPoint = texture.Size() * 0.5f; + SpriteEffects flipSprite = Projectile.direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + int draws = 8; + + Vector2 spearPos = GunTipPosition + vel.RotatedBy(MathHelper.PiOver2 * Projectile.direction) * 12 - vel * 27 - Main.screenPosition; + for (int i = 0; i < draws; i++) + { + float fadeIn = Math.Min(Utils.GetLerpValue(0, 0.8f, spearVis), (float)Math.Pow(Utils.GetLerpValue(1, 0.8f, spearVis), 2)); + Vector2 offset = (MathHelper.TwoPi / draws * i).ToRotationVector2() * 6 * (1 - spearVis); + Main.EntitySpriteDraw(spear, spearPos + offset, null, Effects.ArsenalEffects.ArsenalGaussColor with { A = 0 } * fadeIn * 0.5f, drawRotation, spear.Size() * 0.5f, Projectile.scale, flipSprite); + Main.EntitySpriteDraw(spear, spearPos, null, Color.Lerp(Effects.ArsenalEffects.ArsenalGaussColor with { A = 0 }, drawColor, spearVis) * spearVis, drawRotation, spear.Size() * 0.5f, Projectile.scale, flipSprite); + } + Main.EntitySpriteDraw(spearGlow, spearPos, null, Color.White * spearVis, drawRotation, spearGlow.Size() * 0.5f, Projectile.scale, flipSprite); + + Main.EntitySpriteDraw(texture, drawPosition, null, drawColor, drawRotation, rotationPoint, Projectile.scale, flipSprite); + + Main.EntitySpriteDraw(glow, drawPosition, null, Color.White, drawRotation, rotationPoint, Projectile.scale, flipSprite); + + for (int i = 0; i < draws; i++) + { + Vector2 offset = (MathHelper.TwoPi / draws * i).ToRotationVector2() * 4 * heatVis; + Main.EntitySpriteDraw(heat, drawPosition + offset, null, Effects.ArsenalEffects.ArsenalGaussColor with { A = 0 } * heatVis * 0.35f, drawRotation, heat.Size() * 0.5f, Projectile.scale, flipSprite); + Main.EntitySpriteDraw(heat, drawPosition, null, Color.White with { A = 0 } * heatVis * 0.3f, drawRotation, heat.Size() * 0.5f, Projectile.scale, flipSprite); + } + + float tipSeperation = 4; + // Tip flash 1 + if (flashVis1 > 0) + { + Vector2 position = GunTipPosition + vel * (12 + 30 * (1 - flashVis1)) + vel.RotatedBy(MathHelper.PiOver2) * tipSeperation - Main.screenPosition; + for (int i = 0; i < 3; i++) + Main.EntitySpriteDraw(flash, position, null, Color.White with { A = 0 } * flashVis1, drawRotation, flash.Size() * 0.5f, new Vector2(0.5f + 2f * (1 - flashVis1), 1 - 0.8f * flashVis1) * Projectile.scale, flipSprite); + } + // Tip flash 1 + if (flashVis2 > 0) + { + Vector2 position = GunTipPosition + vel * (12 + 30 * (1 - flashVis2)) + vel.RotatedBy(-MathHelper.PiOver2) * tipSeperation - Main.screenPosition; + for (int i = 0; i < 3; i++) + Main.EntitySpriteDraw(flash, position, null, Color.White with { A = 0 } * flashVis2, drawRotation, flash.Size() * 0.5f, new Vector2(0.5f + 2f * (1 - flashVis2), 1 - 0.8f * flashVis2) * Projectile.scale, flipSprite); + } + return false; + } + } +} diff --git a/Projectiles/DraedonsArsenal/VulcanHoldout.png b/Projectiles/DraedonsArsenal/VulcanHoldout.png new file mode 100644 index 0000000000..3df7e215ab Binary files /dev/null and b/Projectiles/DraedonsArsenal/VulcanHoldout.png differ diff --git a/Projectiles/DraedonsArsenal/VulcanHoldoutGlow.png b/Projectiles/DraedonsArsenal/VulcanHoldoutGlow.png new file mode 100644 index 0000000000..5a1c73ba6c Binary files /dev/null and b/Projectiles/DraedonsArsenal/VulcanHoldoutGlow.png differ diff --git a/Projectiles/DraedonsArsenal/VulcanHoldoutHeatedTip.png b/Projectiles/DraedonsArsenal/VulcanHoldoutHeatedTip.png new file mode 100644 index 0000000000..a6efb3b878 Binary files /dev/null and b/Projectiles/DraedonsArsenal/VulcanHoldoutHeatedTip.png differ diff --git a/Projectiles/DraedonsArsenal/VulcanHoldoutSpear.png b/Projectiles/DraedonsArsenal/VulcanHoldoutSpear.png new file mode 100644 index 0000000000..5a4cb9de3d Binary files /dev/null and b/Projectiles/DraedonsArsenal/VulcanHoldoutSpear.png differ diff --git a/Projectiles/DraedonsArsenal/VulcanHoldoutSpearGlow.png b/Projectiles/DraedonsArsenal/VulcanHoldoutSpearGlow.png new file mode 100644 index 0000000000..3eaba56e73 Binary files /dev/null and b/Projectiles/DraedonsArsenal/VulcanHoldoutSpearGlow.png differ diff --git a/Projectiles/DraedonsArsenal/VulcanProjectile.cs b/Projectiles/DraedonsArsenal/VulcanProjectile.cs new file mode 100644 index 0000000000..8f805e1a94 --- /dev/null +++ b/Projectiles/DraedonsArsenal/VulcanProjectile.cs @@ -0,0 +1,116 @@ +using System; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.DraedonsArsenal +{ + public class VulcanProjectile : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Misc"; + public ref float time => ref Projectile.ai[0]; + public override void SetDefaults() + { + Projectile.width = Projectile.height = 20; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.timeLeft = 720; + Projectile.extraUpdates = 8; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 20 * Projectile.MaxUpdates; + } + public override void AI() + { + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + if (time > 120 && Projectile.penetrate > 1) + Projectile.penetrate = 1; + + if (time > 60 && Projectile.extraUpdates > 2 && time % 4 == 0) + Projectile.extraUpdates--; + + if (Projectile.velocity.Length() < 5) + Projectile.velocity *= 1.01f; + if (targetDist < 1400) + { + if (true) + { + Particle trail = new CustomSpark(Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.UnitX) * 6, Projectile.velocity * 0.2f, "CalamityMod/Particles/BloomCircle", false, 6, 0.15f, Effects.ArsenalEffects.ArsenalGaussColor * 0.9f, new Vector2(1f, 1f), true, true, glowCenterScale: 0.6f, glowOpacity: 0.8f, shrinkSpeed: 0.9f); + GeneralParticleHandler.SpawnParticle(trail); + } + if (time % 17 == 0) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(4, 4), Effects.ArsenalEffects.ArsenalGaussDust); + dust.velocity = Vector2.One.RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(0.1f, 0.2f); + dust.scale = Main.rand.NextFloat(0.7f, 0.85f); + dust.noGravity = true; + dust.color = Effects.ArsenalEffects.ArsenalGaussColor; + dust.noLightEmittence = time % 9 != 0; + dust.fadeIn = 0.3f; + } + } + + time++; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + impactDust(); + + Vector2 launchVel = Projectile.velocity.SafeNormalize(Vector2.UnitX); + float launchPower = 4; + target.MoveNPC(launchVel, launchPower, true); + } + + public override void OnKill(int timeLeft) + { + impactDust(); + } + public void impactDust() + { + for (int i = 0; i < 3; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType()); + dust.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedByRandom(0.1f) * Main.rand.NextFloat(9f, 19f); + dust.scale = Main.rand.NextFloat(0.6f, 0.85f); + dust.noGravity = true; + dust.color = Effects.ArsenalEffects.ArsenalGaussColor; + dust.noLightEmittence = true; + } + } + public override bool PreDraw(ref Color lightColor) + { + Texture2D proj = ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/VulcanProjectile").Value; + proj = ModContent.Request("CalamityMod/Particles/SquareRotated").Value; + + Texture2D square = ModContent.Request("CalamityMod/Particles/GlowSquareParticleThick").Value; + + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Vector2 vel = Projectile.rotation.ToRotationVector2(); + + Color drawColor = Effects.ArsenalEffects.ArsenalGaussColor with { A = 0 }; + float drawRotation = Projectile.velocity.ToRotation(); + Vector2 rotationPoint = proj.Size() * 0.5f; + + int rate = 50; + + float shrink = Utils.GetLerpValue(rate - 1, 0, time % rate); + float fade = Math.Min((float)Math.Pow(Utils.GetLerpValue(0, rate * 0.8f, time % rate, true), 3), (float)Math.Pow(Utils.GetLerpValue(rate - 1, rate * 0.8f, time % 30, true), 3)); + float speed = Utils.GetLerpValue(2, 10, Projectile.extraUpdates); + Vector2 squash = new Vector2(1 + 2 * speed, 1 - 0.3f * speed); + + for (int i = 0; i < 2; i++) + Main.EntitySpriteDraw(square, drawPosition, null, drawColor * fade * (1 - speed), drawRotation + MathHelper.PiOver4, square.Size() * 0.5f, Projectile.scale * (0.05f + 0.2f * shrink), SpriteEffects.None); + + + Main.EntitySpriteDraw(proj, drawPosition, null, drawColor, drawRotation, rotationPoint, squash * Projectile.scale * 0.1f, SpriteEffects.None); + Main.EntitySpriteDraw(proj, drawPosition, null, Color.White with { A = 0 }, drawRotation, rotationPoint, squash * Projectile.scale * 0.06f, SpriteEffects.None); + return false; + } + } +} diff --git a/Projectiles/DraedonsArsenal/VulcanProjectile.png b/Projectiles/DraedonsArsenal/VulcanProjectile.png new file mode 100644 index 0000000000..f5adc1fd7f Binary files /dev/null and b/Projectiles/DraedonsArsenal/VulcanProjectile.png differ diff --git a/Projectiles/DraedonsArsenal/VulcanSpear.cs b/Projectiles/DraedonsArsenal/VulcanSpear.cs new file mode 100644 index 0000000000..6b3f79e602 --- /dev/null +++ b/Projectiles/DraedonsArsenal/VulcanSpear.cs @@ -0,0 +1,199 @@ +using System; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.DraedonsArsenal +{ + public class VulcanSpear : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Misc"; + public ref float time => ref Projectile.ai[0]; + + public NPC targeted; + public bool stuckInGround = false; + public bool canDamage => (targeted == null && !stuckInGround); + public bool canStick = true; + public int stuckTimer = 420; + public Vector2 placementCenter; + Vector2 placementVelocity; + public override void SetDefaults() + { + Projectile.width = Projectile.height = 35; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.timeLeft = 1200; + Projectile.extraUpdates = 30; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + public override void AI() + { + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + + Lighting.AddLight(Projectile.Center, Effects.ArsenalEffects.ArsenalGaussColor.ToVector3() * 0.5f); + if (targetDist < 1400 && canDamage) + { + if (time % 2 == 0) + { + Particle trail = new CustomSpark(Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 14, Projectile.velocity * 0.2f, "CalamityMod/Particles/BloomCircle", false, 12, 0.065f, Effects.ArsenalEffects.ArsenalGaussColor, new Vector2(1f, 2.5f), true, true, glowCenterScale: 0.7f, shrinkSpeed: 0.4f); + GeneralParticleHandler.SpawnParticle(trail); + } + } + + if (!stuckInGround && targeted == null && Collision.SolidCollision(Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.UnitX) * 15, 6, 6)) + { + Projectile.extraUpdates = 0; + stuckInGround = true; + SoundStyle hitTile = new("CalamityMod/Sounds/NPCHit/ExoHit3"); + SoundEngine.PlaySound(hitTile with { Volume = 0.8f, Pitch = Main.rand.NextFloat(0.1f, 0.2f) }, Projectile.Center); + //Get stuck in the ground and fade + } + if (targeted != null && (!targeted.active || targeted.life <= 0)) + targeted = null; + if (targeted != null) + { + Projectile.Center = targeted.Center - placementCenter; + } + else if (Projectile.numHits > 0) + { + Projectile.timeLeft = 1; + } + if (stuckInGround || targeted != null) + { + foreach (Projectile p in Main.ActiveProjectiles) + { + float dist = Utils.Distance(Projectile.Center, p.Center); + if (p.type == ModContent.ProjectileType() && dist <= 900 && p.ai[0] > 120) + { + if (p.velocity.Length() < 6) + p.velocity += p.Center.DirectionTo(Projectile.Center) * Utils.GetLerpValue(1500, 50, dist) * 0.9f; + else + p.velocity *= 0.9f; + if (p.ai[0] % 2 == 0) + p.timeLeft++; + } + } + } + if (!canDamage && Projectile.timeLeft > 300) + Projectile.timeLeft = 300; + time++; + if (Projectile.timeLeft == 35) + { + SoundStyle sound2 = new("CalamityMod/Sounds/Item/VulcanRampUp"); + for (int i = 0; i < 2; i++) + SoundEngine.PlaySound(sound2 with { Volume = 0.9f, MaxInstances = 5, Pitch = -0.4f }, Projectile.Center); + } + } + public override void OnKill(int timeLeft) + { + SoundStyle die = new("CalamityMod/Sounds/NPCHit/ExoHit2"); + SoundEngine.PlaySound(die with { Volume = 0.8f, Pitch = Main.rand.NextFloat(0.4f, 0.5f), MaxInstances = 5 }, Projectile.Center); + SoundStyle sound2 = new("CalamityMod/Sounds/Item/NidhoggFire"); + for (int i = 0; i < 2; i++) + SoundEngine.PlaySound(sound2 with { Volume = 0.8f, MaxInstances = 5, Pitch = -0.1f }, Projectile.Center); + foreach (Projectile p in Main.ActiveProjectiles) + { + float dist = Utils.Distance(Projectile.Center, p.Center); + if (p.type == ModContent.ProjectileType() && dist <= 500) + { + NPC closeTarget = p.Center.ClosestNPCAt(800); + if (closeTarget != null) + p.velocity = p.Center.DirectionTo(closeTarget.Center) * 7; + else + p.velocity = Projectile.Center.DirectionTo(p.Center) * 7; + p.extraUpdates = 8; + p.ai[0] = 0; + p.penetrate = 5; + if (p.ai[1] < 4) // Pretty much just so gfb can't oneshot everything + { + p.damage = (int)(p.damage * 2f); + p.ai[1]++; + } + p.timeLeft = Main.rand.Next(100, 120 + 1); + } + } + Particle bolt = new CustomPulse(Projectile.Center, Vector2.Zero, Effects.ArsenalEffects.ArsenalGaussColor, "CalamityMod/Particles/GlowSquareParticleThick", Vector2.One, MathHelper.PiOver4, 0.1f, 0.7f, 15); + GeneralParticleHandler.SpawnParticle(bolt); + Particle bolt2 = new CustomPulse(Projectile.Center, Vector2.Zero, Effects.ArsenalEffects.ArsenalGaussColor, "CalamityMod/Particles/GlowSquareParticleBig", Vector2.One, 0, 0.3f, 1.15f, 10); + GeneralParticleHandler.SpawnParticle(bolt2); + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + impactDust(); + + Vector2 launchVel = Projectile.velocity.SafeNormalize(Vector2.UnitX); + float launchPower = 12; + target.MoveNPC(launchVel, launchPower, true); + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if (target.life <= 0 && target.realLife == -1) + { + // Don't stick into dead enemies + Projectile.numHits--; + } + else if (targeted == null && !stuckInGround) + { + //Stick + Projectile.extraUpdates = 0; + SoundStyle hitTile = new("CalamityMod/Sounds/NPCHit/ExoHit1"); + SoundEngine.PlaySound(hitTile with { Volume = 0.8f, Pitch = Main.rand.NextFloat(0.1f, 0.2f) }, Projectile.Center); + targeted = target; + placementCenter = targeted.Center - Projectile.Center; + } + } + public override bool? CanDamage() => canDamage ? null : false; + public override bool ShouldUpdatePosition() + { + return canDamage; + } + public void impactDust() + { + for (int i = 0; i < 7; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType()); + dust.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedByRandom(0.15f) * Main.rand.NextFloat(12f, 19f); + dust.scale = Main.rand.NextFloat(0.8f, 1.35f); + dust.noGravity = true; + dust.color = Effects.ArsenalEffects.ArsenalGaussColor; + dust.noLightEmittence = true; + } + } + public override bool PreDraw(ref Color lightColor) + { + Texture2D proj = ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/VulcanSpear").Value; + Texture2D glow = ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/VulcanSpearGlow").Value; + + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Vector2 vel = Projectile.rotation.ToRotationVector2(); + + Color drawColor = Effects.ArsenalEffects.ArsenalGaussColor with { A = 0 }; + float drawRotation = Projectile.velocity.ToRotation() + (Projectile.direction == -1 ? MathHelper.Pi : 0f); + Vector2 rotationPoint = proj.Size() * 0.5f; + SpriteEffects flipSprite = Projectile.direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + Main.EntitySpriteDraw(proj, drawPosition, null, lightColor, drawRotation, rotationPoint, Projectile.scale, flipSprite); + Main.EntitySpriteDraw(glow, drawPosition, null, Color.White, drawRotation, rotationPoint, Projectile.scale, flipSprite); + + int draws = 16; + for (int i = 0; i < draws; i++) + { + float fadeIn = (float)Math.Pow(Utils.GetLerpValue(300, 1, Projectile.timeLeft, true), 3); + Vector2 offset = (MathHelper.TwoPi / draws * i).ToRotationVector2() * 3 * fadeIn; + Main.EntitySpriteDraw(proj, Projectile.Center - Main.screenPosition + offset + Main.rand.NextVector2Circular(3, 3) * fadeIn, null, Effects.ArsenalEffects.ArsenalGaussColor with { A = 0 } * fadeIn * 0.5f, drawRotation, proj.Size() * 0.5f, Projectile.scale, flipSprite); + Main.EntitySpriteDraw(proj, Projectile.Center - Main.screenPosition, null, Color.White with { A = 0 } * fadeIn, drawRotation, proj.Size() * 0.5f, Projectile.scale, flipSprite); + } + + return false; + } + } +} diff --git a/Projectiles/DraedonsArsenal/VulcanSpear.png b/Projectiles/DraedonsArsenal/VulcanSpear.png new file mode 100644 index 0000000000..cfcab36090 Binary files /dev/null and b/Projectiles/DraedonsArsenal/VulcanSpear.png differ diff --git a/Projectiles/DraedonsArsenal/VulcanSpearGlow.png b/Projectiles/DraedonsArsenal/VulcanSpearGlow.png new file mode 100644 index 0000000000..c010c5ec95 Binary files /dev/null and b/Projectiles/DraedonsArsenal/VulcanSpearGlow.png differ diff --git a/Sounds/Item/VulcanRampDown.ogg b/Sounds/Item/VulcanRampDown.ogg new file mode 100644 index 0000000000..3463218167 Binary files /dev/null and b/Sounds/Item/VulcanRampDown.ogg differ diff --git a/Sounds/Item/VulcanRampUp.ogg b/Sounds/Item/VulcanRampUp.ogg new file mode 100644 index 0000000000..63a160b201 Binary files /dev/null and b/Sounds/Item/VulcanRampUp.ogg differ diff --git a/Sounds/Item/VulcanShot.ogg b/Sounds/Item/VulcanShot.ogg new file mode 100644 index 0000000000..11c7584d26 Binary files /dev/null and b/Sounds/Item/VulcanShot.ogg differ diff --git a/Systems/Collections/MagicGunIDList.cs b/Systems/Collections/MagicGunIDList.cs index 9bce514ec6..12a5a0174e 100644 --- a/Systems/Collections/MagicGunIDList.cs +++ b/Systems/Collections/MagicGunIDList.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Systems.Collections ItemType(), ItemType(), ItemType(), - ItemType(), + ItemType(), ItemType(), ItemType(), ItemType(),