1 - Bloodletting Servant charge.

2 - Cirrus vanity = girl noises.
3 - Scourge sand splash correction.
This commit is contained in:
mountaindrew10 committed 2024-05-09 14:38:47 -05:00
1 parent f008687510
commit adea6fda6f
3 files changed
+182 -70

No files matched your search

+1 -1
View File
@@ -1621,7 +1621,7 @@ namespace CalamityMod.CalPlayer
SoundEngine.PlaySound(SoundID.NPCHit4, Player.Center); //metal hit noise
hurtSoundTimer = 10;
}
else if ((aquaticHeartPower || aquaticHeartForce) && !aquaticHeartHide)
else if (((aquaticHeartPower || aquaticHeartForce) && !aquaticHeartHide) || Player.GetModPlayer<CrystalHeartVodkaPlayer>().vanityEquipped)
{
modifiers.DisableSound();
SoundEngine.PlaySound(SoundID.FemaleHit, Player.Center); //female hit noise
+4 -6
View File
@@ -259,12 +259,11 @@ namespace CalamityMod.NPCs.DesertScourge
{
if (NPC.localAI[3] == 0f)
{
Vector2 topCenter = new Vector2(NPC.Center.X, NPC.Top.Y);
Point headTileCenter = topCenter.ToTileCoordinates();
Point headTileCenter = NPC.Top.ToTileCoordinates();
Tile tileSafely = Framing.GetTileSafely(headTileCenter);
bool inSolidTile = tileSafely.HasUnactuatedTile;
bool finsInSolidTile = Framing.GetTileSafely(Main.npc[(int)NPC.ai[0]].Center.ToTileCoordinates()).HasUnactuatedTile;
if (!inSolidTile && finsInSolidTile && Collision.CanHit(topCenter, 1, 1, player.Center, 1, 1))
if (!inSolidTile && finsInSolidTile && Collision.CanHit(NPC.Top, 1, 1, player.Center, 1, 1))
{
NPC.localAI[3] = 1f;
SoundEngine.PlaySound(SoundID.Item74, NPC.Center);
@@ -301,11 +300,10 @@ namespace CalamityMod.NPCs.DesertScourge
{
if (NPC.localAI[3] == 0f)
{
Vector2 topCenter = new Vector2(NPC.Center.X, NPC.Top.Y);
Point headTileCenter = new Vector2(NPC.Center.X, NPC.Bottom.Y).ToTileCoordinates();
Point headTileCenter = NPC.Bottom.ToTileCoordinates();
Tile tileSafely = Framing.GetTileSafely(headTileCenter);
bool inSolidTile = tileSafely.HasUnactuatedTile;
if (inSolidTile && Collision.CanHit(topCenter, 1, 1, player.Center, 1, 1))
if (inSolidTile && Collision.CanHit(NPC.Top, 1, 1, player.Center, 1, 1))
{
NPC.localAI[3] = 1f;
SoundEngine.PlaySound(SoundID.Item74, NPC.Center);
+177 -63
View File
@@ -4,8 +4,10 @@ using CalamityMod.NPCs.VanillaNPCAIOverrides.RegularEnemies;
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;
@@ -15,9 +17,15 @@ namespace CalamityMod.NPCs.NormalNPCs
{
public override string Texture => $"Terraria/Images/NPC_{NPCID.WanderingEye}";
private const float ChargeGateValue = 180f;
private const float ChargeTelegraphGateValue = 90f;
private const float ChargeDuration = 60f;
private const float ChargeDuration_Death = 50f;
public override void SetStaticDefaults()
{
Main.npcFrameCount[NPC.type] = 4;
Main.npcFrameCount[Type] = 4;
NPCID.Sets.TrailingMode[Type] = 1;
NPCID.Sets.NPCBestiaryDrawModifiers bestiaryData = new NPCID.Sets.NPCBestiaryDrawModifiers() { Hide = true };
NPCID.Sets.NPCBestiaryDrawOffset.Add(Type, bestiaryData);
}
@@ -52,25 +60,15 @@ namespace CalamityMod.NPCs.NormalNPCs
public override void AI()
{
Lighting.AddLight(NPC.Center, 0.8f, 0f, 0f);
NPC.TargetClosest();
Player target = Main.player[NPC.target];
Vector2 lookAt = target.Center - NPC.Center;
if (lookAt.X > 0f)
{
NPC.spriteDirection = 1;
NPC.rotation = (float)Math.Atan2(lookAt.Y, lookAt.X);
}
if (lookAt.X < 0f)
{
NPC.spriteDirection = -1;
NPC.rotation = (float)Math.Atan2(lookAt.Y, lookAt.X) + MathHelper.Pi;
}
Lighting.AddLight(NPC.Center, 0.8f, 0f, 0f);
bool targetDead = target.dead;
bool phase2 = NPC.life < NPC.lifeMax * 0.5;
float enrageScale = 1f + NPC.ai[2];
float enrageScaleMaxSpeedBonus = 2f * enrageScale;
float maxSpeedX = (phase2 ? (CalamityWorld.death ? 10f : 8f) : (CalamityWorld.death ? 8f : 6f)) + enrageScaleMaxSpeedBonus;
float maxSpeedY = (phase2 ? (CalamityWorld.death ? 8f : 6f) : (CalamityWorld.death ? 4f : 3f)) + enrageScaleMaxSpeedBonus;
@@ -81,43 +79,140 @@ namespace CalamityMod.NPCs.NormalNPCs
float yAccelBoost1 = maxSpeedY * 0.01f;
float yAccelBoost2 = maxSpeedY * 0.0075f;
if (target.dead)
float chargeVelocity = 12f + enrageScaleMaxSpeedBonus * 2f;
bool attemptingToCharge = NPC.ai[0] >= ChargeGateValue;
bool farEnoughForCharge = NPC.Distance(target.Center) >= 320f;
bool closeEnoughForCharge = NPC.Distance(target.Center) < 480f;
bool charging = (attemptingToCharge && farEnoughForCharge && closeEnoughForCharge) || NPC.ai[1] > 0f;
float projectileShootGateValue = CalamityWorld.death ? 180f : 270f;
if (Main.getGoodWorld)
projectileShootGateValue *= 0.5f;
Vector2 lookAt = target.Center - NPC.Center;
float rateOfRotation = charging ? 0f : 0.1f;
float chargeDuration = CalamityWorld.death ? ChargeDuration_Death : ChargeDuration;
if (charging)
{
if (NPC.ai[1] == 0f)
{
SoundEngine.PlaySound(SoundID.NPCDeath9, NPC.Center);
NPC.velocity = lookAt.SafeNormalize(Vector2.UnitY) * chargeVelocity;
NPC.spriteDirection = lookAt.X < 0f ? -1 : 1;
NPC.rotation = NPC.velocity.ToRotation() + (lookAt.X < 0f ? MathHelper.Pi : 0f);
NPC.ai[1] = 1f;
if (NPC.ai[3] > projectileShootGateValue * 0.5f)
NPC.ai[3] = projectileShootGateValue * 0.5f;
NPC.netUpdate = true;
NPC.netSpam = 0;
}
if (NPC.ai[1] < ChargeDuration + 1f)
{
NPC.ai[1] += 1f;
if (NPC.ai[1] > ChargeDuration + 1f - 10f)
NPC.velocity *= 0.8f;
if (NPC.ai[1] >= ChargeDuration + 1f)
{
NPC.ai[0] = 0f;
NPC.ai[1] = 0f;
NPC.netUpdate = true;
NPC.netSpam = 0;
}
}
}
else
{
if (lookAt.X > 0f)
{
NPC.spriteDirection = 1;
NPC.rotation = (float)Math.Atan2(lookAt.Y, lookAt.X);
}
if (lookAt.X < 0f)
{
NPC.spriteDirection = -1;
NPC.rotation = (float)Math.Atan2(lookAt.Y, lookAt.X) + MathHelper.Pi;
}
}
if (phase2)
{
NPC.damage = (int)Math.Round(NPC.defDamage * 1.3);
if (NPC.ai[0] < ChargeGateValue && !targetDead)
{
NPC.ai[0] += 1f;
if (NPC.ai[0] == ChargeGateValue)
{
NPC.netUpdate = true;
NPC.netSpam = 0;
}
}
}
else
NPC.damage = NPC.defDamage;
if (targetDead)
{
NPC.velocity.Y -= 0.04f;
if (NPC.timeLeft > 10)
NPC.timeLeft = 10;
}
else
else if (!attemptingToCharge)
{
DemonEyeAI.DemonEyeBatMovement(NPC, maxSpeedX, maxSpeedY, xAccel, xAccelBoost1, xAccelBoost2, yAccel, yAccelBoost1, yAccelBoost2);
if (phase2)
NPC.damage = (int)Math.Round(NPC.defDamage * 1.3);
else
NPC.damage = NPC.defDamage;
if (!target.dead)
NPC.ai[3] += enrageScale;
float projectileShootGateValue = CalamityWorld.death ? 180f : 270f;
if (Main.getGoodWorld)
projectileShootGateValue *= 0.5f;
bool shootProjectile = Collision.CanHitLine(NPC.Center, 1, 1, target.Center, 1, 1) && Vector2.Distance(NPC.Center, target.Center) > 240f;
if (NPC.ai[3] >= projectileShootGateValue && shootProjectile)
{
NPC.ai[3] = 0f;
float projectileSpeed = CalamityWorld.death ? 16f : 12f;
Vector2 projectileVelocity = NPC.SafeDirectionTo(target.Center) * projectileSpeed;
if (Main.netMode != NetmodeID.MultiplayerClient)
bool shootProjectile = Collision.CanHitLine(NPC.Center, 1, 1, target.Center, 1, 1) && Vector2.Distance(NPC.Center, target.Center) > 240f;
if (NPC.ai[3] >= projectileShootGateValue && shootProjectile)
{
int projType = ProjectileID.BloodShot;
int projDamage = NPC.GetProjectileDamage(projType);
int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * 10f, projectileVelocity, projType, projDamage, 0f, Main.myPlayer);
Main.projectile[proj].timeLeft = 600;
NPC.ai[3] = 0f;
float projectileSpeed = CalamityWorld.death ? 16f : 12f;
Vector2 projectileVelocity = NPC.SafeDirectionTo(target.Center) * projectileSpeed;
if (Main.netMode != NetmodeID.MultiplayerClient)
{
int projType = ProjectileID.BloodShot;
int projDamage = NPC.GetProjectileDamage(projType);
int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * 10f, projectileVelocity, projType, projDamage, 0f, Main.myPlayer);
Main.projectile[proj].timeLeft = 600;
}
NPC.netUpdate = true;
NPC.netSpam = 0;
}
NPC.netUpdate = true;
float pushVelocity = 0.2f * enrageScale;
for (int i = 0; i < Main.maxNPCs; i++)
{
if (Main.npc[i].active)
{
if (i != NPC.whoAmI && Main.npc[i].type == NPC.type)
{
if (Vector2.Distance(NPC.Center, Main.npc[i].Center) < 48f * NPC.scale)
{
if (NPC.position.X < Main.npc[i].position.X)
NPC.velocity.X -= pushVelocity;
else
NPC.velocity.X += pushVelocity;
if (NPC.position.Y < Main.npc[i].position.Y)
NPC.velocity.Y -= pushVelocity;
else
NPC.velocity.Y += pushVelocity;
}
}
}
}
}
else if (!charging)
{
Vector2 destination = target.Center + new Vector2(-280f * NPC.spriteDirection, -280f);
Vector2 desiredVelocity = NPC.SafeDirectionTo(destination, -Vector2.UnitY) * chargeVelocity;
NPC.SimpleFlyMovement(desiredVelocity, enrageScale);
}
if (Main.rand.NextBool(20))
@@ -127,29 +222,6 @@ namespace CalamityMod.NPCs.NormalNPCs
blood.velocity.X *= 0.5f;
blood.velocity.Y *= 0.1f;
}
float pushVelocity = 0.2f * enrageScale;
for (int i = 0; i < Main.maxNPCs; i++)
{
if (Main.npc[i].active)
{
if (i != NPC.whoAmI && Main.npc[i].type == NPC.type)
{
if (Vector2.Distance(NPC.Center, Main.npc[i].Center) < 48f * NPC.scale)
{
if (NPC.position.X < Main.npc[i].position.X)
NPC.velocity.X -= pushVelocity;
else
NPC.velocity.X += pushVelocity;
if (NPC.position.Y < Main.npc[i].position.Y)
NPC.velocity.Y -= pushVelocity;
else
NPC.velocity.Y += pushVelocity;
}
}
}
}
}
public override void FindFrame(int frameHeight)
@@ -169,6 +241,48 @@ namespace CalamityMod.NPCs.NormalNPCs
NPC.frame.Y += frameHeight * 2;
}
public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor)
{
if (NPC.ai[0] >= ChargeTelegraphGateValue)
{
Texture2D npcTexture = TextureAssets.Npc[NPC.type].Value;
Color originalColor = NPC.GetAlpha(drawColor);
Color newColor = new Color(255, 128, 128, 255 - NPC.alpha);
Vector2 drawPosition = NPC.Center - screenPos + new Vector2(0, NPC.gfxOffY);
Vector2 origin = NPC.frame.Size() / 2;
SpriteEffects spriteEffects = SpriteEffects.None;
if (NPC.spriteDirection == 1)
spriteEffects = SpriteEffects.FlipHorizontally;
float telegraphScalar = MathHelper.Clamp((NPC.ai[0] - ChargeTelegraphGateValue) / ChargeTelegraphGateValue, 0f, 1f);
Color telegraphColor = Color.Lerp(originalColor, newColor, telegraphScalar);
if (CalamityConfig.Instance.Afterimages && NPC.ai[1] > 0f)
{
int afterimageAmount = 10;
int afterImageIncrement = 2;
for (int j = 0; j < afterimageAmount; j += afterImageIncrement)
{
Color afterimageColor = telegraphColor;
afterimageColor = Color.Lerp(afterimageColor, originalColor, 0.5f);
afterimageColor = NPC.GetAlpha(afterimageColor);
afterimageColor *= (afterimageAmount - j) / 15f;
Vector2 afterimagePos = NPC.oldPos[j] + new Vector2(NPC.width, NPC.height) / 2f - screenPos;
afterimagePos -= new Vector2(npcTexture.Width, npcTexture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f;
afterimagePos += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(npcTexture, afterimagePos, NPC.frame, afterimageColor, NPC.rotation, origin, NPC.scale, spriteEffects, 0f);
}
}
spriteBatch.Draw(npcTexture, drawPosition, NPC.frame, telegraphColor, NPC.rotation, origin, NPC.scale, spriteEffects, 0f);
return false;
}
return true;
}
public override Color? GetAlpha(Color drawColor) => new Color(128, 0, 0, 255 - NPC.alpha);
public override void HitEffect(NPC.HitInfo hit)