This commit is contained in:
Altixal committed 2025-08-04 18:46:53 +07:00
1 parent ff0dfcbe24
commit c48f15fe2b
7 files changed
+143 -178

No files matched your search

+2 -9
View File
@@ -3781,18 +3781,11 @@ namespace CalamityMod.CalPlayer
}
}
}
if (victideBarrierSet && !Player.HasCooldown(WardingWave.ID) && !Player.tongued && Player.dashDelay == 0)
if (victideBarrierSet && !Player.HasCooldown(WardingWave.ID))
{
// Explosion and dash are handled in the VictideBarrier file
if (Player.whoAmI == Main.myPlayer)
{
Player.AddCooldown(WardingWave.ID, VictideHeadBarrier.BarrierCooldown);
DeferredDashID = VictideBarrierDash.ID;
Player.dash = 0;
Player.pulley = false;
Player.mount?.Dismount(Player);
Player.RemoveAllGrapplingHooks();
}
}
if (brimflameSet && !Player.HasCooldown(BrimflameFrenzy.ID))
{
-154
View File
@@ -1,154 +0,0 @@
using System;
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Enums;
using CalamityMod.Items.Accessories;
using CalamityMod.Items.Armor.GodSlayer;
using CalamityMod.NPCs.DevourerofGods;
using CalamityMod.Particles;
using Microsoft.Xna.Framework;
using ReLogic.Utilities;
using Terraria;
using Terraria.Audio;
using Terraria.DataStructures;
using Terraria.ModLoader;
namespace CalamityMod.CalPlayer.Dashes
{
// TODO - Make this real
public class VictideBarrierDash : PlayerDashEffect
{
public static new string ID => "Victide Barrier";
public static int GodslayerCooldown = 45;
public SlotId GSDashSlot;
public static readonly SoundStyle Impact = new("CalamityMod/Sounds/NPCKilled/DevourerDeathImpact") { Volume = 0.5f };
public override DashCollisionType CollisionType => DashCollisionType.ShieldSlam;
public override bool IsOmnidirectional => true;
public int Time = 0;
public float Size = 2.2f;
public bool SoundOnce = true;
public override float CalculateDashSpeed(Player player) => 18f;
public override void OnDashEffects(Player player)
{
Time = 0;
Size = 2.2f;
GSDashSlot = SoundEngine.PlaySound(DevourerofGodsHead.DeathAnimationSound, player.Center);
SoundOnce = true;
Particle pulse = new DirectionalPulseRing(player.Center, Vector2.Zero, Color.Orchid, new Vector2(2f, 2f), Main.rand.NextFloat(12f, 25f), 0.1f, 12f, 18);
GeneralParticleHandler.SpawnParticle(pulse);
for (int i = 0; i <= 15; i++)
{
Dust dust = Dust.NewDustPerfect(player.position, 181, -player.velocity.RotatedByRandom(MathHelper.ToRadians(35f)) * Main.rand.NextFloat(0.3f, 0.9f), 0, default, Main.rand.NextFloat(3.1f, 3.9f));
dust.noGravity = false;
}
}
public override void MidDashEffects(Player player, ref float dashSpeed, ref float dashSpeedDecelerationFactor, ref float runSpeedDecelerationFactor)
{
if (SoundEngine.TryGetActiveSound(GSDashSlot, out var Dashsound) && Dashsound.IsPlaying)
Dashsound.Position = player.Center;
Time++;
Size -= 0.01f;
// Constantly update the player's velocity direction.
Vector2 dashVel = Main.MouseWorld - player.Center;
player.velocity = player.velocity.ToRotation().AngleTowards(dashVel.ToRotation(), 0.175f).ToRotationVector2() * CalculateDashSpeed(player);
// Fall way, way, faster than usual.
player.maxFallSpeed = 50f;
if (Time < 115)
{
Particle jaws = new Jaws(player.Center + player.velocity * 0.5f, player.velocity, Color.Fuchsia, new Vector2(0.8f, 1f), player.velocity.ToRotation() + MathHelper.PiOver2, Size, Size, 2);
GeneralParticleHandler.SpawnParticle(jaws);
Particle jaws2 = new Jaws(player.Center + player.velocity * 0.45f, player.velocity, Color.Aqua, new Vector2(0.8f, 1f), player.velocity.ToRotation() + MathHelper.PiOver2, Size - 0.3f, Size - 0.3f, 2);
GeneralParticleHandler.SpawnParticle(jaws2);
}
float radiusFactor = MathHelper.Lerp(0f, 1f, Utils.GetLerpValue(2f, 2.5f, Time, true));
for (int i = 0; i < 3; i++)
{
float offsetRotationAngle = player.velocity.ToRotation() + Time / 20f;
float radius = (30f + (float)Math.Cos(Time / 3f) * 24f) * radiusFactor;
Vector2 dustPosition = player.Center + player.velocity * 0.8f;
dustPosition += offsetRotationAngle.ToRotationVector2().RotatedBy(i / 5f * MathHelper.TwoPi) * radius;
Dust dust = Dust.NewDustPerfect(dustPosition, Main.rand.NextBool(5) ? 181 : 295);
dust.noGravity = true;
dust.velocity = player.velocity * 0.5f;
dust.scale = Main.rand.NextFloat(2.7f, 3.0f);
Dust dust2 = Dust.NewDustPerfect(player.Center + new Vector2(Main.rand.NextFloat(-6f, 6f), Main.rand.NextFloat(-15f, 15f)) + (player.velocity * 0.5f), Main.rand.NextBool(14) ? 180 : 295, -player.velocity.RotatedByRandom(MathHelper.ToRadians(30f)) * Main.rand.NextFloat(0.1f, 0.8f), 0, default, Main.rand.NextFloat(2.7f, 3.9f));
dust2.noGravity = true;
}
if (Time % 2 == 0)
{
float sparkscale = Size * 1.3f;
Vector2 SparkVelocity1 = player.velocity.RotatedBy(player.direction * -4, default) * 0.08f - player.velocity / 2f;
SparkParticle spark = new SparkParticle(player.Center + player.velocity.RotatedBy(2f * player.direction) * 1.2f, SparkVelocity1, false, Main.rand.Next(11, 13), sparkscale, Main.rand.NextBool(3) ? Color.Aqua : Color.Fuchsia);
GeneralParticleHandler.SpawnParticle(spark);
Vector2 SparkVelocity2 = player.velocity.RotatedBy(player.direction * 4, default) * 0.08f - player.velocity / 2f;
SparkParticle spark2 = new SparkParticle(player.Center + player.velocity.RotatedBy(-2f * player.direction) * 1.2f, SparkVelocity2, false, Main.rand.Next(11, 13), sparkscale, Main.rand.NextBool(3) ? Color.Aqua : Color.Fuchsia);
GeneralParticleHandler.SpawnParticle(spark2);
}
if (Time > 115 && Time < 200)
{
Particle pulse = new DirectionalPulseRing(player.Center - player.velocity * 0.52f, player.velocity / 1.5f, Color.Fuchsia, new Vector2(1f, 2f), player.velocity.ToRotation(), 0.82f, 0.32f, 60);
GeneralParticleHandler.SpawnParticle(pulse);
Particle pulse2 = new DirectionalPulseRing(player.Center - player.velocity * 0.40f, player.velocity / 1.5f * 0.9f, Color.Aqua, new Vector2(0.8f, 1.5f), player.velocity.ToRotation(), 0.58f, 0.28f, 50);
GeneralParticleHandler.SpawnParticle(pulse2);
Time = 222;
}
// Dash at a much, much faster speed than the default value.
dashSpeed = 32f;
runSpeedDecelerationFactor = 0.8f;
// Cooldown for God Slayer Armor dash.
player.AddCooldown(Cooldowns.GodSlayerDash.ID, CalamityUtils.SecondsToFrames(GodslayerCooldown));
player.Calamity().godSlayerDashHotKeyPressed = false;
}
public override void OnHitEffects(Player player, NPC npc, IEntitySource source, ref DashHitContext hitContext)
{
if (SoundOnce)
{
SoundEngine.PlaySound(DevourerofGodsHead.DeathExplosionSound, player.Center);
SoundOnce = false;
}
for (int i = 0; i <= 25; i++)
{
Dust dust = Dust.NewDustPerfect(player.position, Main.rand.NextBool(3) ? 226 : 272, player.velocity.RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(0.1f, 0.5f), 0, default, Main.rand.NextFloat(2.1f, 2.9f));
dust.noGravity = false;
}
// Define hit context variables.
int hitDirection = player.direction;
if (player.velocity.X != 0f)
hitDirection = Math.Sign(player.velocity.X);
hitContext.HitDirection = hitDirection;
hitContext.PlayerImmunityFrames = AsgardianAegis.ShieldSlamIFrames;
// Define damage parameters.
hitContext.damageClass = player.GetBestClass();
hitContext.BaseDamage = 3000;
hitContext.BaseKnockback = 15f;
// God Slayer Dash intentionally does not use the vanilla function for collision attack iframes.
// This is because its immunity is meant to be completely consistent and not subject to vanilla anticheese.
hitContext.PlayerImmunityFrames = GodSlayerChestplate.DashIFrames;
npc.AddBuff(ModContent.BuffType<GodSlayerInferno>(), 300);
}
}
}
+2 -2
View File
@@ -22,7 +22,7 @@ namespace CalamityMod.Items.Armor.Victide
public static int BarrierCooldown = CalamityUtils.SecondsToFrames(8);
public static int BarrierDefenseBoost = 10;
public static int BarrierDefenseDamageRecovery = 2;
public static int BarrierExplosionDamage = 100;
public static int BarrierDamage = 50;
public static float BarrierExplosionKB = 8f;
public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RegenBoost.ToRegenPerSecond(), RunAccelerationMult.Round());
@@ -52,7 +52,7 @@ namespace CalamityMod.Items.Armor.Victide
{
// Damage will be set once explosion goes off
var source = player.GetSource_ItemUse(Item);
Projectile.NewProjectile(source, player.Center, Vector2.Zero, ModContent.ProjectileType<VictideBarrier>(), 0, BarrierExplosionKB, player.whoAmI);
Projectile.NewProjectile(source, player.Center, Vector2.Zero, ModContent.ProjectileType<VictideBarrier>(), 0, 0f, player.whoAmI);
}
}
}
@@ -238,9 +238,10 @@ VictideHeadBarrier: {
'''
SetBonus:
'''
[c/{0}:Warding Wave - Forms a tidal barrier which can be exploded to propel you]
[c/{0}:Warding Wave - Forms a tidal barrier which can be exploded to launch you]
[c/A2D6FF:The barrier grants {1} defense and converts {2} {^2:point;points} of defense damage into healing]
[c/A2D6FF:{3} to disperse it for {4} {^4:second;seconds} and propel you in the direction of the cursor]
[c/A2D6FF:The resulting dash can slam through and damage enemies]
'''
}
+3
View File
@@ -1,6 +1,7 @@
using CalamityMod.BiomeManagers;
using CalamityMod.Enums;
using CalamityMod.Items.Accessories;
using CalamityMod.Items.Armor.Vanity;
using CalamityMod.Items.Critters;
using CalamityMod.Items.Fishing.SunkenSeaCatches;
using CalamityMod.Items.Materials;
@@ -152,6 +153,8 @@ namespace CalamityMod.NPCs.SunkenSea
AddScavengerItem(white, ItemID.Coral, 3, 10, 0.2f);
AddScavengerItem(white, ItemID.Starfish, 3, 10, 0.2f);
AddScavengerItem(white, ItemID.Seashell, 3, 10, 0.2f);
AddScavengerItem(white, ModContent.ItemType<VictideCoralTurban>(), 1, 0.05f);
AddScavengerItem(white, ModContent.ItemType<VictideShellmet>(), 1, 0.05f);
// Critters. Golds, Radiants, Pearlpods and any Basalt Gully/Timeless Shore critters are to be excluded
AddScavengerItem(white, ModContent.ItemType<PrismaticGuppyPinkItem>(), 1, 0.02f);
AddScavengerItem(white, ModContent.ItemType<PrismaticGuppyGreenItem>(), 1, 0.02f);
+134 -12
View File
@@ -1,13 +1,18 @@
using CalamityMod.Cooldowns;
using System;
using System.Collections.Generic;
using CalamityMod.Cooldowns;
using CalamityMod.Items.Armor.Victide;
using CalamityMod.Particles;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using Terraria;
using Terraria.Audio;
using Terraria.GameContent;
using Terraria.Graphics.Shaders;
using Terraria.ID;
using Terraria.ModLoader;
using static CalamityMod.CalamityUtils;
namespace CalamityMod.Projectiles.Typeless
{
@@ -16,29 +21,53 @@ namespace CalamityMod.Projectiles.Typeless
public new string LocalizationCategory => "Projectiles.Typeless";
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public static readonly SoundStyle ExplosionSound = new("CalamityMod/Sounds/Custom/BubblyBurst");
public static float ExplosionLifetime = 24f;
public static float MaxScale = 6f;
public static float DashSpeed = 24f; // 24 tiles
public static float DashLifetime = 16f;
public static int DashSlamIFrames = 12;
private List<int> NPCsHitBySlam = new List<int>() { -1 };
public ref float ExplodeTimer => ref Projectile.ai[0];
public ref float DashTimer => ref Projectile.ai[1];
public Player Owner => Main.player[Projectile.owner];
public static Asset<Texture2D> Shine;
public static Asset<Texture2D> Explosion;
public override void Load()
{
Shine = ModContent.Request<Texture2D>("CalamityMod/Particles/SemiCircularSmearSwipe");
Explosion = ModContent.Request<Texture2D>("CalamityMod/Particles/SoftRoundExplosion");
}
public override void SetDefaults()
{
Projectile.width = Projectile.height = 2;
Projectile.width = Projectile.height = 20;
Projectile.friendly = true;
Projectile.ignoreWater = true;
Projectile.tileCollide = false;
Projectile.penetrate = -1;
Projectile.timeLeft = 20;
Projectile.timeLeft = (int)ExplosionLifetime;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = -1;
}
public override void AI()
{
Projectile.rotation = MathHelper.ToRadians(Main.GlobalTimeWrappedHourly * 36f);
if (ExplodeTimer > 0f)
{
float scaleLevel = PiecewiseAnimation(ExplodeTimer / ExplosionLifetime, new CurveSegment[] { new CurveSegment(EasingType.PolyOut, 0f, 0f, 1f, 4) });
Projectile.scale = MathHelper.Lerp(1f, MaxScale, scaleLevel);
Projectile.Opacity = MathF.Sin(MathHelper.PiOver2 + MathHelper.PiOver2 * ExplodeTimer / ExplosionLifetime);
if (ExplodeTimer == 1f)
{
Particle boom = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Cyan * 0.8f, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0f, 0.12f, 24, true);
GeneralParticleHandler.SpawnParticle(boom);
SoundEngine.PlaySound(ExplosionSound, Projectile.Center);
for (int i = 0; i < 5; i++)
{
@@ -61,6 +90,52 @@ namespace CalamityMod.Projectiles.Typeless
ExplodeTimer++;
}
else if (DashTimer > 0f)
{
Owner.mount?.Dismount(Owner);
Owner.RemoveAllGrapplingHooks();
Owner.velocity = Projectile.velocity;
Owner.ChangeDir(Math.Sign(Projectile.velocity.X) <= 0 ? -1 : 1);
// Move the player to the projectile, allowing them to bypass platforms (but not tiles)
Owner.Center = Projectile.Center;
// Custom ram effect, similar to the one used in CalamityPlayerDashEffects
Rectangle hitArea = new Rectangle((int)(Owner.position.X + Owner.velocity.X * 0.5 - 4f), (int)(Owner.position.Y + Owner.velocity.Y * 0.5 - 4), Owner.width + 8, Owner.height + 8);
foreach (NPC n in Main.ActiveNPCs)
{
// Ignore critters with the Guide to Critter Companionship
if (Owner.dontHurtCritters && NPCID.Sets.CountsAsCritter[n.type])
continue;
if (!n.dontTakeDamage && !n.friendly && !NPCsHitBySlam.Contains(n.whoAmI))
{
if (hitArea.Intersects(n.getRect()) && (n.noTileCollide || Owner.CanHit(n)))
{
Projectile.NewProjectile(Owner.GetSource_FromThis(), n.Center, Vector2.Zero, ModContent.ProjectileType<DirectStrike>(), Projectile.damage, 0f, Owner.whoAmI, n.whoAmI);
Owner.GiveImmuneTimeForCollisionAttack(DashSlamIFrames);
NPCsHitBySlam.Add(n.whoAmI);
}
}
}
// Dash trail effects
Color trailColor = Color.Lerp(Color.Cyan, Color.RoyalBlue, DashTimer / DashLifetime);
if (DashTimer % 2f == 1f)
{
Particle trail = new CustomSpark(Projectile.Center - Projectile.velocity * 2f, Projectile.velocity * 0.5f, "CalamityMod/Particles/ForwardSmear", false, 12, 0.2f, trailColor, new Vector2(1f, Main.rand.NextFloat(1.2f, 1.35f)), fadeIn: true, extraRotation: MathHelper.ToRadians(180f));
GeneralParticleHandler.SpawnParticle(trail);
}
for (int direction = -1; direction <= 1; direction += 2)
{
Vector2 sidePos = Projectile.Center - Projectile.velocity * 2f + Projectile.velocity.SafeNormalize(Vector2.Zero).RotatedBy(MathHelper.PiOver2 * direction) * Utils.Remap(DashTimer, 1f, DashLifetime, 48f, 24f);
Particle sideTrail = new CustomSpark(sidePos, Projectile.velocity * 0.5f, "CalamityMod/Particles/BloomCircle", false, 18, 0.3f, trailColor * 0.6f, new Vector2(1f, 2.5f), shrinkSpeed: 0.2f);
GeneralParticleHandler.SpawnParticle(sideTrail);
}
DashTimer++;
}
else
{
// If the barrier set isn't on, unceremoniously disappear
@@ -69,21 +144,36 @@ namespace CalamityMod.Projectiles.Typeless
Projectile.Kill();
return;
}
// Set to explode if cooldown is detected
// Set to dash if cooldown is detected and also create an explosion in its place
if (Owner.HasCooldown(WardingWave.ID))
{
ExplodeTimer++;
Projectile.damage = (int)Owner.GetBestClassDamage().ApplyTo(VictideHeadBarrier.BarrierExplosionDamage);
DashTimer++;
Projectile.damage = (int)Owner.GetBestClassDamage().ApplyTo(VictideHeadBarrier.BarrierDamage);
if (Projectile.owner == Main.myPlayer)
{
// Set dash velocity
Projectile.velocity = Owner.SafeDirectionTo(Main.MouseWorld) * DashSpeed;
Projectile.tileCollide = true;
// Spawn explosion
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.MountedCenter, Vector2.Zero, Type, Projectile.damage, VictideHeadBarrier.BarrierExplosionKB, Projectile.owner, 1f);
}
}
Projectile.Center = Owner.MountedCenter;
Projectile.timeLeft = 20;
Projectile.timeLeft = (int)DashLifetime;
}
}
public override bool? CanDamage() => ExplodeTimer > 0f ? null : false;
public override void OnKill(int timeLeft)
{
if (DashTimer > 0f)
Owner.velocity *= 0.5f;
}
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 112f, targetHitbox);
// Explosion collision only (dash has a custom ram logic check effect)
public override bool? CanDamage() => ExplodeTimer > 0f ? null : false;
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 20f * Projectile.scale, targetHitbox);
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
{
@@ -93,8 +183,40 @@ namespace CalamityMod.Projectiles.Typeless
public override bool PreDraw(ref Color lightColor)
{
// Barrier soonTM
if (DashTimer > 0f)
return false;
Texture2D explosionTex = Explosion.Value;
if (ExplodeTimer > 0f)
{
Main.spriteBatch.EnterShaderRegion(BlendState.Additive);
Vector2 explosionPos = Projectile.Center - Main.screenPosition;
Main.EntitySpriteDraw(explosionTex, explosionPos, null, Color.Cyan * Projectile.Opacity, Projectile.rotation, explosionTex.Size() * 0.5f, 0.02f * Projectile.scale, SpriteEffects.None);
Main.spriteBatch.ExitShaderRegion();
return false;
}
Vector2 drawPos = Owner.Center + Vector2.UnitY * Owner.gfxOffY - Main.screenPosition;
Texture2D circleBase = TextureAssets.Projectile[Type].Value;
// Silly solution to making a clean circle over the player
Main.spriteBatch.EnterShaderRegion();
GameShaders.Misc["CalamityMod:CircularAoETelegraph"].UseOpacity(0.4f);
GameShaders.Misc["CalamityMod:CircularAoETelegraph"].UseColor(Main.hslToRgb(0.6f + 0.1f * MathF.Sin(Main.GlobalTimeWrappedHourly * 2f), 1f, 0.75f));
GameShaders.Misc["CalamityMod:CircularAoETelegraph"].UseSecondaryColor(Color.Transparent);
GameShaders.Misc["CalamityMod:CircularAoETelegraph"].UseSaturation(0f);
GameShaders.Misc["CalamityMod:CircularAoETelegraph"].Apply();
Main.EntitySpriteDraw(circleBase, drawPos, null, Color.White, 0f, circleBase.Size() * 0.5f, 80f, SpriteEffects.None);
Main.spriteBatch.ExitShaderRegion();
// Give it additional texture
Main.spriteBatch.EnterShaderRegion(BlendState.Additive);
Main.EntitySpriteDraw(explosionTex, drawPos, null, Color.Cyan * 0.3f, Projectile.rotation, explosionTex.Size() * 0.5f, 0.04f, SpriteEffects.None);
Texture2D shineTex = Shine.Value;
Main.EntitySpriteDraw(shineTex, drawPos, null, Color.HotPink * 0.5f, MathHelper.ToRadians(36f), shineTex.Size() * 0.5f, 0.45f, SpriteEffects.None);
Main.EntitySpriteDraw(shineTex, drawPos, null, Color.Orange * 0.3f, MathHelper.ToRadians(216f), shineTex.Size() * 0.5f, 0.55f, SpriteEffects.None);
Main.spriteBatch.ExitShaderRegion();
return false;
}
Binary file not shown.