Hogwashing 4
* Moved some of Horrible Hog's static properties to their respective partial class files * Horrible Hog now renders its aura shader in the Bestiary * Horrible Hog now spawns mist on the floor near itself when idling. This becomes more opaque the closer the player is to it * Changed where some of Horrible Hog's sounds are played and renamed some to better suit their new placement * Divine Swine now have 5 HP so that they properly count as critters for the Bestiary * Divine Swine no longer displays its HP at the mouse when hovering over it in the world * Edited Divine Swine's tile avoidance behavior and made it so that it now never leaves the bounds of the world * Decreased Piggy HP from 2000 to 200 * Added a critter item for Gold Piggy * Changed the Piggy critter item sprite to the Piggy resprite
This commit is contained in:
1 parent
c99cc90eb6
commit
7ec783b608
14 files changed
+491
-229
No files matched your search
@@ -0,0 +1,24 @@
|
||||
using CalamityMod.NPCs.NormalNPCs;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Items.Critters
|
||||
{
|
||||
public class PiggyGoldItem : ModItem, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Items.Misc";
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
Item.ResearchUnlockCount = 5;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.DefaultToCapturedCritter(ModContent.NPCType<PiggyGold>());
|
||||
Item.value = Item.sellPrice(gold: 10);
|
||||
Item.rare = ItemRarityID.Orange;
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 606 B |
@@ -8,6 +8,7 @@ namespace CalamityMod.Items.Critters
|
||||
public class PiggyItem : ModItem, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Items.Misc";
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
Item.ResearchUnlockCount = 5;
|
||||
@@ -16,7 +17,7 @@ namespace CalamityMod.Items.Critters
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.DefaultToCapturedCritter(ModContent.NPCType<Piggy>());
|
||||
Item.value = Item.sellPrice(gold: 10);
|
||||
Item.value = Item.sellPrice(silver: 5);
|
||||
Item.rare = ItemRarityID.Blue;
|
||||
Item.Calamity().donorItem = true;
|
||||
}
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 606 B |
@@ -128,6 +128,11 @@ PiggyItem: {
|
||||
Tooltip: ""
|
||||
}
|
||||
|
||||
PiggyGoldItem: {
|
||||
DisplayName: "{$NPCs.PiggyGold.DisplayName}"
|
||||
Tooltip: ""
|
||||
}
|
||||
|
||||
PrismaticGuppyBlueItem: {
|
||||
DisplayName: Blue Prismatic Guppy
|
||||
Tooltip: ""
|
||||
|
||||
@@ -28,6 +28,7 @@ using Terraria.GameContent.Bestiary;
|
||||
using Terraria.GameInput;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using static System.Net.Mime.MediaTypeNames;
|
||||
|
||||
namespace CalamityMod.NPCs.NormalNPCs
|
||||
{
|
||||
@@ -119,8 +120,8 @@ namespace CalamityMod.NPCs.NormalNPCs
|
||||
NPC.damage = 0;
|
||||
NPC.width = 32;
|
||||
NPC.height = 34;
|
||||
NPC.lifeMax = 999999;
|
||||
NPC.defense = 999999;
|
||||
NPC.lifeMax = 5;
|
||||
NPC.defense = 99999999;
|
||||
NPC.rarity = 5;
|
||||
NPC.aiStyle = -1;
|
||||
NPC.knockBackResist = 0.1f;
|
||||
@@ -312,9 +313,14 @@ namespace CalamityMod.NPCs.NormalNPCs
|
||||
NPC.netUpdate = true;
|
||||
}
|
||||
|
||||
if (ShouldTurnAway)
|
||||
Point tileAhead = (NPC.Center + NPC.velocity * 16f).ToTileCoordinates();
|
||||
bool leavingWorldTop = tileAhead.Y <= 40;
|
||||
bool leavingWorldBottom = tileAhead.Y >= Main.maxTilesY - 40;
|
||||
bool leavingWorldLeft = tileAhead.X <= 40;
|
||||
bool leavingWorldRight = tileAhead.X >= Main.maxTilesX - 40;
|
||||
if (ShouldTurnAway || leavingWorldTop || leavingWorldBottom || leavingWorldLeft || leavingWorldRight)
|
||||
{
|
||||
AvoidTileCollision(MaxSpeed + 0.6f);
|
||||
AvoidTileCollision(MaxSpeed + 0.6f, ref leavingWorldTop, ref leavingWorldBottom, ref leavingWorldLeft, ref leavingWorldRight);
|
||||
IdleMovementTimer = 0f;
|
||||
}
|
||||
else
|
||||
@@ -485,11 +491,6 @@ namespace CalamityMod.NPCs.NormalNPCs
|
||||
|
||||
public void TransformIntoPiggy()
|
||||
{
|
||||
if (Main.netMode == NetmodeID.MultiplayerClient)
|
||||
{
|
||||
// run packet here if necessary.
|
||||
}
|
||||
|
||||
AIState = (int)BehaviorState.PiggyTransformation;
|
||||
LocalAIState = 0f;
|
||||
Timer = 0f;
|
||||
@@ -503,13 +504,22 @@ namespace CalamityMod.NPCs.NormalNPCs
|
||||
return true;
|
||||
}
|
||||
|
||||
public void AvoidTileCollision(float maxSpeed, float turnAwayStrength = 0.125f)
|
||||
public void AvoidTileCollision(float maxSpeed, ref bool leavingWorldTop, ref bool leavingWorldBottom, ref bool leavingWorldLeft, ref bool leavingWorldRight, float turnAwayStrength = 0.125f)
|
||||
{
|
||||
float distanceToCollisionLeft = CalamityUtils.DistanceToTileCollisionHit(NPC.Center, NPC.velocity.RotatedBy(MathHelper.PiOver2), 32, ShouldAvoidTile) ?? 10000f;
|
||||
float distanceToCollisionRight = CalamityUtils.DistanceToTileCollisionHit(NPC.Center, NPC.velocity.RotatedBy(-MathHelper.PiOver2), 32, ShouldAvoidTile) ?? 10000f;
|
||||
int directionToMove = (distanceToCollisionLeft > distanceToCollisionRight).ToDirectionInt();
|
||||
|
||||
Vector2 idealVelocity = NPC.velocity.SafeNormalize(Vector2.Zero).RotatedBy(MathHelper.PiOver2 * directionToMove) * (maxSpeed - NPC.velocity.Length());
|
||||
if (leavingWorldTop)
|
||||
idealVelocity = Vector2.UnitY * 2f;
|
||||
if (leavingWorldBottom)
|
||||
idealVelocity = Vector2.UnitY * -2f;
|
||||
if (leavingWorldLeft)
|
||||
idealVelocity = Vector2.UnitX * 2f;
|
||||
if (leavingWorldRight)
|
||||
idealVelocity = Vector2.UnitX * -2f;
|
||||
|
||||
NPC.velocity = Vector2.Lerp(NPC.velocity, idealVelocity, turnAwayStrength);
|
||||
}
|
||||
|
||||
@@ -665,7 +675,17 @@ namespace CalamityMod.NPCs.NormalNPCs
|
||||
DivineSwineOfferingPacket.Send(npc.ModNPC<DivineSwine>(), offeringState);
|
||||
}
|
||||
}
|
||||
npc.position -= npc.netOffset;
|
||||
}
|
||||
|
||||
// Change the mouse display to just show the name and not the text.
|
||||
if (hoveringOverHitbox && !player.mouseInterface)
|
||||
{
|
||||
self.MouseTextHackZoom(npc.GivenOrTypeName);
|
||||
Main.mouseText = true;
|
||||
npc.position -= npc.netOffset;
|
||||
}
|
||||
npc.position -= npc.netOffset;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -880,7 +900,7 @@ namespace CalamityMod.NPCs.NormalNPCs
|
||||
Texture2D baseTexture = TextureAssets.Npc[Type].Value;
|
||||
float floatHeight = MathHelper.Lerp(-8f, 8f, MathF.Sin((float)Timer / 150f) * 0.5f + 0.5f);
|
||||
Vector2 drawPosition = NPC.Center + Vector2.UnitY * floatHeight;
|
||||
Matrix pixelationMatrix = Main.Transform * Matrix.CreateScale(0.5f, 0.5f, 1f);
|
||||
Matrix pixelationMatrix = Matrix.CreateScale(0.5f, 0.5f, 1f);
|
||||
|
||||
RasterizerState previousRasterizerState = spriteBatch.GraphicsDevice.RasterizerState;
|
||||
Rectangle previousScissorRectangle = spriteBatch.GraphicsDevice.ScissorRectangle;
|
||||
|
||||
@@ -14,6 +14,55 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
|
||||
{
|
||||
public partial class HorribleHog
|
||||
{
|
||||
#region Static Behavior Properties
|
||||
public static int Damage_HogCharge => 10;
|
||||
public static int Damage_ShockwaveProjectile => 10;
|
||||
public static int Damage_ShockwaveRubbleProjectile => 12;
|
||||
public static int Damage_VomitChunkProjectile => 12;
|
||||
public static int Damage_VomitBombProjectile => 18;
|
||||
public static int Damage_VomitEyeProjectile => 14;
|
||||
|
||||
public static int ChaseTime => 180;
|
||||
public static float ChasePlayer_MaxSpeed => 5f;
|
||||
public static float ChasePlayer_MaxAcceleration => 0.3f;
|
||||
|
||||
public static int HogCharge_PreChargeTime => 75;
|
||||
public static int HogCharge_ChargingTime => 240;
|
||||
public static int HogCharge_ChargeCooldownTime => CalamityWorld.revenge ? -20 : Main.expertMode ? -30 : -45;
|
||||
public static int HogCharge_PreDashTime => 45;
|
||||
public static int HogCharge_DashTime => 20;
|
||||
public static int HogCharge_MaxCharges => CalamityWorld.revenge ? 4 : Main.expertMode ? 3 : 2;
|
||||
public static float HogCharge_MaxSpeed => CalamityWorld.revenge ? 18f : Main.expertMode ? 15f : 12f;
|
||||
public static float HogCharge_MaxAcceleration => CalamityWorld.revenge ? 0.425f : Main.expertMode ? 0.4f : 0.375f;
|
||||
public static float HogCharge_MaxSlowdownDistance => CalamityWorld.revenge ? 64f : Main.expertMode ? 96f : 128f;
|
||||
|
||||
public static int JumpAndDash_PreJumpTime => 75;
|
||||
public static int JumpAndDash_JumpPreDashTime => 45;
|
||||
public static int JumpAndDash_DashTime => 20;
|
||||
public static int JumpAndDash_CooldownTime => 60;
|
||||
public static int JumpAndDash_PreVomitTime => 60;
|
||||
public static int JumpAndDash_PreGroundPoundTime => 45;
|
||||
public static int JumpAndDash_MaxVomitChunks => CalamityWorld.revenge ? 5 : Main.expertMode ? 4 : 3;
|
||||
public static int JumpAndDash_VomitTimeInterval => CalamityWorld.revenge ? 10 : 15;
|
||||
public static int JumpAndDash_MaxBounces => Main.expertMode ? 3 : 2;
|
||||
public static float JumpAndDash_MaxJumpHeight => 14f;
|
||||
public static float JumpAndDash_MaxDashSpeed => 20f;
|
||||
public static float JumpAndDash_MaxBounceSpeed => CalamityWorld.revenge ? 16f : Main.expertMode ? 14f : 12f;
|
||||
|
||||
public static int HorribleHoller_RoarTime => 75;
|
||||
public static int HorribleHoller_PostRoarCooldownTime => 30;
|
||||
public static int HorribleHoller_MaxZombies => 3;
|
||||
|
||||
public static int VomitBarrage_PreJumpTime => 75;
|
||||
public static int VomitBarrage_VomitTime => 25;
|
||||
public static int VomitBarrage_PostVomitCooldown => 100;
|
||||
public static int VomitBarrage_MaxVomitChunks => CalamityWorld.revenge ? 10 : Main.expertMode ? 8 : 6;
|
||||
public static int VomitBarrage_MinVomitBombs => CalamityWorld.death ? 3 : CalamityWorld.revenge ? 2 : 0;
|
||||
public static int VomitBarrage_MaxVomitBombs => CalamityWorld.death ? 6 : CalamityWorld.revenge ? 5 : Main.expertMode ? 3 : 4;
|
||||
public static float VomitBarrage_MaxSpeed => 8f;
|
||||
public static float VomitBarrage_MaxAcceleration => 0.45f;
|
||||
#endregion
|
||||
|
||||
public void MainBehavior_ChasePlayer(Player target)
|
||||
{
|
||||
// Whenever the player is able to be hit, don't modify velocity mid-air.
|
||||
@@ -68,7 +117,7 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
|
||||
{
|
||||
Timer = 0f;
|
||||
LocalAIState = 1f;
|
||||
SoundEngine.PlaySound(DashGruntSound, NPC.Center);
|
||||
SoundEngine.PlaySound(SoundID.Zombie38, NPC.Center);
|
||||
NPC.netUpdate = true;
|
||||
}
|
||||
|
||||
@@ -95,7 +144,7 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
|
||||
|
||||
AfterimageTrailOpacity = MathHelper.Lerp(AfterimageTrailOpacity, 0f, 0.15f);
|
||||
if (Timer == -10 && !finishedWithCharges)
|
||||
RunEyeGlintEffect(0.4f);
|
||||
DoEyeGlintEffect(0.4f);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -184,7 +233,7 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
|
||||
{
|
||||
NPC.velocity.Y = -JumpAndDash_MaxJumpHeight * 1.2f;
|
||||
NPC.velocity.X += JumpAndDash_MaxDashSpeed * 0.4f * NPC.direction;
|
||||
SpawnJumpParticles();
|
||||
DoJumpEffects();
|
||||
SoundEngine.PlaySound(JumpSound, NPC.Center);
|
||||
}
|
||||
|
||||
@@ -202,7 +251,7 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
|
||||
NPC.direction = (target.Center.X > NPC.Center.X).ToDirectionInt();
|
||||
LastPlayerPosition = target.Center;
|
||||
if (Timer == HogCharge_PreDashTime - 10)
|
||||
RunEyeGlintEffect(0.6f);
|
||||
DoEyeGlintEffect(0.6f);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -214,7 +263,7 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
|
||||
SetSquashVectors(new Vector2(1.12f, 0.96f));
|
||||
SpriteRotation = 0f;
|
||||
NPC.rotation = NPC.velocity.ToRotation() + (NPC.direction > 0 ? 0f : -MathHelper.Pi);
|
||||
SoundEngine.PlaySound(DashGruntSound, NPC.Center);
|
||||
SoundEngine.PlaySound(SoundID.Zombie38, NPC.Center);
|
||||
}
|
||||
|
||||
if (Timer >= HogCharge_PreDashTime && Timer <= HogCharge_PreDashTime + HogCharge_DashTime)
|
||||
@@ -294,7 +343,7 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
|
||||
NPC.velocity.Y = -JumpAndDash_MaxJumpHeight;
|
||||
NPC.velocity.X += JumpAndDash_MaxDashSpeed * 0.2f * NPC.direction;
|
||||
|
||||
SpawnJumpParticles();
|
||||
DoJumpEffects();
|
||||
SetSquashVectors(new Vector2(0.84f, 1.14f));
|
||||
SoundEngine.PlaySound(JumpSound, NPC.Center);
|
||||
HorizontalShakeStrength = 0f;
|
||||
@@ -309,7 +358,7 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
|
||||
SpriteRotation -= (MathHelper.TwoPi / 20f) * NPC.direction;
|
||||
AfterimageTrailOpacity = MathHelper.Lerp(AfterimageTrailOpacity, 1f, 0.15f);
|
||||
if (Timer == JumpAndDash_JumpPreDashTime + JumpAndDash_PreJumpTime - 10)
|
||||
RunEyeGlintEffect(0.4f);
|
||||
DoEyeGlintEffect(0.4f);
|
||||
}
|
||||
|
||||
if (Timer == JumpAndDash_JumpPreDashTime + JumpAndDash_PreJumpTime)
|
||||
@@ -319,7 +368,7 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
|
||||
|
||||
SpriteRotation = 0f;
|
||||
NPC.rotation = NPC.velocity.ToRotation() + (NPC.direction > 0 ? 0f : -MathHelper.Pi);
|
||||
SoundEngine.PlaySound(DashGruntSound, NPC.Center);
|
||||
SoundEngine.PlaySound(SoundID.Zombie38, NPC.Center);
|
||||
}
|
||||
|
||||
if (Timer >= JumpAndDash_JumpPreDashTime + JumpAndDash_PreJumpTime && Timer <= JumpAndDash_JumpPreDashTime + JumpAndDash_PreJumpTime + JumpAndDash_DashTime)
|
||||
@@ -439,7 +488,7 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
|
||||
NPC.velocity *= 0.98f;
|
||||
NPC.GravityMultiplier *= 0.84f;
|
||||
if (Timer == JumpAndDash_PreVomitTime - 10)
|
||||
RunEyeGlintEffect(0.6f);
|
||||
DoEyeGlintEffect(0.6f);
|
||||
}
|
||||
|
||||
if (Timer >= JumpAndDash_PreVomitTime)
|
||||
@@ -544,7 +593,7 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
|
||||
NPC.velocity *= 0.96f;
|
||||
NPC.GravityMultiplier *= 0.4f;
|
||||
if (Timer == JumpAndDash_PreGroundPoundTime - 10)
|
||||
RunEyeGlintEffect(0.6f);
|
||||
DoEyeGlintEffect(0.6f);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -667,9 +716,8 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
|
||||
NPC.velocity.X = -12f * NPC.direction;
|
||||
|
||||
HorizontalShakeStrength = 0f;
|
||||
SpawnJumpParticles(6, 9);
|
||||
DoJumpEffects(6, 9);
|
||||
SetSquashVectors(squashVector: new Vector2(0.84f, 1.14f));
|
||||
SoundEngine.PlaySound(JumpSound, NPC.Center);
|
||||
}
|
||||
|
||||
if (Timer >= VomitBarrage_PreJumpTime && Timer <= VomitBarrage_PreJumpTime + VomitBarrage_VomitTime)
|
||||
@@ -751,10 +799,29 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
|
||||
SwitchBehavior(BehaviorState.VomitBarrage, null, [.. possibleAttacks]);
|
||||
}
|
||||
|
||||
// Do a small hiccup/burp after the attack.
|
||||
int burpTime = VomitBarrage_PostVomitCooldown / 2;
|
||||
if (Timer == burpTime)
|
||||
{
|
||||
SoundEngine.PlaySound(HiccupSound with { Volume = 1.25f }, NPC.Center);
|
||||
SetSquashVectors(squashVector: new Vector2(0.84f, 1.14f));
|
||||
NPC.velocity.Y = -4.25f;
|
||||
|
||||
int burpDustAmt = Main.rand.Next(6, 10);
|
||||
for (int i = 0; i < burpDustAmt; i++)
|
||||
{
|
||||
Vector2 spawnPosition = NPC.Center + new Vector2(8f * NPC.direction, -8f);
|
||||
Vector2 velocity = Vector2.UnitX.RotatedByRandom(MathHelper.ToRadians(20f) + NPC.rotation) * Main.rand.NextFloat(3f, 5f) * NPC.direction;
|
||||
Dust.NewDust(spawnPosition, 1, 1, DustID.FartInAJar, velocity.X, velocity.Y, Scale: Main.rand.NextFloat(0.8f, 1.2f));
|
||||
}
|
||||
}
|
||||
|
||||
if (NPC.velocity.Y == 0f)
|
||||
NPC.velocity.X *= 0.9f;
|
||||
|
||||
float targetAngle = (NPC.velocity.Y != 0f) ? NPC.velocity.X * 0.135f * (NPC.velocity.Y < 0).ToDirectionInt() : 0f;
|
||||
if (Timer >= burpTime && Timer <= VomitBarrage_PostVomitCooldown)
|
||||
targetAngle = (NPC.velocity.Y != 0f) ? (NPC.direction < 0 ? MathHelper.ToRadians(30f) : MathHelper.ToRadians(-30f)) : 0f;
|
||||
NPC.rotation = NPC.rotation.AngleLerp(targetAngle, 0.125f);
|
||||
NPC.direction = (target.Center.X > NPC.Center.X).ToDirectionInt();
|
||||
}
|
||||
|
||||
@@ -10,6 +10,16 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
|
||||
{
|
||||
public partial class HorribleHog
|
||||
{
|
||||
#region Static Behavior Properties
|
||||
public static float EngageDistance => 300f;
|
||||
public static float Idle_MaxSpeed => 2f;
|
||||
public static float Idle_MaxAcceleration => 0.125f;
|
||||
|
||||
public static int DigTowardsTarget_PreJumpTime => 30;
|
||||
public static int DigTowardsTarget_FindSuitablePositionTime => 120;
|
||||
public static int DigTowardsTraget_MaxDiggingTime => 180;
|
||||
#endregion
|
||||
|
||||
public void MainBehavior_PiggyTransformation()
|
||||
{
|
||||
NPC.ShowNameOnHover = false;
|
||||
@@ -36,30 +46,33 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
|
||||
Main.LocalPlayer.SetScreenshake(screenshakeStrength);
|
||||
}
|
||||
|
||||
float smokeOpacity = 1.2f * Utils.GetLerpValue(0f, 45f, Timer, true);
|
||||
int smokeAmt = Main.rand.Next(2, 5);
|
||||
for (int i = 0; i < smokeAmt; i++)
|
||||
if (Timer >= 45f)
|
||||
{
|
||||
Color color = Color.Lerp(new(30, 30, 30), Color.Crimson, Main.rand.NextBool(3) ? Main.rand.NextFloat(0.2f, 0.8f) : Main.rand.Next(2));
|
||||
int lifetime = Main.rand.Next(30, 45);
|
||||
float scale = Main.rand.NextFloat(1.4f, 1.6f);
|
||||
|
||||
HeavySmokeParticle circlingSmoke = new(NPC.Center, Main.rand.NextVector2Circular(16f, 16f), color, lifetime, scale, smokeOpacity, 0.01f, affectedByLight: true);
|
||||
GeneralParticleHandler.SpawnParticle(circlingSmoke, true, Enums.GeneralDrawLayer.BeforeNPCs);
|
||||
}
|
||||
|
||||
float particleStrengthInterpolant = Utils.GetLerpValue(0f, 180f, Timer, true);
|
||||
int lightSpawnRate = (int)MathHelper.Lerp(8, 1, particleStrengthInterpolant);
|
||||
if (Main.rand.NextBool(lightSpawnRate))
|
||||
{
|
||||
int lightAmt = (int)MathHelper.Lerp(1, 6, particleStrengthInterpolant);
|
||||
for (int i = 0; i < Main.rand.Next(1, lightAmt + 1); i++)
|
||||
float smokeOpacity = 1.2f * Utils.GetLerpValue(45f, 75f, Timer, true);
|
||||
int smokeAmt = Main.rand.Next(2, 5);
|
||||
for (int i = 0; i < smokeAmt; i++)
|
||||
{
|
||||
float lightSpeed = MathHelper.Lerp(2f, 4f, particleStrengthInterpolant) * tintStrength;
|
||||
float lightScale = MathHelper.Lerp(0.5f, 0.8f, particleStrengthInterpolant) * Main.rand.NextFloat(0.5f, 1f) * tintStrength;
|
||||
Color color = Color.Lerp(new(30, 30, 30), Color.Crimson, Main.rand.NextBool(3) ? Main.rand.NextFloat(0.2f, 0.8f) : Main.rand.Next(2));
|
||||
int lifetime = Main.rand.Next(30, 45);
|
||||
float scale = Main.rand.NextFloat(1.4f, 1.6f);
|
||||
|
||||
SquishyLightParticle transformLight = new(NPC.Center, Main.rand.NextVector2Circular(lightSpeed, lightSpeed), lightScale, Color.White, Main.rand.Next(30, 45));
|
||||
GeneralParticleHandler.SpawnParticle(transformLight, true, Enums.GeneralDrawLayer.AfterNPCs);
|
||||
HeavySmokeParticle circlingSmoke = new(NPC.Center, Main.rand.NextVector2Circular(16f, 16f), color, lifetime, scale, smokeOpacity, 0.01f, affectedByLight: true);
|
||||
GeneralParticleHandler.SpawnParticle(circlingSmoke, true, Enums.GeneralDrawLayer.BeforeNPCs);
|
||||
}
|
||||
|
||||
float particleStrengthInterpolant = Utils.GetLerpValue(0f, 180f, Timer, true);
|
||||
int lightSpawnRate = (int)MathHelper.Lerp(8, 1, particleStrengthInterpolant);
|
||||
if (Main.rand.NextBool(lightSpawnRate))
|
||||
{
|
||||
int lightAmt = (int)MathHelper.Lerp(1, 6, particleStrengthInterpolant);
|
||||
for (int i = 0; i < Main.rand.Next(1, lightAmt + 1); i++)
|
||||
{
|
||||
float lightSpeed = MathHelper.Lerp(2f, 4f, particleStrengthInterpolant) * tintStrength;
|
||||
float lightScale = MathHelper.Lerp(0.5f, 0.8f, particleStrengthInterpolant) * Main.rand.NextFloat(0.5f, 1f) * tintStrength;
|
||||
|
||||
SquishyLightParticle transformLight = new(NPC.Center, Main.rand.NextVector2Circular(lightSpeed, lightSpeed), lightScale, Color.White, Main.rand.Next(30, 45));
|
||||
GeneralParticleHandler.SpawnParticle(transformLight, true, Enums.GeneralDrawLayer.AfterNPCs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,54 +168,70 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
|
||||
|
||||
public void MainBehavior_DespawnAnimation()
|
||||
{
|
||||
// Jump into the ground and dig away.
|
||||
if (Timer < DigTowardsTarget_PreJumpTime)
|
||||
{
|
||||
NPC.velocity.X *= 0.8f;
|
||||
HorizontalShakeStrength = Utils.Remap(Timer, 0, DigTowardsTarget_PreJumpTime - 5, 0f, 6f, true);
|
||||
SetSquashVectors(new Vector2(1.24f, 0.84f));
|
||||
}
|
||||
NPC.damage = 0;
|
||||
|
||||
if (Timer == DigTowardsTarget_PreJumpTime)
|
||||
// Wait until Hog hits the ground before running the actual animation.
|
||||
if (LocalAIState == 0f)
|
||||
{
|
||||
NPC.velocity.Y -= 6f;
|
||||
NPC.velocity.X += 4f * NPC.direction;
|
||||
HorizontalShakeStrength = 0f;
|
||||
|
||||
SoundEngine.PlaySound(RetreatSound, NPC.Center);
|
||||
SetSquashVectors();
|
||||
}
|
||||
|
||||
if (Timer > DigTowardsTarget_PreJumpTime)
|
||||
{
|
||||
if (NPC.velocity.Y == 0f)
|
||||
if (NPC.velocity.Y == 0f && Timer > 3f)
|
||||
{
|
||||
int dustAmt = Main.rand.Next(10, 15);
|
||||
for (int i = 0; i < dustAmt; i++)
|
||||
{
|
||||
Vector2 dustPosition = NPC.Bottom + Main.rand.NextVector2Circular(NPC.width, 0f);
|
||||
Vector2 dustVelocity = new Vector2(Main.rand.NextFloat(-4f, 4f), Main.rand.NextFloat(-4f, -2f));
|
||||
Dust.NewDust(dustPosition, 1, 1, DustID.Dirt, dustVelocity.X, dustVelocity.Y, Scale: Main.rand.NextFloat(0.8f, 1.2f));
|
||||
}
|
||||
|
||||
int dustCloudAmt = Main.rand.Next(9, 13);
|
||||
for (int i = 0; i < dustCloudAmt; i++)
|
||||
{
|
||||
Vector2 spawnPosition = NPC.Bottom + Main.rand.NextVector2Circular(NPC.width, 0f);
|
||||
Vector2 velocity = new Vector2(Main.rand.NextFloat(-3f, 3f), Main.rand.NextFloat(-2f, -1f));
|
||||
Color color = Color.Lerp(Color.SandyBrown, Color.SaddleBrown, Main.rand.NextFloat());
|
||||
float rotationSpeed = Main.rand.NextFloat(0.01f, 0.03f) * Main.rand.NextBool().ToDirectionInt();
|
||||
|
||||
TimedSmokeParticle dustCloud = new(spawnPosition, velocity, color, color, Main.rand.NextFloat(1.2f, 1.4f), 1f, Main.rand.Next(45, 55), rotationSpeed);
|
||||
GeneralParticleHandler.SpawnParticle(dustCloud, true);
|
||||
}
|
||||
|
||||
CalamityUtils.AddScreenshakeAt(NPC.Center, 5f);
|
||||
SoundEngine.PlaySound(SoundID.Item70, NPC.Center);
|
||||
|
||||
NPC.active = false;
|
||||
LocalAIState = 1f;
|
||||
Timer = 0f;
|
||||
NPC.netUpdate = true;
|
||||
}
|
||||
|
||||
NPC.GravityMultiplier *= 2f;
|
||||
}
|
||||
|
||||
if (LocalAIState == 1f)
|
||||
{
|
||||
// Jump into the ground and dig away.
|
||||
if (Timer < DigTowardsTarget_PreJumpTime)
|
||||
{
|
||||
NPC.velocity.X *= 0.8f;
|
||||
HorizontalShakeStrength = Utils.Remap(Timer, 0, DigTowardsTarget_PreJumpTime - 5, 0f, 6f, true);
|
||||
SetSquashVectors(new Vector2(1.24f, 0.84f));
|
||||
}
|
||||
|
||||
if (Timer == DigTowardsTarget_PreJumpTime)
|
||||
{
|
||||
NPC.velocity.Y -= 6f;
|
||||
NPC.velocity.X += 4f * NPC.direction;
|
||||
HorizontalShakeStrength = 0f;
|
||||
SetSquashVectors();
|
||||
}
|
||||
|
||||
if (Timer > DigTowardsTarget_PreJumpTime)
|
||||
{
|
||||
if (NPC.velocity.Y == 0f)
|
||||
{
|
||||
int dustAmt = Main.rand.Next(10, 15);
|
||||
for (int i = 0; i < dustAmt; i++)
|
||||
{
|
||||
Vector2 dustPosition = NPC.Bottom + Main.rand.NextVector2Circular(NPC.width, 0f);
|
||||
Vector2 dustVelocity = new Vector2(Main.rand.NextFloat(-4f, 4f), Main.rand.NextFloat(-4f, -2f));
|
||||
Dust.NewDust(dustPosition, 1, 1, DustID.Dirt, dustVelocity.X, dustVelocity.Y, Scale: Main.rand.NextFloat(0.8f, 1.2f));
|
||||
}
|
||||
|
||||
int dustCloudAmt = Main.rand.Next(9, 13);
|
||||
for (int i = 0; i < dustCloudAmt; i++)
|
||||
{
|
||||
Vector2 spawnPosition = NPC.Bottom + Main.rand.NextVector2Circular(NPC.width, 0f);
|
||||
Vector2 velocity = new Vector2(Main.rand.NextFloat(-3f, 3f), Main.rand.NextFloat(-2f, -1f));
|
||||
Color color = Color.Lerp(Color.SandyBrown, Color.SaddleBrown, Main.rand.NextFloat());
|
||||
float rotationSpeed = Main.rand.NextFloat(0.01f, 0.03f) * Main.rand.NextBool().ToDirectionInt();
|
||||
|
||||
TimedSmokeParticle dustCloud = new(spawnPosition, velocity, color, color, Main.rand.NextFloat(1.2f, 1.4f), 1f, Main.rand.Next(45, 55), rotationSpeed);
|
||||
GeneralParticleHandler.SpawnParticle(dustCloud, true);
|
||||
}
|
||||
|
||||
CalamityUtils.AddScreenshakeAt(NPC.Center, 5f);
|
||||
SoundEngine.PlaySound(SoundID.Item70, NPC.Center);
|
||||
|
||||
NPC.active = false;
|
||||
NPC.netUpdate = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
float idealRotation = (NPC.velocity.Y != 0f) ? NPC.velocity.ToRotation() + (NPC.direction > 0 ? 0f : -MathHelper.Pi) : 0f;
|
||||
@@ -262,7 +291,7 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
|
||||
if (targetIsVisible || wasHitByNearestTarget)
|
||||
{
|
||||
SwitchBehavior(specificAttack: BehaviorState.EngageAnimation);
|
||||
RunEyeGlintEffect(0.4f);
|
||||
DoEyeGlintEffect(0.4f);
|
||||
}
|
||||
|
||||
// Standing still, occasionally switch directions.
|
||||
@@ -308,6 +337,22 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
|
||||
NPC.soundDelay = Main.rand.Next(30, 45);
|
||||
}
|
||||
|
||||
// Spawn ambient mist around itself while it idles.
|
||||
Rectangle tileWorkSpace = GetTileWorkSpaceForMist();
|
||||
int tileWorkSpaceWithWidth = tileWorkSpace.X + tileWorkSpace.Width;
|
||||
int tileWorkSpaceWithHeight = tileWorkSpace.Y + tileWorkSpace.Height;
|
||||
for (int x = tileWorkSpace.X; x < tileWorkSpaceWithWidth; x++)
|
||||
{
|
||||
for (int y = tileWorkSpace.Y; y < tileWorkSpaceWithHeight; y++)
|
||||
{
|
||||
TrySpawningMist(x, y);
|
||||
}
|
||||
}
|
||||
|
||||
// Tint slightly black.
|
||||
TintColor = Color.Black;
|
||||
TintStrength = 0.6f;
|
||||
|
||||
NPC.chaseable = false;
|
||||
SearchForTargetEveryFrame = true;
|
||||
}
|
||||
@@ -440,7 +485,7 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
|
||||
|
||||
NPC.Center = DiggingEmergeSpot;
|
||||
NPC.velocity = CalamityUtils.GetProjectilePhysicsFiringVelocity(NPC.Center, target.Center, NPC.gravity, 7f) * new Vector2(1f, 1.45f);
|
||||
SpawnJumpParticles();
|
||||
DoJumpEffects();
|
||||
|
||||
LocalAIState = 2f;
|
||||
Timer = 0f;
|
||||
@@ -458,7 +503,7 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
|
||||
NPC.Opacity = MathHelper.Lerp(NPC.Opacity, 1f, 0.085f);
|
||||
if (NPC.velocity.Y == 0f && Timer > 2f)
|
||||
{
|
||||
RunEyeGlintEffect(0.4f);
|
||||
DoEyeGlintEffect(0.4f);
|
||||
SwitchBehavior(specificAttack: BehaviorState.ChasePlayer);
|
||||
}
|
||||
|
||||
|
||||
@@ -63,12 +63,11 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
|
||||
private static SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/HorribleHogHit", 3);
|
||||
private static SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/HorribleHogDeath");
|
||||
private static SoundStyle CackleSound = new("CalamityMod/Sounds/Custom/HorribleHog/HorribleHogCackle");
|
||||
private static SoundStyle DashGruntSound = new("CalamityMod/Sounds/Custom/HorribleHog/HorribleHogDashGrunt");
|
||||
private static SoundStyle HiccupSound = new("CalamityMod/Sounds/Custom/HorribleHog/HorribleHogHiccup", 2);
|
||||
private static SoundStyle JumpSound = new("CalamityMod/Sounds/Custom/HorribleHog/HorribleHogJump", 2);
|
||||
private static SoundStyle GroundImpactSound = new("CalamityMod/Sounds/Custom/HorribleHog/HorribleHogGroundImpact", 2);
|
||||
private static SoundStyle VomitChargeUpSound = new("CalamityMod/Sounds/Custom/HorribleHog/HorribleHogVomitChargeUp", 2);
|
||||
private static SoundStyle VomitSound = new("CalamityMod/Sounds/Custom/HorribleHog/HorribleHogVomit", 2);
|
||||
private static SoundStyle RetreatSound = new("CalamityMod/Sounds/Custom/HorribleHog/HorribleHogRetreat");
|
||||
private static SoundStyle IdleSound = new("CalamityMod/Sounds/Custom/HorribleHog/HorribleHogIdle", 2)
|
||||
{
|
||||
PitchVariance = 0.25f,
|
||||
@@ -114,12 +113,6 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
|
||||
|
||||
public float TintStrength;
|
||||
|
||||
/// <summary>
|
||||
/// Used as a shader parameter to rotate the already-drawn sprite of Horrible Hog directly regardless of the rotation value of <see cref="NPC.rotation"/>. <br></br>
|
||||
/// Used in cases where Horrible Hog needs to spin while also squashing and stretching. <see cref="NPC.rotation"/> is used for the spritebatch-drawn texture <br></br>
|
||||
/// and needs to rotate towards the NPC's velocity in order for the squashed sprite to face the correct direction. This parameter is then used and a shader is <br></br>
|
||||
/// then applied to the spritebatch to rotate the sprite differently from the value passed in spritebatch's Draw call.
|
||||
/// </summary>
|
||||
public float SpriteRotation;
|
||||
|
||||
public Vector2 LastPlayerPosition;
|
||||
@@ -147,63 +140,8 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
|
||||
public static int MaxAttacks_JumpAndDash => Main.expertMode ? 3 : 2;
|
||||
public static int MaxAttacks_VomitBarrage => Main.expertMode ? 2 : 1;
|
||||
public static int MaxAttacksPerCycle => CalamityWorld.revenge ? 5 : Main.expertMode ? 4 : 3;
|
||||
|
||||
public static int Damage_HogCharge => 10;
|
||||
public static int Damage_ShockwaveProjectile => 10;
|
||||
public static int Damage_ShockwaveRubbleProjectile => 12;
|
||||
public static int Damage_VomitChunkProjectile => 12;
|
||||
public static int Damage_VomitBombProjectile => 18;
|
||||
public static int Damage_VomitEyeProjectile => 14;
|
||||
|
||||
public static float EngageDistance => 300f;
|
||||
public static float Idle_MaxSpeed => 2f;
|
||||
public static float Idle_MaxAcceleration => 0.125f;
|
||||
|
||||
|
||||
public static int MaxTimeToStartDigging => 300;
|
||||
|
||||
public static int DigTowardsTarget_PreJumpTime => 30;
|
||||
public static int DigTowardsTarget_FindSuitablePositionTime => 120;
|
||||
public static int DigTowardsTraget_MaxDiggingTime => 180;
|
||||
|
||||
public static int ChaseTime => 180;
|
||||
public static float ChasePlayer_MaxSpeed => 5f;
|
||||
public static float ChasePlayer_MaxAcceleration => 0.3f;
|
||||
|
||||
public static int HogCharge_PreChargeTime => 75;
|
||||
public static int HogCharge_ChargingTime => 240;
|
||||
public static int HogCharge_ChargeCooldownTime => CalamityWorld.revenge ? -20 : Main.expertMode ? -30 : -45;
|
||||
public static int HogCharge_PreDashTime => 45;
|
||||
public static int HogCharge_DashTime => 20;
|
||||
public static int HogCharge_MaxCharges => CalamityWorld.revenge ? 4 : Main.expertMode ? 3 : 2;
|
||||
public static float HogCharge_MaxSpeed => CalamityWorld.revenge ? 18f : Main.expertMode ? 15f : 12f;
|
||||
public static float HogCharge_MaxAcceleration => CalamityWorld.revenge ? 0.425f : Main.expertMode ? 0.4f : 0.375f;
|
||||
public static float HogCharge_MaxSlowdownDistance => CalamityWorld.revenge ? 64f : Main.expertMode ? 96f : 128f;
|
||||
|
||||
public static int JumpAndDash_PreJumpTime => 75;
|
||||
public static int JumpAndDash_JumpPreDashTime => 45;
|
||||
public static int JumpAndDash_DashTime => 20;
|
||||
public static int JumpAndDash_CooldownTime => 60;
|
||||
public static int JumpAndDash_PreVomitTime => 60;
|
||||
public static int JumpAndDash_PreGroundPoundTime => 45;
|
||||
public static int JumpAndDash_MaxVomitChunks => CalamityWorld.revenge ? 5 : Main.expertMode ? 4 : 3;
|
||||
public static int JumpAndDash_VomitTimeInterval => CalamityWorld.revenge ? 10 : 15;
|
||||
public static int JumpAndDash_MaxBounces => Main.expertMode ? 3 : 2;
|
||||
public static float JumpAndDash_MaxJumpHeight => 14f;
|
||||
public static float JumpAndDash_MaxDashSpeed => 20f;
|
||||
public static float JumpAndDash_MaxBounceSpeed => CalamityWorld.revenge ? 16f : Main.expertMode ? 14f : 12f;
|
||||
|
||||
public static int HorribleHoller_RoarTime => 75;
|
||||
public static int HorribleHoller_PostRoarCooldownTime => 30;
|
||||
public static int HorribleHoller_MaxZombies => 3;
|
||||
|
||||
public static int VomitBarrage_PreJumpTime => 75;
|
||||
public static int VomitBarrage_VomitTime => 25;
|
||||
public static int VomitBarrage_PostVomitCooldown => 100;
|
||||
public static int VomitBarrage_MaxVomitChunks => CalamityWorld.revenge ? 10 : Main.expertMode ? 8 : 6;
|
||||
public static int VomitBarrage_MinVomitBombs => CalamityWorld.death ? 3 : CalamityWorld.revenge ? 2 : 0;
|
||||
public static int VomitBarrage_MaxVomitBombs => CalamityWorld.death ? 6 : CalamityWorld.revenge ? 5 : Main.expertMode ? 3 : 4;
|
||||
public static float VomitBarrage_MaxSpeed => 8f;
|
||||
public static float VomitBarrage_MaxAcceleration => 0.45f;
|
||||
#endregion
|
||||
|
||||
public ref float Timer => ref NPC.ai[0];
|
||||
@@ -224,7 +162,7 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
|
||||
{
|
||||
get
|
||||
{
|
||||
float stretch = MathHelper.Clamp(NPC.velocity.Length() / 20f * 0.1f, 1f, 1.05f);
|
||||
float stretch = Utils.Remap(NPC.velocity.Length(), 0f, 20f, 1f, 1.08f);
|
||||
Vector2 stretchedVector = new(1f * stretch, 1f - 1f * stretch * 0.3f);
|
||||
return stretchedVector;
|
||||
}
|
||||
@@ -557,15 +495,7 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
|
||||
NPC.netUpdate = true;
|
||||
}
|
||||
|
||||
public void TransformIntoPiggy()
|
||||
{
|
||||
if (Main.netMode == NetmodeID.MultiplayerClient)
|
||||
{
|
||||
// Run packet here if necessary.
|
||||
}
|
||||
|
||||
SwitchBehavior(specificAttack: BehaviorState.PiggyTransformation);
|
||||
}
|
||||
public void TransformIntoPiggy() => SwitchBehavior(specificAttack: BehaviorState.PiggyTransformation);
|
||||
|
||||
public bool TryTransformingIntoPiggy()
|
||||
{
|
||||
@@ -705,7 +635,7 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
|
||||
return NPC.active && DevilsTongueVolumeMultiplier >= 0.05f;
|
||||
}
|
||||
|
||||
private void SpawnJumpParticles(int dustCloudMin = 10, int dustCloudMax = 14, int dirtDustMin = 14, int dirtDustMax = 18)
|
||||
private void DoJumpEffects(int dustCloudMin = 10, int dustCloudMax = 14, int dirtDustMin = 14, int dirtDustMax = 18)
|
||||
{
|
||||
// Do fart in a jar visuals when Hog does a jump mid-air.
|
||||
float tileCollisionDistance = CalamityUtils.DistanceToTileCollisionHit(NPC.Bottom, Vector2.UnitY, 10) ?? 9999f;
|
||||
@@ -749,9 +679,82 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
|
||||
Vector2 velocity = NPC.velocity * (Main.rand.NextFloat(0.1f, 0.2f) + i * 0.025f);
|
||||
Dust.NewDust(NPC.Bottom, 0, 0, DustID.Dirt, velocity.X, velocity.Y);
|
||||
}
|
||||
|
||||
SoundEngine.PlaySound(JumpSound, NPC.Bottom);
|
||||
}
|
||||
}
|
||||
|
||||
private void TrySpawningMist(int x, int y)
|
||||
{
|
||||
if (!WorldGen.InWorld(x, y, 10) || Main.tile[x, y] == null)
|
||||
return;
|
||||
|
||||
Tile tile = Main.tile[x, y];
|
||||
if (!tile.HasTile || tile.Slope > 0 || tile.IsHalfBlock || !Main.tileSolid[Main.tile[x, y].TileType])
|
||||
return;
|
||||
|
||||
tile = Main.tile[x, y - 1];
|
||||
if (tile.LiquidAmount > 0 && tile.Slope <= 0)
|
||||
{
|
||||
for (int i = tile.Y() - 1; i > tile.Y() - 50; i--)
|
||||
{
|
||||
Tile liquidTile = Main.tile[x, i];
|
||||
Tile liquidTileUnderOne = Main.tile[x, i + 1];
|
||||
Tile liquidTileUnderTwo = Main.tile[x, i + 2];
|
||||
if (liquidTile.LiquidAmount == 0 && !WorldGen.SolidTile(liquidTile) && !WorldGen.SolidTile(liquidTileUnderOne) && !WorldGen.SolidTile(liquidTileUnderTwo))
|
||||
{
|
||||
if (Main.rand.NextBool(240))
|
||||
{
|
||||
SpawnFloorMist(x, i + 1);
|
||||
if (Main.rand.NextBool(3))
|
||||
SpawnFloorMist(x, i + 2);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!WorldGen.SolidTile(tile) && Main.rand.NextBool(240))
|
||||
{
|
||||
SpawnFloorMist(x, y + 1);
|
||||
if (Main.rand.NextBool(3))
|
||||
SpawnFloorMist(x, y);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private Rectangle GetTileWorkSpaceForMist()
|
||||
{
|
||||
Point point = NPC.Center.ToTileCoordinates();
|
||||
int width = 30;
|
||||
int height = 10;
|
||||
return new Rectangle(point.X - width / 2, point.Y - height / 2, width, height);
|
||||
}
|
||||
|
||||
private void SpawnFloorMist(int x, int y)
|
||||
{
|
||||
int textureIndex = Main.rand.Next(GoreID.AmbientFloorCloud1, GoreID.AmbientFloorCloud4 + 1);
|
||||
|
||||
Vector2 position = new Point(x, y - 1).ToWorldCoordinates();
|
||||
Vector2 velocity = Vector2.UnitX * Main.rand.NextFloat(0.2f, 0.4f) * Main.WindForVisuals;
|
||||
Color mistColor = Color.Lerp(new(30, 30, 30), Color.Crimson, Main.rand.NextBool(3) ? Main.rand.NextFloat(0.2f, 0.8f) : Main.rand.Next(2));
|
||||
Color color = Color.Lerp(Lighting.GetColor(new Point(x, y)), mistColor, 0.5f);
|
||||
|
||||
float yOffset = 16f * Main.rand.NextFloat();
|
||||
position.Y -= yOffset;
|
||||
if (yOffset > 4f)
|
||||
textureIndex = GoreID.AmbientFloorCloud4;
|
||||
|
||||
float scale = Main.rand.NextFloat(0.8f, 1.6f) + Main.rand.NextFloat() * 0.2f;
|
||||
float baseOpacity = Main.rand.NextFloat(0.8f, 1.2f) * Utils.Remap(Main.LocalPlayer.Distance(NPC.Center), 1200f, 600f, 0.3f, 1f, true);
|
||||
int lifetime = Main.rand.Next(480, 720);
|
||||
|
||||
GraveyardMistParticle floorMist = new(position, velocity, color, scale, baseOpacity, lifetime, textureIndex);
|
||||
GeneralParticleHandler.SpawnParticle(floorMist);
|
||||
}
|
||||
|
||||
public override float SpawnChance(NPCSpawnInfo spawnInfo)
|
||||
{
|
||||
if (Main.bloodMoon && NPC.downedBoss1 && NPC.CountNPCS(Type) < 1)
|
||||
@@ -797,7 +800,10 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor)
|
||||
{
|
||||
if (NPC.IsABestiaryIconDummy)
|
||||
{
|
||||
Draw_ScaryEvilFuckedUpAura(spriteBatch, screenPos, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
Texture2D baseTexture = TextureAssets.Npc[Type].Value;
|
||||
SpriteEffects effects = NPC.spriteDirection > 0 ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
|
||||
@@ -808,42 +814,7 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
|
||||
|
||||
// Background effect when Horrible Hog is idling and its nearby loop is playing.
|
||||
if (DevilsTongueVolumeMultiplier > 0.05f && AIState != (int)BehaviorState.PiggyTransformation)
|
||||
{
|
||||
using (spriteBatch.Scope())
|
||||
{
|
||||
float radiusBasedOpacity = Utils.Remap(Main.LocalPlayer.Distance(NPC.Center), 250f, 750f, 1f, 0.15f, true);
|
||||
|
||||
Effect auraShader = CalamityShaders.HorribleHogAuraShader.Value;
|
||||
auraShader.Parameters["time"].SetValue(Main.GlobalTimeWrappedHourly);
|
||||
auraShader.Parameters["colorPaletteLimit"].SetValue(16f);
|
||||
auraShader.Parameters["spiralArms"].SetValue(5f);
|
||||
auraShader.Parameters["spiralAdditionalAngle"].SetValue(6f);
|
||||
auraShader.Parameters["minPixelFadeDistance"].SetValue(0.125f);
|
||||
auraShader.Parameters["maxPixelFadeDistance"].SetValue(0.485f);
|
||||
auraShader.Parameters["pixelationFactor"].SetValue(Main.ScreenSize.ToVector2() * 0.25f);
|
||||
auraShader.Parameters["spiralTimeOffset"].SetValue(new Vector2(-0.08f, -0.05f));
|
||||
auraShader.Parameters["vortexDarkColor"].SetValue(new Color(8, 8, 8).ToVector3());
|
||||
auraShader.Parameters["vortexBrightColor"].SetValue(Color.Crimson.ToVector3());
|
||||
|
||||
Main.graphics.GraphicsDevice.Textures[1] = VortexTextureSecondary.Value;
|
||||
Main.graphics.GraphicsDevice.SamplerStates[1] = SamplerState.PointWrap;
|
||||
|
||||
Main.graphics.GraphicsDevice.Textures[2] = VortexDistortionTexture.Value;
|
||||
Main.graphics.GraphicsDevice.SamplerStates[2] = SamplerState.LinearWrap;
|
||||
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointWrap, DepthStencilState.None, Main.Rasterizer, auraShader, Main.GameViewMatrix.TransformationMatrix);
|
||||
|
||||
spriteBatch.Draw(VortexTexture.Value, drawPosition, null, Color.White * radiusBasedOpacity * DevilsTongueVolumeMultiplier, 0f, VortexTexture.Size() * 0.5f, 1f, 0, 0f);
|
||||
|
||||
spriteBatch.End();
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointWrap, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
|
||||
|
||||
float bloomCircleOpacity = MathHelper.Lerp(0.6f, 0.9f, MathF.Sin((float)Main.timeForVisualEffects / 75f + NPC.whoAmI * 0.5f + 0.5f)) * radiusBasedOpacity;
|
||||
spriteBatch.Draw(BloomCircle.Value, drawPosition, null, Color.Crimson with { A = 0 } * bloomCircleOpacity * DevilsTongueVolumeMultiplier, 0f, BloomCircle.Size() * 0.5f, 1.2f, 0, 0f);
|
||||
|
||||
spriteBatch.End();
|
||||
}
|
||||
}
|
||||
Draw_ScaryEvilFuckedUpAura(spriteBatch, screenPos);
|
||||
|
||||
// Horrible Hog and its afterimage trail.
|
||||
using (spriteBatch.Scope())
|
||||
@@ -878,11 +849,6 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
|
||||
spriteBatch.End();
|
||||
}
|
||||
|
||||
// Debugging text for tracking attacks.
|
||||
//string attack = $"{(BehaviorState)AIState}";
|
||||
//Vector2 stringDrawPosition = drawPosition - Vector2.UnitY * 64f;
|
||||
//ChatManager.DrawColorCodedStringWithShadow(spriteBatch, FontAssets.MouseText.Value, attack, stringDrawPosition, Color.LawnGreen, 0f, Vector2.One, Vector2.One);
|
||||
|
||||
// Eye glint.
|
||||
if (EyeGlintScale > 0.05f)
|
||||
{
|
||||
@@ -900,19 +866,86 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
|
||||
return false;
|
||||
}
|
||||
|
||||
private void EffectChaining_ApplyTintShader()
|
||||
private void Draw_ScaryEvilFuckedUpAura(SpriteBatch spriteBatch, Vector2 screenPos, bool bestiary = false)
|
||||
{
|
||||
Effect tintShader = CalamityShaders.BasicTintShader.Value;
|
||||
tintShader.Parameters["uColor"].SetValue(TintColor.ToVector3());
|
||||
tintShader.Parameters["uOpacity"].SetValue(TintStrength);
|
||||
tintShader.Techniques[0].Passes[0].Apply();
|
||||
}
|
||||
RasterizerState previousRasterizerState = spriteBatch.GraphicsDevice.RasterizerState;
|
||||
Rectangle previousScissorRectangle = spriteBatch.GraphicsDevice.ScissorRectangle;
|
||||
|
||||
private void EffectChaining_ApplySpriteRotationShader()
|
||||
{
|
||||
Effect rotateSpriteShader = CalamityShaders.RotateSprite.Value;
|
||||
rotateSpriteShader.Parameters["rotation"].SetValue(SpriteRotation);
|
||||
rotateSpriteShader.Techniques[0].Passes[0].Apply();
|
||||
using (spriteBatch.Scope())
|
||||
{
|
||||
Vector2 drawPosition = NPC.Center - screenPos;
|
||||
float radiusBasedOpacity = Utils.Remap(Main.LocalPlayer.Distance(NPC.Center), 250f, 750f, 1f, 0.15f, true);
|
||||
float generalEffectOpacity = bestiary ? MathHelper.Lerp(0.5f, 1f, MathF.Sin((float)Main.timeForVisualEffects / 75f) * 0.5f + 0.5f) : radiusBasedOpacity * DevilsTongueVolumeMultiplier;
|
||||
float generalEffectScale = bestiary ? 0.5f : 1f;
|
||||
Matrix transformatiomMatrix = bestiary ? Main.UIScaleMatrix : Main.GameViewMatrix.TransformationMatrix;
|
||||
|
||||
Effect auraShader = CalamityShaders.HorribleHogAuraShader.Value;
|
||||
auraShader.Parameters["time"].SetValue(Main.GlobalTimeWrappedHourly);
|
||||
auraShader.Parameters["colorPaletteLimit"].SetValue(16f);
|
||||
auraShader.Parameters["spiralArms"].SetValue(5f);
|
||||
auraShader.Parameters["spiralAdditionalAngle"].SetValue(6f);
|
||||
auraShader.Parameters["minPixelFadeDistance"].SetValue(0.145f);
|
||||
auraShader.Parameters["maxPixelFadeDistance"].SetValue(0.485f);
|
||||
auraShader.Parameters["pixelationFactor"].SetValue(Main.ScreenSize.ToVector2() * 0.25f);
|
||||
auraShader.Parameters["spiralTimeOffset"].SetValue(new Vector2(-0.08f, -0.05f));
|
||||
auraShader.Parameters["vortexDarkColor"].SetValue(new Color(8, 8, 8).ToVector3());
|
||||
auraShader.Parameters["vortexBrightColor"].SetValue(Color.Crimson.ToVector3());
|
||||
|
||||
Main.graphics.GraphicsDevice.Textures[1] = VortexTextureSecondary.Value;
|
||||
Main.graphics.GraphicsDevice.SamplerStates[1] = SamplerState.PointWrap;
|
||||
|
||||
Main.graphics.GraphicsDevice.Textures[2] = VortexDistortionTexture.Value;
|
||||
Main.graphics.GraphicsDevice.SamplerStates[2] = SamplerState.PointWrap;
|
||||
|
||||
// More accurate pixelation for the bestiary.
|
||||
if (bestiary)
|
||||
{
|
||||
auraShader.Parameters["pixelationFactor"].SetValue(Main.ScreenSize.ToVector2());
|
||||
Matrix pixelationMatrix = Matrix.CreateScale(0.5f, 0.5f, 1f);
|
||||
using var pixelationLease = RenderTargetPool.Shared.Rent(Main.graphics.GraphicsDevice, Main.screenWidth / 2, Main.screenHeight / 2, RenderTargetDescriptor.Default);
|
||||
using (pixelationLease.Scope(clearColor: Color.Transparent))
|
||||
{
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointWrap, DepthStencilState.None, Main.Rasterizer, auraShader, pixelationMatrix);
|
||||
|
||||
spriteBatch.Draw(VortexTexture.Value, drawPosition, null, Color.White * generalEffectOpacity, 0f, VortexTexture.Size() * 0.5f, 1f * generalEffectScale, 0, 0f);
|
||||
|
||||
spriteBatch.End();
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointWrap, DepthStencilState.None, Main.Rasterizer, null, pixelationMatrix);
|
||||
|
||||
float bloomCircleOpacity = MathHelper.Lerp(0.6f, 0.9f, MathF.Sin((float)Main.timeForVisualEffects / 75f + NPC.whoAmI) * 0.5f + 0.5f) * generalEffectOpacity;
|
||||
spriteBatch.Draw(BloomCircle.Value, drawPosition, null, Color.Crimson with { A = 0 } * bloomCircleOpacity, 0f, BloomCircle.Size() * 0.5f, 1.2f * generalEffectScale, 0, 0f);
|
||||
|
||||
spriteBatch.End();
|
||||
}
|
||||
|
||||
spriteBatch.GraphicsDevice.RasterizerState = previousRasterizerState;
|
||||
spriteBatch.GraphicsDevice.ScissorRectangle = previousScissorRectangle;
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, previousRasterizerState, null, transformatiomMatrix);
|
||||
|
||||
spriteBatch.Draw(pixelationLease.Target, Vector2.Zero, null, Color.White, 0f, Vector2.Zero, 2f, 0, 0f);
|
||||
|
||||
spriteBatch.End();
|
||||
}
|
||||
else
|
||||
{
|
||||
spriteBatch.GraphicsDevice.RasterizerState = previousRasterizerState;
|
||||
spriteBatch.GraphicsDevice.ScissorRectangle = previousScissorRectangle;
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointWrap, DepthStencilState.None, previousRasterizerState, auraShader, transformatiomMatrix);
|
||||
|
||||
spriteBatch.Draw(VortexTexture.Value, drawPosition, null, Color.White * generalEffectOpacity, 0f, VortexTexture.Size() * 0.5f, 1f * generalEffectScale, 0, 0f);
|
||||
|
||||
spriteBatch.End();
|
||||
|
||||
spriteBatch.GraphicsDevice.RasterizerState = previousRasterizerState;
|
||||
spriteBatch.GraphicsDevice.ScissorRectangle = previousScissorRectangle;
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointWrap, DepthStencilState.None, previousRasterizerState, null, transformatiomMatrix);
|
||||
|
||||
float bloomCircleOpacity = MathHelper.Lerp(0.6f, 0.9f, MathF.Sin((float)Main.timeForVisualEffects / 75f + NPC.whoAmI) * 0.5f + 0.5f) * generalEffectOpacity;
|
||||
spriteBatch.Draw(BloomCircle.Value, drawPosition, null, Color.Crimson with { A = 0 } * bloomCircleOpacity, 0f, BloomCircle.Size() * 0.5f, 1.2f * generalEffectScale, 0, 0f);
|
||||
|
||||
spriteBatch.End();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void SetSquashVectors(Vector2? squashVectorTarget = null, Vector2? squashVector = null)
|
||||
@@ -922,7 +955,7 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
|
||||
SquashVector = squashVector.Value;
|
||||
}
|
||||
|
||||
private void RunEyeGlintEffect(float scale)
|
||||
private void DoEyeGlintEffect(float scale)
|
||||
{
|
||||
EyeGlintScale = scale;
|
||||
float pitch = Utils.Remap(scale, 0.4f, 1f, 0.7f, 0.9f, true);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Security.Policy;
|
||||
using CalamityMod.Effects;
|
||||
using CalamityMod.Items.Critters;
|
||||
using CalamityMod.Items.Placeables.Banners;
|
||||
@@ -97,11 +98,10 @@ namespace CalamityMod.NPCs.NormalNPCs
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
NPC.chaseable = false;
|
||||
NPC.damage = 0;
|
||||
NPC.width = 26;
|
||||
NPC.height = 26;
|
||||
NPC.lifeMax = 2000;
|
||||
NPC.width = 42;
|
||||
NPC.height = 28;
|
||||
NPC.lifeMax = 200;
|
||||
NPC.aiStyle = -1;
|
||||
NPC.knockBackResist = 1.15f;
|
||||
NPC.HitSound = SoundID.NPCHit1;
|
||||
@@ -109,6 +109,7 @@ namespace CalamityMod.NPCs.NormalNPCs
|
||||
NPC.catchItem = (short)ModContent.ItemType<PiggyItem>();
|
||||
Banner = NPC.type;
|
||||
BannerItem = ModContent.ItemType<PiggyBanner>();
|
||||
NPC.chaseable = false;
|
||||
NPC.Calamity().VulnerableToHeat = true;
|
||||
NPC.Calamity().VulnerableToCold = true;
|
||||
NPC.Calamity().VulnerableToSickness = true;
|
||||
@@ -128,6 +129,10 @@ namespace CalamityMod.NPCs.NormalNPCs
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
// Force bestiary cause this doesn't count as Vanilla's definition of a critter for the Bestiary.
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient && Main.BestiaryTracker.Kills.GetKillCount(NPC) <= 0)
|
||||
Main.BestiaryTracker.Kills.SetKillCountDirectly(NPC.GetBestiaryCreditId(), 100);
|
||||
|
||||
if (NPC.direction == 0)
|
||||
NPC.direction = Utils.SelectRandom(Main.rand, -1, 1);
|
||||
|
||||
@@ -393,8 +398,8 @@ namespace CalamityMod.NPCs.NormalNPCs
|
||||
}
|
||||
}
|
||||
|
||||
float targetAngle = (NPC.velocity.Y != 0f) ? NPC.velocity.X * 0.175f * (NPC.velocity.Y > 0).ToDirectionInt() : 0f;
|
||||
NPC.rotation = NPC.rotation.AngleLerp(targetAngle, 0.075f);
|
||||
float idealRotation = (NPC.velocity.Y != 0f) ? NPC.velocity.ToRotation() + (NPC.direction > 0 ? 0f : -MathHelper.Pi) : 0f;
|
||||
NPC.rotation = idealRotation;
|
||||
}
|
||||
|
||||
public void TransformIntoVariant(int type)
|
||||
@@ -449,9 +454,14 @@ namespace CalamityMod.NPCs.NormalNPCs
|
||||
|
||||
public override float SpawnChance(NPCSpawnInfo spawnInfo)
|
||||
{
|
||||
if (spawnInfo.Player.Calamity().ZoneSulphur || spawnInfo.Player.Calamity().ZoneSunkenSea)
|
||||
return 0f;
|
||||
return SpawnCondition.TownCritter.Chance * 0.005f;
|
||||
float goldMultiplier = NPC.type == ModContent.NPCType<PiggyGold>() ? 0.15f : 1f;
|
||||
bool inAtTown = spawnInfo.Player.townNPCs > 2f && (Main.remixWorld ? spawnInfo.Player.ZoneNormalCaverns : spawnInfo.Player.ZoneForest);
|
||||
if (inAtTown)
|
||||
return SpawnCondition.TownCritter.Chance * 0.15f * goldMultiplier;
|
||||
else if (spawnInfo.Player.ZonePurity)
|
||||
return (Main.remixWorld ? SpawnCondition.Cavern.Chance * 0.005f : SpawnCondition.OverworldDayGrassCritter.Chance * 0.005f) * goldMultiplier;
|
||||
|
||||
return 0f;
|
||||
}
|
||||
|
||||
public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.Add(ItemID.Bacon);
|
||||
|
||||
@@ -3,8 +3,12 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using CalamityMod.Items.Critters;
|
||||
using CalamityMod.Items.Placeables.Banners;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria.GameContent.Bestiary;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.NPCs.NormalNPCs
|
||||
{
|
||||
@@ -19,8 +23,9 @@ namespace CalamityMod.NPCs.NormalNPCs
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
NPC.rarity = 3;
|
||||
base.SetDefaults();
|
||||
NPC.catchItem = (short)ModContent.ItemType<PiggyGoldItem>();
|
||||
Banner = 0;
|
||||
}
|
||||
|
||||
public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry)
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
using System;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
|
||||
namespace CalamityMod.Particles
|
||||
{
|
||||
public class GraveyardMistParticle : Particle
|
||||
{
|
||||
public float StretchFactor;
|
||||
|
||||
public float BaseOpacity;
|
||||
|
||||
public int Direction;
|
||||
|
||||
public float Opacity { get; private set; }
|
||||
|
||||
public int TextureIndex { get; private set; }
|
||||
|
||||
public GraveyardMistParticle(Vector2 spawnPosition, Vector2 velocity, Color color, float scale, float baseOpacity, int lifetime, int textureIndex)
|
||||
{
|
||||
Position = spawnPosition;
|
||||
Velocity = velocity;
|
||||
Color = color;
|
||||
Scale = scale;
|
||||
BaseOpacity = baseOpacity;
|
||||
Lifetime = lifetime;
|
||||
TextureIndex = textureIndex;
|
||||
StretchFactor = Main.rand.NextFloat(1f, 2f);
|
||||
}
|
||||
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
|
||||
public override bool SetLifetime => true;
|
||||
|
||||
public override bool UseCustomDraw => true;
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
float halfLifetime = Lifetime / 2;
|
||||
Opacity = BaseOpacity * MathHelper.Lerp(0f, 1f, MathF.Sin(MathHelper.TwoPi * (Time / halfLifetime)));
|
||||
}
|
||||
|
||||
public override void CustomDraw(SpriteBatch spriteBatch)
|
||||
{
|
||||
Texture2D mistTexture = Main.Assets.Request<Texture2D>("Images/Gore_" + TextureIndex).Value;
|
||||
SpriteEffects spriteEffects = (Velocity.X > 0) ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
|
||||
Vector2 scale = new Vector2(StretchFactor, 1f) * Scale;
|
||||
spriteBatch.Draw(mistTexture, Position - Main.screenPosition, mistTexture.Frame(), Color * Opacity * 0.375f, Rotation, mistTexture.Frame().Size() * 0.5f, scale, spriteEffects, 0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
Reference in new issue
Block a user