Crown Jewel updates
No files matched your search
|
After Width: | Height: | Size: 472 B |
|
After Width: | Height: | Size: 192 B |
@@ -1,18 +1,26 @@
|
||||
using CalamityMod.CalPlayer;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using CalamityMod.CalPlayer;
|
||||
using CalamityMod.Events;
|
||||
using CalamityMod.Graphics.Primitives;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Projectiles.Boss;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.Graphics.Shaders;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using static System.Net.Mime.MediaTypeNames;
|
||||
|
||||
namespace CalamityMod.NPCs.NormalNPCs
|
||||
{
|
||||
public class KingSlimeJewelRuby : ModNPC
|
||||
{
|
||||
public override string Texture => "CalamityMod/NPCs/NormalNPCs/KingSlimeJewel";
|
||||
public static readonly SoundStyle ShatterSound = new SoundStyle("CalamityMod/Sounds/NPCKilled/CrownJewelShatter");
|
||||
|
||||
private const int BoltShootGateValue = 60;
|
||||
private const int BoltShootGateValue_Death = 75;
|
||||
@@ -50,7 +58,7 @@ namespace CalamityMod.NPCs.NormalNPCs
|
||||
if (!CalamityPlayer.areThereAnyDamnBosses)
|
||||
{
|
||||
NPC.life = 0;
|
||||
NPC.HitEffect();
|
||||
OnKill();
|
||||
NPC.active = false;
|
||||
NPC.netUpdate = true;
|
||||
return;
|
||||
@@ -131,21 +139,14 @@ namespace CalamityMod.NPCs.NormalNPCs
|
||||
projVector.X *= projLength;
|
||||
projVector.Y *= projLength;
|
||||
|
||||
for (int dusty = 0; dusty < 10; dusty++)
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
Vector2 dustVel = projVector;
|
||||
dustVel.Normalize();
|
||||
int ruby = Dust.NewDust(NPC.Center, NPC.width, NPC.height, DustID.GemRuby, dustVel.X, dustVel.Y, 100, default, 2f);
|
||||
Main.dust[ruby].velocity *= 1.5f;
|
||||
Main.dust[ruby].noGravity = true;
|
||||
if (Main.rand.NextBool())
|
||||
{
|
||||
Main.dust[ruby].scale = 0.5f;
|
||||
Main.dust[ruby].fadeIn = 1f + Main.rand.Next(10) * 0.1f;
|
||||
}
|
||||
GeneralParticleHandler.SpawnParticle(new PointParticle(NPC.Center, new Vector2(Main.rand.NextFloat(20), 0).RotatedByRandom(MathHelper.TwoPi), false, 10, Main.rand.NextFloat(0.5f, 1.5f), Color.Red));
|
||||
GeneralParticleHandler.SpawnParticle(new PointParticle(NPC.Center, new Vector2(Main.rand.NextFloat(10), 0).RotatedByRandom(MathHelper.TwoPi), false, 10, Main.rand.NextFloat(0.5f, 1.5f), Color.Pink));
|
||||
}
|
||||
|
||||
SoundEngine.PlaySound(SoundID.Item8, NPC.Center);
|
||||
SoundEngine.PlaySound(ShatterSound.WithPitchOffset(-0.75f).WithVolumeScale(0.4f), NPC.Center);
|
||||
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
@@ -168,17 +169,46 @@ namespace CalamityMod.NPCs.NormalNPCs
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnKill()
|
||||
{
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
GeneralParticleHandler.SpawnParticle(new PointParticle(NPC.Center, new Vector2(Main.rand.NextFloat(20), 0).RotatedByRandom(MathHelper.TwoPi), false, 10, Main.rand.NextFloat(0.5f, 1.5f), Color.Red));
|
||||
GeneralParticleHandler.SpawnParticle(new PointParticle(NPC.Center, new Vector2(Main.rand.NextFloat(10), 0).RotatedByRandom(MathHelper.TwoPi), false, 10, Main.rand.NextFloat(0.5f, 1.5f), Color.HotPink));
|
||||
}
|
||||
|
||||
float start = Main.rand.NextFloat(MathHelper.TwoPi);
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
GeneralParticleHandler.SpawnParticle(new CustomSprite(NPC.Center, new Vector2(0, -2).RotatedByRandom(start + MathHelper.ToRadians(20f)).RotatedBy(MathHelper.ToRadians(i * 125)), 120, "CalamityMod/Particles/KingSlimeRubyShards", 1f, new Color(255, 255, 255), Main.rand.NextFloat(0.2f, 0.6f), frameCount: 3, frame: i));
|
||||
}
|
||||
SoundEngine.PlaySound(ShatterSound, NPC.Center);
|
||||
}
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor)
|
||||
{
|
||||
Color col = Color.Red;
|
||||
Color flashCol = Color.HotPink;
|
||||
|
||||
float alph = 0f;
|
||||
|
||||
float colorTelegraphGateValue = (BossRushEvent.BossRushActive ? BoltShootGateValue_BossRush : (CalamityWorld.death ? BoltShootGateValue_Death : BoltShootGateValue)) - LightTelegraphDuration;
|
||||
|
||||
if (NPC.ai[0] > colorTelegraphGateValue)
|
||||
alph = MathHelper.Lerp(0f, 1f, (NPC.ai[0] - colorTelegraphGateValue) / LightTelegraphDuration);
|
||||
|
||||
Asset<Texture2D> tex = ModContent.Request<Texture2D>(Texture);
|
||||
Asset<Texture2D> tex2 = ModContent.Request<Texture2D>("CalamityMod/NPCs/NormalNPCs/KingSlimeJewelFlash");
|
||||
|
||||
Main.EntitySpriteDraw(tex.Value, NPC.Center - Main.screenPosition, tex.Frame(), Color.White, NPC.rotation, tex.Frame().Center(), 1f, SpriteEffects.None);
|
||||
Main.EntitySpriteDraw(tex2.Value, NPC.Center - Main.screenPosition, tex2.Frame(), Color.Lerp(col, flashCol, alph).MultiplyRGBA(new Color(alph, alph, alph, 0f)), NPC.rotation, tex2.Frame().Center(), alph * 1.2f, SpriteEffects.None);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override Color? GetAlpha(Color drawColor)
|
||||
{
|
||||
Color initialColor = new Color(175, 100, 100);
|
||||
Color newColor = initialColor;
|
||||
Color finalColor = new Color(255, 150, 150);
|
||||
float colorTelegraphGateValue = (BossRushEvent.BossRushActive ? BoltShootGateValue_BossRush : CalamityWorld.death ? BoltShootGateValue_Death : BoltShootGateValue) - LightTelegraphDuration;
|
||||
if (NPC.ai[0] > colorTelegraphGateValue)
|
||||
newColor = Color.Lerp(initialColor, finalColor, (NPC.ai[0] - colorTelegraphGateValue) / LightTelegraphDuration);
|
||||
newColor.A = (byte)(255 * NPC.Opacity);
|
||||
|
||||
return newColor;
|
||||
return Color.White;
|
||||
}
|
||||
|
||||
public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment)
|
||||
@@ -190,37 +220,9 @@ namespace CalamityMod.NPCs.NormalNPCs
|
||||
|
||||
public override void HitEffect(NPC.HitInfo hit)
|
||||
{
|
||||
int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GemRuby, hit.HitDirection, -1f, 0, default, 1f);
|
||||
Main.dust[dust].noGravity = true;
|
||||
|
||||
if (NPC.life <= 0)
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
NPC.position = NPC.Center;
|
||||
NPC.width = NPC.height = 45;
|
||||
NPC.position.X = NPC.position.X - (NPC.width / 2);
|
||||
NPC.position.Y = NPC.position.Y - (NPC.height / 2);
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
int rubyDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GemRuby, 0f, 0f, 100, default, 2f);
|
||||
Main.dust[rubyDust].velocity *= 3f;
|
||||
Main.dust[rubyDust].noGravity = true;
|
||||
if (Main.rand.NextBool())
|
||||
{
|
||||
Main.dust[rubyDust].scale = 0.5f;
|
||||
Main.dust[rubyDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f;
|
||||
}
|
||||
}
|
||||
|
||||
for (int j = 0; j < 10; j++)
|
||||
{
|
||||
int rubyDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GemRuby, 0f, 0f, 100, default, 3f);
|
||||
Main.dust[rubyDust2].noGravity = true;
|
||||
Main.dust[rubyDust2].velocity *= 5f;
|
||||
rubyDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GemRuby, 0f, 0f, 100, default, 2f);
|
||||
Main.dust[rubyDust2].noGravity = true;
|
||||
Main.dust[rubyDust2].velocity *= 2f;
|
||||
}
|
||||
GeneralParticleHandler.SpawnParticle(new PointParticle(NPC.Center, new Vector2(Main.rand.NextFloat(10), 0).RotatedByRandom(MathHelper.TwoPi), false, 10, Main.rand.NextFloat(0.5f, 1.5f), Color.Red));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
After Width: | Height: | Size: 293 B |
@@ -1,9 +1,12 @@
|
||||
using System;
|
||||
using CalamityMod.CalPlayer;
|
||||
using CalamityMod.Events;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Projectiles.Boss;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
@@ -13,8 +16,6 @@ namespace CalamityMod.NPCs.NormalNPCs
|
||||
{
|
||||
public class KingSlimeJewelSapphire : ModNPC
|
||||
{
|
||||
public override string Texture => "CalamityMod/NPCs/NormalNPCs/KingSlimeJewel";
|
||||
|
||||
private const int BuffDustGateValue = 60;
|
||||
private const float LightTelegraphDuration = 45f;
|
||||
|
||||
@@ -49,7 +50,7 @@ namespace CalamityMod.NPCs.NormalNPCs
|
||||
if (!CalamityPlayer.areThereAnyDamnBosses)
|
||||
{
|
||||
NPC.life = 0;
|
||||
NPC.HitEffect();
|
||||
OnKill();
|
||||
NPC.active = false;
|
||||
NPC.netUpdate = true;
|
||||
return;
|
||||
@@ -184,6 +185,24 @@ namespace CalamityMod.NPCs.NormalNPCs
|
||||
}
|
||||
}
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor)
|
||||
{
|
||||
Color col = Color.BlueViolet;
|
||||
Color flashCol = Color.LightSkyBlue;
|
||||
|
||||
NPC.localAI[1]++;
|
||||
|
||||
float alph = 0.4f + (float)(Math.Sin(NPC.localAI[1] / 30f) * 0.4f);
|
||||
|
||||
Asset<Texture2D> tex = ModContent.Request<Texture2D>(Texture);
|
||||
Asset<Texture2D> tex2 = ModContent.Request<Texture2D>("CalamityMod/NPCs/NormalNPCs/KingSlimeJewelFlash");
|
||||
|
||||
Main.EntitySpriteDraw(tex.Value, NPC.Center - Main.screenPosition, tex.Frame(), Color.White, NPC.rotation, tex.Frame().Center(), 1f, SpriteEffects.None);
|
||||
Main.EntitySpriteDraw(tex2.Value, NPC.Center - Main.screenPosition, tex2.Frame(), Color.Lerp(col, flashCol, alph).MultiplyRGBA(new Color(alph, alph, alph, 0f)), NPC.rotation, tex2.Frame().Center(), alph * 1.2f, SpriteEffects.None);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override Color? GetAlpha(Color drawColor)
|
||||
{
|
||||
Color initialColor = new Color(100, 100, 175);
|
||||
@@ -202,6 +221,22 @@ namespace CalamityMod.NPCs.NormalNPCs
|
||||
NPC.lifeMax = (int)(NPC.lifeMax * balance);
|
||||
}
|
||||
|
||||
public override void OnKill()
|
||||
{
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
GeneralParticleHandler.SpawnParticle(new PointParticle(NPC.Center, new Vector2(Main.rand.NextFloat(20), 0).RotatedByRandom(MathHelper.TwoPi), false, 10, Main.rand.NextFloat(0.5f, 1.5f), Color.BlueViolet));
|
||||
GeneralParticleHandler.SpawnParticle(new PointParticle(NPC.Center, new Vector2(Main.rand.NextFloat(10), 0).RotatedByRandom(MathHelper.TwoPi), false, 10, Main.rand.NextFloat(0.5f, 1.5f), Color.LightSkyBlue));
|
||||
}
|
||||
|
||||
float start = Main.rand.NextFloat(MathHelper.TwoPi);
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
GeneralParticleHandler.SpawnParticle(new CustomSprite(NPC.Center, new Vector2(0, -2).RotatedByRandom(start + MathHelper.ToRadians(20f)).RotatedBy(MathHelper.ToRadians(i * 125)), 120, "CalamityMod/Particles/KingSlimeSapphireShards", 1f, new Color(255, 255, 255), Main.rand.NextFloat(0.2f, 0.6f), frameCount: 3, frame: i));
|
||||
}
|
||||
SoundEngine.PlaySound(KingSlimeJewelRuby.ShatterSound, NPC.Center);
|
||||
}
|
||||
|
||||
public override bool CheckActive() => false;
|
||||
|
||||
public override void HitEffect(NPC.HitInfo hit)
|
||||
|
||||
|
After Width: | Height: | Size: 516 B |
@@ -0,0 +1,83 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
using static CalamityMod.Projectiles.Rogue.FinalDawnFlame;
|
||||
|
||||
namespace CalamityMod.Particles
|
||||
{
|
||||
public class CustomSprite : Particle
|
||||
{
|
||||
bool addBlend = false;
|
||||
bool important = false;
|
||||
bool AffectedByGravity = false;
|
||||
|
||||
string Tex = "";
|
||||
int frames = 1;
|
||||
int currentFrame = 0;
|
||||
|
||||
int Timer = 0;
|
||||
|
||||
float maxGravity = 0f;
|
||||
|
||||
public override bool SetLifetime => true;
|
||||
public override bool UseCustomDraw => true;
|
||||
public override bool UseAdditiveBlend => false;
|
||||
public override bool Important => important;
|
||||
public override string Texture => "CalamityMod/Particles/CuteStars";
|
||||
public override int FrameVariants => frames;
|
||||
|
||||
public CustomSprite(Vector2 relativePosition, Vector2 velocity, int lifetime, string tex, float scale, Color color, float grav = 0f, bool AddativeBlend = true, bool needed = false, int frameCount = 0, int frame = 0)
|
||||
{
|
||||
maxGravity = grav;
|
||||
Position = relativePosition;
|
||||
Velocity = velocity;
|
||||
Scale = scale;
|
||||
Lifetime = lifetime;
|
||||
addBlend = AddativeBlend;
|
||||
important = needed;
|
||||
Color = color;
|
||||
Tex = tex;
|
||||
frames = frameCount;
|
||||
currentFrame = frame;
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
|
||||
Position += Velocity;
|
||||
|
||||
if (addBlend) Color.A = 0;
|
||||
else Color.A = 255;
|
||||
|
||||
Timer++;
|
||||
|
||||
if (Timer > Lifetime - 20)
|
||||
{
|
||||
Scale *= 0.9f;
|
||||
}
|
||||
|
||||
Velocity *= 0.85f;
|
||||
if (maxGravity != 0f)
|
||||
{
|
||||
if (Velocity.Length() < maxGravity)
|
||||
{
|
||||
Velocity.X *= 0.94f;
|
||||
Velocity.Y += maxGravity / 10f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void CustomDraw(SpriteBatch spriteBatch)
|
||||
{
|
||||
Asset<Texture2D> tex = ModContent.Request<Texture2D>(Tex);
|
||||
|
||||
Rectangle fr = tex.Frame(1, frames, 0, currentFrame);
|
||||
|
||||
Main.EntitySpriteDraw(tex.Value, Position - Main.screenPosition, fr, Color.White, Rotation, new Vector2(tex.Width() / 2, tex.Height() / frames / 2), Scale, SpriteEffects.None);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 361 B |
|
After Width: | Height: | Size: 366 B |
|
After Width: | Height: | Size: 361 B |