diff --git a/Items/Weapons/Summon/HarvestStaff.cs b/Items/Weapons/Summon/HarvestStaff.cs
index 168e5de21c..2685be5dce 100644
--- a/Items/Weapons/Summon/HarvestStaff.cs
+++ b/Items/Weapons/Summon/HarvestStaff.cs
@@ -11,6 +11,8 @@ namespace CalamityMod.Items.Weapons.Summon
{
public new string LocalizationCategory => "Items.Weapons.Summon";
+ public static int PumpkinsPerSentry = 5;
+ public static float TimePerPumpkin = 150f;
public static float PlantedEnemyDistanceDetection = 160f;
public static float NormalEnemyDistanceDetection = 1200f;
public static float PumpkinGravityStrength = 0.8f;
@@ -34,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Summon
Item.value = CalamityGlobalItem.Rarity2BuyPrice;
Item.rare = ItemRarityID.Green;
Item.useStyle = ItemUseStyleID.Shoot;
- Item.UseSound = SoundID.Item20;
+ Item.UseSound = SoundID.Grass with { Volume = 0.6f, Pitch = -0.4f };
Item.shootSpeed = 0.1f;
}
diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson
index c52b4ddb79..801b6485e7 100644
--- a/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson
+++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson
@@ -324,3 +324,4 @@ HopeShredder.DisplayName: Hope Shredder
HopeShredderArrow.DisplayName: Hope Shredder Arrow
HopeShredderArrowSplit.DisplayName: Hope Shredder Split Arrow
HarvestStaffMinion.DisplayName: Harvest Staff Minion
+HarvestStaffSentry.DisplayName: Harvest Staff Sentry
diff --git a/Projectiles/Summon/HarvestStaffMinion.cs b/Projectiles/Summon/HarvestStaffMinion.cs
index 248e227b29..3307beed84 100644
--- a/Projectiles/Summon/HarvestStaffMinion.cs
+++ b/Projectiles/Summon/HarvestStaffMinion.cs
@@ -1,12 +1,12 @@
using System;
using System.IO;
-using CalamityMod.Particles;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using Terraria;
using Terraria.Audio;
using Terraria.DataStructures;
+using Terraria.GameContent.Events;
using Terraria.ID;
using Terraria.ModLoader;
using static CalamityMod.Items.Weapons.Summon.HarvestStaff;
@@ -15,7 +15,7 @@ namespace CalamityMod.Projectiles.Summon
{
public class HarvestStaffMinion : ModProjectile, ILocalizedModType
{
- #region Properties and Enums
+ #region Members and Enums
public new string LocalizationCategory => "Projectiles.Summon";
@@ -40,7 +40,10 @@ namespace CalamityMod.Projectiles.Summon
Projectile.ai[1] = (float)value;
if (value == AIState.Attack)
+ {
Animation = AnimationState.Run;
+ SoundEngine.PlaySound(_screamSound, Projectile.Center);
+ }
else if (value == AIState.Idle)
Animation = AnimationState.Idle;
@@ -154,11 +157,38 @@ namespace CalamityMod.Projectiles.Summon
set => Projectile.spriteDirection = Projectile.direction = value;
}
+ private SoundStyle _growSound = new("CalamityMod/Sounds/Custom/PumpkinEmerge", 3);
+
+ private SoundStyle _idleSound = new("CalamityMod/Sounds/Custom/PumpkinIdle", 4);
+
+ private SoundStyle _idleRareSound = new("CalamityMod/Sounds/Custom/PumpkinRareIdle") { Volume = 0.2f };
+
+ private SoundStyle _screamSound = new("CalamityMod/Sounds/Custom/PumpkinScream", 2);
+
+ private SoundStyle _jumpSound = new("CalamityMod/Sounds/Custom/PumpkinJump");
+
+ private SoundStyle _boomSound = new("CalamityMod/Sounds/Custom/PumpkinExplode", 2) { Volume = 0.6f };
+
///
/// The owner of this minion.
///
public Player Owner { get; set; }
+ public Player AnyPlayer
+ {
+ get
+ {
+ for (int i = 0; i < Main.maxPlayers; i++)
+ {
+ Player p = Main.player[i];
+ if (p == null || !p.active || p.dead)
+ continue;
+ return p;
+ }
+ return null;
+ }
+ }
+
///
/// The target of this minion.
///
@@ -176,10 +206,8 @@ namespace CalamityMod.Projectiles.Summon
Projectile proj = Main.projectile[i];
if (proj == null || !proj.active || proj.owner != Projectile.owner || proj.type != ModContent.ProjectileType())
continue;
-
return proj;
}
-
return null;
}
}
@@ -222,7 +250,7 @@ namespace CalamityMod.Projectiles.Summon
if (State == AIState.Idle && Projectile.velocity.Y == 0f)
{
// While the pumpkin's idle and standing still on the ground, when the player gets close it'll jump.
- if (Projectile.WithinRange(Owner.Center, 64f) && IdleJumpCooldown == 0)
+ if (AnyPlayer is not null && Projectile.WithinRange(AnyPlayer.Center, 64f) && IdleJumpCooldown == 0)
NearOwnerJump();
else
Animation = IdleWalkingTimer == 0f ? AnimationState.Idle : AnimationState.Run;
@@ -247,17 +275,13 @@ namespace CalamityMod.Projectiles.Summon
public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac)
{
- if (Target is not null)
- fallThrough = Projectile.Bottom.Y < Target.Top.Y;
- else
- fallThrough = false;
-
+ fallThrough = Target is not null && Projectile.Bottom.Y < Target.Top.Y;
return true;
}
public override void OnKill(int timeLeft)
{
- Projectile.ExpandHitboxBy(3f);
+ Projectile.ExpandHitboxBy(4f);
Projectile.Damage();
for (int i = 0; i < (int)Utils.Remap(Variant, 0f, 2f, 4f, 2f); i++)
@@ -273,13 +297,21 @@ namespace CalamityMod.Projectiles.Summon
for (int i = 0; i < 20; i++)
{
- Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(4) ? 278 : 51, (new Vector2(2, 2).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.5f)) + new Vector2(0, -0.75f));
- dust.noGravity = false;
- dust.scale = Main.rand.NextFloat(0.8f, 1.4f);
- dust.color = Color.Chocolate;
+ if (BirthdayParty.PartyIsUp)
+ {
+ Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.Next(139, 143), (new Vector2(2, 2).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.5f)) + new Vector2(0, -0.75f));
+ dust.scale = 0.8f;
+ }
+ else
+ {
+ Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(4) ? 278 : 51, (new Vector2(2, 2).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.5f)) + new Vector2(0, -0.75f));
+ dust.noGravity = false;
+ dust.scale = Main.rand.NextFloat(0.8f, 1.4f);
+ dust.color = Color.Chocolate;
+ }
}
- SoundEngine.PlaySound(SoundID.Item110 with { Pitch = -0.5f, Volume = 0.2f, PitchVariance = 0.2f }, Projectile.Center);
- SoundEngine.PlaySound(SoundID.Item89 with { Pitch = 0.5f, Volume = 0.25f, PitchVariance = 0.2f }, Projectile.Center);
+
+ SoundEngine.PlaySound(_boomSound, Projectile.Center);
}
///
@@ -289,8 +321,11 @@ namespace CalamityMod.Projectiles.Summon
{
// When the pumpkin has done its growing animation and there's a target nearby or the owner's on top of it,
// it'll do the jump out animation.
- if ((Target is not null || Projectile.getRect().Intersects(Owner.getRect())) && Animation == AnimationState.Grow && CompletedAnimation)
+ if ((Target is not null || (AnyPlayer is not null && Projectile.getRect().Intersects(AnyPlayer.getRect()))) && Animation == AnimationState.Grow && CompletedAnimation)
+ {
Animation = AnimationState.Rise;
+ SoundEngine.PlaySound(_growSound, Projectile.Center);
+ }
// And when they have completed their jumping out animation, they idle until they find a target.
else if (Animation == AnimationState.Rise && CompletedAnimation)
@@ -334,6 +369,9 @@ namespace CalamityMod.Projectiles.Summon
// When the pumpkin encounters a 1-tile-height obstacle, it'll climb it, like the player.
Collision.StepUp(ref Projectile.position, ref Projectile.velocity, Projectile.width, Projectile.height, ref Projectile.stepSpeed, ref Projectile.gfxOffY);
+
+ if (Main.rand.NextBool(700))
+ SoundEngine.PlaySound(Main.rand.NextBool(20) ? _idleRareSound : _idleSound, Projectile.Center);
}
///
@@ -343,12 +381,6 @@ namespace CalamityMod.Projectiles.Summon
{
if (Target is not null)
{
- if (Projectile.WithinRange(Target.Center, 32f))
- {
- Projectile.Kill();
- return;
- }
-
MoveToTarget();
Direction = MathF.Sign(Projectile.velocity.X);
@@ -356,9 +388,12 @@ namespace CalamityMod.Projectiles.Summon
Collision.StepUp(ref Projectile.position, ref Projectile.velocity, Projectile.width, Projectile.height, ref Projectile.stepSpeed, ref Projectile.gfxOffY);
// Pumpkins relase a bit of fire from their heads when running after enemies
- Dust dust = Dust.NewDustPerfect(Projectile.Center + new Vector2(0, -Projectile.height * 0.5f), 6, new Vector2(0, -4).RotatedBy(0.7f * -Projectile.direction) * Main.rand.NextFloat(0.1f, 0.8f));
- dust.noGravity = true;
- dust.scale = Main.rand.NextFloat(0.4f, 0.95f);
+ if (!Main.dedServ)
+ {
+ Dust dust = Dust.NewDustPerfect(Projectile.Center + new Vector2(0, -Projectile.height * 0.5f), 6, new Vector2(0, -4).RotatedBy(0.7f * -Projectile.direction) * Main.rand.NextFloat(0.1f, 0.8f));
+ dust.noGravity = true;
+ dust.scale = Main.rand.NextFloat(0.4f, 0.95f);
+ }
}
else
{
@@ -383,8 +418,11 @@ namespace CalamityMod.Projectiles.Summon
IdleJumpCooldown = 30;
}
- Direction = MathF.Sign(Owner.Center.X - Projectile.Center.X);
+ Direction = MathF.Sign(AnyPlayer.Center.X - Projectile.Center.X);
Animation = AnimationState.Jump;
+
+ SoundEngine.PlaySound(_jumpSound with { Pitch = Utils.Remap(Variant, 0f, 2f, -0.3f, 0.3f) }, Projectile.Center);
+
NetUpdate();
}
@@ -414,6 +452,7 @@ namespace CalamityMod.Projectiles.Summon
// And now we need to negate the velocity to get it on Terraria's coordinate system: v = -sqrt(-2 * gravity * distance).
Projectile.velocity.Y = -MathF.Sqrt(-2f * PumpkinGravityStrength * (destination.Y - Projectile.Bottom.Y));
Animation = AnimationState.Jump;
+ SoundEngine.PlaySound(_jumpSound with { Pitch = Utils.Remap(Variant, 0f, 2f, -0.3f, 0.3f) }, Projectile.Center);
NetUpdate();
}
@@ -494,7 +533,6 @@ namespace CalamityMod.Projectiles.Summon
{
Projectile.DamageType = DamageClass.Summon;
Projectile.localNPCHitCooldown = 30;
- Projectile.penetrate = -1;
Projectile.friendly = true;
Projectile.tileCollide = true;
Projectile.usesLocalNPCImmunity = true;
@@ -519,7 +557,9 @@ namespace CalamityMod.Projectiles.Summon
IdleWalkingDirection = reader.ReadInt32();
}
- public override bool? CanDamage() => null;
+ public override bool? CanDamage() => State == AIState.Attack ? null : false;
+
+ public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => modifiers.SourceDamage *= Utils.Remap(Variant, 0f, 2f, 1.5f, 0.5f);
public override void OnSpawn(IEntitySource source)
{
diff --git a/Projectiles/Summon/HarvestStaffSentry.cs b/Projectiles/Summon/HarvestStaffSentry.cs
index b9c9bfcfb0..a72ac92455 100644
--- a/Projectiles/Summon/HarvestStaffSentry.cs
+++ b/Projectiles/Summon/HarvestStaffSentry.cs
@@ -4,10 +4,11 @@ using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ModLoader;
+using static CalamityMod.Items.Weapons.Summon.HarvestStaff;
namespace CalamityMod.Projectiles.Summon
{
- public class HarvestStaffSentry : ModProjectile
+ public class HarvestStaffSentry : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Summon";
@@ -28,10 +29,10 @@ namespace CalamityMod.Projectiles.Summon
public override void AI()
{
- if (PumpkinQuantity() < 5)
+ if (PumpkinAmount() < PumpkinsPerSentry * SentryAmount())
Timer++;
- if (Timer > 180f)
+ if (Timer > TimePerPumpkin)
{
float randomOffset = 160f;
Vector2 spawnPosition = Projectile.Center + new Vector2(Main.rand.NextFloat(-randomOffset, randomOffset), -80f);
@@ -63,7 +64,9 @@ namespace CalamityMod.Projectiles.Summon
}
}
- public int PumpkinQuantity()
+ #region AI Methods
+
+ public int PumpkinAmount()
{
int amount = 0;
for (int i = 0; i < Main.maxProjectiles; i++)
@@ -77,6 +80,20 @@ namespace CalamityMod.Projectiles.Summon
return amount;
}
+ public int SentryAmount()
+ {
+ int amount = 0;
+ for (int i = 0; i < Main.maxProjectiles; i++)
+ {
+ Projectile proj = Main.projectile[i];
+ if (proj == null || !proj.active || proj.type != ModContent.ProjectileType() || proj.owner != Projectile.owner)
+ continue;
+ amount++;
+ }
+
+ return amount;
+ }
+
public void MakeSpawnValid(ref Vector2 spawnpoint)
{
Point spawnpointTileCoords = spawnpoint.ToSafeTileCoordinates();
@@ -103,6 +120,8 @@ namespace CalamityMod.Projectiles.Summon
}
}
+ #endregion
+
public override bool OnTileCollide(Vector2 oldVelocity) => false;
public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac)
diff --git a/Sounds/Custom/PumpkinEmerge1.ogg b/Sounds/Custom/PumpkinEmerge1.ogg
new file mode 100644
index 0000000000..a349cfb5f2
Binary files /dev/null and b/Sounds/Custom/PumpkinEmerge1.ogg differ
diff --git a/Sounds/Custom/PumpkinEmerge2.ogg b/Sounds/Custom/PumpkinEmerge2.ogg
new file mode 100644
index 0000000000..bad9d97937
Binary files /dev/null and b/Sounds/Custom/PumpkinEmerge2.ogg differ
diff --git a/Sounds/Custom/PumpkinEmerge3.ogg b/Sounds/Custom/PumpkinEmerge3.ogg
new file mode 100644
index 0000000000..ea450c4ebd
Binary files /dev/null and b/Sounds/Custom/PumpkinEmerge3.ogg differ
diff --git a/Sounds/Custom/PumpkinExplode1.ogg b/Sounds/Custom/PumpkinExplode1.ogg
new file mode 100644
index 0000000000..60d7192cec
Binary files /dev/null and b/Sounds/Custom/PumpkinExplode1.ogg differ
diff --git a/Sounds/Custom/PumpkinExplode2.ogg b/Sounds/Custom/PumpkinExplode2.ogg
new file mode 100644
index 0000000000..1c5cb054c9
Binary files /dev/null and b/Sounds/Custom/PumpkinExplode2.ogg differ
diff --git a/Sounds/Custom/PumpkinIdle1.ogg b/Sounds/Custom/PumpkinIdle1.ogg
new file mode 100644
index 0000000000..47c218f282
Binary files /dev/null and b/Sounds/Custom/PumpkinIdle1.ogg differ
diff --git a/Sounds/Custom/PumpkinIdle2.ogg b/Sounds/Custom/PumpkinIdle2.ogg
new file mode 100644
index 0000000000..c146037b63
Binary files /dev/null and b/Sounds/Custom/PumpkinIdle2.ogg differ
diff --git a/Sounds/Custom/PumpkinIdle3.ogg b/Sounds/Custom/PumpkinIdle3.ogg
new file mode 100644
index 0000000000..dca64a2d4d
Binary files /dev/null and b/Sounds/Custom/PumpkinIdle3.ogg differ
diff --git a/Sounds/Custom/PumpkinIdle4.ogg b/Sounds/Custom/PumpkinIdle4.ogg
new file mode 100644
index 0000000000..d399027c10
Binary files /dev/null and b/Sounds/Custom/PumpkinIdle4.ogg differ
diff --git a/Sounds/Custom/PumpkinJump.ogg b/Sounds/Custom/PumpkinJump.ogg
new file mode 100644
index 0000000000..e85c2cfe02
Binary files /dev/null and b/Sounds/Custom/PumpkinJump.ogg differ
diff --git a/Sounds/Custom/PumpkinRareIdle.ogg b/Sounds/Custom/PumpkinRareIdle.ogg
new file mode 100644
index 0000000000..e3a5085e00
Binary files /dev/null and b/Sounds/Custom/PumpkinRareIdle.ogg differ
diff --git a/Sounds/Custom/PumpkinScream1.ogg b/Sounds/Custom/PumpkinScream1.ogg
new file mode 100644
index 0000000000..24de61da1b
Binary files /dev/null and b/Sounds/Custom/PumpkinScream1.ogg differ
diff --git a/Sounds/Custom/PumpkinScream2.ogg b/Sounds/Custom/PumpkinScream2.ogg
new file mode 100644
index 0000000000..f113813a23
Binary files /dev/null and b/Sounds/Custom/PumpkinScream2.ogg differ