Merge branch '1.4.4' into SunkenSeaTileOddities

This commit is contained in:
Heart-Plus-Up committed 2025-02-17 12:55:58 -07:00
commit e2a60debcf
19 files changed
+156 -137

No files matched your search

+3 -11
View File
@@ -930,6 +930,8 @@ namespace CalamityMod.CalPlayer
public bool bloodyGlove = false;
public bool filthyGlove = false;
public bool sandCloak = false;
/// <summary> Solely used for granting the acceleration boost while within Sand Cloak's veil. Other stat boosts are directly given by the projectile. </summary>
public bool getSandCloakAccelBoost = false;
public bool spectralVeil = false;
public int spectralVeilImmunity = 0;
/// <summary> Check for if the player has Plagued Fuel Pack OR Blunder Booster equipped. </summary>
@@ -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<Items.Accessories.SandCloak>()));
float knockback = 2.5f;
int veil = Projectile.NewProjectile(source, Player.Center, Vector2.Zero, ProjectileType<SandCloakVeil>(), 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) +
+11 -28
View File
@@ -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)
{
+19
View File
@@ -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<SandCloakVeil>()) || Player.HasCooldown(Cooldowns.SandCloak.ID)))
{
Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center, Vector2.Zero, ModContent.ProjectileType<SandCloakVeil>(), 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
-3
View File
@@ -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;
}
-3
View File
@@ -17,11 +17,8 @@ namespace CalamityMod.Items.Accessories
Item.accessory = true;
}
public override void ModifyTooltips(List<TooltipLine> list) => list.IntegrateHotkey(CalamityKeybinds.SandCloakHotkey);
public override void UpdateAccessory(Player player, bool hideVisual)
{
player.moveSpeed += 0.05f;
player.Calamity().sandCloak = true;
}
}
+1 -1
View File
@@ -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;
+23 -2
View File
@@ -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;
}
@@ -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.
}
@@ -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
'''
}
@@ -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 <right> 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 <right> 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.]
'''
}
+4 -1
View File
@@ -6419,7 +6419,7 @@ namespace CalamityMod.NPCs
modifiers.FinalDamage *= 1f - damageReduction;
if ((projectile.penetrate > 1 || projectile.penetrate == -1) && !PierceResistExceptionList.Includes(projectile.type) && !projectile.CountsAsClass<SummonDamageClass>() && projectile.aiStyle != 15 && projectile.aiStyle != 39 && projectile.aiStyle != 99)
if ((projectile.penetrate > 1 || projectile.penetrate == -1) && !PierceResistExceptionList.Includes(projectile.type) && !projectile.CountsAsClass<SummonDamageClass>() && 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);
+1
View File
@@ -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;
+1
View File
@@ -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)
+1
View File
@@ -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;
+2 -4
View File
@@ -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)
{
+3 -5
View File
@@ -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)
{
+11
View File
@@ -62,6 +62,11 @@ namespace CalamityMod.Projectiles
/// Solely used to prevent the projectile from inflicting Vulnerability Hex when using the Aflame enchantment.
/// </summary>
public bool CreatedByPlayerDash = false;
/// <summary>
/// If a projectile is spawned from a hostile NPC, this variable is set to the index of the NPC.<br/>
/// Used for identifying which NPC to apply certain retaliatory effects on from projectiles hitting the player.
/// </summary>
public int ParentNPCIndex = -1;
/// <summary> Constant variable used as a speed cap for boss laser projectiles with 2 extra updates. </summary>
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<RangedDamageClass>())
{
+49 -51
View File
@@ -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<GenericDamageClass>() += 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);
}
}
@@ -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<LiliesOfFinalityAoE>(),
ProjectileType<LionfishProj>(),
ProjectileType<MajesticGuardHoldout>(),
ProjectileType<MechanicalBarracuda>(),
ProjectileType<MetalShard>(),
ProjectileType<MurasamaSlash>(),
ProjectileType<NastyChollaBol>(),