Sand Cloak changes

Killed another hotkey :D
This commit is contained in:
CongratsIsTrash committed 2025-02-15 16:29:22 -05:00
1 parent 2e97cab1c2
commit 39bb2d1972
6 files changed
+75 -72

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) +
+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;
}
}
@@ -1461,10 +1461,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
'''
}
+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);
}
}