diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs
index 3ad68c8817..fec8a17155 100644
--- a/CalPlayer/CalamityPlayer.cs
+++ b/CalPlayer/CalamityPlayer.cs
@@ -930,6 +930,8 @@ namespace CalamityMod.CalPlayer
public bool bloodyGlove = false;
public bool filthyGlove = false;
public bool sandCloak = false;
+ /// Solely used for granting the acceleration boost while within Sand Cloak's veil. Other stat boosts are directly given by the projectile.
+ public bool getSandCloakAccelBoost = false;
public bool spectralVeil = false;
public int spectralVeilImmunity = 0;
/// Check for if the player has Plagued Fuel Pack OR Blunder Booster equipped.
@@ -3279,17 +3281,6 @@ namespace CalamityMod.CalPlayer
Player.HealPlayer(2);
}
}
- if (CalamityKeybinds.SandCloakHotkey.JustPressed && sandCloak && Main.myPlayer == Player.whoAmI && !Player.HasCooldown(Cooldowns.SandCloak.ID))
- {
- Player.AddCooldown(Cooldowns.SandCloak.ID, CalamityUtils.SecondsToFrames(20));
-
- var source = Player.GetSource_Accessory(FindAccessory(ItemType()));
- float knockback = 2.5f;
-
- int veil = Projectile.NewProjectile(source, Player.Center, Vector2.Zero, ProjectileType(), 12, knockback, Player.whoAmI);
- Main.projectile[veil].Center = Player.Center;
- SoundEngine.PlaySound(SoundID.Item45, Player.Center);
- }
if (CalamityKeybinds.SpectralVeilHotKey.JustPressed && spectralVeil && Main.myPlayer == Player.whoAmI && rogueStealth >= rogueStealthMax * 0.25f &&
wearingRogueArmor && rogueStealthMax > 0)
{
@@ -4253,6 +4244,7 @@ namespace CalamityMod.CalPlayer
(kamiBoost ? YanmeisKnife.RunAccelerationBoost : 0f) +
(CobaltSet ? CobaltArmorSetChange.SpeedBoostSetBonusPercentage * 0.01f : 0f) +
(silvaSet ? 0.05f : 0f) +
+ (getSandCloakAccelBoost ? 0.75f : 0f) +
(nimbleBounderBoost ? NimbleBounder.AccelerationBoost : 0f) +
(ascendantInsignia ? 0.25f : 0f ) + // Added to Soaring Insignia's 1.25x multiplier to get 1.5x
(blueCandle ? WeightlessCandle.AccelerationBoost : 0f) +
diff --git a/CalPlayer/CalamityPlayerHitHurt.cs b/CalPlayer/CalamityPlayerHitHurt.cs
index 295777dc28..8edcc40001 100644
--- a/CalPlayer/CalamityPlayerHitHurt.cs
+++ b/CalPlayer/CalamityPlayerHitHurt.cs
@@ -1276,36 +1276,19 @@ namespace CalamityMod.CalPlayer
if (!hasIFrames && !Player.creativeGodMode)
nextHitDealsDefenseDamage |= proj.Calamity().DealsDefenseDamage;
- // CIT 22JUL2024: This entire code segment is bugged, so I'm disabling it.
- // Very likely because it's trying to index into Main.npc using Projectile.owner.
- /*if (!proj.friendly && hurtInfo.Damage > 0)
+ // CIT 15FEB2025: This code previously tried to use Main.npc[proj.owner] to find the NPC the projectile came from.
+ // This doesn't work because the server owns NPC-spawned projectiles.
+ // All projectiles spawned from hostile NPCs are now fed the index of the NPC into ParentNPCIndex, so that these can work.
+ if (!proj.friendly && hurtInfo.Damage > 0 && proj.Calamity().ParentNPCIndex != -1)
{
- if (Main.player[proj.owner] is null)
+ if (Main.npc[proj.Calamity().ParentNPCIndex].active)
{
- if (!Main.npc[proj.owner].friendly)
- {
- if (sulphurSet)
- Main.npc[proj.owner].AddBuff(BuffID.Poisoned, 60);
- if (aSpark)
- {
- if (transformer)
- Main.npc[proj.owner].Calamity().transformerShocked = 120;
- else
- Main.npc[proj.owner].Calamity().shocked = 120;
- }
- }
- }
- else
- {
- Player p = Main.player[proj.owner];
- if (p.hostile && Player.hostile && (Player.team != p.team || p.team == 0))
- {
- if (sulphurSet)
- p.AddBuff(BuffID.Poisoned, 60);
- }
-
- }
- }*/
+ if (sulphurSet)
+ Main.npc[proj.Calamity().ParentNPCIndex].AddBuff(BuffID.Poisoned, 60);
+ if (aSpark)
+ Main.npc[proj.Calamity().ParentNPCIndex].Calamity().shocked = 120;
+ }
+ }
if (proj.hostile && hurtInfo.Damage > 0)
{
diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs
index 9889e84da4..afd1a14ad7 100644
--- a/CalPlayer/CalamityPlayerMiscEffects.cs
+++ b/CalPlayer/CalamityPlayerMiscEffects.cs
@@ -407,6 +407,25 @@ namespace CalamityMod.CalPlayer
IsFirstDashFrame = true;
}
+ if (sandCloak)
+ {
+ // Spawn sand veil when dashing if it does not exist and you do not have the cooldown
+ if (Player.dashDelay == -1)
+ {
+ if (IsFirstDashFrame)
+ {
+ if (!(CalamityUtils.AnyProjectiles(ModContent.ProjectileType()) || Player.HasCooldown(Cooldowns.SandCloak.ID)))
+ {
+ Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center, Vector2.Zero, ModContent.ProjectileType(), 13, 2.5f, Player.whoAmI);
+ SoundEngine.PlaySound(SoundID.Item45, Player.Center);
+ }
+ IsFirstDashFrame = false;
+ }
+ }
+ else
+ IsFirstDashFrame = true;
+ }
+
if (tortShell)
{
//reduce player dash velocity as long as you didn't just get hit
diff --git a/CalamityKeybinds.cs b/CalamityKeybinds.cs
index 78c8110dfd..cba78a4d7b 100644
--- a/CalamityKeybinds.cs
+++ b/CalamityKeybinds.cs
@@ -16,7 +16,6 @@ namespace CalamityMod
public static ModKeybind GravistarSabatonHotkey { get; private set; }
public static ModKeybind NormalityRelocatorHotKey { get; private set; }
public static ModKeybind RageHotKey { get; private set; }
- public static ModKeybind SandCloakHotkey { get; private set; }
public static ModKeybind SpectralVeilHotKey { get; private set; }
public static ModKeybind TransformerHotKey { get; private set; }
@@ -35,7 +34,6 @@ namespace CalamityMod
GravistarSabatonHotkey = KeybindLoader.RegisterKeybind(Mod, "GravistarSabatonHotkey", "X");
NormalityRelocatorHotKey = KeybindLoader.RegisterKeybind(Mod, "NormalityRelocator", "Z");
RageHotKey = KeybindLoader.RegisterKeybind(Mod, "RageMode", "V");
- SandCloakHotkey = KeybindLoader.RegisterKeybind(Mod, "SandCloakEffect", "C");
SpectralVeilHotKey = KeybindLoader.RegisterKeybind(Mod, "SpectralVeilTeleport", "Z");
TransformerHotKey = KeybindLoader.RegisterKeybind(Mod, "TransformerHotKey", "K");
}
@@ -54,7 +52,6 @@ namespace CalamityMod
GravistarSabatonHotkey = null;
NormalityRelocatorHotKey = null;
RageHotKey = null;
- SandCloakHotkey = null;
SpectralVeilHotKey = null;
TransformerHotKey = null;
}
diff --git a/Items/Accessories/SandCloak.cs b/Items/Accessories/SandCloak.cs
index 4f69f242e0..d4188317bb 100644
--- a/Items/Accessories/SandCloak.cs
+++ b/Items/Accessories/SandCloak.cs
@@ -17,11 +17,8 @@ namespace CalamityMod.Items.Accessories
Item.accessory = true;
}
- public override void ModifyTooltips(List list) => list.IntegrateHotkey(CalamityKeybinds.SandCloakHotkey);
-
public override void UpdateAccessory(Player player, bool hideVisual)
{
- player.moveSpeed += 0.05f;
player.Calamity().sandCloak = true;
}
}
diff --git a/Items/Weapons/Rogue/ThrowingBrick.cs b/Items/Weapons/Rogue/ThrowingBrick.cs
index 428a27ff9c..a34ec66c13 100644
--- a/Items/Weapons/Rogue/ThrowingBrick.cs
+++ b/Items/Weapons/Rogue/ThrowingBrick.cs
@@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Rogue
Item.useAnimation = Item.useTime = 25;
Item.useStyle = ItemUseStyleID.Swing;
Item.knockBack = 5f;
- Item.value = Item.buyPrice(0, 0, 0, 50);
+ Item.value = Item.sellPrice(0, 0, 0, 4);
Item.rare = ItemRarityID.White;
Item.maxStack = Item.CommonMaxStack;
Item.UseSound = SoundID.Item1;
diff --git a/Items/Weapons/Summon/SquirrelSquireStaff.cs b/Items/Weapons/Summon/SquirrelSquireStaff.cs
index 06d8c8ba72..5ee42ced6e 100644
--- a/Items/Weapons/Summon/SquirrelSquireStaff.cs
+++ b/Items/Weapons/Summon/SquirrelSquireStaff.cs
@@ -1,5 +1,6 @@
using CalamityMod.Projectiles.Summon;
using Microsoft.Xna.Framework;
+using System;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
@@ -45,8 +46,28 @@ namespace CalamityMod.Items.Weapons.Summon
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
- player.FindSentryRestingSpot(type, out int XPosition, out int YPosition, out int YOffset);
- Projectile.NewProjectile(source, new(XPosition, YPosition - YOffset), Vector2.Zero, type, damage, knockback, player.whoAmI);
+ // Find the base farthest position
+ Vector2 initialSpawn = player.GetFarthestSpawnPositionOnLine(position, velocity.X, velocity.Y);
+
+ // Push the squirrel away from collision in all directions if applicable
+ while (!Collision.CanHit(initialSpawn, 0, 0, initialSpawn + Vector2.UnitX * 20f, 0, 0) ||
+ !Collision.CanHit(initialSpawn, 0, 0, initialSpawn - Vector2.UnitX * 20f, 0, 0) ||
+ !Collision.CanHit(initialSpawn, 0, 0, initialSpawn + Vector2.UnitY * 24f, 0, 0) ||
+ !Collision.CanHit(initialSpawn, 0, 0, initialSpawn - Vector2.UnitY * 24f, 0, 0))
+ {
+ if (!Collision.CanHit(initialSpawn, 0, 0, initialSpawn + Vector2.UnitX * 20f, 0, 0))
+ initialSpawn.X -= 1f;
+ // Be sure to not infinite loop
+ if (!Collision.CanHit(initialSpawn, 0, 0, initialSpawn - Vector2.UnitX * 20f, 0, 0) && Collision.CanHit(initialSpawn, 0, 0, initialSpawn + Vector2.UnitX * 20f, 0, 0))
+ initialSpawn.X += 1f;
+ if (!Collision.CanHit(initialSpawn, 0, 0, initialSpawn + Vector2.UnitY * 24f, 0, 0))
+ initialSpawn.Y -= 1f;
+ // Be sure to not infinite loop
+ if (!Collision.CanHit(initialSpawn, 0, 0, initialSpawn - Vector2.UnitY * 24f, 0, 0) && Collision.CanHit(initialSpawn, 0, 0, initialSpawn + Vector2.UnitY * 24f, 0, 0))
+ initialSpawn.Y += 1f;
+ }
+
+ Projectile.NewProjectile(source, initialSpawn, Vector2.Zero, type, damage, knockback, player.whoAmI);
player.UpdateMaxTurrets();
return false;
}
diff --git a/Localization/en-US/Mods.CalamityMod.Bestiary.Vanilla.hjson b/Localization/en-US/Mods.CalamityMod.Bestiary.Vanilla.hjson
index d350c57df8..269038422a 100644
--- a/Localization/en-US/Mods.CalamityMod.Bestiary.Vanilla.hjson
+++ b/Localization/en-US/Mods.CalamityMod.Bestiary.Vanilla.hjson
@@ -19,7 +19,7 @@ NPCName: {
GreekSkeleton: Marble caves were used as arenas during the Deific Era. Fighters looking for glory flocked to them, but now only their bodies populate the area.
UndeadViking: After the Crusade left the continent in shambles, many factions attempted to conquer it. These vikings were one such group, but the icy winds of the tundra made short work of them.
IcyMerman: Mermen rarely stray far from the ocean, favoring the vast waters where their revered Elemental now lives in. Those that do can become lost, wander into cold caverns, and become icy undead fish men.
- IceElemental: Unclaimed fragments of the Water Elemental, Anahita, scattered across the world. Their frosty shards freeze all.
+ IceElemental: After splitting, the fragments of an Elemental may become stranded and inaccessible. Ice Elementals were once part of Anahita, left behind during her journey to the Ocean. Their frosty shards freeze all.
DesertBeast: Minor draconic offshoots who thrive in arid climates, the Basilisk's hardened bodies make them formidable threats.
DuneSplicerHead: The largest worm native to the Desert. Even strengthened by divine magicks, they fall short of the Scourge, and run amok in a hunger-induced frenzy.
SandElemental: The most powerful manifestation of the fragmented Earth Elemental, taking many forms through the properties of different materials. With this feminine form, her tornadoes tear all asunder.
@@ -99,10 +99,10 @@ CommonEntries: {
DemonEye: That suspicious feeling of being watched may very well come true in the dark of night, when the Eye of Cthulhu's minions roam the skies.
SandShark: Sand Sharks lived in the shallow waters of Ilmeris, hiding beneath the sand. They were thankfully well equipped to deal with the fallout of the Incineration.
AngryBones: Cursed with undeath, the former prisoners of the Dungeon roam endlessly through its halls, seeking a victim for their unending fury.
- BlueArmoredBones: Mercenaries hired by Yharim to guard the Dungeon, the Marching Bones were disciplined and relentless, sundering any escapees that decided to rise against their jailors.
+ BlueArmoredBones: Mercenaries hired by Yharim to guard the Dungeon, the Marching Blues were disciplined and relentless, sundering any escapees that decided to rise against their jailors.
HellArmoredBones: Mercenaries hired by Yharim to guard the Dungeon hailing from Azafure, the fiery glow of the Molten Legion is unmistakable. If anyone ever tried to hide, their red-hot armaments would melt the hideout immediately.
RustyArmoredBones: Mercenaries hired by Yharim to guard the Dungeon hailing from Underground factions, the Rusted Company's weapons are jagged and rough through use and neglect. The brutality they employed on the field was enough to make many prisoners give up on freedom.
- Diabolist: Mages of Azafure who bear the Diabolic Sigil, wielding flames as intense as any in the underworld. They were effective at blocking passageways and at making prisoners talk.
- Necromancer: These sorcerers were trained in Azafure and bore the Necromantic Sign. Much like they terrorized prisoners with the bodies of their friends, so do they terrorize the Dungeon now.
+ Diabolist: Mages of Azafure who bear the Diabolic Sigil, a certificate of their prowess, wielding flames as intense as any in the underworld. They were effective at blocking passageways and at making prisoners talk.
+ Necromancer: These sorcerers were trained in Azafure and bore the Necromantic Sign, a certificate of their prowess. Much like they terrorized prisoners with the bodies of their friends, so do they terrorize the Dungeon now.
RaggedCaster: Casters directly from the Dragon Cult, their cursed magic leaves their victims helplessly lost in utter darkness. They perished attempting to contain the onslaught that happened beneath their halls.
}
diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson
index 074e2331b8..0366c49e60 100644
--- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson
+++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson
@@ -1002,7 +1002,7 @@ Laudanum: {
Tooltip:
'''
Converts certain debuffs into buffs and extends their durations
- This also removes debuff immunities if you have them
+ This also removes immunities to these debuffs if you have them
'''
HoldShiftTooltip:
'''
@@ -1161,13 +1161,14 @@ OccultSkullCrown: {
'''
You constantly gain rage over time, and rage does not fade when out of combat
Converts certain debuffs into buffs and extends their durations
+ This also removes immunities to these debuffs if you have them
Adrenaline charges 20% faster
Increases your max movement speed and acceleration by 5%
'''
HoldShiftTooltip:
'''
- Debuffs affected: Darkness, Blackout, Confused, Slow, Weak,
- Broken Armor, Armor Crunch, Chilled, Ichor and Obstructed
+ Debuffs affected: Armor Crunch, Blackout, Bleeding, Broken Armor, Chilled, Confused,
+ Cursed, Darkness, Distorted, Ichor, Silenced, Slow, Weak, and Whispering Death
'''
FlavorTooltip: "'Only a fool would ever wear this...'"
}
@@ -1461,10 +1462,10 @@ SandCloak: {
DisplayName: Sand Cloak
Tooltip:
'''
- 5% increased movement speed
- Press [KEY] to create a protective sand veil which damages enemies inside it
- While inside the veil, you gain 8 defense and 3% critical strike chance
- This effect has a 20 second cooldown before it can be used again
+ Dashing creates a large protective sand veil which damages enemies inside it
+ The sand veil lasts 15 seconds, but dissipates early if you dash again
+ While inside the veil, you gain 10 defense and 1.75x acceleration
+ After dissipating, the sand veil has a 15 second cooldown before it can be used again
'''
}
diff --git a/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson b/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson
index 744810d20e..45aa900888 100644
--- a/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson
+++ b/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson
@@ -400,6 +400,21 @@ RelicOfConvergence: {
'''
}
+RelicOfResilience: {
+ DisplayName: Relic of Resilience
+ Tooltip:
+ '''
+ Holding this item creates orbiting rock shards around you and nearby allies
+ While they orbit you, your minimum defense is set to 150 and minimum damage reduction to 10%
+ Taking a hit or pressing will pull in the shards, then blast them outward, crippling hit enemies
+ This effect has a 10 second cooldown after taking a hit
+ Holding out the shield heavily reduces the damage of all summons while rocks are active, only for you
+ [c/FF8C00:I saw a massacre and did nothing to stop it. My vow broken, I was shunned.]
+ [c/FF8C00:My will to forge ahead vanished. My final wish was simply to not die alone.]
+ [c/FF8C00:But when She put faith in my shield, I would never again let it falter.]
+ '''
+}
+
Rock: {
DisplayName: Rock
Tooltip:
@@ -431,18 +446,3 @@ SuperDummy: {
Right click to kill all super dummies
'''
}
-
-RelicOfResilience: {
- DisplayName: Relic Of Resilience
- Tooltip:
- '''
- Holding this item creates orbiting rock shards around you and nearby allies
- While they orbit you, your minimum defense is set to 150 and minimum damage reduction to 10%
- Taking a hit or pressing will pull in the shards, then blast them outward, crippling hit enemies
- This effect has a 10 second cooldown after taking a hit
- Holding out the shield heavily reduces the damage of all summons while rocks are active, only for you
- [c/FF8C00:I saw a massacre and did nothing to stop it. My vow broken, I was shunned.]
- [c/FF8C00:My will to forge ahead vanished. My final wish was simply to not die alone.]
- [c/FF8C00:But when She put faith in my shield, I would never again let it falter.]
- '''
-}
diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs
index 700dda6e46..528c64aa8a 100644
--- a/NPCs/CalamityGlobalNPC.cs
+++ b/NPCs/CalamityGlobalNPC.cs
@@ -6419,7 +6419,7 @@ namespace CalamityMod.NPCs
modifiers.FinalDamage *= 1f - damageReduction;
- if ((projectile.penetrate > 1 || projectile.penetrate == -1) && !PierceResistExceptionList.Includes(projectile.type) && !projectile.CountsAsClass() && projectile.aiStyle != 15 && projectile.aiStyle != 39 && projectile.aiStyle != 99)
+ if ((projectile.penetrate > 1 || projectile.penetrate == -1) && !PierceResistExceptionList.Includes(projectile.type) && !projectile.CountsAsClass() && projectile.aiStyle != ProjAIStyleID.Flail && projectile.aiStyle != ProjAIStyleID.MechanicalPiranha && projectile.aiStyle != ProjAIStyleID.Yoyo)
projectile.Calamity().timesPierced++;
}
@@ -7126,6 +7126,9 @@ namespace CalamityMod.NPCs
// Debuff visuals. Alphabetical order as per usual, please
public override void DrawEffects(NPC npc, ref Color drawColor)
{
+ if (!npc.canDisplayBuffs)
+ return;
+
if (absorberAffliction > 0)
AbsorberAffliction.DrawEffects(npc, ref drawColor);
diff --git a/NPCs/DesertScourge/DesertScourgeBody.cs b/NPCs/DesertScourge/DesertScourgeBody.cs
index c4d6eac77c..44704fd228 100644
--- a/NPCs/DesertScourge/DesertScourgeBody.cs
+++ b/NPCs/DesertScourge/DesertScourgeBody.cs
@@ -156,6 +156,7 @@ namespace CalamityMod.NPCs.DesertScourge
NPC.life = Main.npc[(int)NPC.ai[1]].life;
NPC.dontTakeDamage = Main.npc[(int)NPC.ai[1]].dontTakeDamage;
+ NPC.canDisplayBuffs = Main.npc[(int)NPC.ai[1]].canDisplayBuffs;
// Percent life remaining
float lifeRatio = NPC.life / (float)NPC.lifeMax;
diff --git a/NPCs/DesertScourge/DesertScourgeHead.cs b/NPCs/DesertScourge/DesertScourgeHead.cs
index 95c60ce2a8..688272f4b0 100644
--- a/NPCs/DesertScourge/DesertScourgeHead.cs
+++ b/NPCs/DesertScourge/DesertScourgeHead.cs
@@ -182,6 +182,7 @@ namespace CalamityMod.NPCs.DesertScourge
}
NPC.dontTakeDamage = hide;
+ NPC.canDisplayBuffs = !hide;
// Get a target
if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active)
diff --git a/NPCs/DesertScourge/DesertScourgeTail.cs b/NPCs/DesertScourge/DesertScourgeTail.cs
index 56f31dd2a4..31d98c95c6 100644
--- a/NPCs/DesertScourge/DesertScourgeTail.cs
+++ b/NPCs/DesertScourge/DesertScourgeTail.cs
@@ -82,6 +82,7 @@ namespace CalamityMod.NPCs.DesertScourge
NPC.life = Main.npc[(int)NPC.ai[1]].life;
NPC.dontTakeDamage = Main.npc[(int)NPC.ai[1]].dontTakeDamage;
+ NPC.canDisplayBuffs = Main.npc[(int)NPC.ai[1]].canDisplayBuffs;
// Percent life remaining
float lifeRatio = NPC.life / (float)NPC.lifeMax;
diff --git a/NPCs/NormalNPCs/WulfrumDrone.cs b/NPCs/NormalNPCs/WulfrumDrone.cs
index 69e1abcaa6..dda3185cc5 100644
--- a/NPCs/NormalNPCs/WulfrumDrone.cs
+++ b/NPCs/NormalNPCs/WulfrumDrone.cs
@@ -108,16 +108,14 @@ namespace CalamityMod.NPCs.NormalNPCs
Player player = Main.player[NPC.target];
bool farFromPlayer = NPC.Distance(player.Center) > 960f;
- bool obstacleInFrontOfPlayer = Main.remixWorld ? false : !Collision.CanHitLine(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height);
- if (NPC.target < 0 || NPC.target >= Main.maxPlayers || farFromPlayer || obstacleInFrontOfPlayer || player.dead || !player.active)
+ if (NPC.target < 0 || NPC.target >= Main.maxPlayers || farFromPlayer || player.dead || !player.active)
{
NPC.TargetClosest(false);
player = Main.player[NPC.target];
farFromPlayer = NPC.Distance(player.Center) > 960f;
- obstacleInFrontOfPlayer = !Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height);
// Fly away if there is no living target, or the closest target is too far away.
- if (player.dead || !player.active || farFromPlayer || obstacleInFrontOfPlayer)
+ if (player.dead || !player.active || farFromPlayer)
{
if (FlyAwayTimer > 420)
{
diff --git a/NPCs/NormalNPCs/WulfrumHovercraft.cs b/NPCs/NormalNPCs/WulfrumHovercraft.cs
index 222778641e..d9233382d8 100644
--- a/NPCs/NormalNPCs/WulfrumHovercraft.cs
+++ b/NPCs/NormalNPCs/WulfrumHovercraft.cs
@@ -132,16 +132,14 @@ namespace CalamityMod.NPCs.NormalNPCs
Player player = Main.player[NPC.target];
bool farFromPlayer = NPC.Distance(player.Center) > 960f;
- bool obstacleInFrontOfPlayer = Main.remixWorld ? false : !Collision.CanHitLine(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height);
- if (NPC.target < 0 || NPC.target >= 255 || farFromPlayer || obstacleInFrontOfPlayer || player.dead || !player.active)
+ if (NPC.target < 0 || NPC.target >= 255 || farFromPlayer|| player.dead || !player.active)
{
NPC.TargetClosest(false);
player = Main.player[NPC.target];
farFromPlayer = NPC.Distance(player.Center) > 960f;
- obstacleInFrontOfPlayer = !Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height);
- // Fly away if there is no living target, or the closest target is too far away... unless its Gfb
- if (player.dead || !player.active || farFromPlayer || obstacleInFrontOfPlayer)
+ // Fly away if there is no living target, or the closest target is too far away.
+ if (player.dead || !player.active || farFromPlayer)
{
if (FlyAwayTimer > 420)
{
diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs
index 837bb1874f..1f98db379c 100644
--- a/Projectiles/CalamityGlobalProjectile.cs
+++ b/Projectiles/CalamityGlobalProjectile.cs
@@ -62,6 +62,11 @@ namespace CalamityMod.Projectiles
/// Solely used to prevent the projectile from inflicting Vulnerability Hex when using the Aflame enchantment.
///
public bool CreatedByPlayerDash = false;
+ ///
+ /// If a projectile is spawned from a hostile NPC, this variable is set to the index of the NPC.
+ /// Used for identifying which NPC to apply certain retaliatory effects on from projectiles hitting the player.
+ ///
+ public int ParentNPCIndex = -1;
/// Constant variable used as a speed cap for boss laser projectiles with 2 extra updates.
public const float AcceleratingBossLaserVelocityCap = 8f;
@@ -284,6 +289,12 @@ namespace CalamityMod.Projectiles
if (sourceItem != null)
extorterBoost = true;
+ if (source is EntitySource_Parent { Entity: NPC npc })
+ {
+ if (!npc.friendly)
+ ParentNPCIndex = npc.whoAmI;
+ }
+
// Whenever the player has Daawnlight Spirit Origin, any ranged projectile will have the capacity to infintely supercrit.
if (Main.player[projectile.owner].Calamity().spiritOrigin && projectile.CountsAsClass())
{
diff --git a/Projectiles/Typeless/SandCloakVeil.cs b/Projectiles/Typeless/SandCloakVeil.cs
index fa7c51d161..8e02acb318 100644
--- a/Projectiles/Typeless/SandCloakVeil.cs
+++ b/Projectiles/Typeless/SandCloakVeil.cs
@@ -12,8 +12,8 @@ namespace CalamityMod.Projectiles.Typeless
public class SandCloakVeil : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Typeless";
- private const float radius = 272f;
- private const int duration = 900;
+ private const float Radius = 360f;
+ private const int Duration = 900;
public override void SetDefaults()
{
@@ -23,82 +23,80 @@ namespace CalamityMod.Projectiles.Typeless
Projectile.ignoreWater = true;
Projectile.tileCollide = false;
Projectile.penetrate = -1;
- Projectile.timeLeft = duration;
+ Projectile.timeLeft = Duration;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = 10;
- Projectile.scale = 1.2f;
+ Projectile.scale = 1.5f;
}
public override void AI()
{
- Projectile.rotation += 0.01f;
+ Projectile.rotation += 0.025f;
+ Player Owner = Main.player[Projectile.owner];
+ Player BuffedPlayer = Main.LocalPlayer;
- Player player = Main.LocalPlayer;
- Vector2 posDiff = player.Center - Projectile.Center;
- if (posDiff.Length() <= radius)
+ Vector2 posDiff = BuffedPlayer.Center - Projectile.Center;
+ if (posDiff.Length() <= Radius)
{
- player.statDefense += 8;
- player.GetCritChance() += 3;
+ BuffedPlayer.Calamity().getSandCloakAccelBoost = true;
+ BuffedPlayer.statDefense += 10;
+ }
+ else
+ BuffedPlayer.Calamity().getSandCloakAccelBoost = false;
+ // Ensure the acceleration boost is removed if the player is still inside the sand veil when it dies
+ if (Projectile.timeLeft == 1)
+ BuffedPlayer.Calamity().getSandCloakAccelBoost = false;
+
+ // Kill the sand veil early if the owner dashes
+ if (Owner.dashDelay == -1 && Projectile.timeLeft < Duration - 45)
+ {
+ if (Projectile.timeLeft > 25)
+ Projectile.timeLeft = 25;
+ }
+
+ // Dust
+ Circle dustCircle = new Circle(Projectile.Center, Radius);
+ for (int i = 0; i < 2; i++)
+ {
+ Vector2 dustPos = dustCircle.RandomPointInCircle();
+ if ((dustPos - Projectile.Center).Length() > 48)
+ {
+ Vector2 dustVel = Projectile.SafeDirectionTo(dustPos).RotatedBy(-MathHelper.PiOver4) * Vector2.Distance(Projectile.Center, dustPos) * 0.04f;
+ Dust sand = Dust.NewDustPerfect(dustPos, DustID.Sand, dustVel, Scale: 0.5f);
+ sand.noGravity = true;
+ sand.fadeIn = 1f;
+ }
}
}
+ // Add Sand Cloak cooldown after the sand veil dies
+ public override void OnKill(int timeLeft) => Main.player[Projectile.owner].AddCooldown(Cooldowns.SandCloak.ID, CalamityUtils.SecondsToFrames(15));
+
public override bool PreDraw(ref Color lightColor)
{
// Sprite Circle
Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Type].Value;
- float scaleStep = 0.03f;
+ float scaleStep = 0.05f;
float rotationOffset = 0.03f;
- Color drawCol = Projectile.GetAlpha(lightColor);
+ Color drawCol = Projectile.GetAlpha(Color.Lerp(lightColor, Color.White, 0.5f));
float drawTransparency = 0.1f;
- if (Projectile.timeLeft > duration - 10)
- {
- drawTransparency = (duration - Projectile.timeLeft) * 0.01f;
- }
+ if (Projectile.timeLeft > Duration - 10)
+ drawTransparency = (Duration - Projectile.timeLeft) * 0.01f;
else if (Projectile.timeLeft < 25)
- {
drawTransparency = Projectile.timeLeft * 0.004f;
- }
-
- // Dust effects
- Circle dustCircle = new Circle(Projectile.Center, radius);
for (int i = 0; i < 20; i++)
{
// Sprite
- Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, drawCol * drawTransparency, Projectile.rotation + (rotationOffset * i * i), tex.Size() / 2f, Projectile.scale - (i * scaleStep), SpriteEffects.None, 0);
-
- // Dust
- Vector2 dustPos = dustCircle.RandomPointInCircle();
- if ((dustPos - Projectile.Center).Length() > 48)
- {
- Dust sand = Dust.NewDustPerfect(dustPos, DustID.Sand);
- sand.noGravity = true;
- sand.fadeIn = 1f;
- sand.velocity = Projectile.SafeDirectionTo(dustPos).RotatedBy(-MathHelper.PiOver4) * Vector2.Distance(Projectile.Center, dustPos) * 0.04f;
- }
+ float rotation = (Projectile.rotation + rotationOffset * i * i) * (i % 2 == 0).ToDirectionInt();
+ Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, drawCol * drawTransparency, rotation, tex.Size() / 2f, (Radius * 0.0044f) - (i * scaleStep), SpriteEffects.None, 0);
}
-
return false;
}
- public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
- {
- // Knockback has to be done manually to ensure the enemies are repelled from the aura as opposed to thrown to one side of it
-
- if (target.knockBackResist <= 0f)
- return;
-
- // 12AUG2023: Ozzatron: TML was giving NaN knockback, probably due to 0 base knockback. Do not use hit.Knockback
- if (CalamityGlobalNPC.ShouldAffectNPC(target))
- {
- float knockbackMultiplier = MathHelper.Clamp(1f - target.knockBackResist, 0f, 1f);
- Vector2 trueKnockback = target.Center - Projectile.Center;
- trueKnockback.Normalize();
- target.velocity = trueKnockback * knockbackMultiplier;
- }
- }
-
- public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, radius, targetHitbox);
+ // CIT 14FEB2025: Replaced old manual knockback code with setting HitDirectionOverride
+ public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => modifiers.HitDirectionOverride = (target.Center.X > Projectile.Center.X).ToDirectionInt();
+ public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Radius, targetHitbox);
}
}
diff --git a/Systems/Collections/PierceResistExceptionList.cs b/Systems/Collections/PierceResistExceptionList.cs
index 7955e5a3b7..493e12a388 100644
--- a/Systems/Collections/PierceResistExceptionList.cs
+++ b/Systems/Collections/PierceResistExceptionList.cs
@@ -27,7 +27,6 @@ namespace CalamityMod.Systems.Collections
ProjectileID.FinalFractal,
ProjectileID.FlyingKnife,
ProjectileID.LastPrismLaser,
- ProjectileID.MechanicalPiranha,
ProjectileID.MonkStaffT3,
ProjectileID.PiercingStarlight,
ProjectileID.Terragrim,
@@ -66,7 +65,6 @@ namespace CalamityMod.Systems.Collections
ProjectileType(),
ProjectileType(),
ProjectileType(),
- ProjectileType(),
ProjectileType(),
ProjectileType(),
ProjectileType(),