1 - T Hanos adjustments.

2 - Fixed some laser issues.
This commit is contained in:
Andrew Marheine committed 2021-06-30 05:12:29 -05:00
1 parent b61f9ed6e5
commit fdfdd6410c
10 files changed
+52 -51

No files matched your search

+3 -4
View File
@@ -332,17 +332,16 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
if (vulnerable)
{
// Noise
float volume = calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge ? 0.25f : 1f;
float volume = calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge ? 0.15f : 1f;
if (npc.localAI[0] == 0f)
Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ThanatosVent").WithVolume(volume), npc.Center);
// Steam
float maxSteamTime = 180f;
npc.localAI[0] += 1f;
if (npc.localAI[0] < maxSteamTime)
if (npc.localAI[0] < ThanatosHead.ventDuration)
{
SmokeDrawer.BaseMoveRotation = npc.rotation - MathHelper.PiOver2;
SmokeDrawer.ParticleSpawnRate = 3;
SmokeDrawer.ParticleSpawnRate = ThanatosHead.ventCloudSpawnRate;
}
}
else
+3 -4
View File
@@ -332,17 +332,16 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
if (vulnerable)
{
// Noise
float volume = calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge ? 0.25f : 1f;
float volume = calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge ? 0.15f : 1f;
if (npc.localAI[0] == 0f)
Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ThanatosVent").WithVolume(volume), npc.Center);
// Steam
float maxSteamTime = 180f;
npc.localAI[0] += 1f;
if (npc.localAI[0] < maxSteamTime)
if (npc.localAI[0] < ThanatosHead.ventDuration)
{
SmokeDrawer.BaseMoveRotation = npc.rotation - MathHelper.PiOver2;
SmokeDrawer.ParticleSpawnRate = 3;
SmokeDrawer.ParticleSpawnRate = ThanatosHead.ventCloudSpawnRate;
}
}
else
+20 -14
View File
@@ -52,6 +52,12 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
// Whether the head is venting heat or not, it is vulnerable to damage during venting
private bool vulnerable = false;
// Max time in vent phase
public const float ventDuration = 180f;
// Spawn rate for vent clouds
public const int ventCloudSpawnRate = 5;
// Default life ratio for the other mechs
private const float defaultLifeRatio = 5f;
@@ -315,11 +321,11 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
// Phase gate values
float velocityAdjustTime = 20f;
float speedUpTime = 480f;
float slowDownTime = 120f;
float speedUpTime = berserk ? 360f : 480f;
float slowDownTime = berserk ? 90f : 120f;
float chargePhaseGateValue = speedUpTime + slowDownTime;
float laserBarrageDuration = 420f;
float laserBarrageDuration = berserk ? 330f : 420f;
// Adjust opacity
bool invisiblePhase = SecondaryAIState == (float)SecondaryPhase.PassiveAndImmune;
@@ -361,8 +367,8 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
float turnDegrees = baseVelocity * 0.11f;
if (berserk)
{
baseVelocity *= 1.2f;
turnDegrees *= 1.2f;
baseVelocity *= 1.25f;
turnDegrees *= 1.25f;
}
float turnSpeed = MathHelper.ToRadians(turnDegrees);
float chargeVelocityMult = MathHelper.Lerp(1f, 1.5f, chargeVelocityScalar);
@@ -380,7 +386,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
float deathrayVelocityScalarIncrement = 1f / deathrayDuration;
// Scalar to use during laser barrage, passive and immune phases
float laserBarrageVelocityScalarIncrement = 0.01f;
float laserBarrageVelocityScalarIncrement = berserk ? 0.02f : 0.01f;
float laserBarrageVelocityScalarDecrement = 1f / velocityAdjustTime;
// Distance from target
@@ -547,7 +553,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
calamityGlobalNPC.newAI[3] += 1f;
if (calamityGlobalNPC.newAI[3] >= velocityAdjustTime)
{
npc.localAI[0] = /*berserk ? 1f : 0f*/ 1f;
npc.localAI[0] = (berserk || otherExoMechsAlive == 0) ? 1f : 0f;
AIState = (float)Phase.Charge;
calamityGlobalNPC.newAI[2] = 0f;
calamityGlobalNPC.newAI[3] = 0f;
@@ -567,7 +573,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
vulnerable = true;
// If close enough to the target, prepare to fire deathray
bool readyToFireDeathray = distanceFromTarget < 800f;
bool readyToFireDeathray = distanceFromTarget < 960f;
if (readyToFireDeathray)
npc.localAI[2] = 1f;
@@ -599,8 +605,9 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
// Gradually turn and move slower if within 50 tiles of the target
if (npc.localAI[2] == 1f)
{
baseVelocity *= distanceFromTarget / 800f;
turnSpeed *= distanceFromTarget / 800f;
float velocityScale = distanceFromTarget / 960f;
baseVelocity *= velocityScale;
turnSpeed *= velocityScale;
if (calamityGlobalNPC.newAI[2] < deathrayTelegraphDuration)
{
@@ -638,7 +645,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
{
int type = ModContent.ProjectileType<ExoDestroyerBeamStart>();
int damage = npc.GetProjectileDamage(type);
int laser = Projectile.NewProjectile(npc.Center, Vector2.Zero, type, damage, 0f, 255, npc.whoAmI);
int laser = Projectile.NewProjectile(npc.Center, Vector2.Zero, type, damage, 0f, Main.myPlayer, npc.whoAmI);
if (Main.projectile.IndexInRange(laser))
Main.projectile[laser].ai[0] = npc.whoAmI;
}
@@ -680,12 +687,11 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ThanatosVent"), npc.Center);
// Steam
float maxSteamTime = 180f;
npc.localAI[1] += 1f;
if (npc.localAI[1] < maxSteamTime)
if (npc.localAI[1] < ventDuration)
{
SmokeDrawer.BaseMoveRotation = npc.rotation - MathHelper.PiOver2;
SmokeDrawer.ParticleSpawnRate = 3;
SmokeDrawer.ParticleSpawnRate = ventCloudSpawnRate;
}
}
else
+3 -4
View File
@@ -331,17 +331,16 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
if (vulnerable)
{
// Noise
float volume = calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge ? 0.25f : 1f;
float volume = calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge ? 0.15f : 1f;
if (npc.localAI[0] == 0f)
Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ThanatosVent").WithVolume(volume), npc.Center);
// Steam
float maxSteamTime = 180f;
npc.localAI[0] += 1f;
if (npc.localAI[0] < maxSteamTime)
if (npc.localAI[0] < ThanatosHead.ventDuration)
{
SmokeDrawer.BaseMoveRotation = npc.rotation - MathHelper.PiOver2;
SmokeDrawer.ParticleSpawnRate = 3;
SmokeDrawer.ParticleSpawnRate = ThanatosHead.ventCloudSpawnRate;
}
}
else
+2 -2
View File
@@ -142,7 +142,7 @@ namespace CalamityMod.Projectiles.Boss
if (num223 > 0f)
{
float num224 = 0f;
Rectangle rectangle7 = new Rectangle(0, 16 * (projectile.timeLeft / 3 % 5), texture.Width, 16);
Rectangle rectangle7 = new Rectangle(0, 0, texture.Width, texture.Height);
while (num224 + 1f < num223)
{
if (num223 - num224 < rectangle7.Height)
@@ -152,7 +152,7 @@ namespace CalamityMod.Projectiles.Boss
spriteBatch.Draw(texture, value20 - Main.screenPosition, new Rectangle?(rectangle7), color44, projectile.rotation, new Vector2(rectangle7.Width / 2, 0f), projectile.scale, SpriteEffects.None, 0f);
num224 += rectangle7.Height * projectile.scale;
value20 += projectile.velocity * rectangle7.Height * projectile.scale;
rectangle7.Y += 16;
rectangle7.Y += texture.Height;
if (rectangle7.Y + rectangle7.Height > texture.Height)
{
rectangle7.Y = 0;
+2 -2
View File
@@ -173,7 +173,7 @@ namespace CalamityMod.Projectiles.Boss
if (num223 > 0f)
{
float num224 = 0f;
Rectangle rectangle7 = new Rectangle(0, 16 * (projectile.timeLeft / 3 % 5), texture2D20.Width, 16);
Rectangle rectangle7 = new Rectangle(0, 0, texture2D20.Width, texture2D20.Height);
while (num224 + 1f < num223)
{
if (num223 - num224 < rectangle7.Height)
@@ -183,7 +183,7 @@ namespace CalamityMod.Projectiles.Boss
spriteBatch.Draw(texture2D20, value20 - Main.screenPosition, new Rectangle?(rectangle7), color44, projectile.rotation, new Vector2(rectangle7.Width / 2, 0f), projectile.scale, SpriteEffects.None, 0f);
num224 += rectangle7.Height * projectile.scale;
value20 += projectile.velocity * rectangle7.Height * projectile.scale;
rectangle7.Y += 16;
rectangle7.Y += texture2D20.Height;
if (rectangle7.Y + rectangle7.Height > texture2D20.Height)
{
rectangle7.Y = 0;
+15 -17
View File
@@ -24,14 +24,13 @@ namespace CalamityMod.Projectiles.Boss
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Thanatos Deathray");
Main.projFrames[projectile.type] = 4;
}
public override void SetDefaults()
{
projectile.Calamity().canBreakPlayerDefense = true;
projectile.width = 32;
projectile.height = 32;
projectile.width = 30;
projectile.height = 30;
projectile.hostile = true;
projectile.alpha = 255;
projectile.penetrate = -1;
@@ -71,7 +70,7 @@ namespace CalamityMod.Projectiles.Boss
Vector2 hostNPCDirection = Vector2.Normalize(ThingToAttachTo.velocity);
// Offset to move the beam forward so that it starts inside the NPC's mouth.
float beamStartForwardsOffset = -18f;
float beamStartForwardsOffset = -8f;
// Set the starting location of the beam to the center of the NPC.
projectile.Center = ThingToAttachTo.Center;
@@ -80,11 +79,6 @@ namespace CalamityMod.Projectiles.Boss
// Add the forwards offset, measured in pixels.
projectile.position += hostNPCDirection * beamStartForwardsOffset;
projectile.rotation = ThingToAttachTo.velocity.ToRotation();
Time++;
float scale = 1f;
Time++;
if (Time >= Lifetime)
{
@@ -92,13 +86,16 @@ namespace CalamityMod.Projectiles.Boss
return;
}
projectile.scale = (float)Math.Sin(Time * MathHelper.Pi / Lifetime) * 10f * scale;
float scale = 1f;
projectile.scale = (float)Math.Sin(Time * MathHelper.Pi / Lifetime) * 10f * scale;
if (projectile.scale > scale)
projectile.scale = scale;
projectile.rotation = ThingToAttachTo.velocity.ToRotation();
projectile.velocity = projectile.rotation.ToRotationVector2();
projectile.rotation = ThingToAttachTo.velocity.ToRotation() - MathHelper.PiOver2;
float arraySize = 3f;
Vector2 samplingPoint = projectile.Center;
float[] samples = new float[(int)arraySize];
@@ -121,6 +118,7 @@ namespace CalamityMod.Projectiles.Boss
float divisor = expertMode ? 80f : 160f;
if (ThingToAttachTo.Calamity().newAI[2] % divisor == 0f && projectile.owner == Main.myPlayer)
{
Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), ThingToAttachTo.Center);
Vector2 velocity = projectile.velocity;
velocity.Normalize();
float distanceBetweenProjectiles = malice ? 160f : death ? 256f : revenge ? 288f : 320f;
@@ -134,7 +132,7 @@ namespace CalamityMod.Projectiles.Boss
float radians = MathHelper.TwoPi / totalProjectiles;
for (int j = 0; j < totalProjectiles; j++)
{
Vector2 projVelocity = projectile.velocity.RotatedBy(radians * j + MathHelper.PiOver2);
Vector2 projVelocity = projectile.velocity.RotatedBy(radians * j + MathHelper.PiOver2) * 12f;
Projectile.NewProjectile(fireFrom, projVelocity, type, damage, 0f, Main.myPlayer, 0f, -1f);
}
fireFrom += velocity * distanceBetweenProjectiles;
@@ -197,11 +195,11 @@ namespace CalamityMod.Projectiles.Boss
Texture2D beamEnd = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/ExoDestroyerBeamEnd");
float drawLength = LengthOfLaser;
Color color = new Color(250, 0, 0, 0);
Color color = new Color(250, 100, 100, 0);
// Draw start of beam
Vector2 vector = projectile.Center - Main.screenPosition;
Rectangle? sourceRectangle = new Rectangle(0, 16 * (projectile.timeLeft / Main.projFrames[projectile.type] % 5), beamStart.Width, 16);
Rectangle? sourceRectangle = new Rectangle(0, 30 * (projectile.timeLeft / 3 % 4), beamStart.Width, 30);
spriteBatch.Draw(beamStart, vector, sourceRectangle, color, projectile.rotation, beamStart.Size() / 2f, projectile.scale, SpriteEffects.None, 0f);
// Draw middle of beam
@@ -211,7 +209,7 @@ namespace CalamityMod.Projectiles.Boss
if (drawLength > 0f)
{
float i = 0f;
Rectangle rectangle = new Rectangle(0, 16 * (projectile.timeLeft / Main.projFrames[projectile.type] % 5), beamMiddle.Width, 16);
Rectangle rectangle = new Rectangle(0, 30 * (projectile.timeLeft / 3 % 4), beamMiddle.Width, 30);
while (i + 1f < drawLength)
{
if (drawLength - i < rectangle.Height)
@@ -222,7 +220,7 @@ namespace CalamityMod.Projectiles.Boss
i += rectangle.Height * projectile.scale;
center += projectile.velocity * rectangle.Height * projectile.scale;
rectangle.Y += 16;
rectangle.Y += 30;
if (rectangle.Y + rectangle.Height > beamMiddle.Height)
rectangle.Y = 0;
}
@@ -230,7 +228,7 @@ namespace CalamityMod.Projectiles.Boss
// Draw end of beam
Vector2 vector2 = center - Main.screenPosition;
sourceRectangle = new Rectangle(0, 16 * (projectile.timeLeft / Main.projFrames[projectile.type] % 5), beamEnd.Width, 16);
sourceRectangle = new Rectangle(0, 30 * (projectile.timeLeft / 3 % 4), beamEnd.Width, 30);
spriteBatch.Draw(beamEnd, vector2, sourceRectangle, color, projectile.rotation, beamEnd.Frame(1, 1, 0, 0).Top(), projectile.scale, SpriteEffects.None, 0f);
return false;
@@ -249,7 +247,7 @@ namespace CalamityMod.Projectiles.Boss
return true;
float collisionPoint = 0f;
if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity * LengthOfLaser, 22f * projectile.scale, ref collisionPoint))
if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity * LengthOfLaser, 30f * projectile.scale, ref collisionPoint))
return true;
return false;
@@ -56,7 +56,7 @@ namespace CalamityMod.Projectiles.Boss
Vector2 hostNPCDirection = Vector2.Normalize(ThingToAttachTo.velocity);
// Offset to move the beam forward so that it starts inside the NPC's mouth.
float beamStartForwardsOffset = -18f;
float beamStartForwardsOffset = -8f;
// Set the starting location of the beam to the center of the NPC.
projectile.Center = ThingToAttachTo.Center;
+1 -1
View File
@@ -237,7 +237,7 @@ namespace CalamityMod.Projectiles.Boss
public override Color? GetAlpha(Color lightColor)
{
return new Color(255, 255, 255, projectile.alpha);
return new Color(255, 100, 100, projectile.alpha);
}
public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit)
+2 -2
View File
@@ -158,7 +158,7 @@ namespace CalamityMod.Projectiles.Boss
if (num223 > 0f)
{
float num224 = 0f;
Rectangle rectangle7 = new Rectangle(0, 16 * (projectile.timeLeft / 3 % 5), texture2D20.Width, 16);
Rectangle rectangle7 = new Rectangle(0, 36 * (projectile.timeLeft / 3 % 4), texture2D20.Width, 36);
while (num224 + 1f < num223)
{
if (num223 - num224 < rectangle7.Height)
@@ -168,7 +168,7 @@ namespace CalamityMod.Projectiles.Boss
Main.spriteBatch.Draw(texture2D20, value20 - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(rectangle7), color44, projectile.rotation, new Vector2(rectangle7.Width / 2, 0f), projectile.scale, SpriteEffects.None, 0f);
num224 += rectangle7.Height * projectile.scale;
value20 += projectile.velocity * rectangle7.Height * projectile.scale;
rectangle7.Y += 16;
rectangle7.Y += 36;
if (rectangle7.Y + rectangle7.Height > texture2D20.Height)
{
rectangle7.Y = 0;