diff --git a/Buffs/Summon/AqueousHunterDroneBuff.cs b/Buffs/Summon/AqueousHunterDroneBuff.cs new file mode 100644 index 0000000000..292d0df8e0 --- /dev/null +++ b/Buffs/Summon/AqueousHunterDroneBuff.cs @@ -0,0 +1,12 @@ +using CalamityMod.Projectiles.DraedonsArsenal; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Summon +{ + public class AqueousHunterDroneBuff : BaseSummonBuff + { + protected override int MinionProjectileType => ModContent.ProjectileType(); + + protected override ref bool MinionBool => ref BuffModdedOwner.aqueousHunterDrone; + } +} diff --git a/Buffs/Summon/AqueousHunterDroneBuff.png b/Buffs/Summon/AqueousHunterDroneBuff.png new file mode 100644 index 0000000000..a83fffb582 Binary files /dev/null and b/Buffs/Summon/AqueousHunterDroneBuff.png differ diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index aa354013f5..f62517ee01 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -1515,6 +1515,7 @@ namespace CalamityMod.CalPlayer public bool starSwallowerPetFroge = false; public bool snakeEyes = false; public bool poleWarper = false; + public bool aqueousHunterDrone = false; public bool causticDragon = false; public bool plaguebringerPatronSummon = false; public bool howlTrio = false; @@ -2664,6 +2665,7 @@ namespace CalamityMod.CalPlayer starSwallowerPetFroge = false; snakeEyes = false; poleWarper = false; + aqueousHunterDrone = false; causticDragon = false; plaguebringerPatronSummon = false; howlTrio = false; diff --git a/Effects/ArsenalEffects.cs b/Effects/ArsenalEffects.cs index 41ecff817f..c0a21645a7 100644 --- a/Effects/ArsenalEffects.cs +++ b/Effects/ArsenalEffects.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Effects // Plasma public static int ArsenalPlasmaDust = ModContent.DustType(); - public static Color ArsenalPlasmaColor = Color.Lerp(Color.Green, Color.Chartreuse, 0.45f); + public static Color ArsenalPlasmaColor = new Color(154, 255, 0); // Laser public static int ArsenalLaserDust = ModContent.DustType(); public static Color ArsenalLaserColor = Color.Lerp(Color.Crimson, Color.Red, 0.45f); diff --git a/Items/DraedonMisc/EncryptedSchematicSunkenSea.cs b/Items/DraedonMisc/EncryptedSchematicSunkenSea.cs index 3af6d8f825..105dd1799c 100644 --- a/Items/DraedonMisc/EncryptedSchematicSunkenSea.cs +++ b/Items/DraedonMisc/EncryptedSchematicSunkenSea.cs @@ -76,7 +76,7 @@ namespace CalamityMod.Items.DraedonMisc mageDisplay.OverrideColor = new Color(201, 41, 255); list.Insert(insertIndex + 3, mageDisplay); - int summonItem = ModContent.ItemType(); + int summonItem = ModContent.ItemType(); TooltipLine summonDisplay = new TooltipLine(this.Mod, "CalamityMod:SummonDisplay", $"[i:{summonItem}] {CalamityUtils.GetItemName(summonItem)}"); summonDisplay.OverrideColor = new Color(149, 243, 43); list.Insert(insertIndex + 4, summonDisplay); diff --git a/Items/Weapons/DraedonsArsenal/StarSwallowerContainmentUnit.cs b/Items/Weapons/DraedonsArsenal/AqueousHunterDrone.cs similarity index 66% rename from Items/Weapons/DraedonsArsenal/StarSwallowerContainmentUnit.cs rename to Items/Weapons/DraedonsArsenal/AqueousHunterDrone.cs index 15fda0cf58..d539d7fa94 100644 --- a/Items/Weapons/DraedonsArsenal/StarSwallowerContainmentUnit.cs +++ b/Items/Weapons/DraedonsArsenal/AqueousHunterDrone.cs @@ -1,28 +1,36 @@ using System; using System.Collections.Generic; +using CalamityMod.Cooldowns; using CalamityMod.CustomRecipes; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.SunkenSea; using CalamityMod.Projectiles.DraedonsArsenal; using Microsoft.Xna.Framework; +using rail; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.DraedonsArsenal { - public class StarSwallowerContainmentUnit : ModItem, ILocalizedModType + public class AqueousHunterDrone : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.DraedonsArsenal"; + public static readonly SoundStyle Fire = new("CalamityMod/Sounds/Item/ShrimpFire"); + public static readonly SoundStyle Hit = new("CalamityMod/Sounds/Item/ShrimpMissileHit"); + public static readonly SoundStyle Sound1 = new("CalamityMod/Sounds/Item/ShrimpSound1"); + public static readonly SoundStyle Sound2 = new("CalamityMod/Sounds/Item/ShrimpSound2"); + public static readonly SoundStyle Surprise = new("CalamityMod/Sounds/Item/ShrimpSurprise"); public override void SetDefaults() { CalamityGlobalItem modItem = Item.Calamity(); - Item.width = 18; - Item.height = 28; + Item.width = 34; + Item.height = 32; Item.shootSpeed = 10f; - Item.damage = 24; + Item.damage = 31; Item.mana = 10; Item.useAnimation = Item.useTime = 30; Item.useStyle = ItemUseStyleID.HoldUp; @@ -30,33 +38,25 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.knockBack = 2.25f; Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; - Item.UseSound = SoundID.Item15; Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; - - modItem.UsesCharge = true; - modItem.MaxCharge = 50f; - modItem.ChargePerUse = 0.8f; - modItem.ChargePerAltUse = 0f; } - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { Vector2 mouse = player.ClampedMouseWorld(); Point mouseTileCoords = mouse.ToTileCoordinates(); - if (!CalamityUtils.ParanoidTileRetrieval(mouseTileCoords.X, mouseTileCoords.Y).HasTile) + if (!CalamityUtils.ParanoidTileRetrieval(mouseTileCoords.X, mouseTileCoords.Y).HasTile /*&& player.ownedProjectileCounts[Item.shoot] <= 0*/) { - int p = Projectile.NewProjectile(source, mouse, Vector2.Zero, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, new Vector2(mouse.X, player.Center.Y - 600), Vector2.Zero, type, damage, knockback, player.whoAmI); + Main.projectile[p].localAI[2] = player.ownedProjectileCounts[Item.shoot]; if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; } return false; } - public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 1); - public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/DraedonsArsenal/AqueousHunterDrone.png b/Items/Weapons/DraedonsArsenal/AqueousHunterDrone.png new file mode 100644 index 0000000000..4c5c16cd38 Binary files /dev/null and b/Items/Weapons/DraedonsArsenal/AqueousHunterDrone.png differ diff --git a/Items/Weapons/DraedonsArsenal/AqueousHunterDroneGlow.png b/Items/Weapons/DraedonsArsenal/AqueousHunterDroneGlow.png new file mode 100644 index 0000000000..b069a6dde7 Binary files /dev/null and b/Items/Weapons/DraedonsArsenal/AqueousHunterDroneGlow.png differ diff --git a/Localization/en-US/Mods.CalamityMod.Buffs.hjson b/Localization/en-US/Mods.CalamityMod.Buffs.hjson index ed14a54750..9eb3262493 100644 --- a/Localization/en-US/Mods.CalamityMod.Buffs.hjson +++ b/Localization/en-US/Mods.CalamityMod.Buffs.hjson @@ -1073,6 +1073,11 @@ AquaticStar: { Description: The aquatic star will protect you } +AqueousHunterDroneBuff: { + DisplayName: Aqueous Hunter Drone Buff + Description: shimp +} + AstralProbeBuff: { DisplayName: Astral Probe Description: The astral probe will protect you diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.DraedonsArsenal.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.DraedonsArsenal.hjson index a1ee116328..045c3cca64 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.DraedonsArsenal.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.DraedonsArsenal.hjson @@ -10,6 +10,18 @@ AerialTracker: { ''' } +AqueousHunterDrone: { + DisplayName: Aqueous Hunter Drone + Tooltip: + ''' + Summons a shrimp drone that fires bursts of homing plasma missiles + Pressing while holding any summon weapon will make the shrimp fire vertical missiles + These missiles will fall at your cursor and leave a lingering blast if they hit tiles + Each shrimp costs 4 minion slots + [c/1FFBFF:'yum shimp.'] + ''' +} + Auger: { DisplayName: P-GSS: Auger Tooltip: @@ -223,16 +235,6 @@ SnakeEyes: { ''' } -StarSwallowerContainmentUnit: { - DisplayName: Star Swallower Containment Unit - Tooltip: - ''' - Summons a biomechanical frog that vomits plasma onto enemies - [c/1FFBFF:'These simplistic creatures were mechanized to autonomously transport plasma.] - [c/1FFBFF:They are vastly more servicable than their mundane organic counterparts.'] - ''' -} - SystemBane: { DisplayName: System Bane Tooltip: diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Misc.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Misc.hjson index 9dc5d84ee5..89933d995f 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Misc.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Misc.hjson @@ -8,6 +8,7 @@ AnomalysNanogunHoldout.DisplayName: The Anomaly's Nanogun AnomalysNanogunMPFBBoom.DisplayName: MPFB Explosion AnomalysNanogunMPFBDevastator.DisplayName: MPFB Devastator AnomalysNanogunPlasmaBeam.DisplayName: Plasma Beam +AqueousHunterDroneSummon.DisplayName: Aqueous Hunter Drone AugerHoldout.DisplayName: P-GSS Auger AugerSlash.DisplayName: Auger Slash AugerPull.DisplayName: Auger Pull @@ -82,3 +83,4 @@ PlagueShotBuffer.DisplayName: Plague Shot WaterShot.DisplayName: Water Shot WaterShotBuffer.DisplayName: Water Shot FrequencyManipulatorEnergy.DisplayName: Frequency Manipulator Energy +ShrimpPlasmaMissile.DisplayName: Shrimp Plasma Missile diff --git a/ModSupport/WeakReferenceSupport.cs b/ModSupport/WeakReferenceSupport.cs index 51133250cd..b8550398d8 100644 --- a/ModSupport/WeakReferenceSupport.cs +++ b/ModSupport/WeakReferenceSupport.cs @@ -1167,7 +1167,7 @@ namespace CalamityMod RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); - RegisterSummon(ItemType(), BuffType(), ProjectileType()); + RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); diff --git a/Projectiles/DraedonsArsenal/AqueousHunterDroneSummon.cs b/Projectiles/DraedonsArsenal/AqueousHunterDroneSummon.cs new file mode 100644 index 0000000000..8a3700c0ff --- /dev/null +++ b/Projectiles/DraedonsArsenal/AqueousHunterDroneSummon.cs @@ -0,0 +1,429 @@ +using System; +using CalamityMod.Buffs.Summon; +using CalamityMod.Cooldowns; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.DraedonsArsenal; +using CalamityMod.Particles; +using Microsoft.Build.Construction; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.DraedonsArsenal +{ + public class AqueousHunterDroneSummon : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Misc"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public Player Owner => Main.player[Projectile.owner]; + public int time = 0; + public ref float attackTimer => ref Projectile.ai[0]; + public ref float interactionTimer => ref Projectile.ai[1]; + public int interactionPoint = 600; // The time needed before shimps do their idle animation + public int cooldownGiven = 450; + public bool pressedRight => Projectile.ai[2] == 5; + public bool doingSpecialAttack = false; + public float moveSpeed = 30; // Lower is actually faster + public NPC targetedNPC; // The NPC being targeted + public float tailRot = 0; // Extra rotation on the tail + public float tailRecoil = 0; // Recoil for the tail after firing + public int facingDir = 0; + public Vector2 headPlace; + public Vector2 tailPlace; + public float lastFirePositionX; // Used for some of the movement + public Vector2 chillSpot; // Stored position for intro animation and some movement + public Vector2 spawnAnimStart; // Second stored position for the spawn animation + public Vector2 lastTargetCenter; + public int attackDowntime = 0; + public int surpriseTimer = 0; + public float slidingDirection = 0; // Value that lerps from left to right + public int animationClickTime = 70; // Time before body and tail click together in spawn anim + public bool doSpin = false; // If the shrimp will spin for it's attack + public float specialAttackfx = 0; + public override void SetStaticDefaults() + { + Main.projPet[Type] = true; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.SummonTagDamageMultiplier[Type] = 0f; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; + } + public override void SetDefaults() + { + Projectile.width = 1; + Projectile.height = 1; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.minionSlots = 4f; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.minion = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 5; + Projectile.DamageType = DamageClass.Summon; + } + + public override void AI() + { + int shrimpNum = Owner.ownedProjectileCounts[Projectile.type]; + facingDir = Math.Sign(Projectile.velocity.X); + GrantBuffs(Owner); + if ((targetedNPC == null || targetedNPC.life <= 0 || !targetedNPC.CanBeChasedBy() || attackDowntime == 20) && attackDowntime < 30) + targetedNPC = Projectile.Center.MinionHoming(2000f, Owner); + + // All the stuff for the spawn animation + if (time < animationClickTime + 20) + { + if (time == 0) + { + chillSpot = Projectile.Center; + spawnAnimStart = Projectile.Center; + int chosenDir = Math.Sign(Projectile.Center.DirectionTo(Owner.Center).X); + Projectile.velocity.X = (chosenDir * 16); + tailRot = -2f * chosenDir; + attackTimer += 8 * Projectile.localAI[2]; + } + SpawnAnim(); + facingDir = Math.Sign(Projectile.velocity.X); + time++; + return; + } + + slidingDirection = MathHelper.Lerp(slidingDirection, Owner.direction, 0.03f); + + bool isSummonWeapon = (Owner.HeldItem.DamageType == DamageClass.Summon) || (Owner.HeldItem.DamageType == DamageClass.SummonMeleeSpeed) || (Owner.HeldItem.DamageType == DamageClass.MagicSummonHybrid); + if (Owner.Calamity().mouseRight && Owner.whoAmI == Main.myPlayer && !Main.mapFullscreen && !Main.blockMouse && Owner.Calamity().arsenalCooldown <= 0 && isSummonWeapon) + { + Projectile.ai[2] = 5; + foreach (Projectile p in Main.ActiveProjectiles) + { + if (p.type == Projectile.type && p.owner == Projectile.owner) + { + p.ai[2] = 5; + } + } + } + + if (doingSpecialAttack) + { + SpecialAttack(); + } + else + { + specialAttackfx = MathHelper.Lerp(specialAttackfx, 0, 0.15f); + if (targetedNPC != null || attackDowntime > 0) + { + lastTargetCenter = (targetedNPC == null ? Owner.Center : targetedNPC.Center); + Attacking(); + } + else + { + Passive(); + CheckForSpecialAttack(); + } + } + + if (tailRecoil > 0) + tailRecoil = MathHelper.Lerp(tailRecoil, 0, 0.2f); + if (attackDowntime > 0) + attackDowntime--; + time++; + SetVisualPlacement(); + } + public void CheckForSpecialAttack() + { + if (pressedRight) + { + Projectile.ai[2] = 0; + doingSpecialAttack = true; + attackTimer = 0; + if (Projectile.velocity.Length() < 5) + Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX) * 12; + else + Projectile.velocity *= 1.3f; + Owner.Calamity().arsenalCooldown = cooldownGiven; + Owner.AddCooldown(ArsenalPower.ID, cooldownGiven); + } + } + public void SpecialAttack() + { + interactionTimer = 0; + int length = 33; + specialAttackfx = MathHelper.Lerp(specialAttackfx, 1, 0.2f); + + facingDir = Math.Sign(Projectile.Center.DirectionTo(Owner.Center).X); + Projectile.velocity *= 0.98f; + Projectile.rotation += ((MathHelper.TwoPi * 3) / length) * facingDir; + + tailRot = MathHelper.Lerp(tailRot, 0.75f * -facingDir, 0.2f); + for (int i = -1; i <= 1; i += 2) + { + bool noFall = !Main.rand.NextBool(5); + Vector2 vel = Vector2.UnitY.RotatedBy(Projectile.rotation * -5) * i; + int dustStyle = noFall ? ModContent.DustType() : Effects.ArsenalEffects.ArsenalPlasmaDust; + Dust dust = Dust.NewDustPerfect(Projectile.Center + vel * 43 * specialAttackfx, dustStyle); + dust.scale = Main.rand.NextFloat(0.8f, 1.1f) + (noFall ? 0 : 0.5f); + dust.velocity = vel.RotatedBy(Main.rand.NextFloat(-0.2f, 0.2f) - MathHelper.PiOver4 * facingDir) * Main.rand.NextFloat(4, 5.5f); + dust.noGravity = noFall; + dust.color = Effects.ArsenalEffects.ArsenalPlasmaColor; + dust.fadeIn = noFall ? 0 : 0.7f; + } + + if (attackTimer % 3 == 0) + { + int usedTimer = (int)(facingDir == -1 ? (length - attackTimer) : attackTimer); + SoundEngine.PlaySound(AqueousHunterDrone.Fire with { Volume = 0.7f, Pitch = 0.0f, PitchVariance = 0.3f, MaxInstances = 10 }, Projectile.Center); + Vector2 shootVel = (MathHelper.PiOver2 / 10 * (int)(usedTimer / 3 - 1)).ToRotationVector2().RotatedBy(-MathHelper.PiOver2 - MathHelper.PiOver4); + Vector2 shootPlace = Projectile.Center + shootVel * 10; + + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), shootPlace, shootVel * 8, ModContent.ProjectileType(), Projectile.damage, 0, Projectile.owner, 0, 0, attackTimer + 1); + } + attackTimer++; + if (attackTimer > length) + { + attackTimer = 8 * Projectile.localAI[2]; + doingSpecialAttack = false; + } + } + public void SpawnAnim() + { + Vector2 tailDist = new Vector2((30 - Math.Abs(tailRot) * 15) * (-facingDir), 7 - Math.Abs(tailRot) * 3).RotatedBy(Projectile.rotation); + Vector2 headDist = new Vector2(0, 0); + headPlace = Projectile.Center + headDist; + if (time < animationClickTime) + { + tailRot += 0.05f * Projectile.direction; + Projectile.velocity *= 0.98f; + Projectile.Center -= Projectile.velocity; + spawnAnimStart = new Vector2(spawnAnimStart.X, Owner.Center.Y - 700); + + tailPlace = chillSpot + tailDist + (Vector2.UnitY * ((float)Math.Pow(time, 2.05f) * 0.085f) + Vector2.UnitX * (16 - Math.Abs(Projectile.velocity.X)) * 10 * Projectile.direction); + } + else + tailPlace = Projectile.Center + tailDist; + + if (time > animationClickTime - 40) + { + if (time == animationClickTime - 1) + { + Projectile.velocity = Projectile.velocity.RotatedBy(MathHelper.PiOver4 * Projectile.direction) * 3; + SoundStyle click = new("CalamityMod/Sounds/Item/DudFire"); + SoundEngine.PlaySound(click with { Pitch = 0.4f }, Projectile.Center); + SoundEngine.PlaySound((Main.rand.NextBool() ? AqueousHunterDrone.Sound1 : AqueousHunterDrone.Sound2) with { Volume = 0.6f, Pitch = 0.3f, MaxInstances = 10 }, Projectile.Center); + + for (int i = -9; i <= 9; i++) + { + int dustStyle = Effects.ArsenalEffects.ArsenalPlasmaDust; + Dust dust = Dust.NewDustPerfect(tailPlace + Main.rand.NextVector2Circular(5, 5), dustStyle); + dust.scale = Main.rand.NextFloat(0.7f, 1.3f); + dust.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.Pi * (Math.Sign(i) == 1 ? 0 : 1)) * Main.rand.NextFloat(1, 5); + dust.noGravity = true; + dust.color = Effects.ArsenalEffects.ArsenalPlasmaColor; + dust.fadeIn = 0.1f; + if (i == -1) + i++; + } + for (int i = 0; i < 2; i++) + { + Particle spark = new CustomSpark(tailPlace, Vector2.Zero, "CalamityMod/Particles/BloomCircle", false, 15, 0.4f, Effects.ArsenalEffects.ArsenalPlasmaColor, new Vector2(1, 1), true, true, 0, false, false); + GeneralParticleHandler.SpawnParticle(spark); + } + } + if (time > animationClickTime - 1) + { + Projectile.velocity *= 0.97f; + tailRot = MathHelper.Lerp(tailRot, 0, 0.1f); + } + else + { + Projectile.Center = Vector2.Lerp(spawnAnimStart, tailPlace, Utils.GetLerpValue(animationClickTime - 40, animationClickTime, time, true)); + } + } + } + public void Passive() + { + float sine = (float)Math.Sin((time + Projectile.localAI[2] * 3) * 0.075f / MathHelper.Pi); + float sine2 = (float)Math.Sin(((time + Projectile.localAI[2] * 3) * 0.075f / MathHelper.Pi) * 2); + + TailRotationBasedOnMovement(); + + attackTimer = 8 * Projectile.localAI[2]; + + if (interactionTimer == interactionPoint) + { + chillSpot = Owner.Center + Main.rand.NextVector2CircularEdge(190, 190); + } + Projectile.rotation = Projectile.rotation.AngleLerp(0, 0.04f); + Vector2 destination = interactionTimer > interactionPoint ? (chillSpot + new Vector2(220 * sine, -90 + 130 * sine2)) : Owner.Center + new Vector2((-50 + -85 * Projectile.localAI[2]) * slidingDirection, -80 + 30 * sine); + + if (surpriseTimer == 0) + Projectile.velocity = (destination - Projectile.Center) / (moveSpeed + (interactionTimer > interactionPoint ? 20 : 0) - 9 + 9 * sine2); + else + surpriseTimer--; + if (interactionTimer > interactionPoint) + { + if (time % 25 == 0) + { + Particle spark2 = new CustomSpark(Projectile.Center + Main.rand.NextVector2Circular(5, 5) - Vector2.UnitY * 20, -Vector2.UnitY.RotatedByRandom(0.1f) * Main.rand.NextFloat(3.3f, 5.5f), "CalamityMod/Projectiles/Magic/MelterNote1", false, 32, Main.rand.NextFloat(1.2f, 1.3f), Color.Lerp(Color.Green, Color.Chartreuse, Main.rand.NextFloat(0, 0.7f)), new Vector2(1, 1), true, false, 0, false, false); + GeneralParticleHandler.SpawnParticle(spark2); + } + if (time % (480 + Projectile.localAI[2] * 120) == 0 && Owner.miscCounter != 0) + { + SoundEngine.PlaySound((Main.rand.NextBool() ? AqueousHunterDrone.Sound1 : AqueousHunterDrone.Sound2) with { Volume = 0.3f, Pitch = 0f + Projectile.localAI[2] * 0.1f * (Projectile.localAI[2] % 2 == 0 ? -1 : 1), MaxInstances = 10 }, Projectile.Center); + } + } + if (Owner.Center.Distance(Projectile.Center) > 450 && interactionTimer > interactionPoint && Owner.velocity.Length() > 5) + { + CombatText.NewText(Projectile.Hitbox, Effects.ArsenalEffects.ArsenalPlasmaColor, "!", true); + SoundEngine.PlaySound(AqueousHunterDrone.Surprise with { Volume = 0.6f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f) }, Projectile.Center); + Projectile.velocity = Projectile.Center.DirectionTo(Owner.Center); + surpriseTimer = 25; + interactionTimer = 0; + } + if (Projectile.velocity.Length() < 5) + interactionTimer++; + else if (interactionTimer > 0 && interactionTimer < interactionPoint) + interactionTimer -= 2; + } + public void Attacking() + { + interactionTimer = 0; + facingDir = Math.Sign(Projectile.Center.DirectionTo(lastTargetCenter).X); + if (tailRecoil > 1 && doSpin) + { + Projectile.rotation += 0.35f * facingDir; + } + else + Projectile.rotation = (Projectile.rotation).AngleLerp(tailPlace.DirectionTo(lastTargetCenter).ToRotation() + (facingDir == -1 ? MathHelper.Pi : 0) + (MathHelper.PiOver4 * -facingDir), 0.18f); + if (Utils.Distance(Projectile.Center, lastTargetCenter) > 250 && Projectile.velocity.Length() < 15) + Projectile.velocity += tailPlace.DirectionTo(lastTargetCenter) * 0.3f; + else + Projectile.velocity *= 0.96f; + if (lastTargetCenter.Y - 80 < tailPlace.Y) + Projectile.velocity.Y -= 0.7f; + + Projectile.velocity *= 0.99f; + if (attackDowntime > 35) + { + Projectile.velocity.X += 0.8f * Math.Sign(lastTargetCenter.X - lastFirePositionX); + TailRotationBasedOnMovement(); + } + else + { + CheckForSpecialAttack(); + tailRot = MathHelper.Lerp(tailRot, 0, 0.1f); + } + if (attackTimer > 60) + { + Vector2 shootVel = tailPlace.DirectionTo(lastTargetCenter); + Vector2 shootPlace = tailPlace + shootVel * 10; + + lastFirePositionX = Projectile.Center.X; + SoundEngine.PlaySound(AqueousHunterDrone.Fire with { Volume = 0.7f, Pitch = 0.0f, PitchVariance = 0.3f, MaxInstances = 10 }, Projectile.Center); + + for (int i = 0; i < 13; i++) + { + bool noFall = !Main.rand.NextBool(5); + float variance = Main.rand.NextFloat(-0.7f, 0.7f); + int dustStyle = noFall ? ModContent.DustType() : Effects.ArsenalEffects.ArsenalPlasmaDust; + Dust dust = Dust.NewDustPerfect(tailPlace, dustStyle); + dust.scale = Main.rand.NextFloat(1.4f, 1.8f) - Math.Abs(variance); + dust.velocity = shootVel.RotatedBy(variance) * Main.rand.NextFloat(9, 9.5f) * (1 - Math.Abs(variance)); + dust.noGravity = noFall; + dust.color = Effects.ArsenalEffects.ArsenalPlasmaColor; + dust.fadeIn = noFall ? 0 : 1.1f; + } + + Particle bolt2 = new CustomPulse(shootPlace, shootVel * 0.2f, Effects.ArsenalEffects.ArsenalPlasmaColor, "CalamityMod/Particles/BloomRing", new Vector2(0.5f, 1f), shootVel.ToRotation(), 0f, 0.6f, 23); + GeneralParticleHandler.SpawnParticle(bolt2); + for (int i = 0; i < 2; i++) + { + Particle spark = new CustomSpark(shootPlace, shootVel * 0.2f, "CalamityMod/Particles/BloomCircle", false, 28, 0.6f, Effects.ArsenalEffects.ArsenalPlasmaColor, new Vector2(1f, 0.5f), true, true, 0, false, false); + GeneralParticleHandler.SpawnParticle(spark); + } + + for (int i = -1; i <= 1; i++) + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), shootPlace, shootVel.RotatedBy(0.5f * i) * 8, ModContent.ProjectileType(), Projectile.damage, 0, Projectile.owner, 0, 0, 0); + + doSpin = Main.rand.NextBool(5); + if (doSpin) + SoundEngine.PlaySound((Main.rand.NextBool() ? AqueousHunterDrone.Sound1 : AqueousHunterDrone.Sound2) with { Volume = 0.4f, Pitch = 0.2f, MaxInstances = 10 }, Projectile.Center); + tailRecoil = 25f; + Projectile.velocity += shootVel * (doSpin ? -18 : -9); + attackTimer = 0; + attackDowntime = 60; + } + attackTimer++; + } + public void TailRotationBasedOnMovement() + { + float sine = (float)Math.Sin(time * 0.1f / MathHelper.Pi); + tailRot = (sine * 0.2f) + 1.2f * (float)Math.Pow(Utils.GetLerpValue(0, 12 * facingDir, Projectile.velocity.X, true), 1.5f) * facingDir; + } + public void SetVisualPlacement() + { + float sine = (float)Math.Sin(time * 0.35f / MathHelper.Pi); + float sine2 = (float)Math.Sin(time * 0.05f / MathHelper.Pi); + Vector2 shake = new Vector2(3 * sine * (facingDir), 7 * sine2); + Vector2 visualPlace = Projectile.Center + shake + Vector2.UnitY * (surpriseTimer > 20 ? Utils.GetLerpValue(25, 20, surpriseTimer) : 1 - (float)Math.Pow(Utils.GetLerpValue(20, 15, surpriseTimer, true), 2)) * -25; + Vector2 tailDist = new Vector2((30 - Math.Abs(tailRot) * 15) * (-facingDir), 7 - Math.Abs(tailRot) * 3).RotatedBy(Projectile.rotation); + Vector2 headDist = new Vector2(0, 0); + Vector2 recoilPlace = ((Projectile.rotation - (facingDir == -1 ? MathHelper.Pi : 0) - (MathHelper.PiOver4 * -facingDir)).ToRotationVector2() * -tailRecoil); + headPlace = visualPlace + headDist; + tailPlace = visualPlace + tailDist + recoilPlace; + } + public void GrantBuffs(Player player) + { + bool isCorrectProjectile = Projectile.type == ModContent.ProjectileType(); + player.AddBuff(ModContent.BuffType(), 3600); + if (isCorrectProjectile) + { + if (player.dead) + { + player.Calamity().aqueousHunterDrone = false; + } + if (player.Calamity().aqueousHunterDrone) + { + Projectile.timeLeft = 2; + } + } + } + public override bool MinionContactDamage() => false; + public override bool PreDraw(ref Color lightColor) + { + Texture2D head = ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/ShrimpBody").Value; + Texture2D glow = ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/ShrimpBodyGlow").Value; + Texture2D tail = ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/ShrimpTail").Value; + Texture2D glow2 = ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/ShrimpTailGlow").Value; + Texture2D spin = ModContent.Request("CalamityMod/Particles/CircularSmearSmokey").Value; + Color drawColor = Projectile.GetAlpha(lightColor); + bool left = facingDir == -1; + float rotation = Projectile.rotation; + + Main.EntitySpriteDraw(tail, tailPlace - Main.screenPosition, null, drawColor, rotation + tailRot, new Vector2(left ? tail.Height : 0, 0), Projectile.scale, left ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + Main.EntitySpriteDraw(glow2, tailPlace - Main.screenPosition, null, Color.White, rotation + tailRot, new Vector2(left ? glow2.Height : 0, 0), Projectile.scale, left ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + + float sine = (float)Math.Sin(time * 0.35f / MathHelper.Pi); + float headFadeIn = (float)Math.Pow(Utils.GetLerpValue(0, animationClickTime - 25, time, true), 8); + Main.EntitySpriteDraw(head, headPlace - Main.screenPosition, null, drawColor * headFadeIn, rotation + sine * 0.1f, head.Size() * 0.5f, Projectile.scale, left ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + Main.EntitySpriteDraw(glow, headPlace - Main.screenPosition, null, Color.White * headFadeIn, rotation + sine * 0.1f, glow.Size() * 0.5f, Projectile.scale, left ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + + Main.EntitySpriteDraw(spin, Vector2.Lerp(headPlace, tailPlace, 0f) - Main.screenPosition, null, Effects.ArsenalEffects.ArsenalPlasmaColor with { A = 0 } * specialAttackfx, rotation * 1.8f, spin.Size() * 0.5f, Projectile.scale * 0.53f * specialAttackfx, left ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + + if (tailRecoil > 0) + { + float fade = Utils.GetLerpValue(0, 15, tailRecoil, true); + for (int i = 0; i < 12; i++) + { + Vector2 vel = (MathHelper.TwoPi * i / 12f).ToRotationVector2() * (2 + 2 * fade); + Main.EntitySpriteDraw(glow2, tailPlace - Main.screenPosition + vel, null, Color.White with { A = 0 } * fade, rotation + tailRot, new Vector2(left ? glow2.Height : 0, 0), Projectile.scale, left ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + } + } + + return false; + } + } +} diff --git a/Projectiles/DraedonsArsenal/ShrimpBody.png b/Projectiles/DraedonsArsenal/ShrimpBody.png new file mode 100644 index 0000000000..6a9768e1f1 Binary files /dev/null and b/Projectiles/DraedonsArsenal/ShrimpBody.png differ diff --git a/Projectiles/DraedonsArsenal/ShrimpBodyGlow.png b/Projectiles/DraedonsArsenal/ShrimpBodyGlow.png new file mode 100644 index 0000000000..5ddf245160 Binary files /dev/null and b/Projectiles/DraedonsArsenal/ShrimpBodyGlow.png differ diff --git a/Projectiles/DraedonsArsenal/ShrimpPlasmaMissile.cs b/Projectiles/DraedonsArsenal/ShrimpPlasmaMissile.cs new file mode 100644 index 0000000000..b9f0b9130d --- /dev/null +++ b/Projectiles/DraedonsArsenal/ShrimpPlasmaMissile.cs @@ -0,0 +1,186 @@ +using System; +using System.Composition.Hosting.Core; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.DraedonsArsenal; +using CalamityMod.Particles; +using Microsoft.Build.Construction; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.DraedonsArsenal +{ + public class ShrimpPlasmaMissile : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Misc"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public ref float time => ref Projectile.ai[0]; + public NPC closestNPC; + public Vector2 offset = Vector2.Zero; + public bool hitTile = false; + public float randomRate = 0; + public float randomSize = 0; + public override void SetStaticDefaults() + { + //ProjectileID.Sets.SummonTagDamageMultiplier[Type] = 0f; // The balance people will say if this is needed + } + public override void SetDefaults() + { + Projectile.width = Projectile.height = 10; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Summon; + Projectile.timeLeft = 300; + Projectile.extraUpdates = 3; + Projectile.penetrate = -1; + Projectile.ArmorPenetration = 15; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + public override void AI() + { + Player Owner = Main.player[Projectile.owner]; + if (time == 0) + { + randomRate = Main.rand.NextFloat(1, 3); + randomSize = Main.rand.NextFloat(1, 5); + } + float sine = (float)Math.Sin(time * 0.075f / MathHelper.Pi * randomRate); + + if (time > 0 && Projectile.numHits == 0) + { + if (Utils.Distance(Owner.Center, Projectile.Center) < 1400) + { + Particle spark = new CustomSpark(Projectile.Center, Projectile.velocity * -0.01f, "CalamityMod/Particles/BloomCircle", false, 12, 0.18f, Effects.ArsenalEffects.ArsenalPlasmaColor, new Vector2(0.3f, 1), true, true, 0, false, false, 0.3f, glowCenterScale: 0.5f); + GeneralParticleHandler.SpawnParticle(spark); + } + if (Projectile.ai[2] == 0) + { + if (time > 10) + { + if (closestNPC == null || closestNPC.life <= 0 || !closestNPC.CanBeChasedBy()) + closestNPC = Projectile.Center.ClosestNPCAt(900); + if (closestNPC != null) + { + Projectile.timeLeft++; + float distMult = ((float)Math.Pow(Utils.GetLerpValue(140, 80, Projectile.Center.Distance(closestNPC.Center), true), 3)); + CalamityUtils.HomeInOnSelectedNPC(Projectile, closestNPC, true, 0.2f + 0.3f * distMult, 8, 0.99f - 0.1f * distMult, accelerate: true); + } + } + } + else + { + Vector2 goalPosition = Owner.Calamity().mouseWorld + offset; + int fallTime = 300 - (int)Projectile.ai[2] * Projectile.extraUpdates; + offset = Vector2.UnitX * sine * 15 * randomSize; + if (time == fallTime) + { + Projectile.timeLeft = 600; + Projectile.extraUpdates = 6; + Projectile.scale = 1.5f; + } + if (time > fallTime) + { + float distMult = (float)Math.Pow(Utils.GetLerpValue(480, 340, time, true), 3); + + Vector2 moveTo = (goalPosition - Projectile.Center).SafeNormalize(Vector2.UnitX); + + if (Projectile.velocity.Y < 8) + Projectile.velocity.Y += 0.1f; + Projectile.velocity.X += moveTo.X * 0.5f; + Projectile.velocity.X *= 0.975f; + } + else + Projectile.timeLeft++; + } + + if (Main.rand.NextBool(5)) + { + int dustStyle = Effects.ArsenalEffects.ArsenalPlasmaDust; + Dust dust = Dust.NewDustPerfect(Projectile.Center, dustStyle); + dust.scale = Main.rand.NextFloat(0.5f, 0.7f); + dust.velocity = -Projectile.velocity * Main.rand.NextFloat(0.1f, 0.3f); + dust.noGravity = false; + dust.color = Effects.ArsenalEffects.ArsenalPlasmaColor; + dust.fadeIn = -0.2f; + } + } + if (Collision.SolidCollision(Projectile.Center, 8, 8) && Projectile.numHits == 0 && Projectile.ai[2] > 0 && Projectile.Center.Y > Owner.Calamity().mouseWorld.Y && Projectile.scale > 1) + { + hitTile = true; + Projectile.numHits = 1; + Explode(); + } + time++; + } + public void Explode() + { + float lifetimeMult = (hitTile ? 5 : 1); + if (hitTile) + Projectile.localNPCHitCooldown = 8; + Projectile.extraUpdates = 0; + Projectile.timeLeft = (int)(12 * lifetimeMult); + Projectile.velocity = Vector2.Zero; + for (int i = 0; i < (int)(12 * Projectile.scale); i++) + { + bool noFall = !Main.rand.NextBool(5); + int dustStyle = noFall ? ModContent.DustType() : Effects.ArsenalEffects.ArsenalPlasmaDust; + Dust dust = Dust.NewDustPerfect(Projectile.Center, dustStyle); + dust.scale = Main.rand.NextFloat(0.9f, 1.7f) * (noFall ? 2 : 0.75f) * Projectile.scale; + dust.velocity = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(6.4f, 7.5f) * (noFall ? 0.7f : 1.2f) * Projectile.scale; + dust.noGravity = noFall; + dust.color = Effects.ArsenalEffects.ArsenalPlasmaColor; + dust.fadeIn = (noFall ? 4.5f * Projectile.scale : 1f); + } + SoundEngine.PlaySound(AqueousHunterDrone.Hit with { Volume = 0.4f * Projectile.scale, Pitch = Main.rand.NextFloat(-0.1f, 0.1f), MaxInstances = 30 }, Projectile.Center); + Particle bolt2 = new CustomPulse(Projectile.Center, Vector2.Zero, Effects.ArsenalEffects.ArsenalPlasmaColor * 0.95f, "CalamityMod/Particles/SmokeExplosion", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.1f * Projectile.scale, 14); + GeneralParticleHandler.SpawnParticle(bolt2); + + Particle bolt3 = new CustomPulse(Projectile.Center, Vector2.Zero, Effects.ArsenalEffects.ArsenalPlasmaColor * 0.75f, "CalamityMod/Particles/WaterFoam", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.77f * Projectile.scale, (int)(10 * lifetimeMult)); + GeneralParticleHandler.SpawnParticle(bolt3); + + Particle spark = new CustomSpark(Projectile.Center, Vector2.Zero, "CalamityMod/Particles/BloomCircle", false, (int)(17 * lifetimeMult), 0.6f * Projectile.scale, Effects.ArsenalEffects.ArsenalPlasmaColor, new Vector2(1, 1), true, true, 0, false, false); + GeneralParticleHandler.SpawnParticle(spark); + if (hitTile) + { + Particle spark2 = new CustomSpark(Projectile.Center, Vector2.Zero, "CalamityMod/Particles/BloomCircle", false, (int)(20 * lifetimeMult), 0.6f * Projectile.scale * lifetimeMult, Effects.ArsenalEffects.ArsenalPlasmaColor * 0.35f, new Vector2(1, 1), true, true, 0, false, false, glowOpacity: 0.35f); + GeneralParticleHandler.SpawnParticle(spark2); + } + if (Projectile.scale > 1) + { + Player Owner = Main.player[Projectile.owner]; + Owner.Calamity().GeneralScreenShakePower = 2.5f; + } + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if (Projectile.numHits == 0) + { + Explode(); + } + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (Projectile.numHits > 0) + { + float minMult = 0.5f; + int hitsToMinMult = 8; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult * 0.5f; + } + } + public override bool? CanDamage() => ((time > 5 && Projectile.ai[2] == 0) || (Projectile.scale > 1)) ? null : false; + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + return CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width * (Projectile.numHits > 0 ? 10 : 1) * Projectile.scale, targetHitbox); + } + public override bool PreDraw(ref Color lightColor) + { + return false; + } + } +} diff --git a/Projectiles/DraedonsArsenal/ShrimpTail.png b/Projectiles/DraedonsArsenal/ShrimpTail.png new file mode 100644 index 0000000000..ea5481c028 Binary files /dev/null and b/Projectiles/DraedonsArsenal/ShrimpTail.png differ diff --git a/Projectiles/DraedonsArsenal/ShrimpTailGlow.png b/Projectiles/DraedonsArsenal/ShrimpTailGlow.png new file mode 100644 index 0000000000..0d7d5e8d71 Binary files /dev/null and b/Projectiles/DraedonsArsenal/ShrimpTailGlow.png differ diff --git a/Sounds/Item/ShrimpFire.ogg b/Sounds/Item/ShrimpFire.ogg new file mode 100644 index 0000000000..b60d95c9aa Binary files /dev/null and b/Sounds/Item/ShrimpFire.ogg differ diff --git a/Sounds/Item/ShrimpMissileHit.ogg b/Sounds/Item/ShrimpMissileHit.ogg new file mode 100644 index 0000000000..c34fcac6cf Binary files /dev/null and b/Sounds/Item/ShrimpMissileHit.ogg differ diff --git a/Sounds/Item/ShrimpSound1.ogg b/Sounds/Item/ShrimpSound1.ogg new file mode 100644 index 0000000000..38d7eae4ea Binary files /dev/null and b/Sounds/Item/ShrimpSound1.ogg differ diff --git a/Sounds/Item/ShrimpSound2.ogg b/Sounds/Item/ShrimpSound2.ogg new file mode 100644 index 0000000000..f8106c6edf Binary files /dev/null and b/Sounds/Item/ShrimpSound2.ogg differ diff --git a/Sounds/Item/ShrimpSurprise.ogg b/Sounds/Item/ShrimpSurprise.ogg new file mode 100644 index 0000000000..5eb8fbad6d Binary files /dev/null and b/Sounds/Item/ShrimpSurprise.ogg differ