1 - Many Foveanator changes.

2 - Many Slime God changes (can someone please fix the bestiary image, because I don't want to).
3 - Improved Profaned Guardian Commander and Defender charge a bit.
4 - Fixed Rev+ Destroyer not having a netMode check for the segment spawning.
5 - Fixed Retinazer projectile firing offsets and rotation rate.
This commit is contained in:
mountaindrew10 committed 2024-09-11 09:08:20 -05:00
1 parent 3cb5c96436
commit 4f8ff657fa
31 files changed
+1385 -863

No files matched your search

+3 -3
View File
@@ -643,9 +643,9 @@ namespace CalamityMod
{ new Tuple<int, int>(NPCID.Spazmatism, ProjectileID.EyeFire), new int[] { 60, 120, 148, 176, 264 } },
{ new Tuple<int, int>(NPCID.Spazmatism, ModContent.ProjectileType<Shadowflamethrower>()), new int[] { 70, 120, 148, 176, 264 } },
{ new Tuple<int, int>(NPCID.Spazmatism, ModContent.ProjectileType<ShadowflameFireball>()), new int[] { 60, 100, 128, 156, 234 } },
/*{ new Tuple<int, int>(ModContent.NPCType<Foveanator>(), ModContent.ProjectileType<FoveaLaser>()), new int[] { 50, 108, 132, 156, 234 } },
{ new Tuple<int, int>(ModContent.NPCType<Foveanator>(), ModContent.ProjectileType<FoveaEnergyBomb>()), new int[] { 70, 120, 148, 176, 264 } },
{ new Tuple<int, int>(ModContent.NPCType<Foveanator>(), ModContent.ProjectileType<FoveaFlamethrower>()), new int[] { 70, 120, 148, 176, 264 } },*/
{ new Tuple<int, int>(ModContent.NPCType<Foveanator>(), ModContent.ProjectileType<FoveanatorLaser>()), new int[] { 50, 108, 132, 156, 234 } },
{ new Tuple<int, int>(ModContent.NPCType<Foveanator>(), ModContent.ProjectileType<FoveanatorEnergyBomb>()), new int[] { 70, 120, 148, 176, 264 } },
//{ new Tuple<int, int>(ModContent.NPCType<Foveanator>(), ModContent.ProjectileType<FoveaFlamethrower>()), new int[] { 70, 120, 148, 176, 264 } },
{ new Tuple<int, int>(ModContent.NPCType<AquaticScourgeHead>(), ModContent.ProjectileType<SulphuricAcidMist>()), new int[] { 60, 100, 120, 140, 210 } },
{ new Tuple<int, int>(ModContent.NPCType<AquaticScourgeHead>(), ModContent.ProjectileType<SandPoisonCloud>()), new int[] { 70, 120, 136, 152, 228 } },
Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

@@ -64,6 +64,8 @@ FlareBomb.DisplayName: Flare Bomb
FlareDust.DisplayName: Flare Dust
FlareDust2.DisplayName: Flare Bomb
Flarenado.DisplayName: Flarenado
FoveanatorEnergyBomb.DisplayName: Nebulous Energy Bomb
FoveanatorLaser.DisplayName: Nebulous Laser
FrostMist.DisplayName: Frost Mist
GooglyEye.DisplayName: Googly Eye
GreatSandBlast.DisplayName: Great Sand Blast
+69 -40
View File
@@ -4,6 +4,7 @@ using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Buffs.StatDebuffs;
using CalamityMod.DataStructures;
using CalamityMod.Events;
using CalamityMod.NPCs.AstrumDeus;
using CalamityMod.Projectiles.Boss;
using CalamityMod.World;
using Microsoft.Xna.Framework;
@@ -27,6 +28,8 @@ namespace CalamityMod.NPCs.NormalNPCs
public static int phase1IconIndex;
public static int phase2IconIndex;
public static Asset<Texture2D> GlowTexture;
internal static void LoadHeadIcons()
{
string phase1IconPath = "CalamityMod/NPCs/NormalNPCs/Foveanator_Head_Boss";
@@ -44,6 +47,9 @@ namespace CalamityMod.NPCs.NormalNPCs
Main.npcFrameCount[NPC.type] = 6;
NPCID.Sets.NPCBestiaryDrawModifiers bestiaryData = new NPCID.Sets.NPCBestiaryDrawModifiers() { Hide = true };
NPCID.Sets.NPCBestiaryDrawOffset.Add(Type, bestiaryData);
if (!Main.dedServ)
GlowTexture = ModContent.Request<Texture2D>("CalamityMod/NPCs/NormalNPCs/FoveanatorGlow", AssetRequestMode.AsyncLoad);
}
public override void SetDefaults()
@@ -152,7 +158,7 @@ namespace CalamityMod.NPCs.NormalNPCs
hoverRotation -= MathHelper.TwoPi;
// Rotate faster during energy bomb and laser barrage
float rotationRate = NPC.ai[1] == 3f ? 0.25f : 0.1f;
float rotationRate = NPC.ai[1] == 3f ? 0.25f : 0.15f;
NPC.rotation = NPC.rotation.AngleTowards(hoverRotation, rotationRate);
if (Main.rand.NextBool(5))
@@ -308,13 +314,12 @@ namespace CalamityMod.NPCs.NormalNPCs
{
NPC.ai[3] = 0f;
SoundEngine.PlaySound(AstrumDeusHead.LaserSound, NPC.Center);
if (Main.netMode != NetmodeID.MultiplayerClient)
{
float laserSpeed = 12f;
laserSpeed += 4f * enrageScale;
// TODO - Change this to Foveanator's laser when it's implemented
int type = ProjectileID.EyeLaser;
float laserSpeed = 3f + 1.5f * enrageScale;
int type = ModContent.ProjectileType<FoveanatorLaser>();
int damage = NPC.GetProjectileDamage(type);
// Reduce mech boss projectile damage depending on the new ore progression changes
@@ -329,7 +334,7 @@ namespace CalamityMod.NPCs.NormalNPCs
}
Vector2 laserVelocity = (Main.player[NPC.target].Center - NPC.Center).SafeNormalize(Vector2.UnitY) * laserSpeed;
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + laserVelocity.SafeNormalize(Vector2.UnitY) * 150f, laserVelocity, type, damage, 0f, Main.myPlayer);
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + laserVelocity.SafeNormalize(Vector2.UnitY) * 60f, laserVelocity, type, damage, 0f, Main.myPlayer);
}
}
}
@@ -384,7 +389,7 @@ namespace CalamityMod.NPCs.NormalNPCs
if (NPC.velocity.Length() < maxVelocity)
{
NPC.velocity *= 1.025f;
NPC.velocity *= 1.04f;
if (NPC.velocity.Length() > maxVelocity)
{
NPC.velocity.Normalize();
@@ -458,13 +463,12 @@ namespace CalamityMod.NPCs.NormalNPCs
{
if (NPC.ai[1] % 10f == 0f)
{
SoundEngine.PlaySound(SoundID.Item33, NPC.Center);
SoundEngine.PlaySound(AstrumDeusHead.LaserSound, NPC.Center);
if (Main.netMode != NetmodeID.MultiplayerClient)
{
bool shootLaser = NPC.ai[1] % 20f == 0f;
// TODO - Change this to Foveanator's lasers and energy bombs when they're implemented
int type = shootLaser ? ProjectileID.DeathLaser : ModContent.ProjectileType<HomingLaserDart>();
int type = shootLaser ? ModContent.ProjectileType<FoveanatorLaser>() : ModContent.ProjectileType<FoveanatorEnergyBomb>();
int damage = NPC.GetProjectileDamage(type);
// Reduce mech boss projectile damage depending on the new ore progression changes
@@ -478,15 +482,15 @@ namespace CalamityMod.NPCs.NormalNPCs
damage = (int)(damage * secondMechMultiplier);
}
Vector2 projectileVelocity = (Main.player[NPC.target].Center - NPC.Center).SafeNormalize(Vector2.UnitY) * 7f;
float projectileSpeed = shootLaser ? (3f + 1.5f * enrageScale) : 16f;
Vector2 projectileVelocity = (Main.player[NPC.target].Center - NPC.Center).SafeNormalize(Vector2.UnitY) * projectileSpeed;
int numProj = shootLaser ? 4 : 2;
int spread = shootLaser ? 15 : 30;
float rotation = MathHelper.ToRadians(spread);
float offset = shootLaser ? 150f : 100f;
for (int i = 0; i < numProj; i++)
{
Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1)));
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * offset, perturbedSpeed, type, damage, 0f, Main.myPlayer);
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 60f, perturbedSpeed, type, damage, 0f, Main.myPlayer);
}
}
}
@@ -614,8 +618,7 @@ namespace CalamityMod.NPCs.NormalNPCs
{
NPC.localAI[1] = 0f;
float foveanatorFlamethrowerSpeed = 4f;
foveanatorFlamethrowerSpeed += 2f * enrageScale;
float foveanatorFlamethrowerSpeed = 4f + 2f * enrageScale;
float timeForFlamethrowerToReachMaxVelocity = 60f;
float flamethrowerSpeedScalar = MathHelper.Clamp(NPC.ai[2] / timeForFlamethrowerToReachMaxVelocity, 0f, 1f);
foveanatorFlamethrowerSpeed = MathHelper.Lerp(0.1f, foveanatorFlamethrowerSpeed, flamethrowerSpeedScalar);
@@ -640,7 +643,7 @@ namespace CalamityMod.NPCs.NormalNPCs
if (NPC.IsMechQueenUp)
flamethrowerVelocity = (NPC.rotation + MathHelper.PiOver2).ToRotationVector2() * foveanatorFlamethrowerSpeed + NPC.velocity * 0.5f;
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + flamethrowerVelocity.SafeNormalize(Vector2.UnitY) * 25f, flamethrowerVelocity, type, damage, 0f, Main.myPlayer);
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + flamethrowerVelocity.SafeNormalize(Vector2.UnitY) * 40f, flamethrowerVelocity, type, damage, 0f, Main.myPlayer);
}
}
}
@@ -668,7 +671,8 @@ namespace CalamityMod.NPCs.NormalNPCs
NPC.damage = setDamage;
// Play charge sound
SoundEngine.PlaySound(SoundID.ForceRoar, NPC.Center);
// TODO - Make this a jet turbine sound or something
//SoundEngine.PlaySound(SoundID.ForceRoar, NPC.Center);
// Set rotation and velocity
NPC.rotation = hoverRotation;
@@ -689,7 +693,7 @@ namespace CalamityMod.NPCs.NormalNPCs
// Set damage
NPC.damage = setDamage;
NPC.ai[2] += (retAlive || spazAlive) ? 1f : 1.25f;
NPC.ai[2] += 1f;
float chargeTime = 60f - (death ? 20f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f);
@@ -710,7 +714,6 @@ namespace CalamityMod.NPCs.NormalNPCs
else
{
// Accelerative charge
// TODO - Make the charge leave behind energy bomb projectiles when the projectiles are done
float maxVelocity = 27f;
maxVelocity += 6f * enrageScale;
if (death)
@@ -718,9 +721,34 @@ namespace CalamityMod.NPCs.NormalNPCs
if (Main.getGoodWorld)
maxVelocity *= 1.2f;
// Spawn Energy Bombs along the way
float energyBombFireRate = 8f;
if (NPC.ai[2] % energyBombFireRate == 0f)
{
SoundEngine.PlaySound(AstrumDeusHead.LaserSound, NPC.Center);
if (Main.netMode != NetmodeID.MultiplayerClient)
{
int type = ModContent.ProjectileType<FoveanatorEnergyBomb>();
int damage = NPC.GetProjectileDamage(type);
// Reduce mech boss projectile damage depending on the new ore progression changes
if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive)
{
double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert;
double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert;
if (!NPC.downedMechBossAny)
damage = (int)(damage * firstMechMultiplier);
else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1))
damage = (int)(damage * secondMechMultiplier);
}
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + NPC.velocity.SafeNormalize(Vector2.UnitY) * 60f, Vector2.Zero, type, damage, 0f, Main.myPlayer);
}
}
if (NPC.velocity.Length() < maxVelocity)
{
NPC.velocity *= 1.05f;
NPC.velocity *= 1.06f;
if (NPC.velocity.Length() > maxVelocity)
{
NPC.velocity.Normalize();
@@ -785,15 +813,15 @@ namespace CalamityMod.NPCs.NormalNPCs
float laserBarrageFireRate = 45f;
float energyBombFireRate = 90f;
// Laser barrages
NPC.ai[2] += 1f;
if (NPC.ai[2] % laserBarrageFireRate == 0f)
// Energy bombs
if (NPC.ai[2] % energyBombFireRate == 0f)
{
SoundEngine.PlaySound(SoundID.Item33, NPC.Center);
SoundEngine.PlaySound(AstrumDeusHead.LaserSound, NPC.Center);
if (Main.netMode != NetmodeID.MultiplayerClient)
{
// TODO - Change this to Foveanator's laser when it's made
int type = ProjectileID.DeathLaser;
int type = ModContent.ProjectileType<FoveanatorEnergyBomb>();
int damage = NPC.GetProjectileDamage(type);
// Reduce mech boss projectile damage depending on the new ore progression changes
@@ -807,28 +835,26 @@ namespace CalamityMod.NPCs.NormalNPCs
damage = (int)(damage * secondMechMultiplier);
}
Vector2 projectileVelocity = (Main.player[NPC.target].Center - NPC.Center).SafeNormalize(Vector2.UnitY) * 12f;
int numProj = 4;
int spread = 40;
Vector2 projectileVelocity = (Main.player[NPC.target].Center - NPC.Center).SafeNormalize(Vector2.UnitY) * 16f;
int numProj = 3;
int spread = 30;
float rotation = MathHelper.ToRadians(spread);
for (int i = 0; i < numProj; i++)
{
Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1)));
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 50f, perturbedSpeed, type, damage, 0f, Main.myPlayer);
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 60f, perturbedSpeed, type, damage, 0f, Main.myPlayer);
}
}
NPC.ai[3] += 1f;
}
// Energy bombs
else if (NPC.ai[2] % energyBombFireRate == 0f)
else if (NPC.ai[2] % laserBarrageFireRate == 0f)
{
SoundEngine.PlaySound(SoundID.Item33, NPC.Center);
SoundEngine.PlaySound(AstrumDeusHead.LaserSound, NPC.Center);
if (Main.netMode != NetmodeID.MultiplayerClient)
{
// TODO - Change this to Foveanator's energy bomb when it's made
int type = ModContent.ProjectileType<HomingLaserDart>();
int type = ModContent.ProjectileType<FoveanatorLaser>();
int damage = NPC.GetProjectileDamage(type);
// Reduce mech boss projectile damage depending on the new ore progression changes
@@ -842,15 +868,15 @@ namespace CalamityMod.NPCs.NormalNPCs
damage = (int)(damage * secondMechMultiplier);
}
Vector2 projectileVelocity = (Main.player[NPC.target].Center - NPC.Center).SafeNormalize(Vector2.UnitY) * 6f;
int numProj = 3;
int spread = 30;
float projectileSpeed = 4f + 2f * enrageScale;
Vector2 projectileVelocity = (Main.player[NPC.target].Center - NPC.Center).SafeNormalize(Vector2.UnitY) * projectileSpeed;
int numProj = 4;
int spread = 40;
float rotation = MathHelper.ToRadians(spread);
float offset = 50f;
for (int i = 0; i < numProj; i++)
{
Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1)));
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * offset, perturbedSpeed, type, damage, 0f, Main.myPlayer);
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 60f, perturbedSpeed, type, damage, 0f, Main.myPlayer);
}
}
@@ -886,6 +912,9 @@ namespace CalamityMod.NPCs.NormalNPCs
spriteBatch.Draw(TextureAssets.Npc[NPC.type].Value, NPC.Center - screenPos + new Vector2(0f, NPC.gfxOffY), NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, NPC.frame.Size() / 2, NPC.scale, spriteEffects, 0f);
Texture2D glowTexture = GlowTexture.Value;
spriteBatch.Draw(glowTexture, NPC.Center - screenPos + new Vector2(0f, NPC.gfxOffY), NPC.frame, Color.White, NPC.rotation, NPC.frame.Size() / 2, NPC.scale, spriteEffects, 0f);
return false;
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

