First bit of shimp

This commit is contained in:
Xyk authored and Cameron Ewell committed 2025-09-05 14:02:21 -04:00
1 parent af7151883c
commit 817bbce40f
23 files changed
+667 -29

No files matched your search

+12
View File
@@ -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<AqueousHunterDroneSummon>();
protected override ref bool MinionBool => ref BuffModdedOwner.aqueousHunterDrone;
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

+2
View File
@@ -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;
+1 -1
View File
@@ -10,7 +10,7 @@ namespace CalamityMod.Effects
// Plasma
public static int ArsenalPlasmaDust = ModContent.DustType<SquashDustTileTouch>();
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<DiamondDust>();
public static Color ArsenalLaserColor = Color.Lerp(Color.Crimson, Color.Red, 0.45f);
@@ -76,7 +76,7 @@ namespace CalamityMod.Items.DraedonMisc
mageDisplay.OverrideColor = new Color(201, 41, 255);
list.Insert(insertIndex + 3, mageDisplay);
int summonItem = ModContent.ItemType<StarSwallowerContainmentUnit>();
int summonItem = ModContent.ItemType<AqueousHunterDrone>();
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);
@@ -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<StarSwallowerSummon>();
Item.shoot = ModContent.ProjectileType<AqueousHunterDroneSummon>();
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<TooltipLine> tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 1);
public override void AddRecipes()
{
CreateRecipe().
Binary file not shown.

After

Width:  |  Height:  |  Size: 776 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

@@ -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
@@ -10,6 +10,18 @@ AerialTracker: {
'''
}
AqueousHunterDrone: {
DisplayName: Aqueous Hunter Drone
Tooltip:
'''
Summons a shrimp drone that fires bursts of homing plasma missiles
Pressing <right> 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:
@@ -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
+1 -1
View File
@@ -1167,7 +1167,7 @@ namespace CalamityMod
RegisterSummon(ItemType<ScabRipper>(), BuffType<BabyBloodCrawlerBuff>(), ProjectileType<BabyBloodCrawler>());
RegisterSummon(ItemType<CinderBlossomStaff>(), BuffType<CinderBlossomBuff>(), ProjectileType<CinderBlossom>());
RegisterSummon(ItemType<DankStaff>(), BuffType<DankCreeperBuff>(), ProjectileType<DankCreeperMinion>());
RegisterSummon(ItemType<StarSwallowerContainmentUnit>(), BuffType<StarSwallowerBuff>(), ProjectileType<StarSwallowerSummon>());
RegisterSummon(ItemType<AqueousHunterDrone>(), BuffType<AqueousHunterDroneBuff>(), ProjectileType<AqueousHunterDroneSummon>());
RegisterSummon(ItemType<HerringStaff>(), BuffType<Herring>(), ProjectileType<HerringMinion>());
RegisterSummon(ItemType<EyeOfNight>(), BuffType<EyeOfNightBuff>(), ProjectileType<EyeOfNightSummon>());
RegisterSummon(ItemType<FleshOfInfidelity>(), BuffType<FleshBallBuff>(), ProjectileType<FleshBallMinion>());
@@ -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<SquashDust>() : 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<ShrimpPlasmaMissile>(), 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<SquashDust>() : 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<ShrimpPlasmaMissile>(), 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<AqueousHunterDroneSummon>();
player.AddBuff(ModContent.BuffType<AqueousHunterDroneBuff>(), 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<Texture2D>("CalamityMod/Projectiles/DraedonsArsenal/ShrimpBody").Value;
Texture2D glow = ModContent.Request<Texture2D>("CalamityMod/Projectiles/DraedonsArsenal/ShrimpBodyGlow").Value;
Texture2D tail = ModContent.Request<Texture2D>("CalamityMod/Projectiles/DraedonsArsenal/ShrimpTail").Value;
Texture2D glow2 = ModContent.Request<Texture2D>("CalamityMod/Projectiles/DraedonsArsenal/ShrimpTailGlow").Value;
Texture2D spin = ModContent.Request<Texture2D>("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;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 838 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

@@ -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<SquashDust>() : 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;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.