1 - DoG and Yharon contact damage fairness.
2 - I changed my mind about the Duke-like boss spin attacks, I've made them deal 0 contact damage.
This commit is contained in:
1 parent
9c42fca711
commit
4b7c51cea8
9 files changed
+353
-184
No files matched your search
@@ -920,9 +920,6 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs
|
||||
// Set velocity for spin
|
||||
else if (phase2AttackPicker == 2)
|
||||
{
|
||||
// Set damage
|
||||
npc.damage = setDamage;
|
||||
|
||||
// Velocity and rotation
|
||||
npc.velocity = Vector2.Normalize(player.Center - npc.Center) * spinAttackSpeed;
|
||||
npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X);
|
||||
@@ -1038,7 +1035,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs
|
||||
else if (npc.ai[0] == 7f)
|
||||
{
|
||||
// Set damage
|
||||
npc.damage = setDamage;
|
||||
npc.damage = 0;
|
||||
|
||||
// Play sounds and spawn Tooth Balls and a Vortex
|
||||
if (npc.ai[2] == 0f)
|
||||
@@ -1344,9 +1341,6 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs
|
||||
// Set velocity for spin
|
||||
else if (phase3AttackPicker == 4)
|
||||
{
|
||||
// Set damage
|
||||
npc.damage = setDamage;
|
||||
|
||||
// Velocity and rotation
|
||||
npc.velocity = Vector2.Normalize(player.Center - npc.Center) * spinAttackSpeed;
|
||||
npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X);
|
||||
@@ -1583,7 +1577,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs
|
||||
else if (npc.ai[0] == 14f)
|
||||
{
|
||||
// Set damage
|
||||
npc.damage = setDamage;
|
||||
npc.damage = 0;
|
||||
|
||||
// Play sounds and spawn Tooth Balls and a Vortex
|
||||
if (npc.ai[2] == 0f)
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Events;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System.IO;
|
||||
@@ -137,6 +139,21 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
NPC.position.X = NPC.position.X + targetX;
|
||||
NPC.position.Y = NPC.position.Y + targetY;
|
||||
}
|
||||
|
||||
// Calculate contact damage based on velocity
|
||||
float segmentVelocity = BossRushEvent.BossRushActive ? 30f : CalamityWorld.revenge ? 25f : 23f;
|
||||
float minimalContactDamageVelocity = segmentVelocity * 0.25f;
|
||||
float minimalDamageVelocity = segmentVelocity * 0.5f;
|
||||
float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length();
|
||||
if (bodyAndTailVelocity <= minimalContactDamageVelocity)
|
||||
{
|
||||
NPC.damage = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f);
|
||||
NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar);
|
||||
}
|
||||
}
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor)
|
||||
|
||||
@@ -178,8 +178,9 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
Vector2 segmentDirection = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f);
|
||||
float dogHeadX = Main.npc[CalamityGlobalNPC.DoGHead].position.X + (Main.npc[CalamityGlobalNPC.DoGHead].width / 2);
|
||||
float dogHeadY = Main.npc[CalamityGlobalNPC.DoGHead].position.Y + (Main.npc[CalamityGlobalNPC.DoGHead].height / 2);
|
||||
float maxDistanceFromDoG = BossRushEvent.BossRushActive ? 30f : CalamityWorld.revenge ? 25f : 23f;
|
||||
float segmentVelocity = BossRushEvent.BossRushActive ? 30f : CalamityWorld.revenge ? 25f : 23f;
|
||||
float velocityMult = BossRushEvent.BossRushActive ? 0.9f : CalamityWorld.revenge ? 0.75f : 0.23f;
|
||||
float maxDistanceFromDoGHead = 160f;
|
||||
|
||||
if (increaseSpeedMore)
|
||||
velocityMult *= 4f;
|
||||
@@ -191,18 +192,18 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
if (Main.npc[i].active && (Main.npc[i].type == NPC.type || Main.npc[i].type == ModContent.NPCType<DevourerofGodsHead>()) && i != NPC.whoAmI)
|
||||
{
|
||||
Vector2 distFromHead = Main.npc[i].Center - NPC.Center;
|
||||
if (distFromHead.Length() < 400f)
|
||||
if (distFromHead.Length() < maxDistanceFromDoGHead)
|
||||
{
|
||||
distFromHead.Normalize();
|
||||
distFromHead *= 400f;
|
||||
distFromHead *= maxDistanceFromDoGHead;
|
||||
dogHeadX -= distFromHead.X;
|
||||
dogHeadY -= distFromHead.Y;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
float higherMaxDistance = maxDistanceFromDoG * 1.3f;
|
||||
float lowerMaxDistance = maxDistanceFromDoG * 0.7f;
|
||||
float higherMaxDistance = segmentVelocity * 1.3f;
|
||||
float lowerMaxDistance = segmentVelocity * 0.7f;
|
||||
float npcSpeed = NPC.velocity.Length();
|
||||
if (npcSpeed > 0f)
|
||||
{
|
||||
@@ -227,7 +228,7 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
float targetDistance = (float)Math.Sqrt(dogHeadX * dogHeadX + dogHeadY * dogHeadY);
|
||||
float absoluteDoGX = Math.Abs(dogHeadX);
|
||||
float absoluteDoGY = Math.Abs(dogHeadY);
|
||||
float timeToReachTarget = maxDistanceFromDoG / targetDistance;
|
||||
float timeToReachTarget = segmentVelocity / targetDistance;
|
||||
dogHeadX *= timeToReachTarget;
|
||||
dogHeadY *= timeToReachTarget;
|
||||
if ((NPC.velocity.X > 0f && dogHeadX > 0f) || (NPC.velocity.X < 0f && dogHeadX < 0f) || (NPC.velocity.Y > 0f && dogHeadY > 0f) || (NPC.velocity.Y < 0f && dogHeadY < 0f))
|
||||
@@ -254,7 +255,7 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
NPC.velocity.Y = NPC.velocity.Y - velocityMult;
|
||||
}
|
||||
}
|
||||
if (Math.Abs(dogHeadY) < maxDistanceFromDoG * 0.2 && ((NPC.velocity.X > 0f && dogHeadX < 0f) || (NPC.velocity.X < 0f && dogHeadX > 0f)))
|
||||
if (Math.Abs(dogHeadY) < segmentVelocity * 0.2 && ((NPC.velocity.X > 0f && dogHeadX < 0f) || (NPC.velocity.X < 0f && dogHeadX > 0f)))
|
||||
{
|
||||
if (NPC.velocity.Y > 0f)
|
||||
{
|
||||
@@ -265,7 +266,7 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
NPC.velocity.Y = NPC.velocity.Y - velocityMult * 2f;
|
||||
}
|
||||
}
|
||||
if (Math.Abs(dogHeadX) < maxDistanceFromDoG * 0.2 && ((NPC.velocity.Y > 0f && dogHeadY < 0f) || (NPC.velocity.Y < 0f && dogHeadY > 0f)))
|
||||
if (Math.Abs(dogHeadX) < segmentVelocity * 0.2 && ((NPC.velocity.Y > 0f && dogHeadY < 0f) || (NPC.velocity.Y < 0f && dogHeadY > 0f)))
|
||||
{
|
||||
if (NPC.velocity.X > 0f)
|
||||
{
|
||||
@@ -289,7 +290,7 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
{
|
||||
NPC.velocity.X = NPC.velocity.X - velocityMult * 1.1f; //changed from 1.1
|
||||
}
|
||||
if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < maxDistanceFromDoG * 0.5)
|
||||
if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < segmentVelocity * 0.5)
|
||||
{
|
||||
if (NPC.velocity.Y > 0f)
|
||||
{
|
||||
@@ -311,7 +312,7 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
{
|
||||
NPC.velocity.Y = NPC.velocity.Y - velocityMult * 1.1f;
|
||||
}
|
||||
if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < maxDistanceFromDoG * 0.5)
|
||||
if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < segmentVelocity * 0.5)
|
||||
{
|
||||
if (NPC.velocity.X > 0f)
|
||||
{
|
||||
@@ -324,7 +325,21 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
}
|
||||
}
|
||||
}
|
||||
NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X) + 1.57f;
|
||||
|
||||
// Calculate contact damage based on velocity
|
||||
float minimalContactDamageVelocity = segmentVelocity * 0.25f;
|
||||
float minimalDamageVelocity = segmentVelocity * 0.5f;
|
||||
if (NPC.velocity.Length() <= minimalContactDamageVelocity)
|
||||
{
|
||||
NPC.damage = (int)(NPC.defDamage * 0.5f);
|
||||
}
|
||||
else
|
||||
{
|
||||
float velocityDamageScalar = MathHelper.Clamp((NPC.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f);
|
||||
NPC.damage = (int)MathHelper.Lerp(NPC.defDamage * 0.5f, NPC.defDamage, velocityDamageScalar);
|
||||
}
|
||||
|
||||
NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X) + MathHelper.PiOver2;
|
||||
}
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor)
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Events;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System.IO;
|
||||
@@ -134,6 +136,21 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
NPC.position.X = NPC.position.X + targetX;
|
||||
NPC.position.Y = NPC.position.Y + targetY;
|
||||
}
|
||||
|
||||
// Calculate contact damage based on velocity
|
||||
float segmentVelocity = BossRushEvent.BossRushActive ? 30f : CalamityWorld.revenge ? 25f : 23f;
|
||||
float minimalContactDamageVelocity = segmentVelocity * 0.25f;
|
||||
float minimalDamageVelocity = segmentVelocity * 0.5f;
|
||||
float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length();
|
||||
if (bodyAndTailVelocity <= minimalContactDamageVelocity)
|
||||
{
|
||||
NPC.damage = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f);
|
||||
NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar);
|
||||
}
|
||||
}
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor)
|
||||
|
||||
@@ -140,7 +140,10 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
if (NPC.life > Main.npc[(int)NPC.ai[1]].life)
|
||||
NPC.life = Main.npc[(int)NPC.ai[1]].life;
|
||||
|
||||
bool phase2 = NPC.life / (float)NPC.lifeMax < 0.6f;
|
||||
// Percent life remaining
|
||||
float lifeRatio = NPC.life / (float)NPC.lifeMax;
|
||||
|
||||
bool phase2 = lifeRatio < 0.6f;
|
||||
bool bossRush = BossRushEvent.BossRushActive;
|
||||
bool expertMode = Main.expertMode || bossRush;
|
||||
bool revenge = CalamityWorld.revenge || bossRush;
|
||||
@@ -330,6 +333,27 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
NPC.rotation = directionToNextSegment.ToRotation() + MathHelper.PiOver2;
|
||||
NPC.Center = aheadSegment.Center - directionToNextSegment.SafeNormalize(Vector2.Zero) * NPC.scale * NPC.width;
|
||||
NPC.spriteDirection = (directionToNextSegment.X > 0).ToDirectionInt();
|
||||
|
||||
// Velocity variables
|
||||
float segmentVelocity = bossRush ? 19f : death ? 17.5f : 16f;
|
||||
if (expertMode)
|
||||
segmentVelocity += 4f * (1f - lifeRatio);
|
||||
if (Main.getGoodWorld)
|
||||
segmentVelocity *= 1.1f;
|
||||
|
||||
// Calculate contact damage based on velocity
|
||||
float minimalContactDamageVelocity = segmentVelocity * 0.25f;
|
||||
float minimalDamageVelocity = segmentVelocity * 0.5f;
|
||||
float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length();
|
||||
if (bodyAndTailVelocity <= minimalContactDamageVelocity)
|
||||
{
|
||||
NPC.damage = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f);
|
||||
NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar);
|
||||
}
|
||||
}
|
||||
|
||||
private bool AnyTeleportRifts()
|
||||
|
||||
@@ -392,9 +392,9 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
extrapitch = Main.zenithWorld ? 0.3f : 0f;
|
||||
|
||||
// Velocity variables
|
||||
float fallSpeed = bossRush ? 19f : death ? 17.5f : 16f;
|
||||
float segmentVelocity = bossRush ? 19f : death ? 17.5f : 16f;
|
||||
if (expertMode)
|
||||
fallSpeed += 4f * (1f - lifeRatio);
|
||||
segmentVelocity += 4f * (1f - lifeRatio);
|
||||
|
||||
float speed = bossRush ? 18f : death ? 16.5f : 15f;
|
||||
float turnSpeed = bossRush ? 0.36f : death ? 0.33f : 0.3f;
|
||||
@@ -418,7 +418,7 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
|
||||
if (Main.getGoodWorld)
|
||||
{
|
||||
fallSpeed *= 1.1f;
|
||||
segmentVelocity *= 1.1f;
|
||||
speed *= 1.1f;
|
||||
turnSpeed *= 1.1f;
|
||||
homingSpeed *= 1.1f;
|
||||
@@ -1054,6 +1054,8 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
// Charge in a direction for a second until the timer is back at 0
|
||||
if (postTeleportTimer > 0)
|
||||
{
|
||||
NPC.damage = NPC.defDamage;
|
||||
|
||||
NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X) + MathHelper.PiOver2;
|
||||
return;
|
||||
}
|
||||
@@ -1271,6 +1273,8 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
// Charge in a direction for a second until the timer is back at 0
|
||||
if (postTeleportTimer > 0)
|
||||
{
|
||||
NPC.damage = NPC.defDamage;
|
||||
|
||||
NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X) + MathHelper.PiOver2;
|
||||
return;
|
||||
}
|
||||
@@ -1291,7 +1295,7 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
if (CalamityWorld.LegendaryMode && revenge)
|
||||
{
|
||||
if (NPC.SafeDirectionTo(player.Center).AngleBetween((NPC.rotation - MathHelper.PiOver2).ToRotationVector2()) < MathHelper.ToRadians(10f))
|
||||
fallSpeed *= 2f;
|
||||
segmentVelocity *= 2f;
|
||||
}
|
||||
|
||||
if (!flies)
|
||||
@@ -1365,17 +1369,17 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
if (!flies)
|
||||
{
|
||||
NPC.velocity.Y += groundPhaseTurnSpeed;
|
||||
if (NPC.velocity.Y > fallSpeed)
|
||||
NPC.velocity.Y = fallSpeed;
|
||||
if (NPC.velocity.Y > segmentVelocity)
|
||||
NPC.velocity.Y = segmentVelocity;
|
||||
|
||||
if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < fallSpeed * 2.2)
|
||||
if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < segmentVelocity * 2.2)
|
||||
{
|
||||
if (NPC.velocity.X < 0f)
|
||||
NPC.velocity.X -= turnSpeedCopy * 1.1f;
|
||||
else
|
||||
NPC.velocity.X += turnSpeedCopy * 1.1f;
|
||||
}
|
||||
else if (NPC.velocity.Y == fallSpeed)
|
||||
else if (NPC.velocity.Y == segmentVelocity)
|
||||
{
|
||||
if (NPC.velocity.X < targetX)
|
||||
NPC.velocity.X += turnSpeedCopy;
|
||||
@@ -1404,7 +1408,7 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
float targetDistance = (float)Math.Sqrt(targetX * targetX + targetY * targetY);
|
||||
float absoluteTargetX2 = Math.Abs(targetX);
|
||||
float absoluteTargetY2 = Math.Abs(targetY);
|
||||
float timeToReachTarget2 = fallSpeed / targetDistance;
|
||||
float timeToReachTarget2 = segmentVelocity / targetDistance;
|
||||
targetX *= timeToReachTarget2;
|
||||
targetY *= timeToReachTarget2;
|
||||
|
||||
@@ -1433,7 +1437,7 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
else if (NPC.velocity.Y > targetY)
|
||||
NPC.velocity.Y -= groundPhaseTurnSpeed;
|
||||
|
||||
if (Math.Abs(targetY) < fallSpeed * maximumSpeed1 && ((NPC.velocity.X > 0f && targetX < 0f) || (NPC.velocity.X < 0f && targetX > 0f)))
|
||||
if (Math.Abs(targetY) < segmentVelocity * maximumSpeed1 && ((NPC.velocity.X > 0f && targetX < 0f) || (NPC.velocity.X < 0f && targetX > 0f)))
|
||||
{
|
||||
if (NPC.velocity.Y > 0f)
|
||||
NPC.velocity.Y += groundPhaseTurnSpeed * 2f;
|
||||
@@ -1441,7 +1445,7 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
NPC.velocity.Y -= groundPhaseTurnSpeed * 2f;
|
||||
}
|
||||
|
||||
if (Math.Abs(targetX) < fallSpeed * maximumSpeed1 && ((NPC.velocity.Y > 0f && targetY < 0f) || (NPC.velocity.Y < 0f && targetY > 0f)))
|
||||
if (Math.Abs(targetX) < segmentVelocity * maximumSpeed1 && ((NPC.velocity.Y > 0f && targetY < 0f) || (NPC.velocity.Y < 0f && targetY > 0f)))
|
||||
{
|
||||
if (NPC.velocity.X > 0f)
|
||||
NPC.velocity.X += groundPhaseTurnSpeed * 2f;
|
||||
@@ -1456,7 +1460,7 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
else if (NPC.velocity.X > targetX)
|
||||
NPC.velocity.X -= groundPhaseTurnSpeed * 1.1f;
|
||||
|
||||
if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < fallSpeed * maximumSpeed2)
|
||||
if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < segmentVelocity * maximumSpeed2)
|
||||
{
|
||||
if (NPC.velocity.Y > 0f)
|
||||
NPC.velocity.Y += groundPhaseTurnSpeed;
|
||||
@@ -1471,7 +1475,7 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
else if (NPC.velocity.Y > targetY)
|
||||
NPC.velocity.Y -= groundPhaseTurnSpeed * 1.1f;
|
||||
|
||||
if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < fallSpeed * maximumSpeed2)
|
||||
if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < segmentVelocity * maximumSpeed2)
|
||||
{
|
||||
if (NPC.velocity.X > 0f)
|
||||
NPC.velocity.X += groundPhaseTurnSpeed;
|
||||
@@ -2055,7 +2059,7 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
if (CalamityWorld.LegendaryMode && revenge)
|
||||
{
|
||||
if (NPC.SafeDirectionTo(player.Center).AngleBetween((NPC.rotation - MathHelper.PiOver2).ToRotationVector2()) < MathHelper.ToRadians(10f))
|
||||
fallSpeed *= 2f;
|
||||
segmentVelocity *= 2f;
|
||||
}
|
||||
|
||||
if (!flies)
|
||||
@@ -2096,7 +2100,7 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
bool canDirectlyCharge = true;
|
||||
if (NPC.position.Y > player.position.Y)
|
||||
{
|
||||
for (int k = 0; k < 255; k++)
|
||||
for (int k = 0; k < Main.maxPlayers; k++)
|
||||
{
|
||||
if (Main.player[k].active)
|
||||
{
|
||||
@@ -2129,17 +2133,17 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
if (!flies)
|
||||
{
|
||||
NPC.velocity.Y += groundPhaseTurnSpeed;
|
||||
if (NPC.velocity.Y > fallSpeed)
|
||||
NPC.velocity.Y = fallSpeed;
|
||||
if (NPC.velocity.Y > segmentVelocity)
|
||||
NPC.velocity.Y = segmentVelocity;
|
||||
|
||||
if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < fallSpeed * 2.2)
|
||||
if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < segmentVelocity * 2.2)
|
||||
{
|
||||
if (NPC.velocity.X < 0f)
|
||||
NPC.velocity.X -= turnSpeedCopy * 1.1f;
|
||||
else
|
||||
NPC.velocity.X += turnSpeedCopy * 1.1f;
|
||||
}
|
||||
else if (NPC.velocity.Y == fallSpeed)
|
||||
else if (NPC.velocity.Y == segmentVelocity)
|
||||
{
|
||||
if (NPC.velocity.X < targetX)
|
||||
NPC.velocity.X += turnSpeedCopy;
|
||||
@@ -2168,7 +2172,7 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
float targetDistance = (float)Math.Sqrt(targetX * targetX + targetY * targetY);
|
||||
float absoluteTargetX2 = Math.Abs(targetX);
|
||||
float absoluteTargetY2 = Math.Abs(targetY);
|
||||
float timeToReachTarget2 = fallSpeed / targetDistance;
|
||||
float timeToReachTarget2 = segmentVelocity / targetDistance;
|
||||
targetX *= timeToReachTarget2;
|
||||
targetY *= timeToReachTarget2;
|
||||
|
||||
@@ -2197,7 +2201,7 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
else if (NPC.velocity.Y > targetY)
|
||||
NPC.velocity.Y -= groundPhaseTurnSpeed;
|
||||
|
||||
if (Math.Abs(targetY) < fallSpeed * maximumSpeed1 && ((NPC.velocity.X > 0f && targetX < 0f) || (NPC.velocity.X < 0f && targetX > 0f)))
|
||||
if (Math.Abs(targetY) < segmentVelocity * maximumSpeed1 && ((NPC.velocity.X > 0f && targetX < 0f) || (NPC.velocity.X < 0f && targetX > 0f)))
|
||||
{
|
||||
if (NPC.velocity.Y > 0f)
|
||||
NPC.velocity.Y += groundPhaseTurnSpeed * 2f;
|
||||
@@ -2205,7 +2209,7 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
NPC.velocity.Y -= groundPhaseTurnSpeed * 2f;
|
||||
}
|
||||
|
||||
if (Math.Abs(targetX) < fallSpeed * maximumSpeed1 && ((NPC.velocity.Y > 0f && targetY < 0f) || (NPC.velocity.Y < 0f && targetY > 0f)))
|
||||
if (Math.Abs(targetX) < segmentVelocity * maximumSpeed1 && ((NPC.velocity.Y > 0f && targetY < 0f) || (NPC.velocity.Y < 0f && targetY > 0f)))
|
||||
{
|
||||
if (NPC.velocity.X > 0f)
|
||||
NPC.velocity.X += groundPhaseTurnSpeed * 2f;
|
||||
@@ -2220,7 +2224,7 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
else if (NPC.velocity.X > targetX)
|
||||
NPC.velocity.X -= groundPhaseTurnSpeed * 1.1f;
|
||||
|
||||
if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < fallSpeed * maximumSpeed2)
|
||||
if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < segmentVelocity * maximumSpeed2)
|
||||
{
|
||||
if (NPC.velocity.Y > 0f)
|
||||
NPC.velocity.Y += groundPhaseTurnSpeed;
|
||||
@@ -2235,7 +2239,7 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
else if (NPC.velocity.Y > targetY)
|
||||
NPC.velocity.Y -= groundPhaseTurnSpeed * 1.1f;
|
||||
|
||||
if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < fallSpeed * maximumSpeed2)
|
||||
if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < segmentVelocity * maximumSpeed2)
|
||||
{
|
||||
if (NPC.velocity.X > 0f)
|
||||
NPC.velocity.X += groundPhaseTurnSpeed;
|
||||
@@ -2305,6 +2309,19 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
}
|
||||
}
|
||||
|
||||
// Calculate contact damage based on velocity
|
||||
float minimalContactDamageVelocity = segmentVelocity * 0.25f;
|
||||
float minimalDamageVelocity = segmentVelocity * 0.5f;
|
||||
if (NPC.velocity.Length() <= minimalContactDamageVelocity)
|
||||
{
|
||||
NPC.damage = (int)(NPC.defDamage * 0.5f);
|
||||
}
|
||||
else
|
||||
{
|
||||
float velocityDamageScalar = MathHelper.Clamp((NPC.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f);
|
||||
NPC.damage = (int)MathHelper.Lerp(NPC.defDamage * 0.5f, NPC.defDamage, velocityDamageScalar);
|
||||
}
|
||||
|
||||
if (NPC.life > Main.npc[(int)NPC.ai[0]].life)
|
||||
NPC.life = Main.npc[(int)NPC.ai[0]].life;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Buffs.StatDebuffs;
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Events;
|
||||
using CalamityMod.Projectiles.Melee.Yoyos;
|
||||
using CalamityMod.Sounds;
|
||||
using CalamityMod.World;
|
||||
@@ -145,7 +146,15 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
if (NPC.life > Main.npc[(int)NPC.ai[1]].life)
|
||||
NPC.life = Main.npc[(int)NPC.ai[1]].life;
|
||||
|
||||
if (NPC.life / (float)NPC.lifeMax < 0.6f)
|
||||
// Percent life remaining
|
||||
float lifeRatio = NPC.life / (float)NPC.lifeMax;
|
||||
|
||||
bool phase2 = lifeRatio < 0.6f;
|
||||
bool bossRush = BossRushEvent.BossRushActive;
|
||||
bool expertMode = Main.expertMode || bossRush;
|
||||
bool death = CalamityWorld.death || bossRush;
|
||||
|
||||
if (phase2)
|
||||
{
|
||||
phase2Started = true;
|
||||
|
||||
@@ -301,6 +310,27 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
else if (playerXDist > 0f)
|
||||
NPC.spriteDirection = 1;
|
||||
}
|
||||
|
||||
// Velocity variables
|
||||
float segmentVelocity = bossRush ? 19f : death ? 17.5f : 16f;
|
||||
if (expertMode)
|
||||
segmentVelocity += 4f * (1f - lifeRatio);
|
||||
if (Main.getGoodWorld)
|
||||
segmentVelocity *= 1.1f;
|
||||
|
||||
// Calculate contact damage based on velocity
|
||||
float minimalContactDamageVelocity = segmentVelocity * 0.25f;
|
||||
float minimalDamageVelocity = segmentVelocity * 0.5f;
|
||||
float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length();
|
||||
if (bodyAndTailVelocity <= minimalContactDamageVelocity)
|
||||
{
|
||||
NPC.damage = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f);
|
||||
NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar);
|
||||
}
|
||||
}
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor)
|
||||
|
||||
@@ -667,9 +667,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
|
||||
// Set velocity for spin
|
||||
else if (phase2AttackPicker == 2)
|
||||
{
|
||||
// Set damage
|
||||
npc.damage = setDamage;
|
||||
|
||||
// Velocity and rotation
|
||||
npc.velocity = Vector2.Normalize(player.Center - npc.Center) * bubbleSpinPhaseVelocity;
|
||||
npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X);
|
||||
@@ -748,7 +745,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
|
||||
else if (npc.ai[0] == 7f)
|
||||
{
|
||||
// Set damage
|
||||
npc.damage = setDamage;
|
||||
npc.damage = 0;
|
||||
|
||||
// Play sounds and spawn bubbles
|
||||
if (npc.ai[2] == 0f)
|
||||
@@ -1729,10 +1726,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
|
||||
break;
|
||||
|
||||
case 2:
|
||||
|
||||
// Set damage
|
||||
npc.damage = setDamage;
|
||||
|
||||
npc.velocity = Vector2.Normalize(player.Center - center) * num18;
|
||||
npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X);
|
||||
if (num31 != 0)
|
||||
@@ -1794,7 +1787,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
|
||||
else if (npc.ai[0] == 7f)
|
||||
{
|
||||
// Set damage
|
||||
npc.damage = setDamage;
|
||||
npc.damage = 0;
|
||||
|
||||
if (npc.ai[2] == 0f)
|
||||
SoundEngine.PlaySound(SoundID.Zombie20, npc.Center);
|
||||
|
||||
+192
-130
@@ -199,10 +199,12 @@ namespace CalamityMod.NPCs.Yharon
|
||||
CalamityGlobalNPC.yharon = NPC.whoAmI;
|
||||
CalamityGlobalNPC.yharonP2 = -1;
|
||||
|
||||
int setDamage = NPC.defDamage;
|
||||
|
||||
// Start phase 2 or not
|
||||
if (startSecondAI)
|
||||
{
|
||||
Yharon_AI2(expertMode, revenge, death, bossRush, pie, lifeRatio, calamityGlobalNPC);
|
||||
Yharon_AI2(expertMode, revenge, death, bossRush, pie, lifeRatio, calamityGlobalNPC, setDamage);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -373,14 +375,11 @@ namespace CalamityMod.NPCs.Yharon
|
||||
{
|
||||
phaseSwitchTimer = 15;
|
||||
protectionBoost = true;
|
||||
NPC.damage = NPC.defDamage * 5;
|
||||
setDamage *= 5;
|
||||
chargeSpeed += 25f;
|
||||
}
|
||||
else
|
||||
{
|
||||
NPC.damage = NPC.defDamage;
|
||||
protectionBoost = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (Main.getGoodWorld)
|
||||
@@ -412,9 +411,6 @@ namespace CalamityMod.NPCs.Yharon
|
||||
}
|
||||
}
|
||||
|
||||
if (bulletHell)
|
||||
NPC.damage = 0;
|
||||
|
||||
NPC.dontTakeDamage = bulletHell;
|
||||
|
||||
// Trigger spawn effects
|
||||
@@ -531,6 +527,9 @@ namespace CalamityMod.NPCs.Yharon
|
||||
// Phase switch
|
||||
else if (NPC.ai[0] == 0f && !player.dead)
|
||||
{
|
||||
// Avoid cheap bullshit
|
||||
NPC.damage = 0;
|
||||
|
||||
if (NPC.ai[1] == 0f)
|
||||
NPC.ai[1] = Math.Sign((NPC.Center - player.Center).X);
|
||||
|
||||
@@ -557,12 +556,6 @@ namespace CalamityMod.NPCs.Yharon
|
||||
NPC.spriteDirection = -NPC.direction;
|
||||
}
|
||||
|
||||
if (phase2Check)
|
||||
{
|
||||
// Avoid cheap bullshit
|
||||
NPC.damage = 0;
|
||||
}
|
||||
|
||||
NPC.ai[2] += 1f;
|
||||
if (NPC.ai[2] >= phaseSwitchTimer)
|
||||
{
|
||||
@@ -592,6 +585,9 @@ namespace CalamityMod.NPCs.Yharon
|
||||
|
||||
if (aiState == 1)
|
||||
{
|
||||
// Set damage
|
||||
NPC.damage = setDamage;
|
||||
|
||||
NPC.ai[0] = 1f;
|
||||
NPC.ai[1] = 0f;
|
||||
NPC.ai[2] = 0f;
|
||||
@@ -633,6 +629,9 @@ namespace CalamityMod.NPCs.Yharon
|
||||
}
|
||||
else if (aiState == 5)
|
||||
{
|
||||
// Set damage
|
||||
NPC.damage = setDamage;
|
||||
|
||||
if (playFastChargeRoarSound)
|
||||
RoarSoundSlot = SoundEngine.PlaySound(RoarSound, NPC.Center);
|
||||
|
||||
@@ -666,6 +665,9 @@ namespace CalamityMod.NPCs.Yharon
|
||||
// Charge
|
||||
else if (NPC.ai[0] == 1f)
|
||||
{
|
||||
// Set damage
|
||||
NPC.damage = setDamage;
|
||||
|
||||
ChargeDust(7, pie);
|
||||
|
||||
NPC.ai[2] += 1f;
|
||||
@@ -683,6 +685,9 @@ namespace CalamityMod.NPCs.Yharon
|
||||
// Fireball breath
|
||||
else if (NPC.ai[0] == 2f)
|
||||
{
|
||||
// Avoid cheap bullshit
|
||||
NPC.damage = 0;
|
||||
|
||||
if (NPC.ai[1] == 0f)
|
||||
NPC.ai[1] = Math.Sign((NPC.Center - player.Center).X);
|
||||
|
||||
@@ -733,6 +738,9 @@ namespace CalamityMod.NPCs.Yharon
|
||||
// Fire tornadoes
|
||||
else if (NPC.ai[0] == 3f)
|
||||
{
|
||||
// Avoid cheap bullshit
|
||||
NPC.damage = 0;
|
||||
|
||||
NPC.velocity *= 0.98f;
|
||||
NPC.velocity.Y = MathHelper.Lerp(NPC.velocity.Y, 0f, 0.02f);
|
||||
|
||||
@@ -784,6 +792,9 @@ namespace CalamityMod.NPCs.Yharon
|
||||
// Fast charge
|
||||
else if (NPC.ai[0] == 5f)
|
||||
{
|
||||
// Set damage
|
||||
NPC.damage = setDamage;
|
||||
|
||||
ChargeDust(14, pie);
|
||||
|
||||
NPC.ai[2] += 1f;
|
||||
@@ -803,6 +814,9 @@ namespace CalamityMod.NPCs.Yharon
|
||||
// Phase switch
|
||||
else if (NPC.ai[0] == 6f && !player.dead)
|
||||
{
|
||||
// Avoid cheap bullshit
|
||||
NPC.damage = 0;
|
||||
|
||||
if (NPC.ai[1] == 0f)
|
||||
NPC.ai[1] = Math.Sign((NPC.Center - player.Center).X);
|
||||
|
||||
@@ -829,12 +843,6 @@ namespace CalamityMod.NPCs.Yharon
|
||||
NPC.spriteDirection = -NPC.direction;
|
||||
}
|
||||
|
||||
if (phase3Check)
|
||||
{
|
||||
// Avoid cheap bullshit
|
||||
NPC.damage = 0;
|
||||
}
|
||||
|
||||
NPC.ai[2] += 1f;
|
||||
if (NPC.ai[2] >= phaseSwitchTimer)
|
||||
{
|
||||
@@ -867,6 +875,9 @@ namespace CalamityMod.NPCs.Yharon
|
||||
|
||||
if (aiState == 1)
|
||||
{
|
||||
// Set damage
|
||||
NPC.damage = setDamage;
|
||||
|
||||
NPC.ai[0] = 7f;
|
||||
NPC.ai[1] = 0f;
|
||||
NPC.ai[2] = 0f;
|
||||
@@ -887,8 +898,6 @@ namespace CalamityMod.NPCs.Yharon
|
||||
}
|
||||
else if (aiState == 2)
|
||||
{
|
||||
NPC.damage = 0;
|
||||
|
||||
if (NPC.Opacity > 0f)
|
||||
{
|
||||
NPC.Opacity -= 0.2f;
|
||||
@@ -954,6 +963,9 @@ namespace CalamityMod.NPCs.Yharon
|
||||
}
|
||||
else if (aiState == 5)
|
||||
{
|
||||
// Set damage
|
||||
NPC.damage = setDamage;
|
||||
|
||||
if (playFastChargeRoarSound)
|
||||
RoarSoundSlot = SoundEngine.PlaySound(RoarSound, NPC.Center);
|
||||
|
||||
@@ -1007,6 +1019,9 @@ namespace CalamityMod.NPCs.Yharon
|
||||
// Charge
|
||||
else if (NPC.ai[0] == 7f)
|
||||
{
|
||||
// Set damage
|
||||
NPC.damage = setDamage;
|
||||
|
||||
ChargeDust(7, pie);
|
||||
|
||||
NPC.ai[2] += 1f;
|
||||
@@ -1024,6 +1039,9 @@ namespace CalamityMod.NPCs.Yharon
|
||||
// Flare Dust bullet hell
|
||||
else if (NPC.ai[0] == 8f)
|
||||
{
|
||||
// Avoid cheap bullshit
|
||||
NPC.damage = 0;
|
||||
|
||||
if (NPC.ai[2] == 0f)
|
||||
{
|
||||
RoarSoundSlot = SoundEngine.PlaySound(RoarSound, NPC.Center);
|
||||
@@ -1055,6 +1073,9 @@ namespace CalamityMod.NPCs.Yharon
|
||||
// Infernado
|
||||
else if (NPC.ai[0] == 9f)
|
||||
{
|
||||
// Avoid cheap bullshit
|
||||
NPC.damage = 0;
|
||||
|
||||
NPC.velocity *= 0.98f;
|
||||
NPC.velocity.Y = MathHelper.Lerp(NPC.velocity.Y, 0f, 0.02f);
|
||||
|
||||
@@ -1103,6 +1124,9 @@ namespace CalamityMod.NPCs.Yharon
|
||||
// Fast charge
|
||||
else if (NPC.ai[0] == 11f)
|
||||
{
|
||||
// Set damage
|
||||
NPC.damage = setDamage;
|
||||
|
||||
ChargeDust(14, pie);
|
||||
|
||||
NPC.ai[2] += 1f;
|
||||
@@ -1120,6 +1144,9 @@ namespace CalamityMod.NPCs.Yharon
|
||||
// Flare Dust circle
|
||||
else if (NPC.ai[0] == 12f)
|
||||
{
|
||||
// Set damage
|
||||
NPC.damage = 0;
|
||||
|
||||
if (NPC.ai[2] == 0f)
|
||||
RoarSoundSlot = SoundEngine.PlaySound(RoarSound, NPC.Center);
|
||||
|
||||
@@ -1158,6 +1185,9 @@ namespace CalamityMod.NPCs.Yharon
|
||||
// Phase switch
|
||||
else if (NPC.ai[0] == 13f && !player.dead)
|
||||
{
|
||||
// Avoid cheap bullshit
|
||||
NPC.damage = 0;
|
||||
|
||||
if (NPC.ai[1] == 0f)
|
||||
NPC.ai[1] = Math.Sign((NPC.Center - player.Center).X);
|
||||
|
||||
@@ -1184,12 +1214,6 @@ namespace CalamityMod.NPCs.Yharon
|
||||
NPC.spriteDirection = -NPC.direction;
|
||||
}
|
||||
|
||||
if (phase4Check)
|
||||
{
|
||||
// Avoid cheap bullshit
|
||||
NPC.damage = 0;
|
||||
}
|
||||
|
||||
NPC.ai[2] += 1f;
|
||||
if (NPC.ai[2] >= phaseSwitchTimer)
|
||||
{
|
||||
@@ -1225,6 +1249,9 @@ namespace CalamityMod.NPCs.Yharon
|
||||
|
||||
if (aiState == 1)
|
||||
{
|
||||
// Set damage
|
||||
NPC.damage = setDamage;
|
||||
|
||||
NPC.ai[0] = 14f;
|
||||
NPC.ai[1] = 0f;
|
||||
NPC.ai[2] = 0f;
|
||||
@@ -1245,8 +1272,6 @@ namespace CalamityMod.NPCs.Yharon
|
||||
}
|
||||
else if (aiState == 2)
|
||||
{
|
||||
NPC.damage = 0;
|
||||
|
||||
if (NPC.Opacity > 0f)
|
||||
{
|
||||
NPC.Opacity -= 0.2f;
|
||||
@@ -1312,6 +1337,9 @@ namespace CalamityMod.NPCs.Yharon
|
||||
}
|
||||
else if (aiState == 5)
|
||||
{
|
||||
// Set damage
|
||||
NPC.damage = setDamage;
|
||||
|
||||
if (playFastChargeRoarSound)
|
||||
RoarSoundSlot = SoundEngine.PlaySound(RoarSound, NPC.Center);
|
||||
|
||||
@@ -1372,6 +1400,9 @@ namespace CalamityMod.NPCs.Yharon
|
||||
// Charge
|
||||
else if (NPC.ai[0] == 14f)
|
||||
{
|
||||
// Set damage
|
||||
NPC.damage = setDamage;
|
||||
|
||||
ChargeDust(7, pie);
|
||||
|
||||
NPC.ai[2] += 1f;
|
||||
@@ -1389,6 +1420,9 @@ namespace CalamityMod.NPCs.Yharon
|
||||
// Flare Dust bullet hell
|
||||
else if (NPC.ai[0] == 15f)
|
||||
{
|
||||
// Avoid cheap bullshit
|
||||
NPC.damage = 0;
|
||||
|
||||
if (NPC.ai[2] == 0f)
|
||||
{
|
||||
RoarSoundSlot = SoundEngine.PlaySound(RoarSound, NPC.Center);
|
||||
@@ -1420,6 +1454,9 @@ namespace CalamityMod.NPCs.Yharon
|
||||
// Infernado
|
||||
else if (NPC.ai[0] == 16f)
|
||||
{
|
||||
// Avoid cheap bullshit
|
||||
NPC.damage = 0;
|
||||
|
||||
NPC.velocity *= 0.98f;
|
||||
NPC.velocity.Y = MathHelper.Lerp(NPC.velocity.Y, 0f, 0.02f);
|
||||
|
||||
@@ -1470,6 +1507,9 @@ namespace CalamityMod.NPCs.Yharon
|
||||
// Fast charge
|
||||
else if (NPC.ai[0] == 18f)
|
||||
{
|
||||
// Set damage
|
||||
NPC.damage = setDamage;
|
||||
|
||||
ChargeDust(14, pie);
|
||||
|
||||
NPC.ai[2] += 1f;
|
||||
@@ -1487,6 +1527,9 @@ namespace CalamityMod.NPCs.Yharon
|
||||
// Fireball ring
|
||||
else if (NPC.ai[0] == 19f)
|
||||
{
|
||||
// Set damage
|
||||
NPC.damage = 0;
|
||||
|
||||
if (NPC.ai[2] == 0f)
|
||||
RoarSoundSlot = SoundEngine.PlaySound(RoarSound, NPC.Center);
|
||||
|
||||
@@ -1523,6 +1566,9 @@ namespace CalamityMod.NPCs.Yharon
|
||||
// Fireball breath
|
||||
else if (NPC.ai[0] == 20f)
|
||||
{
|
||||
// Avoid cheap bullshit
|
||||
NPC.damage = 0;
|
||||
|
||||
if (NPC.ai[1] == 0f)
|
||||
NPC.ai[1] = Math.Sign((NPC.Center - player.Center).X);
|
||||
|
||||
@@ -1573,7 +1619,7 @@ namespace CalamityMod.NPCs.Yharon
|
||||
}
|
||||
|
||||
#region AI2
|
||||
public void Yharon_AI2(bool expertMode, bool revenge, bool death, bool bossRush, float pie, float lifeRatio, CalamityGlobalNPC calamityGlobalNPC)
|
||||
public void Yharon_AI2(bool expertMode, bool revenge, bool death, bool bossRush, float pie, float lifeRatio, CalamityGlobalNPC calamityGlobalNPC, int contactDamage)
|
||||
{
|
||||
CalamityGlobalNPC.yharonP2 = NPC.whoAmI;
|
||||
|
||||
@@ -1601,6 +1647,8 @@ namespace CalamityMod.NPCs.Yharon
|
||||
CalamityUtils.DisplayLocalizedText(key, messageColor);
|
||||
}
|
||||
|
||||
int setDamage = contactDamage;
|
||||
|
||||
NPC.dontTakeDamage = false;
|
||||
|
||||
bool invincible = invincibilityCounter < Phase2InvincibilityTime;
|
||||
@@ -1662,13 +1710,10 @@ namespace CalamityMod.NPCs.Yharon
|
||||
if (enraged)
|
||||
{
|
||||
protectionBoost = true;
|
||||
NPC.damage = NPC.defDamage * 5;
|
||||
setDamage *= 5;
|
||||
}
|
||||
else
|
||||
{
|
||||
protectionBoost = false;
|
||||
NPC.damage = NPC.defDamage;
|
||||
}
|
||||
|
||||
// Set DR based on protection boost (aka enrage)
|
||||
bool bulletHell = NPC.ai[0] == 5f;
|
||||
@@ -1683,12 +1728,6 @@ namespace CalamityMod.NPCs.Yharon
|
||||
{
|
||||
case 1:
|
||||
|
||||
if (phase2)
|
||||
{
|
||||
// Avoid cheap bullshit
|
||||
NPC.damage = 0;
|
||||
}
|
||||
|
||||
calamityGlobalNPC.DR = phase2 ? (bossRush ? 0.99f : 0.7f) : normalDR;
|
||||
calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = phase2;
|
||||
|
||||
@@ -1696,12 +1735,6 @@ namespace CalamityMod.NPCs.Yharon
|
||||
|
||||
case 2:
|
||||
|
||||
if (phase3)
|
||||
{
|
||||
// Avoid cheap bullshit
|
||||
NPC.damage = 0;
|
||||
}
|
||||
|
||||
calamityGlobalNPC.DR = phase3 ? (bossRush ? 0.99f : 0.7f) : normalDR;
|
||||
calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = phase3;
|
||||
|
||||
@@ -1709,12 +1742,6 @@ namespace CalamityMod.NPCs.Yharon
|
||||
|
||||
case 3:
|
||||
|
||||
if (phase4)
|
||||
{
|
||||
// Avoid cheap bullshit
|
||||
NPC.damage = 0;
|
||||
}
|
||||
|
||||
calamityGlobalNPC.DR = phase4 ? (bossRush ? 0.99f : 0.7f) : normalDR;
|
||||
calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = phase4;
|
||||
|
||||
@@ -1728,9 +1755,6 @@ namespace CalamityMod.NPCs.Yharon
|
||||
}
|
||||
}
|
||||
|
||||
if (bulletHell)
|
||||
NPC.damage = 0;
|
||||
|
||||
float reduceSpeedChargeDistance = 500f;
|
||||
float reduceSpeedFireballSpitChargeDistance = 800f;
|
||||
float phaseSwitchTimer = bossRush ? 28f : expertMode ? 30f : 32f;
|
||||
@@ -1790,6 +1814,9 @@ namespace CalamityMod.NPCs.Yharon
|
||||
|
||||
if (NPC.ai[0] == 0f)
|
||||
{
|
||||
// Avoid cheap bullshit
|
||||
NPC.damage = 0;
|
||||
|
||||
NPC.ai[1] += 1f;
|
||||
if (NPC.ai[1] >= 10f)
|
||||
{
|
||||
@@ -1801,6 +1828,9 @@ namespace CalamityMod.NPCs.Yharon
|
||||
}
|
||||
else if (NPC.ai[0] == 1f)
|
||||
{
|
||||
// Avoid cheap bullshit
|
||||
NPC.damage = 0;
|
||||
|
||||
if (NPC.ai[2] == 0f)
|
||||
NPC.ai[2] = (NPC.Center.X < targetData.Center.X) ? 1 : -1;
|
||||
|
||||
@@ -1827,14 +1857,14 @@ namespace CalamityMod.NPCs.Yharon
|
||||
switch ((int)NPC.ai[3])
|
||||
{
|
||||
case 0:
|
||||
phase2AttackType = 8; //teleport
|
||||
phase2AttackType = 8; // Teleport
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
phase2AttackType = 7; //fast charge
|
||||
phase2AttackType = 7; // Fast charge
|
||||
break;
|
||||
case 3:
|
||||
phase2AttackType = 5; //fire circle + tornado (only once) + fireballs
|
||||
phase2AttackType = 5; // Fire circle + tornado (only once) + fireballs
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1843,52 +1873,52 @@ namespace CalamityMod.NPCs.Yharon
|
||||
switch ((int)NPC.ai[3])
|
||||
{
|
||||
case 0:
|
||||
phase2AttackType = 6; //tornado
|
||||
phase2AttackType = 6; // Tornado
|
||||
break;
|
||||
case 1:
|
||||
phase2AttackType = 7; //fast charge
|
||||
phase2AttackType = 7; // Fast charge
|
||||
break;
|
||||
case 2:
|
||||
phase2AttackType = 8; //teleport
|
||||
phase2AttackType = 8; // Teleport
|
||||
break;
|
||||
case 3:
|
||||
phase2AttackType = 7; //fast charge
|
||||
phase2AttackType = 7; // Fast charge
|
||||
break;
|
||||
case 4:
|
||||
phase2AttackType = 5; //fire circle
|
||||
phase2AttackType = 5; // Fire circle
|
||||
break;
|
||||
case 5:
|
||||
phase2AttackType = Main.rand.NextBool() ? 3 : 4; //fireballs
|
||||
phase2AttackType = Main.rand.NextBool() ? 3 : 4; // Fireballs
|
||||
break;
|
||||
case 6:
|
||||
phase2AttackType = 7; //fast charge
|
||||
phase2AttackType = 7; // Fast charge
|
||||
break;
|
||||
case 7:
|
||||
phase2AttackType = 8; //teleport
|
||||
phase2AttackType = 8; // Teleport
|
||||
break;
|
||||
case 8:
|
||||
phase2AttackType = 7; //fast charge
|
||||
phase2AttackType = 7; // Fast charge
|
||||
break;
|
||||
case 9:
|
||||
phase2AttackType = Main.rand.NextBool() ? 4 : 3; //fireballs
|
||||
phase2AttackType = Main.rand.NextBool() ? 4 : 3; // Fireballs
|
||||
break;
|
||||
case 10:
|
||||
phase2AttackType = 6; //tornado
|
||||
phase2AttackType = 6; // Tornado
|
||||
break;
|
||||
case 11:
|
||||
phase2AttackType = 7; //fast charge
|
||||
phase2AttackType = 7; // Fast charge
|
||||
break;
|
||||
case 12:
|
||||
phase2AttackType = 8; //teleport
|
||||
phase2AttackType = 8; // Teleport
|
||||
break;
|
||||
case 13:
|
||||
phase2AttackType = 7; //fast charge
|
||||
phase2AttackType = 7; // Fast charge
|
||||
break;
|
||||
case 14:
|
||||
phase2AttackType = 5; //fire circle
|
||||
phase2AttackType = 5; // Fire circle
|
||||
break;
|
||||
case 15:
|
||||
phase2AttackType = Main.rand.NextBool() ? 3 : 4; //fireballs
|
||||
phase2AttackType = Main.rand.NextBool() ? 3 : 4; // Fireballs
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1897,37 +1927,37 @@ namespace CalamityMod.NPCs.Yharon
|
||||
switch ((int)NPC.ai[3])
|
||||
{
|
||||
case 0:
|
||||
phase2AttackType = 6; //tornado
|
||||
phase2AttackType = 6; // Tornado
|
||||
break;
|
||||
case 1:
|
||||
phase2AttackType = 7; //fast charge
|
||||
phase2AttackType = 7; // Fast charge
|
||||
break;
|
||||
case 2:
|
||||
phase2AttackType = 2; //charge
|
||||
phase2AttackType = 2; // Charge
|
||||
break;
|
||||
case 3:
|
||||
phase2AttackType = 5; //fire circle
|
||||
phase2AttackType = 5; // Fire circle
|
||||
break;
|
||||
case 4:
|
||||
phase2AttackType = Main.rand.NextBool() ? 3 : 4; //fireballs
|
||||
phase2AttackType = Main.rand.NextBool() ? 3 : 4; // Fireballs
|
||||
break;
|
||||
case 5:
|
||||
phase2AttackType = 7; //fast charge
|
||||
phase2AttackType = 7; // Fast charge
|
||||
break;
|
||||
case 6:
|
||||
phase2AttackType = 2; //charge
|
||||
phase2AttackType = 2; // Charge
|
||||
break;
|
||||
case 7:
|
||||
phase2AttackType = Main.rand.NextBool() ? 4 : 3; //fireballs
|
||||
phase2AttackType = Main.rand.NextBool() ? 4 : 3; // Fireballs
|
||||
break;
|
||||
case 8:
|
||||
phase2AttackType = 7; //fast charge
|
||||
phase2AttackType = 7; // Fast charge
|
||||
break;
|
||||
case 9:
|
||||
phase2AttackType = 2; //charge
|
||||
phase2AttackType = 2; // Charge
|
||||
break;
|
||||
case 10:
|
||||
phase2AttackType = 5; //fire circle
|
||||
phase2AttackType = 5; // Fire circle
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1936,34 +1966,35 @@ namespace CalamityMod.NPCs.Yharon
|
||||
switch ((int)NPC.ai[3])
|
||||
{
|
||||
case 0:
|
||||
phase2AttackType = 6; //tornado
|
||||
phase2AttackType = 6; // Tornado
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
phase2AttackType = 2; //charge
|
||||
phase2AttackType = 2; // Charge
|
||||
break;
|
||||
case 3:
|
||||
phase2AttackType = Main.rand.NextBool() ? 3 : 4; //fireballs
|
||||
phase2AttackType = Main.rand.NextBool() ? 3 : 4; // Fireballs
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
phase2AttackType = 7; //fast charge
|
||||
phase2AttackType = 7; // Fast charge
|
||||
break;
|
||||
case 6:
|
||||
phase2AttackType = Main.rand.NextBool() ? 4 : 3; //fireballs
|
||||
phase2AttackType = Main.rand.NextBool() ? 4 : 3; // Fireballs
|
||||
break;
|
||||
case 7:
|
||||
case 8:
|
||||
phase2AttackType = 2; //charge
|
||||
phase2AttackType = 2; // Charge
|
||||
break;
|
||||
case 9:
|
||||
phase2AttackType = 5; //fire circle
|
||||
phase2AttackType = 5; // Fire circle
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (phase2AttackType == 5 && NPC.ai[1] < phaseSwitchTimer + teleportPhaseTimer)
|
||||
{
|
||||
// Avoid cheap bullshit
|
||||
NPC.damage = 0;
|
||||
|
||||
float newRotation = NPC.AngleTo(targetData.Center);
|
||||
@@ -2027,6 +2058,9 @@ namespace CalamityMod.NPCs.Yharon
|
||||
|
||||
if (phase2AttackType == 7 && doFastChargeTelegraph)
|
||||
{
|
||||
// Avoid cheap bullshit
|
||||
NPC.damage = 0;
|
||||
|
||||
float newRotation = NPC.AngleTo(targetData.Center);
|
||||
float amount = 0.04f;
|
||||
|
||||
@@ -2062,6 +2096,7 @@ namespace CalamityMod.NPCs.Yharon
|
||||
NPC.ai[3] = Main.rand.Next(11);
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
if (phase3)
|
||||
{
|
||||
@@ -2072,6 +2107,7 @@ namespace CalamityMod.NPCs.Yharon
|
||||
NPC.ai[3] = Main.rand.Next(16);
|
||||
}
|
||||
break;
|
||||
|
||||
case 3:
|
||||
if (phase4)
|
||||
{
|
||||
@@ -2099,49 +2135,57 @@ namespace CalamityMod.NPCs.Yharon
|
||||
|
||||
switch (phase2AttackType)
|
||||
{
|
||||
case 2: //charge
|
||||
{
|
||||
Vector2 vector = NPC.SafeDirectionTo(targetData.Center, Vector2.UnitX * NPC.spriteDirection);
|
||||
NPC.spriteDirection = (vector.X > 0f) ? 1 : -1;
|
||||
NPC.rotation = vector.ToRotation();
|
||||
case 2: // Charge
|
||||
{
|
||||
// Set damage
|
||||
NPC.damage = setDamage;
|
||||
|
||||
Vector2 vector = NPC.SafeDirectionTo(targetData.Center, Vector2.UnitX * NPC.spriteDirection);
|
||||
NPC.spriteDirection = (vector.X > 0f) ? 1 : -1;
|
||||
NPC.rotation = vector.ToRotation();
|
||||
|
||||
if (NPC.spriteDirection == -1)
|
||||
NPC.rotation += pie;
|
||||
if (NPC.spriteDirection == -1)
|
||||
NPC.rotation += pie;
|
||||
|
||||
NPC.velocity = vector * chargeSpeed;
|
||||
NPC.velocity = vector * chargeSpeed;
|
||||
|
||||
break;
|
||||
}
|
||||
case 3: //fireballs
|
||||
{
|
||||
Vector2 fireSpitFaceDirection = new Vector2((targetData.Center.X > NPC.Center.X) ? 1 : -1, 0f);
|
||||
NPC.spriteDirection = (fireSpitFaceDirection.X > 0f) ? 1 : -1;
|
||||
NPC.velocity = fireSpitFaceDirection * -2f;
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 5: //spin move
|
||||
{
|
||||
NPC.damage = 0;
|
||||
NPC.dontTakeDamage = true;
|
||||
NPC.localAI[3] = Main.rand.Next(2);
|
||||
NPC.velocity = Vector2.Zero;
|
||||
case 3: // Fireballs
|
||||
{
|
||||
Vector2 fireSpitFaceDirection = new Vector2((targetData.Center.X > NPC.Center.X) ? 1 : -1, 0f);
|
||||
NPC.spriteDirection = (fireSpitFaceDirection.X > 0f) ? 1 : -1;
|
||||
NPC.velocity = fireSpitFaceDirection * -2f;
|
||||
|
||||
break;
|
||||
}
|
||||
case 7: //fast charge
|
||||
{
|
||||
Vector2 vector = NPC.SafeDirectionTo(targetData.Center, Vector2.UnitX * NPC.spriteDirection);
|
||||
NPC.spriteDirection = (vector.X > 0f) ? 1 : -1;
|
||||
NPC.rotation = vector.ToRotation();
|
||||
break;
|
||||
}
|
||||
|
||||
if (NPC.spriteDirection == -1)
|
||||
NPC.rotation += pie;
|
||||
case 5: // Spin move
|
||||
{
|
||||
NPC.dontTakeDamage = true;
|
||||
NPC.localAI[3] = Main.rand.Next(2);
|
||||
NPC.velocity = Vector2.Zero;
|
||||
|
||||
NPC.velocity = vector * chargeSpeed * fastChargeVelocityMultiplier;
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 7: // Fast charge
|
||||
{
|
||||
// Set damage
|
||||
NPC.damage = setDamage;
|
||||
|
||||
Vector2 vector = NPC.SafeDirectionTo(targetData.Center, Vector2.UnitX * NPC.spriteDirection);
|
||||
NPC.spriteDirection = (vector.X > 0f) ? 1 : -1;
|
||||
NPC.rotation = vector.ToRotation();
|
||||
|
||||
if (NPC.spriteDirection == -1)
|
||||
NPC.rotation += pie;
|
||||
|
||||
NPC.velocity = vector * chargeSpeed * fastChargeVelocityMultiplier;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2149,6 +2193,9 @@ namespace CalamityMod.NPCs.Yharon
|
||||
// Charge
|
||||
else if (NPC.ai[0] == 2f)
|
||||
{
|
||||
// Set damage
|
||||
NPC.damage = setDamage;
|
||||
|
||||
if (NPC.ai[1] == 1f)
|
||||
SoundEngine.PlaySound(ShortRoarSound, NPC.Center);
|
||||
|
||||
@@ -2167,6 +2214,9 @@ namespace CalamityMod.NPCs.Yharon
|
||||
// Fireball spit charge
|
||||
else if (NPC.ai[0] == 3f)
|
||||
{
|
||||
// Avoid cheap bullshit
|
||||
NPC.damage = 0;
|
||||
|
||||
int fireballFaceDirection = (NPC.Center.X < targetData.Center.X) ? 1 : -1;
|
||||
|
||||
NPC.ai[1] += 1f;
|
||||
@@ -2232,6 +2282,9 @@ namespace CalamityMod.NPCs.Yharon
|
||||
// Splitting fireball breath
|
||||
else if (NPC.ai[0] == 4f)
|
||||
{
|
||||
// Avoid cheap bullshit
|
||||
NPC.damage = 0;
|
||||
|
||||
int splitFireFaceDirection = (NPC.Center.X < targetData.Center.X) ? 1 : -1;
|
||||
NPC.ai[2] = splitFireFaceDirection;
|
||||
|
||||
@@ -2294,6 +2347,9 @@ namespace CalamityMod.NPCs.Yharon
|
||||
// Fireball spin
|
||||
else if (NPC.ai[0] == 5f)
|
||||
{
|
||||
// Avoid cheap bullshit
|
||||
NPC.damage = 0;
|
||||
|
||||
if (NPC.ai[1] == 1f)
|
||||
{
|
||||
RoarSoundSlot = SoundEngine.PlaySound(RoarSound, NPC.Center);
|
||||
@@ -2357,6 +2413,9 @@ namespace CalamityMod.NPCs.Yharon
|
||||
// Fire ring
|
||||
else if (NPC.ai[0] == 6f)
|
||||
{
|
||||
// Avoid cheap bullshit
|
||||
NPC.damage = 0;
|
||||
|
||||
if (NPC.ai[1] == 0f)
|
||||
{
|
||||
Vector2 destination2 = targetData.Center + new Vector2(0f, -200f);
|
||||
@@ -2418,6 +2477,9 @@ namespace CalamityMod.NPCs.Yharon
|
||||
// Fast charge
|
||||
else if (NPC.ai[0] == 7f)
|
||||
{
|
||||
// Set damage
|
||||
NPC.damage = setDamage;
|
||||
|
||||
if (NPC.ai[1] == 1f)
|
||||
SoundEngine.PlaySound(ShortRoarSound, NPC.Center);
|
||||
|
||||
@@ -3069,13 +3131,13 @@ namespace CalamityMod.NPCs.Yharon
|
||||
}
|
||||
if (NPC.frame.Y >= frameHeight * 5)
|
||||
NPC.frame.Y = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NPC.frame.Y = frameHeight * 5;
|
||||
if (doTelegraphRoarAnimation)
|
||||
NPC.frame.Y = frameHeight * 6;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user