@@ -705,10 +705,25 @@ namespace CalamityMod.NPCs.ProfanedGuardians
}
}
}
else
else if (NPC.localAI[2] == 1f)
{
inertia *= 1.5f;
NPC.velocity = (NPC.velocity * (inertia - 1f) + targetVector * (NPC.velocity.Length() + (0.111111117f * inertia))) / inertia;
// Stop charging towards the player when within a certain distance
if (NPC.Distance(player.Center) < 160f * NPC.scale)
NPC.localAI[2] = 2f;
}
else
{
// Slow down
if (NPC.Distance(player.Center) >= 240f * NPC.scale || NPC.localAI[2] == 3f)
{
if (NPC.localAI[2] != 3f)
NPC.localAI[2] = 3f;
NPC.velocity *= 0.98f;
}
}
// Throw down holy fire while charging
@@ -646,11 +646,26 @@ namespace CalamityMod.NPCs.ProfanedGuardians
}
}
}
else
else if (NPC.localAI[2] == 1f)
{
// Charge towards target
float inertia = (bossRush || enraged) ? 57f : death ? 63f : revenge ? 66f : expertMode ? 69f : 75f;
NPC.velocity = (NPC.velocity * (inertia - 1f) + targetVector * (NPC.velocity.Length() + (0.111111117f * inertia))) / inertia;
// Stop charging towards the player when within a certain distance
if (NPC.Distance(player.Center) < 160f * NPC.scale)
NPC.localAI[2] = 2f;
}
else
{
// Slow down
if (NPC.Distance(player.Center) >= 240f * NPC.scale || NPC.localAI[2] == 3f)
{
if (NPC.localAI[2] != 3f)
NPC.localAI[2] = 3f;
NPC.velocity *= 0.98f;
}
}
// Lay holy bombs while charging
+179 -95
View File
@@ -5,8 +5,10 @@ using CalamityMod.Events;
using CalamityMod.Projectiles.Boss;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.Audio;
using Terraria.GameContent;
using Terraria.ID;
using Terraria.ModLoader;
@@ -16,25 +18,25 @@ namespace CalamityMod.NPCs.SlimeGod
public class CrimulanPaladin : ModNPC
{
private float bossLife;
private float addedStretch = 0f;
private float landingRecoil = 0f;
public override void SetStaticDefaults()
{
this.HideFromBestiary();
Main.npcFrameCount[NPC.type] = 6;
}
public override void SetDefaults()
{
NPC.Calamity().canBreakPlayerDefense = true;
NPC.GetNPCDamage();
NPC.width = 150;
NPC.height = 92;
NPC.width = 206;
NPC.height = 156;
NPC.scale = 1.1f;
NPC.defense = 12;
NPC.LifeMaxNERB(7500, 9000, 160000);
NPC.BossBar = Main.BigBossProgressBar.NeverValid;
NPC.knockBackResist = 0f;
AnimationType = NPCID.KingSlime;
NPC.value = 0f;
NPC.Opacity = 0.8f;
NPC.lavaImmune = false;
@@ -91,6 +93,17 @@ namespace CalamityMod.NPCs.SlimeGod
setDamage += 25;
}
// Used for landing squash and stretch
if (landingRecoil > 0f)
{
landingRecoil *= 0.965f;
landingRecoil -= 0.01f;
}
else
landingRecoil = 0f;
addedStretch = -landingRecoil;
float scale = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 0.6f : Main.getGoodWorld ? 0.8f : 1f;
NPC.aiAction = 0;
NPC.noTileCollide = false;
@@ -254,90 +267,103 @@ namespace CalamityMod.NPCs.SlimeGod
NPC.ai[3] = 0f;
NPC.netUpdate = true;
}
else if (NPC.velocity.Y == 0f)
{
// Avoid cheap bullshit
NPC.damage = 0;
NPC.TargetClosest();
NPC.velocity.X *= 0.8f;
NPC.ai[1] += 1f;
float jumpGateValue = 50f;
float velocityX = death ? 10f : revenge ? 9f : expertMode ? 8f : 6f;
if (revenge)
{
float moveBoost = death ? 45f * (1f - lifeRatio) : 30f * (1f - lifeRatio);
float speedBoost = death ? 4.5f * (1f - lifeRatio) : 3f * (1f - lifeRatio);
jumpGateValue -= moveBoost;
velocityX += speedBoost;
}
float distanceBelowTarget = NPC.position.Y - (player.position.Y + 80f);
float speedMult = 1f;
if (distanceBelowTarget > 0f)
speedMult += distanceBelowTarget * 0.002f;
if (speedMult > 2f)
speedMult = 2f;
float velocityY = 4f;
if (!Collision.CanHit(NPC.Center, 1, 1, player.Center, 1, 1))
velocityY += 2f;
if (NPC.ai[1] > jumpGateValue)
{
// Set damage
NPC.damage = setDamage;
NPC.ai[3] += 1f;
if (NPC.ai[3] >= 2f)
{
NPC.ai[3] = 0f;
velocityX *= 1.25f;
}
NPC.ai[1] = 0f;
NPC.velocity.Y -= velocityY * speedMult;
NPC.velocity.X = (velocityX + distanceSpeedBoost) * NPC.direction;
NPC.noTileCollide = true;
NPC.netUpdate = true;
}
else if (NPC.ai[1] >= jumpGateValue - 30f)
NPC.aiAction = 1;
}
else
{
// Set damage
NPC.damage = setDamage;
NPC.velocity.X *= 0.99f;
if (NPC.direction < 0 && NPC.velocity.X > -1f)
NPC.velocity.X = -1f;
if (NPC.direction > 0 && NPC.velocity.X < 1f)
NPC.velocity.X = 1f;
if (!player.dead)
{
if (NPC.velocity.Y > 0f && NPC.Bottom.Y > player.Top.Y)
NPC.noTileCollide = false;
else if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.Center, 1, 1) && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height))
NPC.noTileCollide = false;
else
NPC.noTileCollide = true;
}
}
NPC.ai[2] += 1f;
if (revenge)
NPC.ai[2] += death ? 4f * (1f - lifeRatio) : 2f * (1f - lifeRatio);
if (NPC.velocity.Y == 0f)
{
// Avoid cheap bullshit
NPC.damage = 0;
float phaseSwitchGateValue = 360f;
NPC.ai[2] += 1f;
if (revenge)
NPC.ai[2] += death ? 4f * (1f - lifeRatio) : 2f * (1f - lifeRatio);
NPC.TargetClosest();
NPC.velocity.X *= 0.8f;
}
float landingSquashTime = 10f;
float telegraphTime = 20f;
float phaseSwitchGateValue = 240f;
float jumpTelegraphGateValue = phaseSwitchGateValue - telegraphTime;
if (NPC.ai[2] < jumpTelegraphGateValue)
{
if (NPC.velocity.Y == 0f)
{
// Squash when landing
if (NPC.ai[1] < 0f)
landingRecoil += Math.Abs(NPC.ai[1]) / landingSquashTime;
NPC.ai[1] += 1f;
float jumpGateValue = 50f;
float velocityX = death ? 10f : revenge ? 9f : expertMode ? 8f : 6f;
if (revenge)
{
float moveBoost = death ? 22f * (1f - lifeRatio) : 14f * (1f - lifeRatio);
float speedBoost = death ? 4.5f * (1f - lifeRatio) : 3f * (1f - lifeRatio);
jumpGateValue -= moveBoost;
velocityX += speedBoost;
}
float distanceBelowTarget = NPC.position.Y - (player.position.Y + 80f);
float speedMult = 1f;
if (distanceBelowTarget > 0f)
speedMult += distanceBelowTarget * 0.002f;
if (speedMult > 2f)
speedMult = 2f;
float velocityY = 8f;
if (!Collision.CanHit(NPC.Center, 1, 1, player.Center, 1, 1))
velocityY += 4f;
float jumpTelegraphGateValue2 = jumpGateValue - telegraphTime;
if (NPC.ai[1] >= jumpGateValue)
{
// Set damage
NPC.damage = setDamage;
NPC.ai[3] += 1f;
if (NPC.ai[3] >= 2f)
{
NPC.ai[3] = 0f;
velocityX *= 1.25f;
}
NPC.ai[1] = -landingSquashTime;
NPC.velocity.Y -= velocityY * speedMult;
NPC.velocity.X = (velocityX + distanceSpeedBoost) * NPC.direction;
NPC.noTileCollide = true;
NPC.netUpdate = true;
}
else if (NPC.ai[1] >= jumpTelegraphGateValue2)
landingRecoil += (NPC.ai[1] - jumpTelegraphGateValue2) / telegraphTime;
}
else
{
// Set damage
NPC.damage = setDamage;
NPC.velocity.X *= 0.99f;
if (NPC.direction < 0 && NPC.velocity.X > -1f)
NPC.velocity.X = -1f;
if (NPC.direction > 0 && NPC.velocity.X < 1f)
NPC.velocity.X = 1f;
if (!player.dead)
{
if (NPC.velocity.Y > 0f && NPC.Bottom.Y > player.Top.Y)
NPC.noTileCollide = false;
else if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.Center, 1, 1) && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height))
NPC.noTileCollide = false;
else
NPC.noTileCollide = true;
}
}
}
if (NPC.velocity.Y == 0f)
{
bool switchPhase = NPC.ai[2] >= phaseSwitchGateValue;
if (switchPhase)
{
@@ -371,8 +397,8 @@ namespace CalamityMod.NPCs.SlimeGod
NPC.netUpdate = true;
}
}
else if (NPC.ai[1] >= phaseSwitchGateValue - 30f)
NPC.aiAction = 1;
else if (NPC.ai[2] >= jumpTelegraphGateValue)
landingRecoil += (NPC.ai[2] - jumpTelegraphGateValue) / telegraphTime;
}
}
else if (NPC.ai[0] == 1f)
@@ -489,6 +515,8 @@ namespace CalamityMod.NPCs.SlimeGod
NPC.ai[3] = 0f;
NPC.netUpdate = true;
}
else
landingRecoil += NPC.ai[1] / 10f;
}
else if (NPC.ai[2] == 0f)
NPC.noTileCollide = true;
@@ -538,7 +566,7 @@ namespace CalamityMod.NPCs.SlimeGod
NPC.ai[2] += 1f;
}
else
NPC.aiAction = 1;
landingRecoil += NPC.ai[1] / 10f;
}
else
{
@@ -558,12 +586,18 @@ namespace CalamityMod.NPCs.SlimeGod
// Avoid cheap bullshit
NPC.damage = 0;
NPC.localAI[2] = NPC.ai[0];
NPC.ai[0] = 0f;
NPC.ai[1] = 0f;
NPC.ai[2] = 0f;
NPC.ai[3] = 0f;
NPC.netUpdate = true;
NPC.ai[2] += 1f;
if (NPC.ai[2] >= 23f)
{
NPC.localAI[2] = NPC.ai[0];
NPC.ai[0] = 0f;
NPC.ai[1] = 0f;
NPC.ai[2] = 0f;
NPC.ai[3] = 0f;
NPC.netUpdate = true;
}
else
landingRecoil += (NPC.ai[2] - 3f) / 10f;
}
}
@@ -668,7 +702,7 @@ namespace CalamityMod.NPCs.SlimeGod
if (NPC.ai[1] >= teleportEndTime && Main.netMode != NetmodeID.MultiplayerClient)
{
NPC.ai[0] = 0f;
NPC.ai[1] = 0f;
NPC.ai[1] = -10f;
NPC.netUpdate = true;
NPC.TargetClosest();
}
@@ -676,7 +710,7 @@ namespace CalamityMod.NPCs.SlimeGod
if (Main.netMode == NetmodeID.MultiplayerClient && NPC.ai[1] >= teleportEndTime * 2f)
{
NPC.ai[0] = 0f;
NPC.ai[1] = 0f;
NPC.ai[1] = -10f;
NPC.TargetClosest();
}
@@ -691,6 +725,10 @@ namespace CalamityMod.NPCs.SlimeGod
}
}
// Limit the landing recoil
if (landingRecoil > 0.36f)
landingRecoil = 0.36f;
if (bossLife == 0f && NPC.life > 0)
bossLife = NPC.lifeMax;
@@ -705,8 +743,8 @@ namespace CalamityMod.NPCs.SlimeGod
NPC.position.X = NPC.position.X + (float)(NPC.width / 2);
NPC.position.Y = NPC.position.Y + (float)NPC.height;
NPC.scale = scaleRatio;
NPC.width = (int)(150f * NPC.scale);
NPC.height = (int)(92f * NPC.scale);
NPC.width = (int)(206f * NPC.scale);
NPC.height = (int)(156f * NPC.scale);
NPC.position.X = NPC.position.X - (float)(NPC.width / 2);
NPC.position.Y = NPC.position.Y - (float)NPC.height;
}
@@ -736,6 +774,27 @@ namespace CalamityMod.NPCs.SlimeGod
}
}
// Can only hit the target if within certain distance
public override bool CanHitPlayer(Player target, ref int cooldownSlot)
{
Rectangle targetHitbox = target.Hitbox;
float hitboxTopLeft = Vector2.Distance(NPC.Center, targetHitbox.TopLeft());
float hitboxTopRight = Vector2.Distance(NPC.Center, targetHitbox.TopRight());
float hitboxBotLeft = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft());
float hitboxBotRight = Vector2.Distance(NPC.Center, targetHitbox.BottomRight());
float minDist = hitboxTopLeft;
if (hitboxTopRight < minDist)
minDist = hitboxTopRight;
if (hitboxBotLeft < minDist)
minDist = hitboxBotLeft;
if (hitboxBotRight < minDist)
minDist = hitboxBotRight;
return minDist <= 75f * NPC.scale;
}
public override Color? GetAlpha(Color drawColor)
{
Color lightColor = new Color(Main.DiscoR, 100, 150, NPC.alpha);
@@ -743,6 +802,31 @@ namespace CalamityMod.NPCs.SlimeGod
return newColor * NPC.Opacity;
}
public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor)
{
SpriteEffects spriteEffects = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
Texture2D texture = TextureAssets.Npc[Type].Value;
Color drawColorAlpha = NPC.GetAlpha(drawColor);
// Stretch based on Y velocity.
float stretch = NPC.velocity.Y * 0.03f;
stretch = Math.Abs(stretch) + addedStretch;
// Stretch rapidly if about to jump or teleport, stretch normally while idle.
if (NPC.velocity.Y == 0f)
stretch += MathHelper.Lerp(0f, 0.16f, (float)Math.Sin(Main.GlobalTimeWrappedHourly * (NPC.aiAction == 1 ? 15f : 2f)) / 2f + 0.5f);
if (stretch > 0.5f)
stretch = 0.5f;
Vector2 scaleStretch = new Vector2(1f - stretch, 1f + stretch) * NPC.scale;
float yOffset = stretch * 0.5f * NPC.height;
spriteBatch.Draw(texture, NPC.Center - screenPos + new Vector2(0f, NPC.gfxOffY - yOffset), NPC.frame, drawColorAlpha, NPC.rotation, NPC.frame.Size() * 0.5f, scaleStretch, spriteEffects, 0f);
return false;
}
public override void HitEffect(NPC.HitInfo hit)
{
Color dustColor = Color.Crimson;
Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 7.5 KiB

File diff suppressed because it is too large. Load diff
Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

+120 -38
View File
@@ -44,15 +44,37 @@ namespace CalamityMod.NPCs.SlimeGod
public static readonly SoundStyle ShotSound = new("CalamityMod/Sounds/Custom/SlimeGodShot", 2);
public static readonly SoundStyle BigShotSound = new("CalamityMod/Sounds/Custom/SlimeGodBigShot", 2);
public static Asset<Texture2D> ZenithSeedEyeTexture;
public static Asset<Texture2D> EyeTexture;
public static Asset<Texture2D> OverlayTexture;
private int eyeFrameDrawn = 0;
private int eyeFrameX = 0;
private const int TotalXEyeFrames = 2;
private const int TotalEyeFrames = 25;
private const int TotalEyeFrames_FirstColumn = 19;
public override void SetStaticDefaults()
{
NPCID.Sets.BossBestiaryPriority.Add(Type);
NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers()
{
Scale = 0.5f,
PortraitScale = 0.6f,
CustomTexturePath = "CalamityMod/ExtraTextures/Bestiary/SlimeGod_Bestiary",
PortraitPositionXOverride = 40,
PortraitPositionYOverride = 40
};
value.Position.X += 65;
value.Position.Y += 35;
NPCID.Sets.NPCBestiaryDrawOffset[Type] = value;
NPCID.Sets.MPAllowedEnemies[Type] = true;
if (!Main.dedServ)
{
EyeTexture = ModContent.Request<Texture2D>("CalamityMod/NPCs/SlimeGod/SlimeGodEyes", AssetRequestMode.AsyncLoad);
ZenithSeedEyeTexture = ModContent.Request<Texture2D>("CalamityMod/NPCs/SlimeGod/SlimeGodEyes", AssetRequestMode.AsyncLoad);
EyeTexture = ModContent.Request<Texture2D>("CalamityMod/NPCs/SlimeGod/ExtraTextures/SlimeGodCoreEye", AssetRequestMode.AsyncLoad);
OverlayTexture = ModContent.Request<Texture2D>("CalamityMod/NPCs/SlimeGod/ExtraTextures/SlimeGodCoreOverlay", AssetRequestMode.AsyncLoad);
}
}
@@ -61,8 +83,8 @@ namespace CalamityMod.NPCs.SlimeGod
NPC.Calamity().canBreakPlayerDefense = true;
NPC.GetNPCDamage();
NPC.npcSlots = 10f;
NPC.width = 44;
NPC.height = 44;
NPC.width = 96;
NPC.height = 98;
if (CalamityWorld.LegendaryMode && CalamityWorld.revenge)
NPC.scale = 2f;
@@ -128,6 +150,9 @@ namespace CalamityMod.NPCs.SlimeGod
bool revenge = CalamityWorld.revenge || bossRush;
bool death = CalamityWorld.death || bossRush;
// For animating the eye
NPC.localAI[0] += 1f;
// Get a target
if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active)
NPC.TargetClosest();
@@ -196,8 +221,8 @@ namespace CalamityMod.NPCs.SlimeGod
// Vanish phase
if ((!purpleSlimeAlive && !redSlimeAlive) || calamityGlobalNPC.newAI[3] == 1f || NPC.ai[3] == 1f)
{
// Avoid cheap bullshit
NPC.damage = 0;
// Avoid cheap bullshit
NPC.damage = 0;
// Make sure Opacity is set to 0.8f if it's below that when the vanish phase starts
if (NPC.ai[3] == 0f)
@@ -510,7 +535,7 @@ namespace CalamityMod.NPCs.SlimeGod
if (distanceFromFlyDestination < 300f)
NPC.velocity = (NPC.velocity * 7f + idealVelocity) / 8f;
NPC.rotation = NPC.velocity.X * 0.1f;
NPC.rotation = NPC.velocity.X * 0.05f;
}
public Vector2 GetFlyDestination(Player target)
@@ -575,51 +600,108 @@ namespace CalamityMod.NPCs.SlimeGod
public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor)
{
SpriteEffects spriteEffects = SpriteEffects.None;
if (NPC.spriteDirection == 1)
{
spriteEffects = SpriteEffects.FlipHorizontally;
}
SpriteEffects spriteEffects = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
Color drawColorAlpha = NPC.GetAlpha(drawColor);
Color colorLightingArea = Lighting.GetColor((int)((double)NPC.position.X + (double)NPC.width * 0.5) / 16, (int)(((double)NPC.position.Y + (double)NPC.height * 0.5) / 16.0));
Texture2D texture2D3 = TextureAssets.Npc[NPC.type].Value;
Texture2D pog = EyeTexture.Value;
int frameTexture = TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type];
int y3 = frameTexture * (int)NPC.frameCounter;
Rectangle rectangle = new Rectangle(0, y3, texture2D3.Width, frameTexture);
Vector2 halfRect = rectangle.Size() / 2f;
int twoConst = 2;
int coreID = 1;
spriteBatch.Draw(texture2D3, NPC.Center - screenPos + new Vector2(0, NPC.gfxOffY), NPC.frame, drawColorAlpha, NPC.rotation, NPC.frame.Size() / 2, NPC.scale, spriteEffects, 0);
if (Main.zenithWorld)
Vector2 origin = NPC.frame.Size() * 0.5f;
Vector2 halfSize = NPC.Size * 0.5f;
Texture2D texture = TextureAssets.Npc[NPC.type].Value;
Texture2D eyeTexture = EyeTexture.Value;
Texture2D overlayTexture = OverlayTexture.Value;
Texture2D pog = ZenithSeedEyeTexture.Value;
// Used for animating the eye
if (NPC.localAI[0] % 6f == 0f)
{
spriteBatch.Draw(pog, NPC.Center - screenPos + new Vector2(0, NPC.gfxOffY), NPC.frame, drawColorAlpha, NPC.rotation, NPC.frame.Size() / 2, NPC.scale, spriteEffects, 0);
eyeFrameDrawn++;
if (eyeFrameX == 0)
{
if (eyeFrameDrawn >= TotalEyeFrames_FirstColumn)
{
eyeFrameDrawn = 0;
eyeFrameX = 1;
}
}
else
{
if (eyeFrameDrawn >= TotalEyeFrames)
{
eyeFrameDrawn = 0;
eyeFrameX = 0;
}
}
}
Rectangle eyeFrame = new Rectangle(eyeTexture.Width / TotalXEyeFrames * eyeFrameX, eyeTexture.Height / TotalEyeFrames * eyeFrameDrawn, eyeTexture.Width / TotalXEyeFrames, eyeTexture.Height / TotalEyeFrames);
Vector2 eyeOrigin = new Vector2(eyeTexture.Width / TotalXEyeFrames, eyeTexture.Height / TotalEyeFrames) * 0.5f;
if (!Main.zenithWorld)
{
Vector2 drawPositionAdjustment = halfSize - screenPos + new Vector2(0f, NPC.gfxOffY);
float colorAlphaDivisor = NPCID.Sets.TrailCacheLength[NPC.type] * 1.5f;
int twoConst = 2;
int coreID = 1;
while (((twoConst > 0 && coreID < 8) || (twoConst < 0 && coreID > 8)) && CalamityClientConfig.Instance.Afterimages)
{
Color colorLightingAlpha = NPC.GetAlpha(colorLightingArea);
{
goto IL_6899;
}
IL_6881:
coreID += twoConst;
continue;
IL_6899:
float trailLengthMult = (float)(8 - coreID);
if (twoConst < 0)
{
trailLengthMult = (float)(1 - coreID);
}
colorLightingAlpha *= trailLengthMult / ((float)NPCID.Sets.TrailCacheLength[NPC.type] * 1.5f);
Vector2 drawPosition = NPC.oldPos[coreID];
float coreRotate = NPC.rotation;
Main.spriteBatch.Draw(texture2D3, drawPosition + NPC.Size / 2f - screenPos + new Vector2(0, NPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), colorLightingAlpha, coreRotate + NPC.rotation * 0f * (float)(coreID - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), halfRect, NPC.scale, spriteEffects, 0f);
goto IL_6881;
drawColorAlpha *= trailLengthMult / colorAlphaDivisor;
Vector2 drawPosition = NPC.oldPos[coreID] + drawPositionAdjustment;
// Draw the base texture afterimages
spriteBatch.Draw(texture, drawPosition, NPC.frame, drawColorAlpha, NPC.rotation, origin, NPC.scale, spriteEffects, 0f);
// Draw the eye texture afterimages
spriteBatch.Draw(eyeTexture, drawPosition, eyeFrame, drawColorAlpha, NPC.rotation, eyeOrigin, NPC.scale, spriteEffects, 0f);
// Draw the overlay texture afterimages
spriteBatch.Draw(overlayTexture, drawPosition, NPC.frame, drawColorAlpha, NPC.rotation, origin, NPC.scale, spriteEffects, 0f);
coreID += twoConst;
}
}
// Reset the color
drawColorAlpha = NPC.GetAlpha(drawColor);
// Draw the base texture
spriteBatch.Draw(texture, NPC.Center - screenPos + new Vector2(0f, NPC.gfxOffY), NPC.frame, drawColorAlpha, NPC.rotation, origin, NPC.scale, spriteEffects, 0f);
// Draw the eye
spriteBatch.Draw(eyeTexture, NPC.Center - screenPos + new Vector2(0f, NPC.gfxOffY), eyeFrame, drawColorAlpha, NPC.rotation, eyeOrigin, NPC.scale, spriteEffects, 0f);
// Draw the overlay
spriteBatch.Draw(overlayTexture, NPC.Center - screenPos + new Vector2(0f, NPC.gfxOffY), NPC.frame, drawColorAlpha, NPC.rotation, origin, NPC.scale, spriteEffects, 0f);
if (Main.zenithWorld)
spriteBatch.Draw(pog, NPC.Center - screenPos + new Vector2(0f, NPC.gfxOffY), NPC.frame, drawColorAlpha, NPC.rotation, origin, NPC.scale, spriteEffects, 0f);
return false;
}
// Can only hit the target if within certain distance
public override bool CanHitPlayer(Player target, ref int cooldownSlot)
{
Rectangle targetHitbox = target.Hitbox;
float hitboxTopLeft = Vector2.Distance(NPC.Center, targetHitbox.TopLeft());
float hitboxTopRight = Vector2.Distance(NPC.Center, targetHitbox.TopRight());
float hitboxBotLeft = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft());
float hitboxBotRight = Vector2.Distance(NPC.Center, targetHitbox.BottomRight());
float minDist = hitboxTopLeft;
if (hitboxTopRight < minDist)
minDist = hitboxTopRight;
if (hitboxBotLeft < minDist)
minDist = hitboxBotLeft;
if (hitboxBotRight < minDist)
minDist = hitboxBotRight;
return minDist <= 40f * NPC.scale;
}
public override void BossLoot(ref string name, ref int potionType)
{
potionType = ItemID.HealingPotion;
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

+157 -74
View File
@@ -5,8 +5,10 @@ using CalamityMod.Events;
using CalamityMod.Projectiles.Boss;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.Audio;
using Terraria.GameContent;
using Terraria.GameContent.Bestiary;
using Terraria.ID;
using Terraria.ModLoader;
@@ -17,10 +19,11 @@ namespace CalamityMod.NPCs.SlimeGod
public class SplitCrimulanPaladin : ModNPC
{
private float bossLife;
private float addedStretch = 0f;
private float landingRecoil = 0f;
public override void SetStaticDefaults()
{
Main.npcFrameCount[NPC.type] = 6;
NPCID.Sets.BossBestiaryPriority.Add(Type);
NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers()
{
@@ -38,12 +41,11 @@ namespace CalamityMod.NPCs.SlimeGod
NPC.LifeMaxNERB(1875, 2250, 80000);
NPC.BossBar = Main.BigBossProgressBar.NeverValid;
NPC.GetNPCDamage();
NPC.width = 150;
NPC.height = 92;
NPC.width = 166;
NPC.height = 114;
NPC.scale = 0.8f;
NPC.defense = 10;
NPC.knockBackResist = 0f;
AnimationType = NPCID.KingSlime;
NPC.value = Item.buyPrice(0, 1, 0, 0);
NPC.Opacity = 0.8f;
NPC.lavaImmune = false;
@@ -106,6 +108,17 @@ namespace CalamityMod.NPCs.SlimeGod
setDamage += 22;
}
// Used for landing squash and stretch
if (landingRecoil > 0f)
{
landingRecoil *= 0.965f;
landingRecoil -= 0.01f;
}
else
landingRecoil = 0f;
addedStretch = -landingRecoil;
float scale = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 0.6f : Main.getGoodWorld ? 0.8f : 1f;
NPC.aiAction = 0;
NPC.noTileCollide = false;
@@ -251,79 +264,91 @@ namespace CalamityMod.NPCs.SlimeGod
// Avoid cheap bullshit
NPC.damage = 0;
NPC.ai[2] += 1f;
if (revenge)
NPC.ai[2] += death ? 1f * (1f - lifeRatio) : 0.5f * (1f - lifeRatio);
NPC.TargetClosest();
NPC.velocity.X *= 0.8f;
NPC.ai[1] += 1f;
}
float jumpGateValue = 35f;
float velocityX = death ? 11.5f : revenge ? 10.5f : expertMode ? 9.5f : 7.5f;
if (revenge)
float landingSquashTime = 10f;
float telegraphTime = 20f;
float phaseSwitchGateValue = 120f;
float jumpTelegraphGateValue = phaseSwitchGateValue - telegraphTime;
if (NPC.ai[2] < jumpTelegraphGateValue)
{
if (NPC.velocity.Y == 0f)
{
float moveBoost = death ? 11f * (1f - lifeRatio) : 7f * (1f - lifeRatio);
float speedBoost = death ? 2.25f * (1f - lifeRatio) : 1.5f * (1f - lifeRatio);
jumpGateValue -= moveBoost;
velocityX += speedBoost;
// Squash when landing
if (NPC.ai[1] < 0f)
landingRecoil += Math.Abs(NPC.ai[1]) / landingSquashTime;
NPC.ai[1] += 1f;
float jumpGateValue = 40f;
float velocityX = death ? 11.5f : revenge ? 10.5f : expertMode ? 9.5f : 7.5f;
if (revenge)
{
float moveBoost = death ? 11f * (1f - lifeRatio) : 7f * (1f - lifeRatio);
float speedBoost = death ? 2.25f * (1f - lifeRatio) : 1.5f * (1f - lifeRatio);
jumpGateValue -= moveBoost;
velocityX += speedBoost;
}
float distanceBelowTarget = NPC.position.Y - (player.position.Y + 80f);
float speedMult = 1f;
if (distanceBelowTarget > 0f)
speedMult += distanceBelowTarget * 0.002f;
if (speedMult > 2f)
speedMult = 2f;
float velocityY = 8f;
if (!Collision.CanHit(NPC.Center, 1, 1, player.Center, 1, 1))
velocityY += 4f;
float jumpTelegraphGateValue2 = jumpGateValue - telegraphTime;
if (NPC.ai[1] >= jumpGateValue)
{
// Set damage
NPC.damage = setDamage;
velocityX *= 1.25f;
NPC.ai[1] = -landingSquashTime;
NPC.velocity.Y -= velocityY * speedMult;
NPC.velocity.X = (velocityX + distanceSpeedBoost) * NPC.direction;
NPC.noTileCollide = true;
NPC.netUpdate = true;
}
else if (NPC.ai[1] >= jumpTelegraphGateValue2)
landingRecoil += (NPC.ai[1] - jumpTelegraphGateValue2) / telegraphTime;
}
float distanceBelowTarget = NPC.position.Y - (player.position.Y + 80f);
float speedMult = 1f;
if (distanceBelowTarget > 0f)
speedMult += distanceBelowTarget * 0.002f;
if (speedMult > 2f)
speedMult = 2f;
float velocityY = 4f;
if (!Collision.CanHit(NPC.Center, 1, 1, player.Center, 1, 1))
velocityY += 2f;
if (NPC.ai[1] > jumpGateValue)
else
{
// Set damage
NPC.damage = setDamage;
velocityX *= 1.25f;
NPC.ai[1] = 0f;
NPC.velocity.Y -= velocityY * speedMult;
NPC.velocity.X = (velocityX + distanceSpeedBoost) * NPC.direction;
NPC.noTileCollide = true;
NPC.netUpdate = true;
}
else if (NPC.ai[1] >= jumpGateValue - 30f)
NPC.aiAction = 1;
}
else
{
// Set damage
NPC.damage = setDamage;
NPC.velocity.X *= 0.99f;
if (NPC.direction < 0 && NPC.velocity.X > -1f)
NPC.velocity.X = -1f;
if (NPC.direction > 0 && NPC.velocity.X < 1f)
NPC.velocity.X = 1f;
NPC.velocity.X *= 0.99f;
if (NPC.direction < 0 && NPC.velocity.X > -1f)
NPC.velocity.X = -1f;
if (NPC.direction > 0 && NPC.velocity.X < 1f)
NPC.velocity.X = 1f;
if (!player.dead)
{
if (NPC.velocity.Y > 0f && NPC.Bottom.Y > player.Top.Y)
NPC.noTileCollide = false;
else if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.Center, 1, 1) && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height))
NPC.noTileCollide = false;
else
NPC.noTileCollide = true;
if (!player.dead)
{
if (NPC.velocity.Y > 0f && NPC.Bottom.Y > player.Top.Y)
NPC.noTileCollide = false;
else if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.Center, 1, 1) && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height))
NPC.noTileCollide = false;
else
NPC.noTileCollide = true;
}
}
}
NPC.ai[2] += 1f;
if (revenge)
NPC.ai[2] += death ? 1f * (1f - lifeRatio) : 0.5f * (1f - lifeRatio);
if (NPC.velocity.Y == 0f)
{
// Avoid cheap bullshit
NPC.damage = 0;
float phaseSwitchGateValue = 180f;
bool switchPhase = NPC.ai[2] >= phaseSwitchGateValue;
if (switchPhase)
{
@@ -355,8 +380,8 @@ namespace CalamityMod.NPCs.SlimeGod
NPC.netUpdate = true;
}
}
else if (NPC.ai[1] >= phaseSwitchGateValue - 30f)
NPC.aiAction = 1;
else if (NPC.ai[2] >= jumpTelegraphGateValue)
landingRecoil += (NPC.ai[2] - jumpTelegraphGateValue) / telegraphTime;
}
}
else if (NPC.ai[0] == 1f)
@@ -472,6 +497,8 @@ namespace CalamityMod.NPCs.SlimeGod
NPC.ai[2] = 0f;
NPC.netUpdate = true;
}
else
landingRecoil += NPC.ai[1] / 10f;
}
else if (NPC.ai[2] == 0f)
NPC.noTileCollide = true;
@@ -521,7 +548,7 @@ namespace CalamityMod.NPCs.SlimeGod
NPC.ai[2] += 1f;
}
else
NPC.aiAction = 1;
landingRecoil += NPC.ai[1] / 10f;
}
else
{
@@ -541,11 +568,17 @@ namespace CalamityMod.NPCs.SlimeGod
// Avoid cheap bullshit
NPC.damage = 0;
NPC.localAI[2] = NPC.ai[0];
NPC.ai[0] = 0f;
NPC.ai[1] = 0f;
NPC.ai[2] = 0f;
NPC.netUpdate = true;
NPC.ai[2] += 1f;
if (NPC.ai[2] >= 23f)
{
NPC.localAI[2] = NPC.ai[0];
NPC.ai[0] = 0f;
NPC.ai[1] = 0f;
NPC.ai[2] = 0f;
NPC.netUpdate = true;
}
else
landingRecoil += (NPC.ai[2] - 3f) / 10f;
}
}
@@ -649,7 +682,7 @@ namespace CalamityMod.NPCs.SlimeGod
if (NPC.ai[1] >= teleportEndTime && Main.netMode != NetmodeID.MultiplayerClient)
{
NPC.ai[0] = 0f;
NPC.ai[1] = 0f;
NPC.ai[1] = -10f;
NPC.netUpdate = true;
NPC.TargetClosest();
}
@@ -657,7 +690,7 @@ namespace CalamityMod.NPCs.SlimeGod
if (Main.netMode == NetmodeID.MultiplayerClient && NPC.ai[1] >= teleportEndTime * 2f)
{
NPC.ai[0] = 0f;
NPC.ai[1] = 0f;
NPC.ai[1] = -10f;
NPC.TargetClosest();
}
@@ -672,6 +705,10 @@ namespace CalamityMod.NPCs.SlimeGod
}
}
// Limit the landing recoil
if (landingRecoil > 0.36f)
landingRecoil = 0.36f;
if (bossLife == 0f && NPC.life > 0)
bossLife = NPC.lifeMax;
@@ -686,8 +723,8 @@ namespace CalamityMod.NPCs.SlimeGod
NPC.position.X = NPC.position.X + (float)(NPC.width / 2);
NPC.position.Y = NPC.position.Y + (float)NPC.height;
NPC.scale = scaleRatio * 0.75f;
NPC.width = (int)(150f * NPC.scale);
NPC.height = (int)(92f * NPC.scale);
NPC.width = (int)(166f * NPC.scale);
NPC.height = (int)(114f * NPC.scale);
NPC.position.X = NPC.position.X - (float)(NPC.width / 2);
NPC.position.Y = NPC.position.Y - (float)NPC.height;
}
@@ -717,6 +754,27 @@ namespace CalamityMod.NPCs.SlimeGod
}
}
// Can only hit the target if within certain distance
public override bool CanHitPlayer(Player target, ref int cooldownSlot)
{
Rectangle targetHitbox = target.Hitbox;
float hitboxTopLeft = Vector2.Distance(NPC.Center, targetHitbox.TopLeft());
float hitboxTopRight = Vector2.Distance(NPC.Center, targetHitbox.TopRight());
float hitboxBotLeft = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft());
float hitboxBotRight = Vector2.Distance(NPC.Center, targetHitbox.BottomRight());
float minDist = hitboxTopLeft;
if (hitboxTopRight < minDist)
minDist = hitboxTopRight;
if (hitboxBotLeft < minDist)
minDist = hitboxBotLeft;
if (hitboxBotRight < minDist)
minDist = hitboxBotRight;
return minDist <= 55f * NPC.scale;
}
public override Color? GetAlpha(Color drawColor)
{
Color lightColor = new Color(Main.DiscoR, 100, 150, NPC.alpha);
@@ -724,6 +782,31 @@ namespace CalamityMod.NPCs.SlimeGod
return newColor * NPC.Opacity;
}
public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor)
{
SpriteEffects spriteEffects = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
Texture2D texture = TextureAssets.Npc[Type].Value;
Color drawColorAlpha = NPC.GetAlpha(drawColor);
// Stretch based on Y velocity.
float stretch = NPC.velocity.Y * 0.03f;
stretch = Math.Abs(stretch) + addedStretch;
// Stretch rapidly if about to jump or teleport, stretch normally while idle.
if (NPC.velocity.Y == 0f)
stretch += MathHelper.Lerp(0f, 0.16f, (float)Math.Sin(Main.GlobalTimeWrappedHourly * (NPC.aiAction == 1 ? 15f : 2f)) / 2f + 0.5f);
if (stretch > 0.5f)
stretch = 0.5f;
Vector2 scaleStretch = new Vector2(1f - stretch, 1f + stretch) * NPC.scale;
float yOffset = stretch * 0.5f * NPC.height;
spriteBatch.Draw(texture, NPC.Center - screenPos + new Vector2(0f, NPC.gfxOffY - yOffset), NPC.frame, drawColorAlpha, NPC.rotation, NPC.frame.Size() * 0.5f, scaleStretch, spriteEffects, 0f);
return false;
}
public override void OnKill()
{
int heartAmt = Main.rand.Next(3) + 3;
Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 5.0 KiB

+158 -75
View File
@@ -5,8 +5,10 @@ using CalamityMod.Events;
using CalamityMod.Projectiles.Boss;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.Audio;
using Terraria.GameContent;
using Terraria.GameContent.Bestiary;
using Terraria.ID;
using Terraria.ModLoader;
@@ -17,10 +19,11 @@ namespace CalamityMod.NPCs.SlimeGod
public class SplitEbonianPaladin : ModNPC
{
private float bossLife;
private float addedStretch = 0f;
private float landingRecoil = 0f;
public override void SetStaticDefaults()
{
Main.npcFrameCount[NPC.type] = 6;
NPCID.Sets.BossBestiaryPriority.Add(Type);
NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers()
{
@@ -38,14 +41,13 @@ namespace CalamityMod.NPCs.SlimeGod
NPC.LifeMaxNERB(2000, 2400, 110000);
NPC.BossBar = Main.BigBossProgressBar.NeverValid;
NPC.GetNPCDamage();
NPC.width = 150;
NPC.height = 92;
NPC.width = 166;
NPC.height = 114;
NPC.scale = 0.8f;
NPC.defense = 8;
NPC.aiStyle = -1;
AIType = -1;
NPC.knockBackResist = 0f;
AnimationType = NPCID.KingSlime;
NPC.value = Item.buyPrice(0, 1, 0, 0);
NPC.Opacity = 0.8f;
NPC.lavaImmune = false;
@@ -106,6 +108,17 @@ namespace CalamityMod.NPCs.SlimeGod
setDamage += 20;
}
// Used for landing squash and stretch
if (landingRecoil > 0f)
{
landingRecoil *= 0.965f;
landingRecoil -= 0.01f;
}
else
landingRecoil = 0f;
addedStretch = -landingRecoil;
float scale = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 0.6f : Main.getGoodWorld ? 0.8f : 1f;
NPC.aiAction = 0;
NPC.noTileCollide = false;
@@ -249,79 +262,91 @@ namespace CalamityMod.NPCs.SlimeGod
// Avoid cheap bullshit
NPC.damage = 0;
NPC.ai[2] += 1f;
if (revenge)
NPC.ai[2] += death ? 1f * (1f - lifeRatio) : 0.5f * (1f - lifeRatio);
NPC.TargetClosest();
NPC.velocity.X *= 0.8f;
NPC.ai[1] += hyperMode ? 2f : 1f;
}
float jumpGateValue = 40f;
float velocityX = death ? 10f : revenge ? 9f : expertMode ? 8f : 6f;
if (revenge)
float landingSquashTime = 10f;
float telegraphTime = 20f;
float phaseSwitchGateValue = 150f;
float jumpTelegraphGateValue = phaseSwitchGateValue - telegraphTime;
if (NPC.ai[2] < jumpTelegraphGateValue)
{
if (NPC.velocity.Y == 0f)
{
float moveBoost = death ? 15f * (1f - lifeRatio) : 10f * (1f - lifeRatio);
float speedBoost = death ? 3f * (1f - lifeRatio) : 2f * (1f - lifeRatio);
jumpGateValue -= moveBoost;
velocityX += speedBoost;
// Squash when landing
if (NPC.ai[1] < 0f)
landingRecoil += Math.Abs(NPC.ai[1]) / landingSquashTime;
NPC.ai[1] += hyperMode ? 2f : 1f;
float jumpGateValue = 45f;
float velocityX = death ? 10f : revenge ? 9f : expertMode ? 8f : 6f;
if (revenge)
{
float moveBoost = death ? 15f * (1f - lifeRatio) : 10f * (1f - lifeRatio);
float speedBoost = death ? 3f * (1f - lifeRatio) : 2f * (1f - lifeRatio);
jumpGateValue -= moveBoost;
velocityX += speedBoost;
}
float distanceBelowTarget = NPC.position.Y - (player.position.Y + 80f);
float speedMult = 1f;
if (distanceBelowTarget > 0f)
speedMult += distanceBelowTarget * 0.002f;
if (speedMult > 2f)
speedMult = 2f;
float velocityY = 10f;
if (!Collision.CanHit(NPC.Center, 1, 1, player.Center, 1, 1))
velocityY += 2f;
float jumpTelegraphGateValue2 = jumpGateValue - telegraphTime;
if (NPC.ai[1] > jumpGateValue)
{
// Set damage
NPC.damage = setDamage;
velocityY *= 1.25f;
NPC.ai[1] = -landingSquashTime;
NPC.velocity.Y -= velocityY * speedMult;
NPC.velocity.X = (velocityX + distanceSpeedBoost) * NPC.direction;
NPC.noTileCollide = true;
NPC.netUpdate = true;
}
else if (NPC.ai[1] >= jumpTelegraphGateValue2)
landingRecoil += (NPC.ai[1] - jumpTelegraphGateValue2) / telegraphTime;
}
float distanceBelowTarget = NPC.position.Y - (player.position.Y + 80f);
float speedMult = 1f;
if (distanceBelowTarget > 0f)
speedMult += distanceBelowTarget * 0.002f;
if (speedMult > 2f)
speedMult = 2f;
float velocityY = 5f;
if (!Collision.CanHit(NPC.Center, 1, 1, player.Center, 1, 1))
velocityY += 2f;
if (NPC.ai[1] > jumpGateValue)
else
{
// Set damage
NPC.damage = setDamage;
velocityY *= 1.25f;
NPC.ai[1] = 0f;
NPC.velocity.Y -= velocityY * speedMult;
NPC.velocity.X = (velocityX + distanceSpeedBoost) * NPC.direction;
NPC.noTileCollide = true;
NPC.netUpdate = true;
}
else if (NPC.ai[1] >= jumpGateValue - 30f)
NPC.aiAction = 1;
}
else
{
// Set damage
NPC.damage = setDamage;
NPC.velocity.X *= 0.99f;
if (NPC.direction < 0 && NPC.velocity.X > -1f)
NPC.velocity.X = -1f;
if (NPC.direction > 0 && NPC.velocity.X < 1f)
NPC.velocity.X = 1f;
NPC.velocity.X *= 0.99f;
if (NPC.direction < 0 && NPC.velocity.X > -1f)
NPC.velocity.X = -1f;
if (NPC.direction > 0 && NPC.velocity.X < 1f)
NPC.velocity.X = 1f;
if (!player.dead)
{
if (NPC.velocity.Y > 0f && NPC.Bottom.Y > player.Top.Y)
NPC.noTileCollide = false;
else if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.Center, 1, 1) && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height))
NPC.noTileCollide = false;
else
NPC.noTileCollide = true;
if (!player.dead)
{
if (NPC.velocity.Y > 0f && NPC.Bottom.Y > player.Top.Y)
NPC.noTileCollide = false;
else if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.Center, 1, 1) && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height))
NPC.noTileCollide = false;
else
NPC.noTileCollide = true;
}
}
}
NPC.ai[2] += 1f;
if (revenge)
NPC.ai[2] += death ? 1f * (1f - lifeRatio) : 0.5f * (1f - lifeRatio);
if (NPC.velocity.Y == 0f)
{
// Avoid cheap bullshit
NPC.damage = 0;
float phaseSwitchGateValue = 210f;
bool switchPhase = NPC.ai[2] >= phaseSwitchGateValue;
if (switchPhase)
{
@@ -357,8 +382,8 @@ namespace CalamityMod.NPCs.SlimeGod
NPC.netUpdate = true;
}
}
else if (NPC.ai[1] >= phaseSwitchGateValue - 30f)
NPC.aiAction = 1;
else if (NPC.ai[2] >= jumpTelegraphGateValue)
landingRecoil += (NPC.ai[2] - jumpTelegraphGateValue) / telegraphTime;
}
}
else if (NPC.ai[0] == 1f)
@@ -390,7 +415,7 @@ namespace CalamityMod.NPCs.SlimeGod
{
Vector2 randomVelocity = Main.rand.NextVector2CircularEdge(3f, 3f);
Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, j / (float)(numProj - 1))) + randomVelocity;
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 30f * NPC.scale, perturbedSpeed, type, damage, 0f, Main.myPlayer);
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 45f * NPC.scale, perturbedSpeed, type, damage, 0f, Main.myPlayer);
}
}
}
@@ -519,6 +544,8 @@ namespace CalamityMod.NPCs.SlimeGod
NPC.ai[2] = 0f;
NPC.netUpdate = true;
}
else
landingRecoil += NPC.ai[1] / 10f;
}
else if (NPC.ai[2] == 0f)
NPC.noTileCollide = true;
@@ -568,7 +595,7 @@ namespace CalamityMod.NPCs.SlimeGod
NPC.ai[2] += 1f;
}
else
NPC.aiAction = 1;
landingRecoil += NPC.ai[1] / 10f;
}
else
{
@@ -588,11 +615,17 @@ namespace CalamityMod.NPCs.SlimeGod
// Avoid cheap bullshit
NPC.damage = 0;
NPC.localAI[2] = NPC.ai[0];
NPC.ai[0] = 0f;
NPC.ai[1] = 0f;
NPC.ai[2] = 0f;
NPC.netUpdate = true;
NPC.ai[2] += 1f;
if (NPC.ai[2] >= 22f)
{
NPC.localAI[2] = NPC.ai[0];
NPC.ai[0] = 0f;
NPC.ai[1] = 0f;
NPC.ai[2] = 0f;
NPC.netUpdate = true;
}
else
landingRecoil += (NPC.ai[2] - 2f) / 10f;
}
}
@@ -696,7 +729,7 @@ namespace CalamityMod.NPCs.SlimeGod
if (NPC.ai[1] >= teleportEndTime && Main.netMode != NetmodeID.MultiplayerClient)
{
NPC.ai[0] = 0f;
NPC.ai[1] = 0f;
NPC.ai[1] = -10f;
NPC.netUpdate = true;
NPC.TargetClosest();
}
@@ -704,7 +737,7 @@ namespace CalamityMod.NPCs.SlimeGod
if (Main.netMode == NetmodeID.MultiplayerClient && NPC.ai[1] >= teleportEndTime * 2f)
{
NPC.ai[0] = 0f;
NPC.ai[1] = 0f;
NPC.ai[1] = -10f;
NPC.TargetClosest();
}
@@ -719,6 +752,10 @@ namespace CalamityMod.NPCs.SlimeGod
}
}
// Limit the landing recoil
if (landingRecoil > 0.36f)
landingRecoil = 0.36f;
if (bossLife == 0f && NPC.life > 0)
bossLife = NPC.lifeMax;
@@ -733,8 +770,8 @@ namespace CalamityMod.NPCs.SlimeGod
NPC.position.X = NPC.position.X + (float)(NPC.width / 2);
NPC.position.Y = NPC.position.Y + (float)NPC.height;
NPC.scale = scaleRatio * 0.75f;
NPC.width = (int)(150f * NPC.scale);
NPC.height = (int)(92f * NPC.scale);
NPC.width = (int)(166f * NPC.scale);
NPC.height = (int)(114f * NPC.scale);
NPC.position.X = NPC.position.X - (float)(NPC.width / 2);
NPC.position.Y = NPC.position.Y - (float)NPC.height;
}
@@ -761,6 +798,27 @@ namespace CalamityMod.NPCs.SlimeGod
}
}
// Can only hit the target if within certain distance
public override bool CanHitPlayer(Player target, ref int cooldownSlot)
{
Rectangle targetHitbox = target.Hitbox;
float hitboxTopLeft = Vector2.Distance(NPC.Center, targetHitbox.TopLeft());
float hitboxTopRight = Vector2.Distance(NPC.Center, targetHitbox.TopRight());
float hitboxBotLeft = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft());
float hitboxBotRight = Vector2.Distance(NPC.Center, targetHitbox.BottomRight());
float minDist = hitboxTopLeft;
if (hitboxTopRight < minDist)
minDist = hitboxTopRight;
if (hitboxBotLeft < minDist)
minDist = hitboxBotLeft;
if (hitboxBotRight < minDist)
minDist = hitboxBotRight;
return minDist <= 55f * NPC.scale;
}
public override Color? GetAlpha(Color drawColor)
{
Color lightColor = new Color(200, 150, Main.DiscoB, NPC.alpha);
@@ -768,6 +826,31 @@ namespace CalamityMod.NPCs.SlimeGod
return newColor * NPC.Opacity;
}
public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor)
{
SpriteEffects spriteEffects = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
Texture2D texture = TextureAssets.Npc[Type].Value;
Color drawColorAlpha = NPC.GetAlpha(drawColor);
// Stretch based on Y velocity.
float stretch = NPC.velocity.Y * 0.03f;
stretch = Math.Abs(stretch) + addedStretch;
// Stretch rapidly if about to jump or teleport, stretch normally while idle.
if (NPC.velocity.Y == 0f)
stretch += MathHelper.Lerp(0f, 0.16f, (float)Math.Sin(Main.GlobalTimeWrappedHourly * (NPC.aiAction == 1 ? 15f : 2f)) / 2f + 0.5f);
if (stretch > 0.5f)
stretch = 0.5f;
Vector2 scaleStretch = new Vector2(1f - stretch, 1f + stretch) * NPC.scale;
float yOffset = stretch * 0.5f * NPC.height;
spriteBatch.Draw(texture, NPC.Center - screenPos + new Vector2(0f, NPC.gfxOffY - yOffset), NPC.frame, drawColorAlpha, NPC.rotation, NPC.frame.Size() * 0.5f, scaleStretch, spriteEffects, 0f);
return false;
}
public override void OnKill()
{
int heartAmt = Main.rand.Next(3) + 3;
Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

@@ -330,24 +330,27 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
if (npc.type == NPCID.TheDestroyer)
{
// Spawn segments from head
if (npc.ai[0] == 0f)
if (Main.netMode != NetmodeID.MultiplayerClient)
{
npc.ai[3] = npc.whoAmI;
npc.realLife = npc.whoAmI;
int index = npc.whoAmI;
for (int j = 0; j <= totalSegments; j++)
if (npc.ai[0] == 0f)
{
int type = NPCID.TheDestroyerBody;
if (j == totalSegments)
type = NPCID.TheDestroyerTail;
npc.ai[3] = npc.whoAmI;
npc.realLife = npc.whoAmI;
int index = npc.whoAmI;
for (int j = 0; j <= totalSegments; j++)
{
int type = NPCID.TheDestroyerBody;
if (j == totalSegments)
type = NPCID.TheDestroyerTail;
int segment = NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X), (int)(npc.position.Y + npc.height), type, npc.whoAmI);
Main.npc[segment].ai[3] = npc.whoAmI;
Main.npc[segment].realLife = npc.whoAmI;
Main.npc[segment].ai[1] = index;
Main.npc[index].ai[0] = segment;
NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, segment);
index = segment;
int segment = NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X), (int)(npc.position.Y + npc.height), type, npc.whoAmI);
Main.npc[segment].ai[3] = npc.whoAmI;
Main.npc[segment].realLife = npc.whoAmI;
Main.npc[segment].ai[1] = index;
Main.npc[index].ai[0] = segment;
NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, segment);
index = segment;
}
}
}
+10 -10
View File
@@ -57,7 +57,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
else if (hoverRotation > MathHelper.TwoPi)
hoverRotation -= MathHelper.TwoPi;
float rotationRate = 0.1f;
float rotationRate = 0.15f;
npc.rotation = npc.rotation.AngleTowards(hoverRotation, rotationRate);
if (Main.rand.NextBool(5))
@@ -251,7 +251,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
}
Vector2 laserVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * laserSpeed;
Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + laserVelocity.SafeNormalize(Vector2.UnitY) * 150f, laserVelocity, type, damage, 0f, Main.myPlayer);
Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + laserVelocity.SafeNormalize(Vector2.UnitY) * 90f, laserVelocity, type, damage, 0f, Main.myPlayer);
}
}
}
@@ -387,7 +387,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
int numProj = shootLaser ? 6 : 2;
int spread = shootLaser ? 20 : 80;
float rotation = MathHelper.ToRadians(spread);
float offset = shootLaser ? 150f : 50f;
float offset = shootLaser ? 90f : 50f;
for (int i = 0; i < numProj; i++)
{
Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1)));
@@ -535,7 +535,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
}
Vector2 laserVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * laserSpeed;
Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + laserVelocity.SafeNormalize(Vector2.UnitY) * 150f, laserVelocity, type, damage, 0f, Main.myPlayer);
Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + laserVelocity.SafeNormalize(Vector2.UnitY) * 120f, laserVelocity, type, damage, 0f, Main.myPlayer);
}
}
}
@@ -592,7 +592,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
}
Vector2 laserVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * laserSpeed;
Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + laserVelocity.SafeNormalize(Vector2.UnitY) * 150f, laserVelocity, type, damage, 0f, Main.myPlayer);
Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + laserVelocity.SafeNormalize(Vector2.UnitY) * 120f, laserVelocity, type, damage, 0f, Main.myPlayer);
}
}
}
@@ -688,7 +688,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
}
Vector2 laserDartVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * laserDartSpeed;
Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + npc.velocity.SafeNormalize(Vector2.UnitY) * 50f, laserDartVelocity, type, damage, 0f, Main.myPlayer);
Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + npc.velocity.SafeNormalize(Vector2.UnitY) * 60f, laserDartVelocity, type, damage, 0f, Main.myPlayer);
}
}
}
@@ -1851,7 +1851,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
num423 += (float)Main.rand.Next(-inaccuracy, inaccuracy + 1) * 0.08f;
Vector2 laserVelocity = new Vector2(num422, num423);
Projectile.NewProjectile(npc.GetSource_FromAI(), vector43 + laserVelocity.SafeNormalize(Vector2.UnitY) * 150f, laserVelocity, type, damage, 0f, Main.myPlayer);
Projectile.NewProjectile(npc.GetSource_FromAI(), vector43 + laserVelocity.SafeNormalize(Vector2.UnitY) * 90f, laserVelocity, type, damage, 0f, Main.myPlayer);
}
}
}
@@ -1990,7 +1990,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
for (int i = 0; i < numProj; i++)
{
Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1)));
int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 150f, perturbedSpeed, type, damage, 0f, Main.myPlayer);
int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 90f, perturbedSpeed, type, damage, 0f, Main.myPlayer);
Main.projectile[proj].tileCollide = false;
}
}
@@ -2169,7 +2169,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
num441 *= num442;
Vector2 laserVelocity = new Vector2(num440, num441);
Projectile.NewProjectile(npc.GetSource_FromAI(), vector45 + laserVelocity.SafeNormalize(Vector2.UnitY) * 150f, laserVelocity, type, damage, 0f, Main.myPlayer);
Projectile.NewProjectile(npc.GetSource_FromAI(), vector45 + laserVelocity.SafeNormalize(Vector2.UnitY) * 120f, laserVelocity, type, damage, 0f, Main.myPlayer);
}
return false;
@@ -2260,7 +2260,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
num451 *= num452;
Vector2 laserVelocity = new Vector2(num450, num451);
Projectile.NewProjectile(npc.GetSource_FromAI(), vector46 + laserVelocity.SafeNormalize(Vector2.UnitY) * 150f, laserVelocity, type, damage, 0f, Main.myPlayer);
Projectile.NewProjectile(npc.GetSource_FromAI(), vector46 + laserVelocity.SafeNormalize(Vector2.UnitY) * 120f, laserVelocity, type, damage, 0f, Main.myPlayer);
}
}
+133
View File
@@ -0,0 +1,133 @@
using System;
using CalamityMod.Buffs.DamageOverTime;
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.Boss
{
public class FoveanatorEnergyBomb : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Boss";
private const int TotalXFrames = 2;
private const int TotalYFrames = 8;
private const int ExplodeFrames = 6;
private const int ExplodeDamageStartFrame = 3;
private const int FrameTimer = 6;
public int frameX = 0;
public int frameY = 0;
public int CurrentFrame
{
get => frameX * TotalYFrames + frameY;
set
{
frameX = value / TotalYFrames;
frameY = value % TotalYFrames;
}
}
private const int TimeLeft = 300;
private const int ExplodeTime = TimeLeft - FrameTimer * ExplodeFrames;
private const float ExplodeDistance = 50f;
public override void SetDefaults()
{
Projectile.width = 133;
Projectile.height = 142;
Projectile.hostile = true;
Projectile.ignoreWater = true;
Projectile.tileCollide = false;
Projectile.penetrate = -1;
Projectile.timeLeft = TimeLeft;
}
public override void AI()
{
// Get a target and calculate distance from it.
int target = Player.FindClosest(Projectile.Center, 1, 1);
float distanceFromTarget = (Main.player[target].Center - Projectile.Center).Length();
// Explode when within a certain distance of the target.
if (distanceFromTarget <= ExplodeDistance && Projectile.timeLeft > ExplodeTime)
Projectile.timeLeft = ExplodeTime;
bool explode = Projectile.timeLeft <= ExplodeTime;
// Stop immediately if explosion is triggered.
if (explode && Projectile.velocity.Length() > 0f)
Projectile.velocity = Vector2.Zero;
// Reset the frame counter and frameY when explosion is triggered.
if (Projectile.timeLeft == ExplodeTime)
{
Projectile.frameCounter = 0;
frameY = 0;
}
// Explosion noise when actually exploding.
if (frameY == ExplodeDamageStartFrame && explode && Projectile.localAI[0] == 0f)
{
Projectile.localAI[0] = 1f;
SoundEngine.PlaySound(DeusMine.ExplodeSound, Projectile.Center);
}
Projectile.frameCounter++;
if (Projectile.frameCounter % FrameTimer == 0)
{
CurrentFrame++;
// Non-explosion uses the left side of the sheet, explosion uses the right side of the sheet.
frameX = explode ? 1 : 0;
// Kill the projectile when the explosion animation is done.
if (explode && frameY >= ExplodeFrames)
{
Projectile.Kill();
return;
}
}
// Explosion has brighter light.
float redLight = explode ? 1.2f : 0.6f;
float greenLight = explode ? 0.3f : 0.15f;
float blueLight = (Main.DiscoB / 255f) * (explode ? 1.5f : 0.75f);
Lighting.AddLight(Projectile.Center, redLight, greenLight, blueLight);
}
public override bool PreDraw(ref Color lightColor) => false;
public override void PostDraw(Color lightColor)
{
if (Projectile.frameCounter < 5)
return;
lightColor.R = (byte)(255 * Projectile.Opacity);
lightColor.G = (byte)(255 * Projectile.Opacity);
lightColor.B = (byte)(255 * Projectile.Opacity);
Texture2D texture = TextureAssets.Projectile[Projectile.type].Value;
Vector2 position = Projectile.Center - Main.screenPosition;
Vector2 origin = texture.Size() / new Vector2(TotalXFrames, TotalYFrames) * 0.5f;
Rectangle frame = texture.Frame(TotalXFrames, TotalYFrames, frameX, frameY);
Main.EntitySpriteDraw(texture, position, frame, Color.White, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None);
}
public override bool CanHitPlayer(Player target) => Projectile.timeLeft <= ExplodeTime && frameY >= ExplodeDamageStartFrame;
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, ExplodeDistance, targetHitbox);
public override void OnHitPlayer(Player target, Player.HurtInfo info)
{
if (Projectile.timeLeft <= ExplodeTime)
target.AddBuff(BuffID.Frostburn, 180);
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

+100
View File
@@ -0,0 +1,100 @@
using System;
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.NPCs.TownNPCs;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Boss
{
public class FoveanatorLaser : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Boss";
private const int FadeOutTime = 30;
private const float Acceleration = 1.05f;
private const float MaxVelocity = 24f;
public override void SetStaticDefaults()
{
Main.projFrames[Projectile.type] = 4;
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2;
ProjectileID.Sets.TrailingMode[Projectile.type] = 0;
}
public override void SetDefaults()
{
Projectile.width = 16;
Projectile.height = 16;
Projectile.hostile = true;
Projectile.ignoreWater = true;
Projectile.Opacity = 0f;
Projectile.penetrate = -1;
Projectile.timeLeft = 300;
}
public override void AI()
{
Projectile.frameCounter++;
if (Projectile.frameCounter > 4)
{
Projectile.frame++;
Projectile.frameCounter = 0;
}
if (Projectile.frame > 3)
Projectile.frame = 0;
if (Projectile.velocity.Length() < MaxVelocity)
{
Projectile.velocity *= Acceleration;
if (Projectile.velocity.Length() > MaxVelocity)
{
Projectile.velocity.Normalize();
Projectile.velocity *= MaxVelocity;
}
}
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2;
Lighting.AddLight(Projectile.Center, 0.4f * Projectile.Opacity, 0.1f * Projectile.Opacity, (Main.DiscoB / 255f) * 0.5f * Projectile.Opacity);
if (Projectile.timeLeft < FadeOutTime)
{
Projectile.Opacity -= 1f / FadeOutTime;
}
else if (Projectile.Opacity < 1f)
{
Projectile.Opacity += 0.25f;
if (Projectile.Opacity > 1f)
Projectile.Opacity = 1f;
}
}
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.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1);
return false;
}
public override bool CanHitPlayer(Player target) => Projectile.timeLeft >= FadeOutTime;
public override void OnHitPlayer(Player target, Player.HurtInfo info)
{
if (Projectile.timeLeft >= FadeOutTime)
target.AddBuff(BuffID.Frostburn, 90);
}
public override bool OnTileCollide(Vector2 oldVelocity)
{
Collision.HitTiles(Projectile.Center, Projectile.velocity, Projectile.width, Projectile.height);
SoundEngine.PlaySound(SoundID.Item10, Projectile.position);
return true;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 605 B

+2 -2
View File
@@ -48,9 +48,8 @@ namespace CalamityMod.Projectiles.Boss
Projectile.frameCounter = 0;
}
if (Projectile.frame > 3)
{
Projectile.frame = 0;
}
if (Math.Abs(Projectile.velocity.X) >= 3f || Math.Abs(Projectile.velocity.Y) >= 3f)
{
float randDustXVel = 0f;
@@ -81,6 +80,7 @@ namespace CalamityMod.Projectiles.Boss
Main.dust[smoke].noGravity = true;
Main.dust[smoke].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2 - 6)).RotatedBy((double)Projectile.rotation, default) * 1.1f;
}
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2;
}
+6 -1
View File
@@ -11,6 +11,7 @@ namespace CalamityMod.Projectiles.Boss
public class UnstableEbonianGlob : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Boss";
public override void SetDefaults()
{
Projectile.Calamity().DealsDefenseDamage = true;
@@ -28,9 +29,13 @@ namespace CalamityMod.Projectiles.Boss
public override void AI()
{
if (Projectile.velocity.Length() < 12f && (Main.expertMode || BossRushEvent.BossRushActive))
if (Projectile.velocity.Length() < 12f && (Main.expertMode || BossRushEvent.BossRushActive || Projectile.ai[0] == 1f))
{
float velocityMult = BossRushEvent.BossRushActive ? 1.025f : CalamityWorld.death ? 1.015f : CalamityWorld.revenge ? 1.0125f : Main.expertMode ? 1.01f : 1.005f;
if (Projectile.ai[0] == 1f)
velocityMult += 0.02f;
Projectile.velocity *= velocityMult;
}