Yharon schmoovin'

This commit is contained in:
GinYuH authored and Cameron Ewell committed 2022-12-22 22:14:11 -05:00
1 parent b0f5492ce7
commit 7a08d4797f
5 files changed
+118 -12

No files matched your search

+33 -8
View File
@@ -340,12 +340,13 @@ namespace CalamityMod.NPCs.Yharon
enraged = false;
if (Main.netMode != NetmodeID.MultiplayerClient)
{
safeBox.X = (int)(player.Center.X - (Main.getGoodWorld ? 1000f : bossRush ? 2000f : revenge ? 3000f : 3500f));
// move the first ftw checks to zenith seed later
safeBox.X = (int)(player.Center.X - (Main.getGoodWorld ? 1500f : Main.getGoodWorld ? 1000f : bossRush ? 2000f : revenge ? 3000f : 3500f));
safeBox.Y = (int)(player.Center.Y - 10500f);
safeBox.Width = Main.getGoodWorld ? 2000 : bossRush ? 4000 : revenge ? 6000 : 7000;
safeBox.Width = Main.getGoodWorld ? 3000 : Main.getGoodWorld ? 2000 : bossRush ? 4000 : revenge ? 6000 : 7000;
safeBox.Height = 21000;
Projectile.NewProjectile(NPC.GetSource_FromAI(), player.Center.X + (Main.getGoodWorld ? 1000f : bossRush ? 2000f : revenge ? 3000f : 3500f), player.Center.Y + 100f, 0f, 0f, ModContent.ProjectileType<SkyFlareRevenge>(), 0, 0f, Main.myPlayer);
Projectile.NewProjectile(NPC.GetSource_FromAI(), player.Center.X - (Main.getGoodWorld ? 1000f : bossRush ? 2000f : revenge ? 3000f : 3500f), player.Center.Y + 100f, 0f, 0f, ModContent.ProjectileType<SkyFlareRevenge>(), 0, 0f, Main.myPlayer);
Projectile.NewProjectile(NPC.GetSource_FromAI(), player.Center.X + (Main.getGoodWorld ? 1500f : Main.getGoodWorld ? 1000f : bossRush ? 2000f : revenge ? 3000f : 3500f), player.Center.Y + 100f, 0f, 0f, ModContent.ProjectileType<SkyFlareRevenge>(), 0, 0f, Main.myPlayer);
Projectile.NewProjectile(NPC.GetSource_FromAI(), player.Center.X - (Main.getGoodWorld ? 1500f : Main.getGoodWorld ? 1000f : bossRush ? 2000f : revenge ? 3000f : 3500f), player.Center.Y + 100f, 0f, 0f, ModContent.ProjectileType<SkyFlareRevenge>(), 0, 0f, Main.myPlayer);
}
// Force Yharon to send a sync packet so that the arena gets sent immediately
@@ -876,7 +877,8 @@ namespace CalamityMod.NPCs.Yharon
NPC.Center = center;
float bulletHellVortexDuration = flareDustPhaseTimer + teleportPhaseTimer - 15f;
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.Zero, ModContent.ProjectileType<YharonBulletHellVortex>(), 0, 0f, Main.myPlayer, bulletHellVortexDuration, NPC.whoAmI);
int extraTime = Main.getGoodWorld ? 300 : 0;
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.Zero, ModContent.ProjectileType<YharonBulletHellVortex>(), 0, 0f, Main.myPlayer, bulletHellVortexDuration + extraTime, NPC.whoAmI);
// Yharon takes a small amount of damage in order to summon the bullet hell. This is to compensate for him being invulnerable during it.
int damageAmt = (int)(NPC.lifeMax * (bulletHellVortexDuration / calamityGlobalNPC.KillTime));
@@ -1222,7 +1224,8 @@ namespace CalamityMod.NPCs.Yharon
NPC.Center = center;
float bulletHellVortexDuration = flareDustPhaseTimer + teleportPhaseTimer - 15f;
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.Zero, ModContent.ProjectileType<YharonBulletHellVortex>(), 0, 0f, Main.myPlayer, bulletHellVortexDuration, NPC.whoAmI);
int extraTime = Main.getGoodWorld ? 300 : 0;
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.Zero, ModContent.ProjectileType<YharonBulletHellVortex>(), 0, 0f, Main.myPlayer, bulletHellVortexDuration + extraTime, NPC.whoAmI);
// Yharon takes a small amount of damage in order to summon the bullet hell. This is to compensate for him being invulnerable during it.
int damageAmt = (int)(NPC.lifeMax * (bulletHellVortexDuration / calamityGlobalNPC.KillTime));
@@ -1556,6 +1559,19 @@ namespace CalamityMod.NPCs.Yharon
bool invincible = invincibilityCounter < Phase2InvincibilityTime;
if (invincible)
{
if (Main.getGoodWorld) // move to zenith seed later
{
if (NPC.life < NPC.lifeMax)
{
NPC.life += (int)(NPC.lifeMax * 0.01f);
NPC.HealEffect((int)(NPC.lifeMax * 0.01f), true);
NPC.netUpdate = true;
}
else
{
NPC.life = NPC.lifeMax;
}
}
NPC.dontTakeDamage = true;
phase2 = phase3 = phase4 = false;
invincibilityCounter++;
@@ -1898,7 +1914,8 @@ namespace CalamityMod.NPCs.Yharon
NPC.Center = center;
float bulletHellVortexDuration = spinPhaseTimer + 15f;
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.Zero, ModContent.ProjectileType<YharonBulletHellVortex>(), 0, 0f, Main.myPlayer, bulletHellVortexDuration, NPC.whoAmI);
int extraTime = Main.getGoodWorld ? 300 : 0;
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.Zero, ModContent.ProjectileType<YharonBulletHellVortex>(), 0, 0f, Main.myPlayer, bulletHellVortexDuration + extraTime, NPC.whoAmI);
// Yharon takes a small amount of damage in order to summon the bullet hell. This is to compensate for him being invulnerable during it.
int damageAmt = (int)(NPC.lifeMax * (bulletHellVortexDuration / calamityGlobalNPC.KillTime));
@@ -2876,10 +2893,18 @@ namespace CalamityMod.NPCs.Yharon
// Mark Yharon as dead
DownedBossSystem.downedYharon = true;
CalamityNetcode.SyncWorld();
if (Main.netMode != NetmodeID.MultiplayerClient && Main.getGoodWorld) // move to zenith seed later
{
for (int i = 0; i < 4; i++)
{
Projectile.NewProjectile(NPC.GetSource_Death(), NPC.Center, Vector2.Zero, ModContent.ProjectileType<YharonBulletHellVortex>(), 0, 0f, Main.myPlayer, 360, NPC.whoAmI);
}
}
}
#endregion
#region On Hit Player
#region On Hit Player
public override void OnHitPlayer(Player player, int damage, bool crit)
{
if (damage > 0)
+8 -1
View File
@@ -107,7 +107,10 @@ namespace CalamityMod.Projectiles.Boss
center.Y += 2f;
Projectile.NewProjectile(Projectile.GetSource_FromThis(), center, Projectile.velocity, Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner, 11f, Projectile.ai[1] - 1f);
}
if (Projectile.ai[0] <= 0f)
int tornadoSpeed = 10;
int breakThreshold = -300;
bool breakapart = Main.getGoodWorld && Projectile.ai[0] <= breakThreshold; // move to zenith seed later
if (Projectile.ai[0] <= 0f && !breakapart)
{
float num622 = 0.104719758f;
float num623 = (float)Projectile.width / 5f;
@@ -118,6 +121,10 @@ namespace CalamityMod.Projectiles.Boss
num624 = (float)(Math.Cos((double)(num622 * -(double)Projectile.ai[0])) - 0.5) * num623;
Projectile.position.X += num624 * -Projectile.direction;
}
if (Projectile.ai[0] == breakThreshold && Main.getGoodWorld)
{
Projectile.velocity.X = Main.rand.NextBool(2) ? -tornadoSpeed : tornadoSpeed;
}
if (Projectile.timeLeft == 480)
Projectile.damage = Projectile.GetProjectileDamage(ModContent.NPCType<Yharon>());
+8 -1
View File
@@ -109,7 +109,10 @@ namespace CalamityMod.Projectiles.Boss
center.Y += 2f;
Projectile.NewProjectile(Projectile.GetSource_FromThis(), center, Projectile.velocity, Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner, 11f, Projectile.ai[1] - 1f);
}
if (Projectile.ai[0] <= 0f)
int tornadoSpeed = 10;
int breakThreshold = -300;
bool breakapart = Main.getGoodWorld && Projectile.ai[0] <= breakThreshold; // move to zenith seed later
if (Projectile.ai[0] <= 0f && !breakapart)
{
float num622 = 0.104719758f;
float num623 = (float)Projectile.width / 5f;
@@ -120,6 +123,10 @@ namespace CalamityMod.Projectiles.Boss
num624 = (float)(Math.Cos((double)(num622 * -(double)Projectile.ai[0])) - 0.5) * num623;
Projectile.position.X += num624 * -Projectile.direction;
}
if (Projectile.ai[0] == breakThreshold && Main.getGoodWorld)
{
Projectile.velocity.X = Main.rand.NextBool(2) ? -tornadoSpeed : tornadoSpeed;
}
if (Projectile.timeLeft == 600)
Projectile.damage = Projectile.GetProjectileDamage(ModContent.NPCType<Yharon>());
+8 -1
View File
@@ -109,7 +109,10 @@ namespace CalamityMod.Projectiles.Boss
center.Y += 2f;
Projectile.NewProjectile(Projectile.GetSource_FromThis(), center, Projectile.velocity, Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner, 11f, Projectile.ai[1] - 1f);
}
if (Projectile.ai[0] <= 0f)
int tornadoSpeed = 10;
int breakThreshold = -300;
bool breakapart = Main.getGoodWorld && Projectile.ai[0] <= breakThreshold; // move to zenith seed later
if (Projectile.ai[0] <= 0f && !breakapart)
{
float num622 = 0.104719758f;
float num623 = (float)Projectile.width / 5f;
@@ -120,6 +123,10 @@ namespace CalamityMod.Projectiles.Boss
num624 = (float)(Math.Cos((double)(num622 * -(double)Projectile.ai[0])) - 0.5) * num623;
Projectile.position.X += num624 * -Projectile.direction;
}
if (Projectile.ai[0] == breakThreshold && Main.getGoodWorld)
{
Projectile.velocity.X = Main.rand.NextBool(2) ? -tornadoSpeed : tornadoSpeed;
}
if (Projectile.timeLeft == 720)
Projectile.damage = Projectile.GetProjectileDamage(ModContent.NPCType<Yharon>());
+61 -1
View File
@@ -1,6 +1,7 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using CalamityMod.NPCs.Yharon;
using System.IO;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
@@ -10,6 +11,7 @@ namespace CalamityMod.Projectiles.Boss
public class YharonBulletHellVortex : ModProjectile
{
public ref float TimeCountdown => ref Projectile.ai[0];
public int victim = 0;
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public override void SetStaticDefaults()
{
@@ -29,9 +31,19 @@ namespace CalamityMod.Projectiles.Boss
Projectile.timeLeft = 60000;
}
public override void SendExtraAI(BinaryWriter writer)
{
writer.Write(victim);
}
public override void ReceiveExtraAI(BinaryReader reader)
{
victim = reader.ReadInt32();
}
public override void AI()
{
if (Main.npc[(int)Projectile.ai[1]].active && Main.npc[(int)Projectile.ai[1]].type == ModContent.NPCType<Yharon>())
if ((Main.npc[(int)Projectile.ai[1]].active && Main.npc[(int)Projectile.ai[1]].type == ModContent.NPCType<Yharon>()) || Main.getGoodWorld) // move to zenith seed later
{
if (TimeCountdown > 0f)
{
@@ -41,6 +53,54 @@ namespace CalamityMod.Projectiles.Boss
Projectile.scale = MathHelper.Clamp(Projectile.scale + 0.05f, 0f, 1f);
TimeCountdown--;
// chase players in the zenith seed
if (Main.getGoodWorld) // move to zenith seed later
{
float inertia = 5f;
float speed = 5.35f;
float minDist = 160f;
if (victim >= 0 && Main.player[victim].active && !Main.player[victim].dead)
{
if (Projectile.Distance(Main.player[victim].Center) > minDist)
{
Vector2 moveDirection = Projectile.SafeDirectionTo(Main.player[victim].Center, Vector2.UnitY);
Projectile.velocity = (Projectile.velocity * (inertia - 1f) + moveDirection * speed) / inertia;
}
}
else
{
victim = Player.FindClosest(Projectile.Center, 1, 1);
Projectile.netUpdate = true;
}
// Fly away from other vortices
float pushForce = 0.05f;
for (int k = 0; k < Main.maxProjectiles; k++)
{
Projectile otherProj = Main.projectile[k];
// Short circuits to make the loop as fast as possible
if (!otherProj.active || k == Projectile.whoAmI)
continue;
// If the other projectile is indeed the same owned by the same player and they're too close, nudge them away.
bool sameProjType = otherProj.type == Projectile.type;
float taxicabDist = Vector2.Distance(Projectile.Center, otherProj.Center);
float distancegate = 360f;
if (sameProjType && taxicabDist < distancegate)
{
if (Projectile.position.X < otherProj.position.X)
Projectile.velocity.X -= pushForce;
else
Projectile.velocity.X += pushForce;
if (Projectile.position.Y < otherProj.position.Y)
Projectile.velocity.Y -= pushForce;
else
Projectile.velocity.Y += pushForce;
}
}
}
}
else
Projectile.Kill();