Finish Sealed Singularity

This commit is contained in:
doze-zoze committed 2026-03-06 17:48:50 -06:00
1 parent c710d8128a
commit fc9eb5f7b7
5 files changed
+183 -114

No files matched your search

+2 -1
View File
@@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Rogue
{
Item.width = 32;
Item.height = 32;
Item.damage = 600;
Item.damage = 425;
Item.DamageType = RogueDamageClass.Instance;
Item.autoReuse = true;
Item.noMelee = true;
@@ -30,6 +30,7 @@ namespace CalamityMod.Items.Weapons.Rogue
Item.channel = true;
Item.shootSpeed = 13f;
Item.shoot = ModContent.ProjectileType<SealedSingularityHoldout>();
Item.Calamity().donorItem = true;
}
public override void HoldItem(Player player)
@@ -244,7 +244,7 @@ ScourgeoftheSeasProjectile.DisplayName: Moist Scourge
ScourgeVenomCloud.DisplayName: Venom Cloud
SeafoamBombProj.DisplayName: Seafoam Bomb
SeafoamBubble.DisplayName: Seafoam Bubble
SealedSingularityBlackhole.DisplayName: Sealed Blackhole
SealedSingularityRock.DisplayName: Sealed Singularity Rock
SealedSingularityGore.DisplayName: Sealed Singularity Fragment
SealedSingularityHoldout.DisplayName: Sealed Singularity
SealedSingularityProjectile.DisplayName: Sealed Singularity
@@ -1,100 +0,0 @@
using CalamityMod.NPCs;
using CalamityMod.NPCs.NormalNPCs;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Rogue
{
public class SealedSingularityBlackhole : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Rogue";
public override void SetStaticDefaults()
{
Main.projFrames[Type] = 7;
}
public override void SetDefaults()
{
Projectile.width = 40;
Projectile.height = 40;
Projectile.friendly = true;
Projectile.penetrate = -1;
Projectile.DamageType = RogueDamageClass.Instance;
Projectile.tileCollide = false;
Projectile.usesIDStaticNPCImmunity = true;
Projectile.idStaticNPCHitCooldown = 10;
}
public override bool PreDraw(ref Color lightColor)
{
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor);
return false;
}
public override void AI()
{
// Update animation
if (Projectile.timeLeft % 5 == 0)
{
Projectile.frame++;
}
if (Projectile.frame >= Main.projFrames[Type])
{
Projectile.frame = 0;
}
//Succcc
float projCenX = Projectile.Center.X;
float projCenY = Projectile.Center.Y;
float maxDistance = Projectile.Calamity().stealthStrike ? 1000f : 500f;
float succPower = Projectile.Calamity().stealthStrike ? 0.25f : 0.1f;
for (int index = 0; index < Main.maxNPCs; index++)
{
NPC npc = Main.npc[index];
if (npc.CanBeChasedBy(Projectile, false) && Collision.CanHit(Projectile.Center, 1, 1, npc.Center, 1, 1))
{
if (CalamityGlobalNPC.ShouldAffectNPC(npc) || npc.type == ModContent.NPCType<SuperDummyNPC>())
{
float extraDistance = (npc.width / 2) + (npc.height / 2);
if (Vector2.Distance(npc.Center, Projectile.Center) < (maxDistance + extraDistance))
{
if (npc.position.X < projCenX)
{
npc.velocity.X += succPower;
}
else
{
npc.velocity.X -= succPower;
}
if (npc.position.Y < projCenY)
{
npc.velocity.Y += succPower;
}
else
{
npc.velocity.Y -= succPower;
}
}
}
}
}
Projectile.ai[0]++;
if (Projectile.ai[0] > 300f)
{
Projectile.scale *= 0.95f;
Projectile.Opacity *= 0.95f;
Projectile.height = (int)(Projectile.height * Projectile.scale);
Projectile.width = (int)(Projectile.width * Projectile.scale);
}
if (Projectile.scale <= 0.05f)
{
Projectile.Kill();
}
}
public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.Blackout, 300);
}
}
@@ -1,8 +1,12 @@
using System;
using CalamityMod.Dusts;
using CalamityMod.NPCs.CeaselessVoid;
using CalamityMod.Systems.Graphic.PixelationSystem;
using CalamityMod.Utilities.Daybreak;
using CalamityMod.Utilities.Daybreak.Buffers;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using Terraria;
using Terraria.Audio;
using Terraria.GameContent;
@@ -17,6 +21,8 @@ namespace CalamityMod.Projectiles.Rogue
public new string LocalizationCategory => "Projectiles.Rogue";
public override string Texture => "CalamityMod/Items/Weapons/Rogue/SealedSingularity";
//Trans flag colors with name containing "girlswag" or having a gender change pot in inventory at donor request
public static Color BorderColor => Main.LocalPlayer.name.Contains("girlswag") || Main.LocalPlayer.HasItemInAnyInventory(ItemID.GenderChangePotion) ? Color.Lerp(Color.Pink, Color.LightBlue, (MathF.Sin(Main.GlobalTimeWrappedHourly * 3) + 1) * 0.5f) : new Color(59, 2, 120);
public override void SetStaticDefaults()
{
ProjectileID.Sets.TrailCacheLength[Type] = 3;
@@ -73,6 +79,17 @@ namespace CalamityMod.Projectiles.Rogue
{
Projectile.velocity *= 1 + Math.Clamp(Timer / TimerMax, 0f, 1f) * 2f;
}
if (Timer % 10 == 0 && Main.myPlayer == Projectile.owner && Timer < TimerMax - (Stealth ? 120 : 90))
{
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + new Vector2(Stealth ? 380 : 255, 0).RotatedByRandom(MathHelper.TwoPi), Vector2.Zero, ModContent.ProjectileType<SealedSingularityRock>(), 0, 0, Projectile.owner, Projectile.whoAmI);
var v = new Vector2(Stealth ? 380 : 255, 0).RotatedByRandom(MathHelper.TwoPi);
Dust.NewDustPerfect(Projectile.Center + v, DustID.Clentaminator_Purple, -v / 100f);
}
if (TimerMax - Timer == 330)
{
SoundEngine.PlaySound(CeaselessVoid.BuildupSound with { pitch = 0.75f, MaxInstances = 10, Volume = 0.2f }, Projectile.Center);
}
}
if (AIState == 2)
@@ -90,7 +107,7 @@ namespace CalamityMod.Projectiles.Rogue
if (Timer > TimerMax && AIState == 0)
{
var sizee = Stealth ? 900 : 600;
Projectile.localNPCHitCooldown = 60;
Projectile.localNPCHitCooldown = 30;
Projectile.ResetLocalNPCHitImmunity();
Projectile.tileCollide = false;
Timer = 0;
@@ -104,10 +121,18 @@ namespace CalamityMod.Projectiles.Rogue
Timer = 0;
TimerMax = 300;
Projectile.ResetLocalNPCHitImmunity();
for (int index = 0; index < 3; ++index)
{
float SpeedX = -Projectile.velocity.X * Main.rand.Next(40, 70) * 0.01f + Main.rand.Next(-20, 21) * 0.4f;
float SpeedY = -Projectile.velocity.Y * Main.rand.Next(40, 70) * 0.01f + Main.rand.Next(-20, 21) * 0.4f;
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X + SpeedX, Projectile.Center.Y + SpeedY, SpeedX, SpeedY, ModContent.ProjectileType<SealedSingularityGore>(), 20, 0f, Projectile.owner, index, 0f);
}
SoundEngine.PlaySound(CeaselessVoid.DeathSound with { pitch = 1f, Volume = Stealth ? 0.5f : 0.2f }, Projectile.Center);
}
if (Timer >= TimerMax && AIState == 2)
{
Projectile.Resize(300, 300);
Projectile.ResetLocalNPCHitImmunity();
Projectile.Damage();
@@ -115,23 +140,57 @@ namespace CalamityMod.Projectiles.Rogue
{
var d = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType<LemonNadeExplodeDust>(), Main.rand.NextVector2CircularEdge(15, 15) * Main.rand.NextFloat(0.25f, 1f), Scale: Main.rand.NextFloat(0.5f, 1f));
}
SoundEngine.PlaySound(SoundID.Item62 with { pitch = 1f }, Projectile.Center);
SoundEngine.PlaySound(SoundID.Item111 with { pitch = 0.5f }, Projectile.Center);
for (int index = 0; index < 3; ++index)
{
float SpeedX = -Projectile.velocity.X * Main.rand.Next(40, 70) * 0.01f + Main.rand.Next(-20, 21) * 0.4f;
float SpeedY = -Projectile.velocity.Y * Main.rand.Next(40, 70) * 0.01f + Main.rand.Next(-20, 21) * 0.4f;
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X + SpeedX, Projectile.Center.Y + SpeedY, SpeedX, SpeedY, ModContent.ProjectileType<SealedSingularityGore>(), 20, 0f, Projectile.owner, index, 0f);
}
Projectile.Kill();
}
}
private static Texture2D OutlineTex
{
get
{
if (field == null)
{
var texture = TextureAssets.Projectile[ModContent.ProjectileType<SealedSingularityProjectile>()].Value;
field = new Texture2D(Main.graphics.GraphicsDevice, texture.Width, texture.Height);
var BaseArray = new Color[field.Width * field.Height];
var ColorArray = new Color[field.Width * field.Height];
texture.GetData(BaseArray);
for (var i = 0; i < BaseArray.Length; i++)
{
ColorArray[i] = new Color(255, 255, 255) * (((float)BaseArray[i].A) / 255f);
}
field.SetData(ColorArray);
}
return field;
}
set;
}
private static Asset<Texture2D> VoidTex => field ??= ModContent.Request<Texture2D>("CalamityMod/Projectiles/Rogue/SealedSingularityBlackhole");
public override bool PreDraw(ref Color lightColor)
{
if (AIState == 1)
PixelationManager.AddPixelatedDrawer((matrix) => DrawAuraOutside(this, matrix), Enums.GeneralDrawLayer.AfterEverything);
{
for (float i = 0; i < MathHelper.TwoPi; i += MathHelper.PiOver2)
{
var pos = Projectile.Center - Main.screenPosition;
float rot = Projectile.rotation;
var frame = TextureAssets.Projectile[Type].Frame(1, 1, 0, 0);
float scale = 1f;
float borderOp = MathF.Pow(Projectile.Opacity, 2);
Main.spriteBatch.Draw(OutlineTex, pos + new Vector2(6 * Timer / TimerMax, 0).RotatedBy(i), frame, BorderColor * borderOp, rot, frame.Size() * 0.5f, scale, SpriteEffects.None, 0);
}
PixelationManager.AddPixelatedDrawer((matrix) => DrawAuraOutside(this, matrix), Enums.GeneralDrawLayer.AfterNPCs);
}
if (AIState == 2)
{
var frame = VoidTex.Frame(1, 7, 0, (int)(Timer * 0.2f % 7));
Main.EntitySpriteDraw(VoidTex.Value, Projectile.Center - Main.screenPosition, frame, Color.White, 0, frame.Size() * 0.5f, Projectile.scale, 0);
return false;
}
Main.EntitySpriteDraw(TextureAssets.Projectile[Type].Value, Projectile.Center - Main.screenPosition, null, Color.White, Projectile.rotation, TextureAssets.Projectile[Type].Size() * 0.5f, Projectile.scale, 0);
return false;
}
@@ -147,8 +206,8 @@ namespace CalamityMod.Projectiles.Rogue
GameShaders.Misc["CalamityMod:OtherworldBarrierDistortion"].SetShaderTexture(ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/GreyscaleGradients/Neurons"), 1);
GameShaders.Misc["CalamityMod:OtherworldBarrierDistortion"].Apply();
Texture2D telegraphBase = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomRing").Value;
Main.EntitySpriteDraw(telegraphBase, drawPosition, null, Color.White * mproj.Projectile.Opacity * 0.75f * Math.Clamp(mproj.Timer / 15f, 0f, 1f), mproj.Projectile.whoAmI, telegraphBase.Size() / 2f, (mproj.Stealth ? 900f : 600f) * mproj.Projectile.Opacity / telegraphBase.Width * Math.Clamp(1 - (mproj.Timer - mproj.TimerMax + 15) / 15f, 0f, 1f), 0, 0);
Main.EntitySpriteDraw(telegraphBase, drawPosition, null, new Color(36, 0, 66) * mproj.Projectile.Opacity * 0.75f * Math.Clamp(mproj.Timer / 15f, 0f, 1f), mproj.Projectile.whoAmI, telegraphBase.Size() / 2f, (mproj.Stealth ? 900f : 600f) * mproj.Projectile.Opacity / telegraphBase.Width * Math.Clamp(1 - (mproj.Timer - mproj.TimerMax + 15) / 15f, 0f, 1f), 0, 0);
Main.EntitySpriteDraw(telegraphBase, drawPosition, null, Color.White * mproj.Projectile.Opacity * 0.25f * Math.Clamp(mproj.Timer / 15f, 0f, 1f), mproj.Projectile.whoAmI, telegraphBase.Size() / 2f, (mproj.Stealth ? 900f : 600f) * mproj.Projectile.Opacity / telegraphBase.Width * Math.Clamp(1 - (mproj.Timer - mproj.TimerMax + 15) / 15f, 0f, 1f), 0, 0);
Main.EntitySpriteDraw(telegraphBase, drawPosition, null, BorderColor * mproj.Projectile.Opacity * 0.5f * Math.Clamp(mproj.Timer / 15f, 0f, 1f), mproj.Projectile.whoAmI, telegraphBase.Size() / 2f, (mproj.Stealth ? 900f : 600f) * mproj.Projectile.Opacity / telegraphBase.Width * Math.Clamp(1 - (mproj.Timer - mproj.TimerMax + 15) / 15f, 0f, 1f), 0, 0);
Main.spriteBatch.ExitShaderRegion(matrix: matrix);
}
@@ -187,6 +246,10 @@ namespace CalamityMod.Projectiles.Rogue
targetID = target.whoAmI;
}
}
if (AIState == 1)
{
target.MoveNPC(target.DirectionTo(Projectile.Center), Stealth ? 18 : 4, true);
}
return;
}
case 2:
@@ -204,7 +267,7 @@ namespace CalamityMod.Projectiles.Rogue
switch (AIState)
{
case 1:
modifiers.SourceDamage /= 6;
modifiers.SourceDamage /= 20;
return;
case 2:
modifiers.SourceDamage *= 2;
+105
View File
@@ -0,0 +1,105 @@
using System;
using System.Collections.Generic;
using CalamityMod.NPCs;
using CalamityMod.Utilities.Daybreak;
using CalamityMod.Utilities.Daybreak.Buffers;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.Audio;
using Terraria.GameContent;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Rogue
{
public class SealedSingularityRock : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Rogue";
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public override void SetDefaults()
{
Projectile.width = 40;
Projectile.height = 40;
Projectile.friendly = true;
Projectile.penetrate = -1;
Projectile.DamageType = RogueDamageClass.Instance;
Projectile.tileCollide = false;
Projectile.usesIDStaticNPCImmunity = true;
Projectile.idStaticNPCHitCooldown = 10;
Projectile.Opacity = 0;
Projectile.hide = true;
Projectile.scale = 0.75f;
}
private static Texture2D OutlineTex
{
get
{
if (field == null)
{
var texture = TextureAssets.Projectile[ProjectileID.DeerclopsRangedProjectile].Value;
field = new Texture2D(Main.graphics.GraphicsDevice, texture.Width, texture.Height);
var BaseArray = new Color[field.Width * field.Height];
var ColorArray = new Color[field.Width * field.Height];
texture.GetData(BaseArray);
for (var i = 0; i < BaseArray.Length; i++)
{
ColorArray[i] = new Color(255, 255, 255) * (((float)BaseArray[i].A) / 255f);
}
field.SetData(ColorArray);
}
return field;
}
set;
} = null;
public override bool PreDraw(ref Color lightColor)
{
using (Main.spriteBatch.Scope())
{
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.Transform);
var tex = TextureAssets.Projectile[ProjectileID.DeerclopsRangedProjectile];
var pos = Projectile.Center - Main.screenPosition;
float rot = Projectile.rotation;
var frame = tex.Frame(3, 4, 0, 1);
float scale = Projectile.scale;
float borderOp = MathF.Pow(Projectile.Opacity, 2);
for (float i = 0; i < MathHelper.TwoPi; i += MathHelper.PiOver2)
{
Main.spriteBatch.Draw(OutlineTex, pos + new Vector2(2, 0).RotatedBy(i), frame, SealedSingularityProjectile.BorderColor * borderOp, rot, frame.Size() * 0.5f, scale, SpriteEffects.None, 0);
}
Main.spriteBatch.Draw(tex.Value, pos, frame, Lighting.GetColor(Projectile.Center.ToTileCoordinates()) * Projectile.Opacity, rot, frame.Size() * 0.5f, scale, SpriteEffects.None, 0);
Main.spriteBatch.End();
}
return false;
}
public override void DrawBehind(int index, List<int> behindNPCsAndTiles, List<int> behindNPCs, List<int> behindProjectiles, List<int> overPlayers, List<int> overWiresUI)
{
behindProjectiles.Add(index);
}
Vector2? goaloffset;
public override void AI()
{
var goal = Main.projectile[(int)Projectile.ai[0]];
goaloffset ??= Projectile.Center - goal.Center;
Projectile.Opacity += 0.1f;
if (Projectile.Opacity >= 1f)
{
Projectile.velocity += Projectile.DirectionTo(goal.Center) * 0.4f;
}
Projectile.rotation += 0.1f;
if (Projectile.Distance(goal.Center) < 16)
{
SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/NPCHit/OtherworldlyHit") with { PitchVariance = 0.4f, Volume = 0.2f, MaxInstances = 1 }, Projectile.Center);
Projectile.Kill();
}
}
}
}