Backlog of other changes, too many to list

This commit is contained in:
Xhack committed 2024-08-05 03:28:38 -04:00
1 parent 90c64c12af
commit d43d871408
11 files changed
+267 -107

No files matched your search

+62 -36
View File
@@ -17,15 +17,19 @@ using CalamityMod.NPCs.NormalNPCs;
using CalamityMod.NPCs.OldDuke;
using CalamityMod.NPCs.SulphurousSea;
using CalamityMod.NPCs.SunkenSea;
using CalamityMod.Particles;
using CalamityMod.Projectiles.Boss;
using CalamityMod.Projectiles.Enemy;
using CalamityMod.Rarities;
using CalamityMod.Sounds;
using CalamityMod.Systems;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
using static tModPorter.ProgressUpdate;
namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs
{
@@ -58,6 +62,9 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs
bool phase3 = lifeRatio <= (death ? 0.5f : (revenge ? 0.35f : 0.2f)) && expertMode;
bool phase2AI = npc.ai[0] > 4f;
bool phase3AI = npc.ai[0] > 9f;
int phase = (npc.ModNPC as OldDuke.OldDuke).Phase;
bool charging = npc.ai[3] < 10f;
float pie = (float)Math.PI;
@@ -538,6 +545,8 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs
npc.velocity = Vector2.Normalize(distanceVector) * chargeVelocity;
npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X);
DoChargeBurst(npc, 0);
// Direction
if (dukeLookAt != 0)
{
@@ -625,17 +634,14 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs
}
// Spawn dust
int chargeDustAmt = 7;
for (int j = 0; j < chargeDustAmt; j++)
{
Vector2 arg_E1C_0 = (Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((j - (chargeDustAmt / 2 - 1)) * pie / chargeDustAmt) + npc.Center;
Vector2 vector4 = ((float)(Main.rand.NextDouble() * pie) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8);
int chargeDust = Dust.NewDust(arg_E1C_0 + vector4, 0, 0, (int)CalamityDusts.SulphurousSeaAcid, vector4.X * 2f, vector4.Y * 2f, 100, default, 1.4f);
Main.dust[chargeDust].noGravity = true;
Main.dust[chargeDust].noLight = true;
Main.dust[chargeDust].velocity /= 4f;
Main.dust[chargeDust].velocity -= npc.velocity;
}
Vector2 vel = npc.velocity;
vel.Normalize();
vel *= 55;
DoChargeVisual(npc, phase);
GeneralParticleHandler.SpawnParticle(new SparkParticle(npc.Center + vel + vel.RotatedBy(MathHelper.ToRadians(90)), vel / 7, false, 20, 0.75f, new Color(155, 155, 155, 55), true));
GeneralParticleHandler.SpawnParticle(new SparkParticle(npc.Center + vel + vel.RotatedBy(MathHelper.ToRadians(-90)), vel / 7, false, 20, 0.75f, new Color(155, 155, 155, 55), true));
npc.ai[2] += 1f;
if (npc.ai[2] >= chargeTime)
@@ -910,6 +916,8 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs
npc.spriteDirection = -npc.direction;
}
DoChargeBurst(npc, 1);
}
// Set velocity for spin
@@ -1000,18 +1008,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs
npc.velocity *= 1.01f;
}
// Spawn dust
int phase2ChargeDustAmt = 7;
for (int k = 0; k < phase2ChargeDustAmt; k++)
{
Vector2 arg_1A97_0 = (Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((k - (phase2ChargeDustAmt / 2 - 1)) * pie / phase2ChargeDustAmt) + npc.Center;
Vector2 vector9 = ((float)(Main.rand.NextDouble() * pie) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8);
int phase2ChargeDust = Dust.NewDust(arg_1A97_0 + vector9, 0, 0, (int)CalamityDusts.SulphurousSeaAcid, vector9.X * 2f, vector9.Y * 2f, 100, default, 1.4f);
Main.dust[phase2ChargeDust].noGravity = true;
Main.dust[phase2ChargeDust].noLight = true;
Main.dust[phase2ChargeDust].velocity /= 4f;
Main.dust[phase2ChargeDust].velocity -= npc.velocity;
}
DoChargeVisual(npc, phase);
npc.ai[2] += 1f;
if (npc.ai[2] >= chargeTime)
@@ -1313,6 +1310,8 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs
npc.spriteDirection = -npc.direction;
}
DoChargeBurst(npc, 2);
}
// Pause
@@ -1403,18 +1402,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs
npc.velocity *= 1.01f;
}
// Spawn dust
int phase3ChargeDustAmt = 7;
for (int m = 0; m < phase3ChargeDustAmt; m++)
{
Vector2 arg_2444_0 = (Vector2.Normalize(npc.velocity) * new Vector2((npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((m - (phase3ChargeDustAmt / 2 - 1)) * pie / phase3ChargeDustAmt) + npc.Center;
Vector2 vector11 = ((float)(Main.rand.NextDouble() * pie) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8);
int phase3ChargeDust = Dust.NewDust(arg_2444_0 + vector11, 0, 0, (int)CalamityDusts.SulphurousSeaAcid, vector11.X * 2f, vector11.Y * 2f, 100, default, 1.4f);
Main.dust[phase3ChargeDust].noGravity = true;
Main.dust[phase3ChargeDust].noLight = true;
Main.dust[phase3ChargeDust].velocity /= 4f;
Main.dust[phase3ChargeDust].velocity -= npc.velocity;
}
DoChargeVisual(npc, phase);
npc.ai[2] += 1f;
if (npc.ai[2] >= chargeTime)
@@ -1451,7 +1439,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs
if (npc.ai[2] == teleportPauseTimer / 2)
modNPC.RoarSoundSlot = SoundEngine.PlaySound(OldDuke.OldDuke.RoarSound, npc.Center);
if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == teleportPauseTimer / 2)
if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == teleportPauseTimer - 1f)
{
// Teleport location
if (npc.ai[1] == 0f)
@@ -1653,5 +1641,43 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs
roarSound.Position = npc.Center;
}
}
static Color FireGreen = new Color(155, 255, 55);
static void DoChargeBurst(NPC npc, int phase)
{
SoundEngine.PlaySound(SoundID.DD2_BetsyFireballImpact.WithPitchOffset(-0.5f), npc.Center);
if (phase > 0) SoundEngine.PlaySound(SoundID.DD2_BetsyFireballShot, npc.Center);
if (phase > 0)
{
GeneralParticleHandler.SpawnParticle(new CustomPulse(npc.Center, -npc.velocity / 3, FireGreen, "CalamityMod/Particles/DustyCircleHardEdge", new Vector2(0.4f, 1.2f), Vector2.Zero.AngleTo(npc.velocity) + (Main.rand.NextBool() ? 0 : -MathHelper.Pi), 0.05f, 0.2f, 20));
if (phase > 1)
GeneralParticleHandler.SpawnParticle(new CustomPulse(npc.Center, -npc.velocity / 2, FireGreen, "CalamityMod/Particles/FlameExplosion", new Vector2(0.4f, 1.2f), Vector2.Zero.AngleTo(npc.velocity) + (Main.rand.NextBool() ? 0 : -MathHelper.Pi), 0.1f, 0.4f, 20));
}
if (phase > 0)
{
for (int i = 0; i < 30; i++)
{
float fl = Main.rand.NextFloat(-60, 60);
GeneralParticleHandler.SpawnParticle(new SparkParticle(npc.Center + (Vector2.Zero.DirectionTo(npc.velocity) * 20) + new Vector2(0, fl).RotatedBy(Vector2.Zero.AngleTo(npc.velocity)), (-npc.velocity * Main.rand.NextFloat(2f)).RotatedBy(MathHelper.ToRadians(fl)), false, 25, Main.rand.NextFloat(0.3f, 1.2f), FireGreen));
}
}
}
static void DoChargeVisual(NPC npc, int phase)
{
float progress = npc.ai[2];
int chargeTime = 36;
Color col = Color.Lerp(FireGreen, new Color(55, 55, 55, 55), progress / chargeTime);
if (Math.Floor(VisualTimerSystem.GlobalVisualTimer % 6f) < 1f)
GeneralParticleHandler.SpawnParticle(new CustomPulse(npc.Center, npc.velocity / 3, col, "CalamityMod/Particles/DustyCircleHardEdge", new Vector2(0.4f, 1f), Vector2.Zero.AngleTo(npc.velocity) + (Main.rand.NextBool() ? 0 : -MathHelper.Pi), 0.04f, 0.1f, 20));
if (Main.rand.NextBool())
GeneralParticleHandler.SpawnParticle(new CustomSpark(npc.Center - (npc.velocity * 2), npc.velocity / 2, "CalamityMod/Particles/ForwardSmear", false, 10, Main.rand.NextFloat(0.3f, 0.5f), col, new Vector2(1f, Main.rand.NextFloat(1.45f, 1.6f)), fadeIn: true, extraRotation: MathHelper.ToRadians(180f)));
}
}
}
+48 -14
View File
@@ -19,6 +19,8 @@ using CalamityMod.Items.Weapons.Rogue;
using CalamityMod.Items.Weapons.Summon;
using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs;
using CalamityMod.NPCs.TownNPCs;
using CalamityMod.Particles;
using CalamityMod.Systems;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
@@ -37,6 +39,11 @@ namespace CalamityMod.NPCs.OldDuke
[AutoloadBossHead]
public class OldDuke : ModNPC
{
public static Color GlowColor = new Color(55, 255, 25, 0);
public int Phase = 0;
public float NuclearOverlayVisual = 0f;
public static readonly SoundStyle HuffSound = new("CalamityMod/Sounds/Custom/OldDukeHuff");
public static readonly SoundStyle RoarSound = new("CalamityMod/Sounds/Custom/OldDukeRoar");
public static readonly SoundStyle VomitSound = new("CalamityMod/Sounds/Custom/OldDukeVomit");
@@ -123,6 +130,29 @@ namespace CalamityMod.NPCs.OldDuke
public override void AI()
{
float lifeRatio = NPC.life / (float)NPC.lifeMax;
bool bossRush = BossRushEvent.BossRushActive;
bool expertMode = Main.expertMode || bossRush;
bool revenge = CalamityWorld.revenge || bossRush;
bool death = CalamityWorld.death || bossRush;
bool phase2 = lifeRatio <= (death ? 0.8f : revenge ? 0.7f : 0.5f);
bool phase3 = lifeRatio <= (death ? 0.5f : (revenge ? 0.35f : 0.2f)) && expertMode;
if (phase3) Phase = 2;
else if (phase2) Phase = 1;
else Phase = 0;
if (Phase == 2 && NPC.Calamity().newAI[1] != 1)
{
NuclearOverlayVisual = MathHelper.Lerp(NuclearOverlayVisual, 1f, 0.2f);
}
else
{
NuclearOverlayVisual = MathHelper.Lerp(NuclearOverlayVisual, 0f, 0.05f);
}
OldDukeAI.VanillaOldDukeAI(NPC, Mod);
}
@@ -210,6 +240,12 @@ namespace CalamityMod.NPCs.OldDuke
public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor)
{
Color finalDrawColor = Color.Lerp(drawColor, Color.White, NuclearOverlayVisual);
Color overlayDrawColor = Color.Lerp(Color.Transparent, Color.LimeGreen.MultiplyRGBA(new Color(255, 255, 255, 0)), NuclearOverlayVisual);
finalDrawColor = Color.Lerp(finalDrawColor, Color.Transparent, (float)NPC.alpha / 255f);
overlayDrawColor = Color.Lerp(overlayDrawColor, Color.Transparent, (float)NPC.alpha / 255f);
SpriteEffects spriteEffects = SpriteEffects.None;
if (NPC.spriteDirection == 1)
{
@@ -265,6 +301,7 @@ namespace CalamityMod.NPCs.OldDuke
{
Color afterimageColor = color;
afterimageColor = Color.Lerp(afterimageColor, drawLerpColor, drawLerpValue);
afterimageColor = Color.Lerp(afterimageColor, overlayDrawColor, NuclearOverlayVisual);
afterimageColor = NPC.GetAlpha(afterimageColor);
afterimageColor *= (afterimageAmt - i) / 15f;
Vector2 afterimagePos = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - screenPos;
@@ -314,10 +351,7 @@ namespace CalamityMod.NPCs.OldDuke
{
for (int j = 0; j < secondAfterimageAmt; j++)
{
Color secondAfterimageColor = drawColor;
secondAfterimageColor = Color.Lerp(secondAfterimageColor, drawLerpColor, drawLerpValue);
secondAfterimageColor = NPC.GetAlpha(secondAfterimageColor);
secondAfterimageColor *= 1f - afterimageOpacity;
Color secondAfterimageColor = Color.Lerp(finalDrawColor, Color.Transparent, (float)j / (float)secondAfterimageAmt);
Vector2 secondAfterimagePos = NPC.Center + (j / (float)secondAfterimageAmt * MathHelper.TwoPi + NPC.rotation).ToRotationVector2() * afterimageScale * afterimageOpacity - screenPos;
secondAfterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f;
secondAfterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY);
@@ -325,13 +359,19 @@ namespace CalamityMod.NPCs.OldDuke
}
}
Color finalDrawColor = drawColor;
finalDrawColor = Color.Lerp(finalDrawColor, drawLerpColor, drawLerpValue);
finalDrawColor = NPC.GetAlpha(finalDrawColor);
Vector2 drawLocation = NPC.Center - screenPos;
drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f;
drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, (NPC.ai[0] > 9f ? finalDrawColor : NPC.GetAlpha(drawColor)), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(finalDrawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(overlayDrawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
float auraOutset = 6f + (float)(Math.Sin(VisualTimerSystem.GlobalVisualTimer / 10f) * 10f);
for (float i = 0; i < 360; i+=90)
{
spriteBatch.Draw(texture2D15, drawLocation + new Vector2(auraOutset, 0).RotatedBy(MathHelper.ToRadians(i)), NPC.frame, NPC.GetAlpha(overlayDrawColor.MultiplyRGBA(new Color(0.4f, 0.4f, 0.4f, 0.4f))), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
}
if (NPC.ai[0] >= 4f && NPC.Calamity().newAI[1] != 1f)
{
@@ -484,12 +524,6 @@ namespace CalamityMod.NPCs.OldDuke
{
if (NPC.life > 0)
{
int onHitDust = 0;
while (onHitDust < hit.Damage / NPC.lifeMax * 100.0)
{
Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulphurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f);
onHitDust++;
}
}
else
{
+38
View File
@@ -2,9 +2,12 @@
using CalamityMod.Buffs.StatDebuffs;
using CalamityMod.Dusts;
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.ID;
using Terraria.ModLoader;
@@ -167,6 +170,15 @@ namespace CalamityMod.NPCs.OldDuke
public override void OnKill()
{
for (int i = 0; i < 15; i++)
{
float sc = Main.rand.NextFloat(1f, 3f);
Vector2 vel = new Vector2(Main.rand.NextFloat(10, 25), 0).RotatedByRandom(MathHelper.TwoPi);
GeneralParticleHandler.SpawnParticle(new CustomSpark(NPC.Center, vel, "CalamityMod/Projectiles/Boss/OldDukeToothBallSpike", true, 40, sc + 0.5f, OldDuke.GlowColor, Vector2.One));
GeneralParticleHandler.SpawnParticle(new CustomSpark(NPC.Center, vel, "CalamityMod/Projectiles/Boss/OldDukeToothBallSpike", true, 40, sc, Color.White, Vector2.One, false, affectedByLight: true));
}
int closestPlayer = Player.FindClosest(NPC.Center, 1, 1);
if (Main.rand.NextBool(8) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2)
Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart);
@@ -220,6 +232,32 @@ namespace CalamityMod.NPCs.OldDuke
return true;
}
public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor)
{
float velDist = NPC.velocity.Length();
Vector2 vel = NPC.velocity;
vel.Normalize();
if (velDist > 5)
{
float sc = velDist - 5;
if (Main.rand.NextBool(3))
GeneralParticleHandler.SpawnParticle(new SparkParticle(NPC.Center + new Vector2(Main.rand.NextFloat(5, 30), 0).RotatedBy(Main.rand.NextFloat(MathHelper.TwoPi)), NPC.velocity, false, 20, Main.rand.NextFloat(0.5f, 1.5f), OldDuke.GlowColor, true));
}
if (Main.rand.NextBool(3))
GeneralParticleHandler.SpawnParticle(new MediumMistParticle(NPC.Center, -(vel * 4f).RotatedBy(Main.rand.NextFloat(-MathHelper.PiOver4, MathHelper.PiOver4)), OldDuke.GlowColor, Color.DarkSlateGray, Main.rand.NextFloat(0.5f, 1.5f), 150f));
Asset<Texture2D> tex = ModContent.Request<Texture2D>(Texture);
for (int i = 0; i < 360; i += 90)
{
Main.EntitySpriteDraw(tex.Value, NPC.Center + new Vector2(0, 4) - Main.screenPosition + new Vector2(4,0).RotatedBy(MathHelper.ToRadians(i)), tex.Frame(), OldDuke.GlowColor, NPC.rotation, tex.Frame().Center(), NPC.scale, SpriteEffects.None);
}
return base.PreDraw(spriteBatch, screenPos, drawColor);
}
public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo)
{
if (hurtInfo.Damage > 0)
+1
View File
@@ -251,6 +251,7 @@ namespace CalamityMod.NPCs.OldDuke
afterimageColor = Color.Lerp(afterimageColor, Color.Lime, 0.5f);
afterimageColor = NPC.GetAlpha(afterimageColor);
afterimageColor *= (afterimageAmt - i) / 15f;
afterimageColor.A = 0;
Vector2 afterimagePos = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - screenPos;
afterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f;
afterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY);
Binary file not shown.

After

Width:  |  Height:  |  Size: 114 KiB

+10 -1
View File
@@ -1,6 +1,10 @@
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Buffs.StatDebuffs;
using CalamityMod.NPCs.OldDuke;
using CalamityMod.Particles;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
@@ -34,6 +38,9 @@ namespace CalamityMod.Projectiles.Boss
{
Projectile.velocity.Y += 0.15f;
}
if (Main.rand.NextBool(3))
GeneralParticleHandler.SpawnParticle(new MediumMistParticle(Projectile.Center, -(Projectile.velocity / 4f).RotatedBy(Main.rand.NextFloat(-MathHelper.PiOver4, MathHelper.PiOver4)), OldDuke.GlowColor, Color.DarkSlateGray, Main.rand.NextFloat(0.5f, 1.5f), 150f));
}
public override bool OnTileCollide(Vector2 oldVelocity)
{
@@ -75,7 +82,9 @@ namespace CalamityMod.Projectiles.Boss
public override bool PreDraw(ref Color lightColor)
{
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], new Color(255, 255, 255, 127), 2);
Asset<Texture2D> tex = ModContent.Request<Texture2D>(Texture);
Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition, tex.Frame(), Color.White, Projectile.rotation, tex.Frame().Bottom(), new Vector2(1f, 1f / tex.Height() * (Projectile.velocity.Length() * 3 + 6)), SpriteEffects.None);
return false;
}
}
+20
View File
@@ -1,6 +1,9 @@
using CalamityMod.Buffs.StatDebuffs;
using CalamityMod.Dusts;
using CalamityMod.NPCs.OldDuke;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
@@ -38,6 +41,23 @@ namespace CalamityMod.Projectiles.Boss
}
}
public override bool PreDraw(ref Color lightColor)
{
// There are two of each draw call because it makes the additive glow a bit brighter
Asset<Texture2D> tex = ModContent.Request<Texture2D>(Texture);
for (int i = 0; i < 5; i++)
{
Main.EntitySpriteDraw(tex.Value, Projectile.Center - (Projectile.velocity * i) - Main.screenPosition, tex.Frame(), OldDuke.GlowColor, Projectile.rotation, tex.Frame().Center(), MathHelper.Lerp(1.5f, 0.2f, (float)i / 5f), SpriteEffects.None);
Main.EntitySpriteDraw(tex.Value, Projectile.Center - (Projectile.velocity * i) - Main.screenPosition, tex.Frame(), OldDuke.GlowColor, Projectile.rotation, tex.Frame().Center(), MathHelper.Lerp(1.5f, 0.2f, (float)i / 5f), SpriteEffects.None);
}
Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition, tex.Frame(), OldDuke.GlowColor, Projectile.rotation, tex.Frame().Center(), 1.5f, SpriteEffects.None);
Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition, tex.Frame(), OldDuke.GlowColor, Projectile.rotation, tex.Frame().Center(), 1.5f, SpriteEffects.None);
Projectile.DrawBackglow(OldDuke.GlowColor, 4f);
return base.PreDraw(ref lightColor);
}
public override void OnHitPlayer(Player target, Player.HurtInfo info)
{
if (info.Damage <= 0)
+39 -49
View File
@@ -1,8 +1,13 @@
using System;
using System.Collections.Generic;
using CalamityMod.Buffs.StatDebuffs;
using CalamityMod.Dusts;
using CalamityMod.Particles;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using ReLogic.Utilities;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
@@ -13,22 +18,26 @@ namespace CalamityMod.Projectiles.Boss
public class OldDukeVortex : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Boss";
public static readonly SoundStyle SpawnSound = new("CalamityMod/Sounds/Custom/OldDukeVortex");
public SoundStyle SpawnSound = new("CalamityMod/Sounds/Custom/OldDukeVortex");
public SlotId SoundId;
public override void SetStaticDefaults()
{
SpawnSound.MaxInstances = 50;
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6;
ProjectileID.Sets.TrailingMode[Projectile.type] = 0;
}
public override void SetDefaults()
{
SoundId = SoundEngine.PlaySound(SpawnSound with { IsLooped = true, MaxInstances = 20 }, Projectile.Center, _ => new ProjectileAudioTracker(Projectile).IsActiveAndInGame());
Projectile.Calamity().DealsDefenseDamage = true;
Projectile.width = 408;
Projectile.height = 408;
Projectile.scale = 0.004f;
Projectile.hostile = true;
Projectile.alpha = 255;
Projectile.alpha = 0;
Projectile.penetrate = -1;
Projectile.tileCollide = false;
Projectile.ignoreWater = true;
@@ -56,7 +65,7 @@ namespace CalamityMod.Projectiles.Boss
if (Projectile.alpha < 255)
Projectile.alpha += 3;
Projectile.scale += 0.012f;
Projectile.scale -= 0.012f;
}
}
}
@@ -80,7 +89,7 @@ namespace CalamityMod.Projectiles.Boss
if (Projectile.alpha < 255)
Projectile.alpha += 3;
Projectile.scale += 0.012f;
Projectile.scale -= 0.012f;
Projectile.width = Projectile.height = (int)(408f * Projectile.scale);
}
else
@@ -88,6 +97,10 @@ namespace CalamityMod.Projectiles.Boss
}
}
if (Projectile.timeLeft <= 85)
{
Projectile.localAI[2] += 1f / 85f;
}
Projectile.velocity = Vector2.Normalize(new Vector2(Projectile.ai[0], Projectile.ai[1]) - Projectile.Center) * 1.5f;
Projectile.rotation -= 0.1f * (float)(1D - (Projectile.alpha / 255D));
@@ -95,62 +108,39 @@ namespace CalamityMod.Projectiles.Boss
float lightAmt = 2f * Projectile.scale;
Lighting.AddLight(Projectile.Center, lightAmt, lightAmt * 2f, lightAmt);
if (Projectile.soundDelay == 0)
float maxdist = 1200;
if (SoundEngine.TryGetActiveSound(SoundId, out var Sound) && Sound.IsPlaying)
{
Projectile.soundDelay = 174;
SoundEngine.PlaySound(SpawnSound, Projectile.Center);
Sound.Position = Projectile.Center;
Sound.Volume = Projectile.scale;
Sound.Pitch = MathHelper.Lerp(0f, -1f, (MathHelper.Clamp((Projectile.Distance(Main.LocalPlayer.Center) - 800) / maxdist, 0f, 1f) + (-Projectile.scale + 1)));
}
if (Projectile.timeLeft > 85)
{
int numDust = (int)(0.2f * MathHelper.TwoPi * 408f * Projectile.scale);
float angleIncrement = MathHelper.TwoPi / (float)numDust;
Vector2 dustOffset = new Vector2(408f * Projectile.scale, 0f);
dustOffset = dustOffset.RotatedByRandom(MathHelper.TwoPi);
Vector2 vec2 = Projectile.Center + new Vector2(Main.rand.NextFloat(320, 540) * Projectile.scale, 0).RotatedByRandom(MathHelper.TwoPi);
int var = (int)(408f * Projectile.scale);
for (int i = 0; i < numDust; i++)
{
if (Main.rand.NextBool(var))
{
dustOffset = dustOffset.RotatedBy(angleIncrement);
int dust = Dust.NewDust(Projectile.Center, 1, 1, (int)CalamityDusts.SulphurousSeaAcid);
Main.dust[dust].position = Projectile.Center + dustOffset;
Main.dust[dust].noGravity = true;
Main.dust[dust].velocity = Vector2.Normalize(Projectile.Center - Main.dust[dust].position) * 24f;
Main.dust[dust].scale = Projectile.scale * 3f;
}
}
float distanceRequired = 800f * Projectile.scale;
float succPower = Main.zenithWorld ? 1f : 0.5f;
foreach (Player player in Main.ActivePlayers)
{
float distance = Vector2.Distance(player.Center, Projectile.Center);
if (distance < distanceRequired && player.grappling[0] == -1)
{
if (Collision.CanHit(Projectile.Center, 1, 1, player.Center, 1, 1))
{
float distanceRatio = distance / distanceRequired;
float wingTimeSet = (float)Math.Ceiling((float)player.wingTimeMax * 0.5f * distanceRatio);
if (player.wingTime > wingTimeSet)
player.wingTime = wingTimeSet;
float multiplier = 1f - distanceRatio;
if (player.Center.X < Projectile.Center.X)
player.velocity.X += succPower * multiplier;
else
player.velocity.X -= succPower * multiplier;
}
}
}
GeneralParticleHandler.SpawnParticle(new SparkParticle(vec2, (Projectile.Center - vec2) / 20, false, 10, Main.rand.NextFloat(0.5f, 1f), Color.LimeGreen, true));
}
}
public override bool PreDraw(ref Color lightColor)
{
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1);
Asset<Texture2D> Tex = ModContent.Request<Texture2D>(Texture);
float sc = MathHelper.Lerp(1, 0, Projectile.localAI[2]);
float alphaLerp = MathHelper.Lerp(1f, 0f, (float)Projectile.alpha / 255f);
Main.EntitySpriteDraw(Tex.Value, Projectile.Center - Main.screenPosition, Tex.Frame(), new Color(0f, 0f, 0f, 0.4f).MultiplyRGBA(new Color(alphaLerp, alphaLerp, alphaLerp, alphaLerp)), -Projectile.rotation / 2 * (4 + 1), Tex.Frame().Center(), 1.61f * Projectile.scale * sc, SpriteEffects.None);
for (int i = 2; i >= 0; i--)
{
float lerp = (float)i / 3f;
Main.EntitySpriteDraw(Tex.Value, Projectile.Center - Main.screenPosition, Tex.Frame(), Color.Lerp(new Color(5, 155, 95, 100), new Color(255, 255, 255, 55), lerp).MultiplyRGBA(new Color(alphaLerp, alphaLerp, alphaLerp, alphaLerp)), -Projectile.rotation / 2 * (i + 1), Tex.Frame().Center(), MathHelper.Lerp(1f, 1.7f, lerp) * Projectile.scale * sc, SpriteEffects.None);
}
return false;
}
+13 -4
View File
@@ -1,5 +1,7 @@
using System;
using CalamityMod.Buffs.StatDebuffs;
using CalamityMod.NPCs.OldDuke;
using CalamityMod.Particles;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
@@ -32,6 +34,9 @@ namespace CalamityMod.Projectiles.Boss
public override void AI()
{
Projectile.spriteDirection = 1;
if (Projectile.Center.X < Main.LocalPlayer.Center.X) Projectile.spriteDirection = -1;
Lighting.AddLight(Projectile.Center, 0.1f, 0.7f, 0f);
Projectile.ai[0] += 1f;
@@ -43,6 +48,8 @@ namespace CalamityMod.Projectiles.Boss
}
if (Projectile.ai[0] < 1620f)
{
GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Projectile.Top + new Vector2(Main.rand.NextFloat(-12, 12), 0f), new Vector2(0, -Main.rand.NextFloat(2)), false, 20, Main.rand.NextFloat(0.5f, 1.2f), new Color(0, 255, 0)));
if (Projectile.frame >= 4)
{
Projectile.frame = 0;
@@ -67,10 +74,12 @@ namespace CalamityMod.Projectiles.Boss
public override bool PreDraw(ref Color lightColor)
{
lightColor.R = (byte)(255 * Projectile.Opacity);
lightColor.G = (byte)(255 * Projectile.Opacity);
lightColor.B = (byte)(255 * Projectile.Opacity);
CalamityUtils.DrawProjectileWithBackglow(Projectile, new Color(66, 236, 113), lightColor, 3.75f);
lightColor.R = (byte)(100 * Projectile.Opacity);
lightColor.G = (byte)(155 * Projectile.Opacity);
lightColor.B = (byte)(55 * Projectile.Opacity);
CalamityUtils.DrawProjectileWithBackglow(Projectile, new Color(10, 30, 13, 0), new Color(10, 30, 13, 0), 1.75f);
lightColor.A = 0;
CalamityUtils.DrawProjectileWithBackglow(Projectile, new Color(33, 236, 100, 0), Color.White, 1.75f);
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1);
return false;
}
+22
View File
@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Terraria.ModLoader;
namespace CalamityMod.Systems
{
public class VisualTimerSystem : ModSystem
{
/// <summary>
/// Dummy global variable that increments by one every frame. Good for animated visual effects. Not synced server side.
/// </summary>
public static float GlobalVisualTimer = 0f;
public override void PostUpdateEverything()
{
GlobalVisualTimer++;
}
}
}
+14 -3
View File
@@ -684,10 +684,14 @@ namespace CalamityMod
Vector2 drawPosition = projectile.Center - Main.screenPosition;
Vector2 origin = frame.Value.Size() * 0.5f;
Color backAfterimageColor = backglowColor * projectile.Opacity;
SpriteEffects spriteEffects = SpriteEffects.None;
if (projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally;
for (int i = 0; i < 10; i++)
{
Vector2 drawOffset = (MathHelper.TwoPi * i / 10f).ToRotationVector2() * backglowArea;
Main.spriteBatch.Draw(texture, drawPosition + drawOffset, frame, backAfterimageColor, projectile.rotation, origin, projectile.scale, 0, 0f);
Main.spriteBatch.Draw(texture, drawPosition + drawOffset, frame, backAfterimageColor, projectile.rotation, origin, projectile.scale, spriteEffects, 0f);
}
}
@@ -701,12 +705,16 @@ namespace CalamityMod
Vector2 drawPosition = projectile.Center - Main.screenPosition;
Vector2 origin = frame.Value.Size() * 0.5f;
Color backAfterimageColor = backglowColor * projectile.Opacity;
SpriteEffects spriteEffects = SpriteEffects.None;
if (projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally;
for (int i = 0; i < 10; i++)
{
Vector2 off = Vector2.Zero;
if (offset != null) off += offset.Value;
Vector2 drawOffset = (MathHelper.TwoPi * i / 10f).ToRotationVector2() * backglowArea;
Main.spriteBatch.Draw(texture, drawPosition + drawOffset + off, frame, backAfterimageColor, projectile.rotation, origin, scale, 0, 0f);
Main.spriteBatch.Draw(texture, drawPosition + drawOffset + off, frame, backAfterimageColor, projectile.rotation, origin, scale, spriteEffects, 0f);
}
}
@@ -720,8 +728,11 @@ namespace CalamityMod
Vector2 drawPosition = projectile.Center - Main.screenPosition;
Vector2 origin = frame.Value.Size() * 0.5f;
SpriteEffects spriteEffects = SpriteEffects.None;
if (projectile.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally;
projectile.DrawBackglow(backglowColor, backglowArea, texture, frame);
Main.spriteBatch.Draw(texture, drawPosition, frame, projectile.GetAlpha(lightColor), projectile.rotation, origin, projectile.scale, 0, 0f);
Main.spriteBatch.Draw(texture, drawPosition, frame, projectile.GetAlpha(lightColor), projectile.rotation, origin, projectile.scale, spriteEffects, 0f);
}
public static void DrawStarTrail(this Projectile projectile, Color outer, Color inner, float auraHeight = 10f)