Merge branch 'master' into draedon-summoner
No files matched your search
@@ -2905,7 +2905,19 @@ namespace CalamityMod.CalPlayer
|
||||
if (modPlayer.gState)
|
||||
{
|
||||
player.statDefense -= GlacialState.DefenseReduction;
|
||||
player.velocity = Vector2.Zero;
|
||||
player.velocity.X *= 0.5f;
|
||||
player.velocity.Y += 0.05f;
|
||||
if (player.velocity.Y > 15f)
|
||||
player.velocity.Y = 15f;
|
||||
}
|
||||
|
||||
if (modPlayer.eFreeze)
|
||||
{
|
||||
player.statDefense -= GlacialState.DefenseReduction;
|
||||
player.velocity.X *= 0.5f;
|
||||
player.velocity.Y += 0.1f;
|
||||
if (player.velocity.Y > 15f)
|
||||
player.velocity.Y = 15f;
|
||||
}
|
||||
|
||||
if (modPlayer.eFreeze || modPlayer.silvaStun || modPlayer.eutrophication)
|
||||
|
||||
@@ -36,6 +36,7 @@ using CalamityMod.NPCs.Crags;
|
||||
using CalamityMod.NPCs.Cryogen;
|
||||
using CalamityMod.NPCs.DesertScourge;
|
||||
using CalamityMod.NPCs.DevourerofGods;
|
||||
using CalamityMod.NPCs.ExoMechs.Thanatos;
|
||||
using CalamityMod.NPCs.GreatSandShark;
|
||||
using CalamityMod.NPCs.HiveMind;
|
||||
using CalamityMod.NPCs.Leviathan;
|
||||
@@ -1720,7 +1721,10 @@ namespace CalamityMod
|
||||
NPCType<DevourerofGodsTail>(),
|
||||
NPCType<DevourerofGodsBodyS>(),
|
||||
NPCType<DevourerofGodsTailS>(),
|
||||
};
|
||||
NPCType<ThanatosBody1>(),
|
||||
NPCType<ThanatosBody2>(),
|
||||
NPCType<ThanatosTail>()
|
||||
};
|
||||
|
||||
needsDebuffIconDisplayList = new List<int>()
|
||||
{
|
||||
|
||||
@@ -22,6 +22,7 @@ using CalamityMod.NPCs.Crabulon;
|
||||
using CalamityMod.NPCs.Cryogen;
|
||||
using CalamityMod.NPCs.DesertScourge;
|
||||
using CalamityMod.NPCs.DevourerofGods;
|
||||
using CalamityMod.NPCs.ExoMechs.Thanatos;
|
||||
using CalamityMod.NPCs.HiveMind;
|
||||
using CalamityMod.NPCs.Leviathan;
|
||||
using CalamityMod.NPCs.OldDuke;
|
||||
@@ -576,6 +577,10 @@ namespace CalamityMod
|
||||
{ ModContent.NPCType<DevourerofGodsTailS>(), 9000 },
|
||||
{ ModContent.NPCType<Yharon>(), 15300 },
|
||||
{ ModContent.NPCType<SupremeCalamitas>(), 18000 },
|
||||
{ ModContent.NPCType<ThanatosHead>(), 21600 },
|
||||
{ ModContent.NPCType<ThanatosBody1>(), 21600 },
|
||||
{ ModContent.NPCType<ThanatosBody2>(), 21600 },
|
||||
{ ModContent.NPCType<ThanatosTail>(), 21600 },
|
||||
{ ModContent.NPCType<EidolonWyrmHeadHuge>(), 18000 }
|
||||
};
|
||||
}
|
||||
@@ -700,6 +705,10 @@ namespace CalamityMod
|
||||
{ ModContent.NPCType<DetonatingFlare>(), velocityScaleMin },
|
||||
{ ModContent.NPCType<DetonatingFlare2>(), velocityScaleMin },
|
||||
{ ModContent.NPCType<SupremeCalamitas>(), velocityScaleMin },
|
||||
{ ModContent.NPCType<ThanatosHead>(), bitingEnemeyVelocityScale },
|
||||
{ ModContent.NPCType<ThanatosBody1>(), velocityScaleMin },
|
||||
{ ModContent.NPCType<ThanatosBody2>(), velocityScaleMin },
|
||||
{ ModContent.NPCType<ThanatosTail>(), velocityScaleMin },
|
||||
{ ModContent.NPCType<EidolonWyrmHeadHuge>(), bitingEnemeyVelocityScale }
|
||||
};
|
||||
}
|
||||
|
||||
|
After Width: | Height: | Size: 429 B |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 721 B |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 554 B |
|
After Width: | Height: | Size: 635 B |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 867 B |
|
After Width: | Height: | Size: 563 B |
|
After Width: | Height: | Size: 656 B |
|
After Width: | Height: | Size: 658 B |
|
After Width: | Height: | Size: 365 B |
|
After Width: | Height: | Size: 530 B |
|
After Width: | Height: | Size: 268 B |
|
After Width: | Height: | Size: 259 B |
|
After Width: | Height: | Size: 254 B |
@@ -50,7 +50,7 @@ namespace CalamityMod.Items.Weapons.Rogue
|
||||
{
|
||||
if (player.Calamity().StealthStrikeAvailable())
|
||||
{
|
||||
int stealthDamage = (int)(damage * 1.75f);
|
||||
int stealthDamage = (int)(damage * 1.2f);
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
Vector2 chunkVelocity = new Vector2(speedX, speedY).RotatedByRandom(0.07f) * Main.rand.NextFloat(1.1f, 1.18f);
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace CalamityMod.Items.Weapons.Rogue
|
||||
|
||||
if (mp.StealthStrikeAvailable())
|
||||
{
|
||||
int stealthDamage = (int)(2.4f * damage);
|
||||
int stealthDamage = damage * 2;
|
||||
float stealthSpeedMult = 1.4f;
|
||||
Vector2 stealthVelocity = new Vector2(speedX, speedY) * stealthSpeedMult;
|
||||
int stealth = Projectile.NewProjectile(position, stealthVelocity, ModContent.ProjectileType<ButcherKnife>(), stealthDamage, knockBack, player.whoAmI);
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace CalamityMod.NPCs.Abyss
|
||||
npc.width = 60;
|
||||
npc.height = 88;
|
||||
npc.defense = 0;
|
||||
npc.LifeMaxNERB(1000000, 1150000);
|
||||
npc.LifeMaxNERB(1750000, 2012500);
|
||||
double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01;
|
||||
npc.lifeMax += (int)(npc.lifeMax * HPBoost);
|
||||
npc.aiStyle = -1;
|
||||
@@ -100,13 +100,13 @@ namespace CalamityMod.NPCs.Abyss
|
||||
if (Vector2.Distance(npc.Center, Main.player[Main.npc[(int)npc.ai[2]].target].Center) > 160f)
|
||||
{
|
||||
npc.ai[3] += 1f;
|
||||
float shootProjectile = 200f;
|
||||
float timer = npc.ai[0] + 10f;
|
||||
float divisor = timer + shootProjectile;
|
||||
if (npc.ai[3] % divisor == 0f)
|
||||
float shootShadowFireballGateValue = 90f;
|
||||
float divisor = 5f;
|
||||
if (npc.ai[3] % divisor == 0f && npc.ai[3] >= shootShadowFireballGateValue)
|
||||
{
|
||||
npc.ai[3] = 0f;
|
||||
float distanceVelocityBoost = MathHelper.Clamp((Vector2.Distance(Main.npc[(int)npc.ai[2]].Center, Main.player[Main.npc[(int)npc.ai[2]].target].Center) - 1600f) * 0.025f, 0f, 16f);
|
||||
float fireballVelocity = (Main.player[Main.npc[(int)npc.ai[2]].target].Calamity().ZoneAbyssLayer4 ? 4f : 8f) + distanceVelocityBoost;
|
||||
float fireballVelocity = (Main.player[Main.npc[(int)npc.ai[2]].target].Calamity().ZoneAbyssLayer4 ? 6f : 8f) + distanceVelocityBoost;
|
||||
Vector2 destination = Main.player[Main.npc[(int)npc.ai[2]].target].Center - npc.Center;
|
||||
Vector2 velocity = Vector2.Normalize(destination) * fireballVelocity;
|
||||
int type = ProjectileID.CultistBossFireBallClone;
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace CalamityMod.NPCs.Abyss
|
||||
npc.width = 60;
|
||||
npc.height = 88;
|
||||
npc.defense = 0;
|
||||
npc.LifeMaxNERB(1000000, 1150000);
|
||||
npc.LifeMaxNERB(1750000, 2012500);
|
||||
double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01;
|
||||
npc.lifeMax += (int)(npc.lifeMax * HPBoost);
|
||||
npc.aiStyle = -1;
|
||||
@@ -100,13 +100,13 @@ namespace CalamityMod.NPCs.Abyss
|
||||
if (Vector2.Distance(npc.Center, Main.player[Main.npc[(int)npc.ai[2]].target].Center) > 160f)
|
||||
{
|
||||
npc.ai[3] += 1f;
|
||||
float shootProjectile = 200f;
|
||||
float timer = npc.ai[0] + 15f;
|
||||
float divisor = timer + shootProjectile;
|
||||
if (npc.ai[3] % divisor == 0f)
|
||||
float spawnAncientLightGateValue = 180f;
|
||||
float divisor = 10f;
|
||||
if (npc.ai[0] % divisor == 0f && npc.ai[3] >= spawnAncientLightGateValue)
|
||||
{
|
||||
npc.ai[3] = 0f;
|
||||
float distanceVelocityBoost = MathHelper.Clamp((Vector2.Distance(Main.npc[(int)npc.ai[2]].Center, Main.player[Main.npc[(int)npc.ai[2]].target].Center) - 1600f) * 0.025f, 0f, 16f);
|
||||
float lightVelocity = (Main.player[Main.npc[(int)npc.ai[2]].target].Calamity().ZoneAbyssLayer4 ? 4f : 8f) + distanceVelocityBoost;
|
||||
float lightVelocity = (Main.player[Main.npc[(int)npc.ai[2]].target].Calamity().ZoneAbyssLayer4 ? 6f : 8f) + distanceVelocityBoost;
|
||||
Vector2 destination = Main.player[Main.npc[(int)npc.ai[2]].target].Center - npc.Center;
|
||||
Vector2 velocity = Vector2.Normalize(destination) * lightVelocity;
|
||||
int type = NPCID.AncientLight;
|
||||
|
||||
@@ -73,7 +73,12 @@ namespace CalamityMod.NPCs.Abyss
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
bool adultWyrmAlive = NPC.AnyNPCs(ModContent.NPCType<EidolonWyrmHeadHuge>());
|
||||
bool adultWyrmAlive = false;
|
||||
if (CalamityGlobalNPC.adultEidolonWyrmHead != -1)
|
||||
{
|
||||
if (Main.npc[CalamityGlobalNPC.adultEidolonWyrmHead].active)
|
||||
adultWyrmAlive = true;
|
||||
}
|
||||
if (npc.justHit || detectsPlayer || Main.player[npc.target].chaosState || adultWyrmAlive)
|
||||
{
|
||||
detectsPlayer = true;
|
||||
|
||||
@@ -84,7 +84,7 @@ namespace CalamityMod.NPCs.Abyss
|
||||
npc.DR_NERD(0.4f);
|
||||
CalamityGlobalNPC global = npc.Calamity();
|
||||
global.multDRReductions.Add(BuffID.CursedInferno, 0.9f);
|
||||
npc.LifeMaxNERB(1000000, 1150000);
|
||||
npc.LifeMaxNERB(1750000, 2012500);
|
||||
double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01;
|
||||
npc.lifeMax += (int)(npc.lifeMax * HPBoost);
|
||||
npc.aiStyle = -1;
|
||||
@@ -134,6 +134,8 @@ namespace CalamityMod.NPCs.Abyss
|
||||
{
|
||||
CalamityGlobalNPC calamityGlobalNPC = npc.Calamity();
|
||||
|
||||
CalamityGlobalNPC.adultEidolonWyrmHead = npc.whoAmI;
|
||||
|
||||
// Difficulty modes
|
||||
bool malice = CalamityWorld.malice;
|
||||
bool death = CalamityWorld.death || malice;
|
||||
@@ -510,8 +512,8 @@ namespace CalamityMod.NPCs.Abyss
|
||||
}
|
||||
}
|
||||
|
||||
float predictionAmt = targetDownDeep ? 30f : 60f;
|
||||
float lightningVelocity = targetDownDeep ? 4f : 8f;
|
||||
float predictionAmt = targetDownDeep ? 45f : 60f;
|
||||
float lightningVelocity = targetDownDeep ? 6f : 8f;
|
||||
for (int i = 0; i < numProjectiles; i++)
|
||||
{
|
||||
// Predictive bolt
|
||||
@@ -800,7 +802,7 @@ namespace CalamityMod.NPCs.Abyss
|
||||
|
||||
if ((destination - npc.Center).Length() < iceMistLocationDistance || calamityGlobalNPC.newAI[2] > 0f)
|
||||
{
|
||||
if (calamityGlobalNPC.newAI[2] % 45f == 0f && calamityGlobalNPC.newAI[2] < iceMistDuration && Main.netMode != NetmodeID.MultiplayerClient)
|
||||
if (calamityGlobalNPC.newAI[2] % 60f == 0f && calamityGlobalNPC.newAI[2] < iceMistDuration && Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
int maxTargets = 2;
|
||||
int[] whoAmIArray = new int[maxTargets];
|
||||
@@ -826,8 +828,8 @@ namespace CalamityMod.NPCs.Abyss
|
||||
}
|
||||
}
|
||||
|
||||
float predictionAmt = targetDownDeep ? 60f : 120f;
|
||||
float iceMistVelocity = targetDownDeep ? 8f : 16f;
|
||||
float predictionAmt = targetDownDeep ? 90f : 120f;
|
||||
float iceMistVelocity = targetDownDeep ? 12f : 16f;
|
||||
for (int i = 0; i < numProjectiles; i++)
|
||||
{
|
||||
// Predictive mist
|
||||
@@ -1397,7 +1399,8 @@ namespace CalamityMod.NPCs.Abyss
|
||||
|
||||
public override void OnHitPlayer(Player player, int damage, bool crit)
|
||||
{
|
||||
player.AddBuff(ModContent.BuffType<CrushDepth>(), 600, true);
|
||||
if (npc.Opacity == 1f)
|
||||
player.AddBuff(ModContent.BuffType<CrushDepth>(), 600, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@ namespace CalamityMod.NPCs.Abyss
|
||||
npc.width = 86;
|
||||
npc.height = 120;
|
||||
npc.defense = 0;
|
||||
npc.LifeMaxNERB(1000000, 1150000);
|
||||
npc.LifeMaxNERB(1750000, 2012500);
|
||||
double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01;
|
||||
npc.lifeMax += (int)(npc.lifeMax * HPBoost);
|
||||
npc.aiStyle = -1;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Buffs.StatDebuffs;
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Events;
|
||||
using CalamityMod.Items.Accessories;
|
||||
@@ -17,7 +16,6 @@ using Microsoft.Xna.Framework;
|
||||
using System.IO;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.Localization;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.NPCs.BrimstoneElemental
|
||||
@@ -91,7 +89,7 @@ namespace CalamityMod.NPCs.BrimstoneElemental
|
||||
player.AddBuff(ModContent.BuffType<BrimstoneFlames>(), 180, true);
|
||||
}
|
||||
|
||||
public override void FindFrame(int frameHeight) //9 total frames
|
||||
public override void FindFrame(int frameHeight) // 9 total frames
|
||||
{
|
||||
npc.frameCounter += 1.0;
|
||||
if (npc.ai[0] <= 2f)
|
||||
|
||||
@@ -12769,8 +12769,11 @@ namespace CalamityMod.NPCs
|
||||
// Triple damage if the Adult Eidolon Wyrm is alive
|
||||
if (npc.ai[0] == 0f)
|
||||
{
|
||||
if (NPC.AnyNPCs(ModContent.NPCType<EidolonWyrmHeadHuge>()))
|
||||
npc.damage *= 3;
|
||||
if (CalamityGlobalNPC.adultEidolonWyrmHead != -1)
|
||||
{
|
||||
if (Main.npc[CalamityGlobalNPC.adultEidolonWyrmHead].active)
|
||||
npc.damage *= 3;
|
||||
}
|
||||
}
|
||||
|
||||
npc.ai[0] += 1f;
|
||||
@@ -12903,6 +12906,11 @@ namespace CalamityMod.NPCs
|
||||
{
|
||||
int type = ProjectileID.AncientDoomProjectile;
|
||||
int damage = npc.GetProjectileDamage(type);
|
||||
|
||||
// Triple damage if the Adult Eidolon Wyrm is alive
|
||||
if (Main.npc[(int)npc.ai[0]].type == ModContent.NPCType<EidolonWyrmHeadHuge>())
|
||||
damage *= 3;
|
||||
|
||||
kill = true;
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
|
||||
@@ -21,6 +21,7 @@ using CalamityMod.NPCs.Crags;
|
||||
using CalamityMod.NPCs.Cryogen;
|
||||
using CalamityMod.NPCs.DesertScourge;
|
||||
using CalamityMod.NPCs.DevourerofGods;
|
||||
using CalamityMod.NPCs.ExoMechs.Thanatos;
|
||||
using CalamityMod.NPCs.HiveMind;
|
||||
using CalamityMod.NPCs.Leviathan;
|
||||
using CalamityMod.NPCs.NormalNPCs;
|
||||
@@ -203,6 +204,7 @@ namespace CalamityMod.NPCs
|
||||
public static int draedonExoMechTwinRed = -1;
|
||||
public static int draedonExoMechTwinGreen = -1;
|
||||
public static int draedonExoMechPrime = -1;
|
||||
public static int adultEidolonWyrmHead = -1;
|
||||
|
||||
// Boss Enrage variable for use with the boss health UI.
|
||||
// The logic behind this is as follows:
|
||||
@@ -691,11 +693,13 @@ namespace CalamityMod.NPCs
|
||||
ResetSavedIndex(ref SCal, NPCType<SupremeCalamitas.SupremeCalamitas>());
|
||||
ResetSavedIndex(ref SCalWorm, NPCType<SCalWormHead>());
|
||||
|
||||
/*ResetSavedIndex(ref draedonExoMechWorm, NPCType<ExoWormHead>());
|
||||
ResetSavedIndex(ref draedonExoMechTwinRed, NPCType<ExoTwinRed>());
|
||||
ResetSavedIndex(ref draedonExoMechWorm, NPCType<ThanatosHead>());
|
||||
/*ResetSavedIndex(ref draedonExoMechTwinRed, NPCType<ExoTwinRed>());
|
||||
ResetSavedIndex(ref draedonExoMechTwinGreen, NPCType<ExoTwinGreen>());
|
||||
ResetSavedIndex(ref draedonExoMechPrime, NPCType<ExoPrime>());*/
|
||||
|
||||
ResetSavedIndex(ref adultEidolonWyrmHead, NPCType<EidolonWyrmHeadHuge>());
|
||||
|
||||
CalamityGlobalTownNPC.ResetTownNPCNameBools(npc, mod);
|
||||
|
||||
// Reset the enraged state every frame. The expectation is that bosses will continuously set it back to true if necessary.
|
||||
|
||||
@@ -88,11 +88,11 @@ namespace CalamityMod.NPCs.Crabulon
|
||||
spriteEffects = SpriteEffects.FlipHorizontally;
|
||||
|
||||
Texture2D texture2D15 = Main.npcTexture[npc.type];
|
||||
Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / 2);
|
||||
Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2);
|
||||
|
||||
Vector2 vector43 = npc.Center - Main.screenPosition;
|
||||
vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f;
|
||||
vector43 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY);
|
||||
|
||||
spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f);
|
||||
|
||||
texture2D15 = ModContent.GetTexture("CalamityMod/NPCs/Crabulon/CrabShroomGlow");
|
||||
|
||||
@@ -0,0 +1,522 @@
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Buffs.StatDebuffs;
|
||||
using CalamityMod.Projectiles.Boss;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using System.IO;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.NPCs.ExoMechs.Thanatos
|
||||
{
|
||||
public class ThanatosBody1 : ModNPC
|
||||
{
|
||||
// Whether the body is venting heat or not, it is vulnerable to damage during venting
|
||||
private bool vulnerable = false;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Thanatos");
|
||||
Main.npcFrameCount[npc.type] = 5;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
npc.Calamity().canBreakPlayerDefense = true;
|
||||
npc.npcSlots = 5f;
|
||||
npc.GetNPCDamage();
|
||||
npc.width = 148;
|
||||
npc.height = 98;
|
||||
npc.defense = 100;
|
||||
npc.DR_NERD(0.99f);
|
||||
npc.Calamity().unbreakableDR = true;
|
||||
npc.LifeMaxNERB(1000000, 1150000);
|
||||
double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01;
|
||||
npc.lifeMax += (int)(npc.lifeMax * HPBoost);
|
||||
npc.aiStyle = -1;
|
||||
aiType = -1;
|
||||
npc.knockBackResist = 0f;
|
||||
npc.Opacity = 0f;
|
||||
npc.behindTiles = true;
|
||||
npc.noGravity = true;
|
||||
npc.noTileCollide = true;
|
||||
npc.HitSound = SoundID.NPCHit4;
|
||||
npc.DeathSound = SoundID.NPCDeath14;
|
||||
npc.netAlways = true;
|
||||
npc.dontCountMe = true;
|
||||
npc.chaseable = false;
|
||||
npc.boss = true;
|
||||
music = /*CalamityMod.Instance.GetMusicFromMusicMod("AdultEidolonWyrm") ??*/ MusicID.Boss3;
|
||||
}
|
||||
|
||||
public override void SendExtraAI(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(npc.chaseable);
|
||||
writer.Write(npc.dontTakeDamage);
|
||||
writer.Write(vulnerable);
|
||||
writer.Write(npc.localAI[0]);
|
||||
writer.Write(npc.localAI[1]);
|
||||
for (int i = 0; i < 4; i++)
|
||||
writer.Write(npc.Calamity().newAI[i]);
|
||||
}
|
||||
|
||||
public override void ReceiveExtraAI(BinaryReader reader)
|
||||
{
|
||||
npc.chaseable = reader.ReadBoolean();
|
||||
npc.dontTakeDamage = reader.ReadBoolean();
|
||||
vulnerable = reader.ReadBoolean();
|
||||
npc.localAI[0] = reader.ReadSingle();
|
||||
npc.localAI[1] = reader.ReadSingle();
|
||||
for (int i = 0; i < 4; i++)
|
||||
npc.Calamity().newAI[i] = reader.ReadSingle();
|
||||
}
|
||||
|
||||
public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) => false;
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
if (npc.ai[2] > 0f)
|
||||
npc.realLife = (int)npc.ai[2];
|
||||
|
||||
// Check if other segments are still alive, if not, die
|
||||
bool shouldDespawn = true;
|
||||
for (int i = 0; i < Main.maxNPCs; i++)
|
||||
{
|
||||
if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType<ThanatosHead>())
|
||||
shouldDespawn = false;
|
||||
}
|
||||
if (!shouldDespawn)
|
||||
{
|
||||
if (npc.ai[1] > 0f)
|
||||
shouldDespawn = false;
|
||||
else if (Main.npc[(int)npc.ai[1]].life > 0)
|
||||
shouldDespawn = false;
|
||||
}
|
||||
if (shouldDespawn)
|
||||
{
|
||||
npc.life = 0;
|
||||
npc.HitEffect(0, 10.0);
|
||||
npc.checkDead();
|
||||
npc.active = false;
|
||||
}
|
||||
|
||||
// Set vulnerable to false by default
|
||||
vulnerable = false;
|
||||
|
||||
CalamityGlobalNPC calamityGlobalNPC_Head = Main.npc[(int)npc.ai[2]].Calamity();
|
||||
|
||||
bool invisiblePhase = calamityGlobalNPC_Head.newAI[1] == (float)ThanatosHead.SecondaryPhase.PassiveAndImmune;
|
||||
npc.dontTakeDamage = invisiblePhase;
|
||||
if (!invisiblePhase)
|
||||
{
|
||||
if (Main.npc[(int)npc.ai[1]].Opacity > 0.5f)
|
||||
{
|
||||
npc.Opacity += 0.15f;
|
||||
if (npc.Opacity > 1f)
|
||||
npc.Opacity = 1f;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
npc.Opacity -= 0.05f;
|
||||
if (npc.Opacity < 0f)
|
||||
npc.Opacity = 0f;
|
||||
}
|
||||
|
||||
// Set timer to whoAmI so that segments don't all fire lasers at the same time
|
||||
if (npc.localAI[2] == 0f)
|
||||
npc.localAI[2] = npc.ai[0];
|
||||
|
||||
bool shootTrackingLasers = (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge || calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.UndergroundLaserBarrage) && calamityGlobalNPC_Head.newAI[2] > 0f;
|
||||
if (shootTrackingLasers)
|
||||
{
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
npc.ai[3] += 1f;
|
||||
if (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge)
|
||||
{
|
||||
float divisor = 180f;
|
||||
if ((npc.ai[3] % divisor == 0f && npc.localAI[2] % 10f == 0f) || npc.Calamity().newAI[0] > 0f)
|
||||
{
|
||||
// Body is vulnerable while firing lasers
|
||||
vulnerable = true;
|
||||
|
||||
if (npc.Calamity().newAI[1] == 0f)
|
||||
{
|
||||
npc.Calamity().newAI[0] += 1f;
|
||||
if (npc.Calamity().newAI[0] >= 72f)
|
||||
{
|
||||
npc.Calamity().newAI[1] = 1f;
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
int maxTargets = 3;
|
||||
int[] whoAmIArray = new int[maxTargets];
|
||||
Vector2[] targetCenterArray = new Vector2[maxTargets];
|
||||
int numProjectiles = 0;
|
||||
float maxDistance = 2400f;
|
||||
|
||||
for (int i = 0; i < Main.maxPlayers; i++)
|
||||
{
|
||||
if (!Main.player[i].active || Main.player[i].dead)
|
||||
continue;
|
||||
|
||||
Vector2 playerCenter = Main.player[i].Center;
|
||||
float distance = Vector2.Distance(playerCenter, npc.Center);
|
||||
if (distance < maxDistance)
|
||||
{
|
||||
whoAmIArray[numProjectiles] = i;
|
||||
targetCenterArray[numProjectiles] = playerCenter;
|
||||
int projectileLimit = numProjectiles + 1;
|
||||
numProjectiles = projectileLimit;
|
||||
if (projectileLimit >= targetCenterArray.Length)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
float laserVelocity = 12f;
|
||||
for (int i = 0; i < numProjectiles; i++)
|
||||
{
|
||||
// Normal laser
|
||||
Vector2 projectileDestination = targetCenterArray[i] - npc.Center;
|
||||
Vector2 projectileVelocity = Vector2.Normalize(projectileDestination) * laserVelocity;
|
||||
int type = ModContent.ProjectileType<ExoDestroyerLaser>();
|
||||
int damage = npc.GetProjectileDamage(type);
|
||||
Projectile.NewProjectile(npc.Center, projectileVelocity, type, damage, 0f, Main.myPlayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
npc.Calamity().newAI[0] -= 1f;
|
||||
if (npc.Calamity().newAI[0] <= 0f)
|
||||
{
|
||||
npc.Calamity().newAI[0] = 0f;
|
||||
npc.Calamity().newAI[1] = 0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
npc.ai[3] += 1f;
|
||||
float shootProjectile = 60f;
|
||||
float timer = npc.ai[0] + 15f;
|
||||
float divisor = timer + shootProjectile;
|
||||
if (npc.ai[3] % divisor == 0f || npc.Calamity().newAI[0] > 0f)
|
||||
{
|
||||
// Body is vulnerable while firing lasers
|
||||
vulnerable = true;
|
||||
|
||||
if (npc.Calamity().newAI[1] == 0f)
|
||||
{
|
||||
npc.Calamity().newAI[0] += 1f;
|
||||
if (npc.Calamity().newAI[0] >= 72f)
|
||||
{
|
||||
npc.Calamity().newAI[1] = 1f;
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
int maxTargets = 3;
|
||||
int[] whoAmIArray = new int[maxTargets];
|
||||
Vector2[] targetCenterArray = new Vector2[maxTargets];
|
||||
int numProjectiles = 0;
|
||||
float maxDistance = 2400f;
|
||||
|
||||
for (int i = 0; i < Main.maxPlayers; i++)
|
||||
{
|
||||
if (!Main.player[i].active || Main.player[i].dead)
|
||||
continue;
|
||||
|
||||
Vector2 playerCenter = Main.player[i].Center;
|
||||
float distance = Vector2.Distance(playerCenter, npc.Center);
|
||||
if (distance < maxDistance)
|
||||
{
|
||||
whoAmIArray[numProjectiles] = i;
|
||||
targetCenterArray[numProjectiles] = playerCenter;
|
||||
int projectileLimit = numProjectiles + 1;
|
||||
numProjectiles = projectileLimit;
|
||||
if (projectileLimit >= targetCenterArray.Length)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
float predictionAmt = 20f;
|
||||
float laserVelocity = 12f;
|
||||
Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), npc.Center);
|
||||
for (int i = 0; i < numProjectiles; i++)
|
||||
{
|
||||
// Fire normal lasers if head is in passive state
|
||||
if (calamityGlobalNPC_Head.newAI[1] == (float)ThanatosHead.SecondaryPhase.Passive)
|
||||
{
|
||||
// Normal laser
|
||||
Vector2 projectileDestination = targetCenterArray[i] - npc.Center;
|
||||
Vector2 projectileVelocity = Vector2.Normalize(projectileDestination) * laserVelocity;
|
||||
int type = ModContent.ProjectileType<ExoDestroyerLaser>();
|
||||
int damage = npc.GetProjectileDamage(type);
|
||||
Projectile.NewProjectile(npc.Center, projectileVelocity, type, damage, 0f, Main.myPlayer);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Predictive laser
|
||||
Vector2 projectileDestination = targetCenterArray[i] + Main.player[whoAmIArray[i]].velocity * predictionAmt - npc.Center;
|
||||
Vector2 projectileVelocity = Vector2.Normalize(projectileDestination) * laserVelocity;
|
||||
int type = ModContent.ProjectileType<ExoDestroyerLaser>();
|
||||
int damage = npc.GetProjectileDamage(type);
|
||||
Projectile.NewProjectile(npc.Center, projectileVelocity, type, damage, 0f, Main.myPlayer);
|
||||
|
||||
// Opposite laser
|
||||
projectileDestination = targetCenterArray[i] - Main.player[whoAmIArray[i]].velocity * predictionAmt - npc.Center;
|
||||
projectileVelocity = Vector2.Normalize(projectileDestination) * laserVelocity;
|
||||
Projectile.NewProjectile(npc.Center, projectileVelocity, type, damage, 0f, Main.myPlayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
npc.Calamity().newAI[0] -= 1f;
|
||||
if (npc.Calamity().newAI[0] <= 0f)
|
||||
{
|
||||
npc.Calamity().newAI[0] = 0f;
|
||||
npc.Calamity().newAI[1] = 0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Set alternating laser-firing body segments every 3 seconds
|
||||
npc.localAI[1] += 1f;
|
||||
if (npc.localAI[1] >= 180f)
|
||||
{
|
||||
npc.localAI[1] = 0f;
|
||||
npc.localAI[2] += 1f;
|
||||
}
|
||||
|
||||
npc.Calamity().newAI[0] -= 1f;
|
||||
if (npc.Calamity().newAI[0] <= 0f)
|
||||
{
|
||||
npc.Calamity().newAI[0] = 0f;
|
||||
npc.Calamity().newAI[1] = 0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Body is vulnerable while venting
|
||||
vulnerable = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Homing only works if vulnerable is true
|
||||
npc.chaseable = vulnerable;
|
||||
|
||||
// Adjust DR based on vulnerable
|
||||
npc.Calamity().DR = vulnerable ? 0f : 0.99f;
|
||||
npc.Calamity().unbreakableDR = !vulnerable;
|
||||
|
||||
// Vent noise and steam
|
||||
if (vulnerable)
|
||||
{
|
||||
// Noise
|
||||
if (npc.localAI[0] == 0f)
|
||||
Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ThanatosVent"), npc.Center);
|
||||
|
||||
// Steam
|
||||
float maxSteamTime = 180f;
|
||||
int maxGores = 4;
|
||||
if (npc.localAI[0] < maxSteamTime)
|
||||
{
|
||||
npc.localAI[0] += 1f;
|
||||
int goreAmt = maxGores - (int)Math.Round(npc.localAI[0] / 60f);
|
||||
CalamityUtils.ExplosionGores(npc.Center, goreAmt, true, npc.velocity);
|
||||
}
|
||||
}
|
||||
else
|
||||
npc.localAI[0] = 0f;
|
||||
|
||||
Vector2 vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f);
|
||||
float num191 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2);
|
||||
float num192 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2);
|
||||
num191 = (int)(num191 / 16f) * 16;
|
||||
num192 = (int)(num192 / 16f) * 16;
|
||||
vector18.X = (int)(vector18.X / 16f) * 16;
|
||||
vector18.Y = (int)(vector18.Y / 16f) * 16;
|
||||
num191 -= vector18.X;
|
||||
num192 -= vector18.Y;
|
||||
|
||||
float num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192);
|
||||
if (npc.ai[1] > 0f && npc.ai[1] < Main.npc.Length)
|
||||
{
|
||||
try
|
||||
{
|
||||
vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f);
|
||||
num191 = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - vector18.X;
|
||||
num192 = Main.npc[(int)npc.ai[1]].position.Y + (Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y;
|
||||
} catch
|
||||
{
|
||||
}
|
||||
|
||||
npc.rotation = (float)Math.Atan2(num192, num191) + MathHelper.PiOver2;
|
||||
num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192);
|
||||
int num194 = npc.width;
|
||||
num193 = (num193 - num194) / num193;
|
||||
num191 *= num193;
|
||||
num192 *= num193;
|
||||
npc.velocity = Vector2.Zero;
|
||||
npc.position.X = npc.position.X + num191;
|
||||
npc.position.Y = npc.position.Y + num192;
|
||||
|
||||
if (num191 < 0f)
|
||||
npc.spriteDirection = -1;
|
||||
else if (num191 > 0f)
|
||||
npc.spriteDirection = 1;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool CanHitPlayer(Player target, ref int cooldownSlot)
|
||||
{
|
||||
cooldownSlot = 1;
|
||||
|
||||
Rectangle targetHitbox = target.Hitbox;
|
||||
|
||||
float dist1 = Vector2.Distance(npc.Center, targetHitbox.TopLeft());
|
||||
float dist2 = Vector2.Distance(npc.Center, targetHitbox.TopRight());
|
||||
float dist3 = Vector2.Distance(npc.Center, targetHitbox.BottomLeft());
|
||||
float dist4 = Vector2.Distance(npc.Center, targetHitbox.BottomRight());
|
||||
|
||||
float minDist = dist1;
|
||||
if (dist2 < minDist)
|
||||
minDist = dist2;
|
||||
if (dist3 < minDist)
|
||||
minDist = dist3;
|
||||
if (dist4 < minDist)
|
||||
minDist = dist4;
|
||||
|
||||
return minDist <= 50f && npc.Opacity == 1f;
|
||||
}
|
||||
|
||||
public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit)
|
||||
{
|
||||
return !CalamityUtils.AntiButcher(npc, ref damage, 0.5f);
|
||||
}
|
||||
|
||||
public override void FindFrame(int frameHeight) // 5 total frames
|
||||
{
|
||||
// Swap between venting and non-venting frames
|
||||
CalamityGlobalNPC calamityGlobalNPC_Head = Main.npc[(int)npc.ai[2]].Calamity();
|
||||
bool shootTrackingLasers = (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge || calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.UndergroundLaserBarrage) && calamityGlobalNPC_Head.newAI[2] > 0f;
|
||||
if (shootTrackingLasers)
|
||||
{
|
||||
npc.frameCounter += 1D;
|
||||
if (npc.Calamity().newAI[1] == 0f)
|
||||
{
|
||||
if (npc.frameCounter >= 12D)
|
||||
{
|
||||
npc.frame.Y += frameHeight;
|
||||
npc.frameCounter = 0D;
|
||||
}
|
||||
if (npc.frame.Y >= frameHeight * Main.npcFrameCount[npc.type])
|
||||
npc.frame.Y = frameHeight * Main.npcFrameCount[npc.type];
|
||||
}
|
||||
else
|
||||
{
|
||||
npc.frameCounter += 1D;
|
||||
if (npc.frameCounter >= 12D)
|
||||
{
|
||||
npc.frame.Y -= frameHeight;
|
||||
npc.frameCounter = 0D;
|
||||
}
|
||||
if (npc.frame.Y < 0)
|
||||
npc.frame.Y = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
npc.frameCounter += 1D;
|
||||
if (npc.frameCounter >= 12D)
|
||||
{
|
||||
npc.frame.Y -= frameHeight;
|
||||
npc.frameCounter = 0D;
|
||||
}
|
||||
if (npc.frame.Y < 0)
|
||||
npc.frame.Y = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public override void PostDraw(SpriteBatch spriteBatch, Color drawColor)
|
||||
{
|
||||
SpriteEffects spriteEffects = SpriteEffects.None;
|
||||
if (npc.spriteDirection == 1)
|
||||
spriteEffects = SpriteEffects.FlipHorizontally;
|
||||
|
||||
Texture2D texture = Main.npcTexture[npc.type];
|
||||
Vector2 vector = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2);
|
||||
|
||||
Vector2 center = npc.Center - Main.screenPosition;
|
||||
center -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f;
|
||||
center += vector * npc.scale + new Vector2(0f, 4f + npc.gfxOffY);
|
||||
spriteBatch.Draw(texture, center, npc.frame, npc.GetAlpha(drawColor), npc.rotation, vector, npc.scale, spriteEffects, 0f);
|
||||
|
||||
texture = ModContent.GetTexture("CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosBody1Glow");
|
||||
spriteBatch.Draw(texture, center, npc.frame, Color.White * npc.Opacity, npc.rotation, vector, npc.scale, spriteEffects, 0f);
|
||||
}
|
||||
|
||||
public override bool CheckActive() => false;
|
||||
|
||||
public override bool PreNPCLoot() => false;
|
||||
|
||||
public override void HitEffect(int hitDirection, double damage)
|
||||
{
|
||||
int baseDust = vulnerable ? 3 : 1;
|
||||
for (int k = 0; k < baseDust; k++)
|
||||
Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1f);
|
||||
|
||||
if (npc.life <= 0)
|
||||
{
|
||||
for (int num193 = 0; num193 < 2; num193++)
|
||||
{
|
||||
Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f);
|
||||
}
|
||||
for (int num194 = 0; num194 < 20; num194++)
|
||||
{
|
||||
int num195 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f);
|
||||
Main.dust[num195].noGravity = true;
|
||||
Main.dust[num195].velocity *= 3f;
|
||||
num195 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f);
|
||||
Main.dust[num195].velocity *= 2f;
|
||||
Main.dust[num195].noGravity = true;
|
||||
}
|
||||
|
||||
Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Thanatos/ThanatosBody1"), 1f);
|
||||
Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Thanatos/ThanatosBody1_2"), 1f);
|
||||
Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Thanatos/ThanatosBody1_3"), 1f);
|
||||
}
|
||||
}
|
||||
|
||||
public override void ScaleExpertStats(int numPlayers, float bossLifeScale)
|
||||
{
|
||||
npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale);
|
||||
npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier());
|
||||
}
|
||||
|
||||
public override void OnHitPlayer(Player player, int damage, bool crit)
|
||||
{
|
||||
if (npc.Opacity == 1f)
|
||||
{
|
||||
int duration = vulnerable ? 120 : 60;
|
||||
player.AddBuff(BuffID.Ichor, duration);
|
||||
player.AddBuff(BuffID.CursedInferno, duration);
|
||||
player.AddBuff(ModContent.BuffType<ExoFreeze>(), duration / 4);
|
||||
player.AddBuff(ModContent.BuffType<BrimstoneFlames>(), duration);
|
||||
player.AddBuff(ModContent.BuffType<Plague>(), duration);
|
||||
player.AddBuff(ModContent.BuffType<HolyFlames>(), duration);
|
||||
player.AddBuff(BuffID.Frostburn, duration);
|
||||
player.AddBuff(BuffID.OnFire, duration);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 5.5 KiB |
@@ -0,0 +1,522 @@
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Buffs.StatDebuffs;
|
||||
using CalamityMod.Projectiles.Boss;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using System.IO;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.NPCs.ExoMechs.Thanatos
|
||||
{
|
||||
public class ThanatosBody2 : ModNPC
|
||||
{
|
||||
// Whether the body is venting heat or not, it is vulnerable to damage during venting
|
||||
private bool vulnerable = false;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Thanatos");
|
||||
Main.npcFrameCount[npc.type] = 5;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
npc.Calamity().canBreakPlayerDefense = true;
|
||||
npc.npcSlots = 5f;
|
||||
npc.GetNPCDamage();
|
||||
npc.width = 136;
|
||||
npc.height = 100;
|
||||
npc.defense = 100;
|
||||
npc.DR_NERD(0.99f);
|
||||
npc.Calamity().unbreakableDR = true;
|
||||
npc.LifeMaxNERB(1000000, 1150000);
|
||||
double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01;
|
||||
npc.lifeMax += (int)(npc.lifeMax * HPBoost);
|
||||
npc.aiStyle = -1;
|
||||
aiType = -1;
|
||||
npc.knockBackResist = 0f;
|
||||
npc.Opacity = 0f;
|
||||
npc.behindTiles = true;
|
||||
npc.noGravity = true;
|
||||
npc.noTileCollide = true;
|
||||
npc.HitSound = SoundID.NPCHit4;
|
||||
npc.DeathSound = SoundID.NPCDeath14;
|
||||
npc.netAlways = true;
|
||||
npc.dontCountMe = true;
|
||||
npc.chaseable = false;
|
||||
npc.boss = true;
|
||||
music = /*CalamityMod.Instance.GetMusicFromMusicMod("AdultEidolonWyrm") ??*/ MusicID.Boss3;
|
||||
}
|
||||
|
||||
public override void SendExtraAI(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(npc.chaseable);
|
||||
writer.Write(npc.dontTakeDamage);
|
||||
writer.Write(vulnerable);
|
||||
writer.Write(npc.localAI[0]);
|
||||
writer.Write(npc.localAI[1]);
|
||||
for (int i = 0; i < 4; i++)
|
||||
writer.Write(npc.Calamity().newAI[i]);
|
||||
}
|
||||
|
||||
public override void ReceiveExtraAI(BinaryReader reader)
|
||||
{
|
||||
npc.chaseable = reader.ReadBoolean();
|
||||
npc.dontTakeDamage = reader.ReadBoolean();
|
||||
vulnerable = reader.ReadBoolean();
|
||||
npc.localAI[0] = reader.ReadSingle();
|
||||
npc.localAI[1] = reader.ReadSingle();
|
||||
for (int i = 0; i < 4; i++)
|
||||
npc.Calamity().newAI[i] = reader.ReadSingle();
|
||||
}
|
||||
|
||||
public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) => false;
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
if (npc.ai[2] > 0f)
|
||||
npc.realLife = (int)npc.ai[2];
|
||||
|
||||
// Check if other segments are still alive, if not, die
|
||||
bool shouldDespawn = true;
|
||||
for (int i = 0; i < Main.maxNPCs; i++)
|
||||
{
|
||||
if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType<ThanatosHead>())
|
||||
shouldDespawn = false;
|
||||
}
|
||||
if (!shouldDespawn)
|
||||
{
|
||||
if (npc.ai[1] > 0f)
|
||||
shouldDespawn = false;
|
||||
else if (Main.npc[(int)npc.ai[1]].life > 0)
|
||||
shouldDespawn = false;
|
||||
}
|
||||
if (shouldDespawn)
|
||||
{
|
||||
npc.life = 0;
|
||||
npc.HitEffect(0, 10.0);
|
||||
npc.checkDead();
|
||||
npc.active = false;
|
||||
}
|
||||
|
||||
// Set vulnerable to false by default
|
||||
vulnerable = false;
|
||||
|
||||
CalamityGlobalNPC calamityGlobalNPC_Head = Main.npc[(int)npc.ai[2]].Calamity();
|
||||
|
||||
bool invisiblePhase = calamityGlobalNPC_Head.newAI[1] == (float)ThanatosHead.SecondaryPhase.PassiveAndImmune;
|
||||
npc.dontTakeDamage = invisiblePhase;
|
||||
if (!invisiblePhase)
|
||||
{
|
||||
if (Main.npc[(int)npc.ai[1]].Opacity > 0.5f)
|
||||
{
|
||||
npc.Opacity += 0.15f;
|
||||
if (npc.Opacity > 1f)
|
||||
npc.Opacity = 1f;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
npc.Opacity -= 0.05f;
|
||||
if (npc.Opacity < 0f)
|
||||
npc.Opacity = 0f;
|
||||
}
|
||||
|
||||
// Set timer to whoAmI so that segments don't all fire lasers at the same time
|
||||
if (npc.localAI[2] == 0f)
|
||||
npc.localAI[2] = npc.ai[0];
|
||||
|
||||
bool shootTrackingLasers = (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge || calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.UndergroundLaserBarrage) && calamityGlobalNPC_Head.newAI[2] > 0f;
|
||||
if (shootTrackingLasers)
|
||||
{
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
npc.ai[3] += 1f;
|
||||
if (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge)
|
||||
{
|
||||
float divisor = 180f;
|
||||
if ((npc.ai[3] % divisor == 0f && npc.localAI[2] % 10f == 0f) || npc.Calamity().newAI[0] > 0f)
|
||||
{
|
||||
// Body is vulnerable while firing lasers
|
||||
vulnerable = true;
|
||||
|
||||
if (npc.Calamity().newAI[1] == 0f)
|
||||
{
|
||||
npc.Calamity().newAI[0] += 1f;
|
||||
if (npc.Calamity().newAI[0] >= 72f)
|
||||
{
|
||||
npc.Calamity().newAI[1] = 1f;
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
int maxTargets = 3;
|
||||
int[] whoAmIArray = new int[maxTargets];
|
||||
Vector2[] targetCenterArray = new Vector2[maxTargets];
|
||||
int numProjectiles = 0;
|
||||
float maxDistance = 2400f;
|
||||
|
||||
for (int i = 0; i < Main.maxPlayers; i++)
|
||||
{
|
||||
if (!Main.player[i].active || Main.player[i].dead)
|
||||
continue;
|
||||
|
||||
Vector2 playerCenter = Main.player[i].Center;
|
||||
float distance = Vector2.Distance(playerCenter, npc.Center);
|
||||
if (distance < maxDistance)
|
||||
{
|
||||
whoAmIArray[numProjectiles] = i;
|
||||
targetCenterArray[numProjectiles] = playerCenter;
|
||||
int projectileLimit = numProjectiles + 1;
|
||||
numProjectiles = projectileLimit;
|
||||
if (projectileLimit >= targetCenterArray.Length)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
float laserVelocity = 12f;
|
||||
for (int i = 0; i < numProjectiles; i++)
|
||||
{
|
||||
// Normal laser
|
||||
Vector2 projectileDestination = targetCenterArray[i] - npc.Center;
|
||||
Vector2 projectileVelocity = Vector2.Normalize(projectileDestination) * laserVelocity;
|
||||
int type = ModContent.ProjectileType<ExoDestroyerLaser>();
|
||||
int damage = npc.GetProjectileDamage(type);
|
||||
Projectile.NewProjectile(npc.Center, projectileVelocity, type, damage, 0f, Main.myPlayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
npc.Calamity().newAI[0] -= 1f;
|
||||
if (npc.Calamity().newAI[0] <= 0f)
|
||||
{
|
||||
npc.Calamity().newAI[0] = 0f;
|
||||
npc.Calamity().newAI[1] = 0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
npc.ai[3] += 1f;
|
||||
float shootProjectile = 60f;
|
||||
float timer = npc.ai[0] + 15f;
|
||||
float divisor = timer + shootProjectile;
|
||||
if (npc.ai[3] % divisor == 0f || npc.Calamity().newAI[0] > 0f)
|
||||
{
|
||||
// Body is vulnerable while firing lasers
|
||||
vulnerable = true;
|
||||
|
||||
if (npc.Calamity().newAI[1] == 0f)
|
||||
{
|
||||
npc.Calamity().newAI[0] += 1f;
|
||||
if (npc.Calamity().newAI[0] >= 72f)
|
||||
{
|
||||
npc.Calamity().newAI[1] = 1f;
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
int maxTargets = 3;
|
||||
int[] whoAmIArray = new int[maxTargets];
|
||||
Vector2[] targetCenterArray = new Vector2[maxTargets];
|
||||
int numProjectiles = 0;
|
||||
float maxDistance = 2400f;
|
||||
|
||||
for (int i = 0; i < Main.maxPlayers; i++)
|
||||
{
|
||||
if (!Main.player[i].active || Main.player[i].dead)
|
||||
continue;
|
||||
|
||||
Vector2 playerCenter = Main.player[i].Center;
|
||||
float distance = Vector2.Distance(playerCenter, npc.Center);
|
||||
if (distance < maxDistance)
|
||||
{
|
||||
whoAmIArray[numProjectiles] = i;
|
||||
targetCenterArray[numProjectiles] = playerCenter;
|
||||
int projectileLimit = numProjectiles + 1;
|
||||
numProjectiles = projectileLimit;
|
||||
if (projectileLimit >= targetCenterArray.Length)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
float predictionAmt = 20f;
|
||||
float laserVelocity = 12f;
|
||||
Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), npc.Center);
|
||||
for (int i = 0; i < numProjectiles; i++)
|
||||
{
|
||||
// Fire normal lasers if head is in passive state
|
||||
if (calamityGlobalNPC_Head.newAI[1] == (float)ThanatosHead.SecondaryPhase.Passive)
|
||||
{
|
||||
// Normal laser
|
||||
Vector2 projectileDestination = targetCenterArray[i] - npc.Center;
|
||||
Vector2 projectileVelocity = Vector2.Normalize(projectileDestination) * laserVelocity;
|
||||
int type = ModContent.ProjectileType<ExoDestroyerLaser>();
|
||||
int damage = npc.GetProjectileDamage(type);
|
||||
Projectile.NewProjectile(npc.Center, projectileVelocity, type, damage, 0f, Main.myPlayer);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Predictive laser
|
||||
Vector2 projectileDestination = targetCenterArray[i] + Main.player[whoAmIArray[i]].velocity * predictionAmt - npc.Center;
|
||||
Vector2 projectileVelocity = Vector2.Normalize(projectileDestination) * laserVelocity;
|
||||
int type = ModContent.ProjectileType<ExoDestroyerLaser>();
|
||||
int damage = npc.GetProjectileDamage(type);
|
||||
Projectile.NewProjectile(npc.Center, projectileVelocity, type, damage, 0f, Main.myPlayer);
|
||||
|
||||
// Opposite laser
|
||||
projectileDestination = targetCenterArray[i] - Main.player[whoAmIArray[i]].velocity * predictionAmt - npc.Center;
|
||||
projectileVelocity = Vector2.Normalize(projectileDestination) * laserVelocity;
|
||||
Projectile.NewProjectile(npc.Center, projectileVelocity, type, damage, 0f, Main.myPlayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
npc.Calamity().newAI[0] -= 1f;
|
||||
if (npc.Calamity().newAI[0] <= 0f)
|
||||
{
|
||||
npc.Calamity().newAI[0] = 0f;
|
||||
npc.Calamity().newAI[1] = 0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Set alternating laser-firing body segments every 3 seconds
|
||||
npc.localAI[1] += 1f;
|
||||
if (npc.localAI[1] >= 180f)
|
||||
{
|
||||
npc.localAI[1] = 0f;
|
||||
npc.localAI[2] += 1f;
|
||||
}
|
||||
|
||||
npc.Calamity().newAI[0] -= 1f;
|
||||
if (npc.Calamity().newAI[0] <= 0f)
|
||||
{
|
||||
npc.Calamity().newAI[0] = 0f;
|
||||
npc.Calamity().newAI[1] = 0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Body is vulnerable while venting
|
||||
vulnerable = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Homing only works if vulnerable is true
|
||||
npc.chaseable = vulnerable;
|
||||
|
||||
// Adjust DR based on vulnerable
|
||||
npc.Calamity().DR = vulnerable ? 0f : 0.99f;
|
||||
npc.Calamity().unbreakableDR = !vulnerable;
|
||||
|
||||
// Vent noise and steam
|
||||
if (vulnerable)
|
||||
{
|
||||
// Noise
|
||||
if (npc.localAI[0] == 0f)
|
||||
Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ThanatosVent"), npc.Center);
|
||||
|
||||
// Steam
|
||||
float maxSteamTime = 180f;
|
||||
int maxGores = 4;
|
||||
if (npc.localAI[0] < maxSteamTime)
|
||||
{
|
||||
npc.localAI[0] += 1f;
|
||||
int goreAmt = maxGores - (int)Math.Round(npc.localAI[0] / 60f);
|
||||
CalamityUtils.ExplosionGores(npc.Center, goreAmt, true, npc.velocity);
|
||||
}
|
||||
}
|
||||
else
|
||||
npc.localAI[0] = 0f;
|
||||
|
||||
Vector2 vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f);
|
||||
float num191 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2);
|
||||
float num192 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2);
|
||||
num191 = (int)(num191 / 16f) * 16;
|
||||
num192 = (int)(num192 / 16f) * 16;
|
||||
vector18.X = (int)(vector18.X / 16f) * 16;
|
||||
vector18.Y = (int)(vector18.Y / 16f) * 16;
|
||||
num191 -= vector18.X;
|
||||
num192 -= vector18.Y;
|
||||
|
||||
float num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192);
|
||||
if (npc.ai[1] > 0f && npc.ai[1] < Main.npc.Length)
|
||||
{
|
||||
try
|
||||
{
|
||||
vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f);
|
||||
num191 = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - vector18.X;
|
||||
num192 = Main.npc[(int)npc.ai[1]].position.Y + (Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y;
|
||||
} catch
|
||||
{
|
||||
}
|
||||
|
||||
npc.rotation = (float)Math.Atan2(num192, num191) + MathHelper.PiOver2;
|
||||
num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192);
|
||||
int num194 = npc.width;
|
||||
num193 = (num193 - num194) / num193;
|
||||
num191 *= num193;
|
||||
num192 *= num193;
|
||||
npc.velocity = Vector2.Zero;
|
||||
npc.position.X = npc.position.X + num191;
|
||||
npc.position.Y = npc.position.Y + num192;
|
||||
|
||||
if (num191 < 0f)
|
||||
npc.spriteDirection = -1;
|
||||
else if (num191 > 0f)
|
||||
npc.spriteDirection = 1;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool CanHitPlayer(Player target, ref int cooldownSlot)
|
||||
{
|
||||
cooldownSlot = 1;
|
||||
|
||||
Rectangle targetHitbox = target.Hitbox;
|
||||
|
||||
float dist1 = Vector2.Distance(npc.Center, targetHitbox.TopLeft());
|
||||
float dist2 = Vector2.Distance(npc.Center, targetHitbox.TopRight());
|
||||
float dist3 = Vector2.Distance(npc.Center, targetHitbox.BottomLeft());
|
||||
float dist4 = Vector2.Distance(npc.Center, targetHitbox.BottomRight());
|
||||
|
||||
float minDist = dist1;
|
||||
if (dist2 < minDist)
|
||||
minDist = dist2;
|
||||
if (dist3 < minDist)
|
||||
minDist = dist3;
|
||||
if (dist4 < minDist)
|
||||
minDist = dist4;
|
||||
|
||||
return minDist <= 50f && npc.Opacity == 1f;
|
||||
}
|
||||
|
||||
public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit)
|
||||
{
|
||||
return !CalamityUtils.AntiButcher(npc, ref damage, 0.5f);
|
||||
}
|
||||
|
||||
public override void FindFrame(int frameHeight) // 5 total frames
|
||||
{
|
||||
// Swap between venting and non-venting frames
|
||||
CalamityGlobalNPC calamityGlobalNPC_Head = Main.npc[(int)npc.ai[2]].Calamity();
|
||||
bool shootTrackingLasers = (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge || calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.UndergroundLaserBarrage) && calamityGlobalNPC_Head.newAI[2] > 0f;
|
||||
if (shootTrackingLasers)
|
||||
{
|
||||
npc.frameCounter += 1D;
|
||||
if (npc.Calamity().newAI[1] == 0f)
|
||||
{
|
||||
if (npc.frameCounter >= 12D)
|
||||
{
|
||||
npc.frame.Y += frameHeight;
|
||||
npc.frameCounter = 0D;
|
||||
}
|
||||
if (npc.frame.Y >= frameHeight * Main.npcFrameCount[npc.type])
|
||||
npc.frame.Y = frameHeight * Main.npcFrameCount[npc.type];
|
||||
}
|
||||
else
|
||||
{
|
||||
npc.frameCounter += 1D;
|
||||
if (npc.frameCounter >= 12D)
|
||||
{
|
||||
npc.frame.Y -= frameHeight;
|
||||
npc.frameCounter = 0D;
|
||||
}
|
||||
if (npc.frame.Y < 0)
|
||||
npc.frame.Y = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
npc.frameCounter += 1D;
|
||||
if (npc.frameCounter >= 12D)
|
||||
{
|
||||
npc.frame.Y -= frameHeight;
|
||||
npc.frameCounter = 0D;
|
||||
}
|
||||
if (npc.frame.Y < 0)
|
||||
npc.frame.Y = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public override void PostDraw(SpriteBatch spriteBatch, Color drawColor)
|
||||
{
|
||||
SpriteEffects spriteEffects = SpriteEffects.None;
|
||||
if (npc.spriteDirection == 1)
|
||||
spriteEffects = SpriteEffects.FlipHorizontally;
|
||||
|
||||
Texture2D texture = Main.npcTexture[npc.type];
|
||||
Vector2 vector = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2);
|
||||
|
||||
Vector2 center = npc.Center - Main.screenPosition;
|
||||
center -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f;
|
||||
center += vector * npc.scale + new Vector2(0f, 4f + npc.gfxOffY);
|
||||
spriteBatch.Draw(texture, center, npc.frame, npc.GetAlpha(drawColor), npc.rotation, vector, npc.scale, spriteEffects, 0f);
|
||||
|
||||
texture = ModContent.GetTexture("CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosBody2Glow");
|
||||
spriteBatch.Draw(texture, center, npc.frame, Color.White * npc.Opacity, npc.rotation, vector, npc.scale, spriteEffects, 0f);
|
||||
}
|
||||
|
||||
public override bool CheckActive() => false;
|
||||
|
||||
public override bool PreNPCLoot() => false;
|
||||
|
||||
public override void HitEffect(int hitDirection, double damage)
|
||||
{
|
||||
int baseDust = vulnerable ? 3 : 1;
|
||||
for (int k = 0; k < baseDust; k++)
|
||||
Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1f);
|
||||
|
||||
if (npc.life <= 0)
|
||||
{
|
||||
for (int num193 = 0; num193 < 2; num193++)
|
||||
{
|
||||
Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f);
|
||||
}
|
||||
for (int num194 = 0; num194 < 20; num194++)
|
||||
{
|
||||
int num195 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f);
|
||||
Main.dust[num195].noGravity = true;
|
||||
Main.dust[num195].velocity *= 3f;
|
||||
num195 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f);
|
||||
Main.dust[num195].velocity *= 2f;
|
||||
Main.dust[num195].noGravity = true;
|
||||
}
|
||||
|
||||
Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Thanatos/ThanatosBody2"), 1f);
|
||||
Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Thanatos/ThanatosBody2_2"), 1f);
|
||||
Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Thanatos/ThanatosBody2_3"), 1f);
|
||||
}
|
||||
}
|
||||
|
||||
public override void ScaleExpertStats(int numPlayers, float bossLifeScale)
|
||||
{
|
||||
npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale);
|
||||
npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier());
|
||||
}
|
||||
|
||||
public override void OnHitPlayer(Player player, int damage, bool crit)
|
||||
{
|
||||
if (npc.Opacity == 1f)
|
||||
{
|
||||
int duration = vulnerable ? 120 : 60;
|
||||
player.AddBuff(BuffID.Ichor, duration);
|
||||
player.AddBuff(BuffID.CursedInferno, duration);
|
||||
player.AddBuff(ModContent.BuffType<ExoFreeze>(), duration / 4);
|
||||
player.AddBuff(ModContent.BuffType<BrimstoneFlames>(), duration);
|
||||
player.AddBuff(ModContent.BuffType<Plague>(), duration);
|
||||
player.AddBuff(ModContent.BuffType<HolyFlames>(), duration);
|
||||
player.AddBuff(BuffID.Frostburn, duration);
|
||||
player.AddBuff(BuffID.OnFire, duration);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 5.1 KiB |
@@ -0,0 +1,812 @@
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Buffs.StatDebuffs;
|
||||
using CalamityMod.Events;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using System.IO;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.NPCs.ExoMechs.Thanatos
|
||||
{
|
||||
//[AutoloadBossHead]
|
||||
public class ThanatosHead : ModNPC
|
||||
{
|
||||
public enum Phase
|
||||
{
|
||||
Charge = 0,
|
||||
UndergroundLaserBarrage = 1,
|
||||
Deathray = 2
|
||||
}
|
||||
|
||||
public float AIState
|
||||
{
|
||||
get => npc.Calamity().newAI[0];
|
||||
set => npc.Calamity().newAI[0] = value;
|
||||
}
|
||||
|
||||
public enum SecondaryPhase
|
||||
{
|
||||
Nothing = 0,
|
||||
Passive = 1,
|
||||
PassiveAndImmune = 2
|
||||
}
|
||||
|
||||
public float SecondaryAIState
|
||||
{
|
||||
get => npc.Calamity().newAI[1];
|
||||
set => npc.Calamity().newAI[1] = value;
|
||||
}
|
||||
|
||||
// Whether the head is venting heat or not, it is vulnerable to damage during venting
|
||||
private bool vulnerable = false;
|
||||
|
||||
// Default life ratio for the other mechs
|
||||
private const float defaultLifeRatio = 5f;
|
||||
|
||||
// Base distance from the target for most attacks
|
||||
private const float baseDistance = 1200f;
|
||||
|
||||
// Base distance from target location in order to continue turning
|
||||
private const float baseTurnDistance = 160f;
|
||||
|
||||
// Max distance from the target before they are unable to hear sound telegraphs
|
||||
private const float soundDistance = 2800f;
|
||||
|
||||
// Length variables
|
||||
private const int minLength = 100;
|
||||
private const int maxLength = 101;
|
||||
|
||||
// Variable used to stop the segment spawning loop
|
||||
private bool TailSpawned = false;
|
||||
|
||||
// Used in the lerp to smoothly scale velocity up and down
|
||||
private float chargeVelocityScalar = 0f;
|
||||
|
||||
// Total duration of the deathray telegraph
|
||||
private const float deathrayTelegraphDuration = 120f;
|
||||
|
||||
// Total duration of the deathray
|
||||
private const float deathrayDuration = 180f;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Thanatos");
|
||||
Main.npcFrameCount[npc.type] = 5;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
npc.Calamity().canBreakPlayerDefense = true;
|
||||
npc.npcSlots = 5f;
|
||||
npc.GetNPCDamage();
|
||||
npc.width = 104;
|
||||
npc.height = 174;
|
||||
npc.defense = 80;
|
||||
npc.DR_NERD(0.99f);
|
||||
npc.Calamity().unbreakableDR = true;
|
||||
npc.LifeMaxNERB(1000000, 1150000);
|
||||
double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01;
|
||||
npc.lifeMax += (int)(npc.lifeMax * HPBoost);
|
||||
npc.aiStyle = -1;
|
||||
aiType = -1;
|
||||
npc.Opacity = 0f;
|
||||
npc.knockBackResist = 0f;
|
||||
npc.value = Item.buyPrice(10, 0, 0, 0);
|
||||
npc.behindTiles = true;
|
||||
npc.noGravity = true;
|
||||
npc.noTileCollide = true;
|
||||
npc.HitSound = SoundID.NPCHit4;
|
||||
npc.DeathSound = SoundID.NPCDeath14;
|
||||
npc.netAlways = true;
|
||||
npc.boss = true;
|
||||
npc.chaseable = false;
|
||||
music = /*CalamityMod.Instance.GetMusicFromMusicMod("AdultEidolonWyrm") ??*/ MusicID.Boss3;
|
||||
}
|
||||
|
||||
public override void SendExtraAI(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(npc.chaseable);
|
||||
writer.Write(npc.dontTakeDamage);
|
||||
writer.Write(chargeVelocityScalar);
|
||||
writer.Write(vulnerable);
|
||||
writer.Write(npc.localAI[0]);
|
||||
writer.Write(npc.localAI[1]);
|
||||
writer.Write(npc.localAI[2]);
|
||||
writer.Write(npc.localAI[3]);
|
||||
for (int i = 0; i < 4; i++)
|
||||
writer.Write(npc.Calamity().newAI[i]);
|
||||
}
|
||||
|
||||
public override void ReceiveExtraAI(BinaryReader reader)
|
||||
{
|
||||
npc.chaseable = reader.ReadBoolean();
|
||||
npc.dontTakeDamage = reader.ReadBoolean();
|
||||
chargeVelocityScalar = reader.ReadSingle();
|
||||
vulnerable = reader.ReadBoolean();
|
||||
npc.localAI[0] = reader.ReadSingle();
|
||||
npc.localAI[1] = reader.ReadSingle();
|
||||
npc.localAI[2] = reader.ReadSingle();
|
||||
npc.localAI[3] = reader.ReadSingle();
|
||||
for (int i = 0; i < 4; i++)
|
||||
npc.Calamity().newAI[i] = reader.ReadSingle();
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
CalamityGlobalNPC calamityGlobalNPC = npc.Calamity();
|
||||
|
||||
CalamityGlobalNPC.draedonExoMechWorm = npc.whoAmI;
|
||||
|
||||
// Difficulty modes
|
||||
bool malice = CalamityWorld.malice || BossRushEvent.BossRushActive;
|
||||
bool death = CalamityWorld.death || malice;
|
||||
bool revenge = CalamityWorld.revenge || malice;
|
||||
bool expertMode = Main.expertMode || malice;
|
||||
|
||||
// Percent life remaining
|
||||
float lifeRatio = npc.life / (float)npc.lifeMax;
|
||||
|
||||
// Increase aggression if player is taking a long time to kill the boss
|
||||
if (lifeRatio > calamityGlobalNPC.killTimeRatio_IncreasedAggression)
|
||||
lifeRatio = calamityGlobalNPC.killTimeRatio_IncreasedAggression;
|
||||
|
||||
// Check if the other exo mechs are alive
|
||||
int otherExoMechsAlive = 0;
|
||||
bool exoPrimeAlive = false;
|
||||
bool exoSpazAlive = false;
|
||||
bool exoRetAlive = false;
|
||||
if (CalamityGlobalNPC.draedonExoMechPrime != -1)
|
||||
{
|
||||
if (Main.npc[CalamityGlobalNPC.draedonExoMechPrime].active)
|
||||
{
|
||||
otherExoMechsAlive++;
|
||||
exoPrimeAlive = true;
|
||||
}
|
||||
}
|
||||
if (CalamityGlobalNPC.draedonExoMechTwinGreen != -1)
|
||||
{
|
||||
if (Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].active)
|
||||
{
|
||||
otherExoMechsAlive++;
|
||||
exoSpazAlive = true;
|
||||
}
|
||||
}
|
||||
if (CalamityGlobalNPC.draedonExoMechTwinRed != -1)
|
||||
{
|
||||
if (Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].active)
|
||||
{
|
||||
otherExoMechsAlive++;
|
||||
exoRetAlive = true;
|
||||
}
|
||||
}
|
||||
|
||||
// These are 5 by default to avoid triggering passive phases after the other mechs are dead
|
||||
float exoPrimeLifeRatio = defaultLifeRatio;
|
||||
float exoSpazLifeRatio = defaultLifeRatio;
|
||||
float exoRetLifeRatio = defaultLifeRatio;
|
||||
if (exoPrimeAlive)
|
||||
exoPrimeLifeRatio = Main.npc[CalamityGlobalNPC.draedonExoMechPrime].life / (float)Main.npc[CalamityGlobalNPC.draedonExoMechPrime].lifeMax;
|
||||
if (exoSpazAlive)
|
||||
exoSpazLifeRatio = Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].life / (float)Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].lifeMax;
|
||||
if (exoRetAlive)
|
||||
exoRetLifeRatio = Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].life / (float)Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].lifeMax;
|
||||
float totalOtherExoMechLifeRatio = exoPrimeLifeRatio + exoSpazLifeRatio + exoRetLifeRatio;
|
||||
|
||||
// Check if any of the other mechs are passive
|
||||
bool exoPrimePassive = false;
|
||||
bool exoSpazPassive = false;
|
||||
bool exoRetPassive = false;
|
||||
/*if (exoPrimeAlive)
|
||||
exoPrimePassive = Main.npc[CalamityGlobalNPC.draedonExoMechPrime].newAI[1] == (float)AresBody.SecondaryPhase.Passive;
|
||||
if (exoSpazAlive)
|
||||
exoSpazPassive = Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].newAI[1] == (float)Apollo.SecondaryPhase.Passive;
|
||||
if (exoRetAlive)
|
||||
exoRetPassive = Main.npc[CalamityGlobalNPC.draedonExoMechTwinRed].newAI[1] == (float)Artemis.SecondaryPhase.Passive;*/
|
||||
bool anyOtherExoMechPassive = exoPrimePassive || exoSpazPassive || exoRetPassive;
|
||||
|
||||
// Phases
|
||||
bool lessThan70PercentLife = lifeRatio < 0.7f;
|
||||
bool phase2 = lessThan70PercentLife && otherExoMechsAlive <= 1;
|
||||
bool berserk = lifeRatio < 0.4f || totalOtherExoMechLifeRatio > 3f;
|
||||
|
||||
// Set vulnerable to false by default
|
||||
vulnerable = false;
|
||||
|
||||
// If Thanatos doesn't go berserk
|
||||
bool otherMechIsBerserk = exoPrimeLifeRatio < 0.4f || exoSpazLifeRatio < 0.4f || exoRetLifeRatio < 0.4f;
|
||||
|
||||
// Get a target
|
||||
if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active)
|
||||
npc.TargetClosest();
|
||||
|
||||
// Despawn safety, make sure to target another player if the current player target is too far away
|
||||
if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles)
|
||||
npc.TargetClosest();
|
||||
|
||||
// Target variable
|
||||
Player player = Main.player[npc.target];
|
||||
|
||||
if (npc.ai[2] > 0f)
|
||||
npc.realLife = (int)npc.ai[2];
|
||||
|
||||
// Spawn segments
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
if (!TailSpawned && npc.ai[0] == 0f)
|
||||
{
|
||||
int Previous = npc.whoAmI;
|
||||
for (int num36 = 0; num36 < maxLength; num36++)
|
||||
{
|
||||
int lol;
|
||||
if (num36 >= 0 && num36 < minLength)
|
||||
{
|
||||
if (num36 % 2 == 0)
|
||||
lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType<ThanatosBody1>(), npc.whoAmI);
|
||||
else
|
||||
lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType<ThanatosBody2>(), npc.whoAmI);
|
||||
}
|
||||
else
|
||||
lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType<ThanatosTail>(), npc.whoAmI);
|
||||
|
||||
Main.npc[lol].realLife = npc.whoAmI;
|
||||
Main.npc[lol].ai[2] = npc.whoAmI;
|
||||
Main.npc[lol].ai[1] = Previous;
|
||||
Main.npc[Previous].ai[0] = lol;
|
||||
NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, lol, 0f, 0f, 0f, 0);
|
||||
Previous = lol;
|
||||
}
|
||||
TailSpawned = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Despawn if target is dead
|
||||
if (player.dead)
|
||||
{
|
||||
npc.TargetClosest(false);
|
||||
|
||||
npc.velocity.Y += 2f;
|
||||
if (npc.position.Y > Main.worldSurface * 16.0)
|
||||
npc.velocity.Y += 2f;
|
||||
|
||||
if (npc.position.Y > Main.rockLayer * 16.0)
|
||||
{
|
||||
for (int a = 0; a < Main.maxNPCs; a++)
|
||||
{
|
||||
if (Main.npc[a].type == npc.type || Main.npc[a].type == ModContent.NPCType<ThanatosBody1>() || Main.npc[a].type == ModContent.NPCType<ThanatosBody2>() || Main.npc[a].type == ModContent.NPCType<ThanatosTail>())
|
||||
Main.npc[a].active = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// General AI pattern
|
||||
// Fly towards the target for 7 seconds, gradually speeding up for the first 5 seconds and slowing down for the last 2 seconds, fire lasers from segments that are venting
|
||||
// Fly underneath the target and fire barrages of lasers
|
||||
// Fire deathray from mouth with a telegraph similar to the railgun from enter the gungeon, turn speed is very low during this to avoid cheap hits
|
||||
// Go passive and fly underneath the target while firing lasers
|
||||
// Go passive, immune and invisible; fly far underneath the target and do nothing until next phase
|
||||
|
||||
// Attack patterns
|
||||
// If spawned first
|
||||
// Phase 1 - 0, 1, 0, 2
|
||||
// Phase 2 - 4
|
||||
// Phase 3 - 3
|
||||
|
||||
// If berserk, this is the last phase of thanatos
|
||||
// Phase 4 - 0, 1, 0, 2
|
||||
|
||||
// If not berserk
|
||||
// Phase 4 - 4
|
||||
// Phase 5 - 0, 1, 0, 2
|
||||
|
||||
// If berserk, this is the last phase of thanatos
|
||||
// Phase 6 - 0, 1, 0, 2
|
||||
|
||||
// If not berserk
|
||||
// Phase 6 - 4
|
||||
// Phase 7 - 0, 1, 0, 2
|
||||
|
||||
// Phase gate values
|
||||
float velocityAdjustTime = 20f;
|
||||
float speedUpTime = 300f;
|
||||
float slowDownTime = 120f;
|
||||
float chargePhaseGateValue = speedUpTime + slowDownTime;
|
||||
|
||||
float laserBarrageDuration = 420f;
|
||||
|
||||
// Adjust opacity
|
||||
bool invisiblePhase = SecondaryAIState == (float)SecondaryPhase.PassiveAndImmune;
|
||||
npc.dontTakeDamage = invisiblePhase;
|
||||
if (!invisiblePhase)
|
||||
{
|
||||
npc.Opacity += 0.15f;
|
||||
if (npc.Opacity > 1f)
|
||||
npc.Opacity = 1f;
|
||||
}
|
||||
else
|
||||
{
|
||||
npc.Opacity -= 0.05f;
|
||||
if (npc.Opacity < 0f)
|
||||
npc.Opacity = 0f;
|
||||
}
|
||||
|
||||
// Rotation and direction
|
||||
npc.rotation = npc.velocity.ToRotation() + MathHelper.PiOver2;
|
||||
int direction = npc.direction;
|
||||
npc.direction = npc.spriteDirection = (npc.velocity.X > 0f) ? 1 : (-1);
|
||||
if (direction != npc.direction)
|
||||
npc.netUpdate = true;
|
||||
|
||||
// Default vector to fly to
|
||||
Vector2 destination = player.Center;
|
||||
|
||||
// Charge variables
|
||||
float turnDistance = baseTurnDistance;
|
||||
float chargeLocationDistance = turnDistance * 0.2f;
|
||||
|
||||
// Laser Barrage variables
|
||||
Vector2 laserBarrageLocation = new Vector2(0f, baseDistance);
|
||||
float laserBarrageLocationDistance = turnDistance * 5f;
|
||||
|
||||
// Velocity and turn speed values
|
||||
float baseVelocity = 9f;
|
||||
float turnSpeed = MathHelper.ToRadians(1f);
|
||||
float chargeVelocityMult = MathHelper.Lerp(1f, 2f, chargeVelocityScalar);
|
||||
float chargeTurnSpeedMult = MathHelper.Lerp(1f, 2f, chargeVelocityScalar);
|
||||
float laserBarragePhaseVelocityMult = MathHelper.Lerp(1f, 2f, chargeVelocityScalar);
|
||||
float laserBarragePhaseTurnSpeedMult = MathHelper.Lerp(1f, 8f, chargeVelocityScalar);
|
||||
float deathrayVelocityMult = MathHelper.Lerp(1f, 4f, chargeVelocityScalar);
|
||||
float deathrayTurnSpeedMult = MathHelper.Lerp(1f, 4f, chargeVelocityScalar);
|
||||
|
||||
// Base scale on total time spent in phase
|
||||
float chargeVelocityScalarIncrement = 1f / speedUpTime;
|
||||
float chargeVelocityScalarDecrement = 1f / slowDownTime;
|
||||
|
||||
// Scalar to use during laser barrage, passive and immune phases
|
||||
float laserBarrageVelocityScalarIncrement = 0.01f;
|
||||
float laserBarrageVelocityScalarDecrement = 1f / velocityAdjustTime;
|
||||
|
||||
// Distance from target
|
||||
float distanceFromTarget = Vector2.Distance(npc.Center, player.Center);
|
||||
|
||||
// Passive and Immune phases
|
||||
switch ((int)SecondaryAIState)
|
||||
{
|
||||
case (int)SecondaryPhase.Nothing:
|
||||
|
||||
// Spawn the other mechs if Thanatos is first
|
||||
if (otherExoMechsAlive == 0)
|
||||
{
|
||||
if (phase2 && !berserk)
|
||||
{
|
||||
SecondaryAIState = (float)SecondaryPhase.PassiveAndImmune;
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
// Spawn code here
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// If not spawned first, go to passive state if any other mech is passive or if Thanatos is under 70% life
|
||||
// Do not run this if berserk
|
||||
// Do not run this if any exo mech is dead
|
||||
if ((anyOtherExoMechPassive || lessThan70PercentLife) && !berserk && totalOtherExoMechLifeRatio < 5f)
|
||||
{
|
||||
// Tells Thanatos to return to the battle in passive state
|
||||
SecondaryAIState = (float)SecondaryPhase.Passive;
|
||||
}
|
||||
|
||||
// Go passive and immune if one of the other mechs is berserk
|
||||
// This is only called if two exo mechs are alive
|
||||
if (otherMechIsBerserk)
|
||||
SecondaryAIState = (float)SecondaryPhase.PassiveAndImmune;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
// Fly underneath target and fire lasers
|
||||
case (int)SecondaryPhase.Passive:
|
||||
|
||||
// Fire lasers while passive
|
||||
AIState = (float)Phase.UndergroundLaserBarrage;
|
||||
|
||||
// Enter passive and invincible phase if one of the other exo mechs is berserk
|
||||
if (otherMechIsBerserk)
|
||||
SecondaryAIState = (float)SecondaryPhase.PassiveAndImmune;
|
||||
|
||||
// If Thanatos is the first mech to go berserk
|
||||
if (berserk)
|
||||
{
|
||||
// Reset
|
||||
AIState = (float)Phase.Charge;
|
||||
|
||||
// Never be passive if berserk
|
||||
SecondaryAIState = (float)SecondaryPhase.Nothing;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
// Fly underneath target and become immune
|
||||
case (int)SecondaryPhase.PassiveAndImmune:
|
||||
|
||||
// Fire lasers while passive
|
||||
AIState = (float)Phase.UndergroundLaserBarrage;
|
||||
|
||||
// Enter the fight again if any of the other exo mechs is below 70% and the other mechs aren't berserk
|
||||
if ((exoPrimeLifeRatio < 0.7f || exoSpazLifeRatio < 0.7f || exoRetLifeRatio < 0.7f) && !otherMechIsBerserk)
|
||||
{
|
||||
// Tells Thanatos to return to the battle in passive state
|
||||
// Return to normal phases if one or more mechs have been downed
|
||||
SecondaryAIState = totalOtherExoMechLifeRatio > 5f ? (float)SecondaryPhase.Nothing : (float)SecondaryPhase.Passive;
|
||||
}
|
||||
|
||||
if (berserk)
|
||||
{
|
||||
// Reset
|
||||
AIState = (float)Phase.Charge;
|
||||
|
||||
// Never be passive if berserk
|
||||
SecondaryAIState = (float)SecondaryPhase.Nothing;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
// Attacking phases
|
||||
switch ((int)AIState)
|
||||
{
|
||||
// Fly towards target and gain velocity over time
|
||||
case (int)Phase.Charge:
|
||||
|
||||
// Use a lerp to smoothly scale up velocity and turn speed
|
||||
if (calamityGlobalNPC.newAI[3] == 0f)
|
||||
{
|
||||
chargeVelocityScalar += chargeVelocityScalarIncrement;
|
||||
if (chargeVelocityScalar >= 1f)
|
||||
{
|
||||
chargeVelocityScalar = 1f;
|
||||
calamityGlobalNPC.newAI[3] = 1f;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
chargeVelocityScalar -= chargeVelocityScalarDecrement;
|
||||
if (chargeVelocityScalar < 0f)
|
||||
chargeVelocityScalar = 0f;
|
||||
}
|
||||
|
||||
baseVelocity *= chargeVelocityMult;
|
||||
turnSpeed *= chargeTurnSpeedMult;
|
||||
turnDistance = chargeLocationDistance;
|
||||
|
||||
// Gradually turn slower if within 20 tiles of the target
|
||||
if (distanceFromTarget < 320f)
|
||||
turnSpeed *= distanceFromTarget / 320f;
|
||||
|
||||
calamityGlobalNPC.newAI[2] += 1f;
|
||||
if (calamityGlobalNPC.newAI[2] >= chargePhaseGateValue)
|
||||
{
|
||||
AIState = npc.localAI[0] == 1f ? (float)Phase.Deathray : (float)Phase.UndergroundLaserBarrage;
|
||||
calamityGlobalNPC.newAI[2] = 0f;
|
||||
calamityGlobalNPC.newAI[3] = 0f;
|
||||
chargeVelocityScalar = 0f;
|
||||
npc.TargetClosest();
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
// Fly below and summon barrages of lasers
|
||||
case (int)Phase.UndergroundLaserBarrage:
|
||||
|
||||
// Fly down
|
||||
destination += laserBarrageLocation;
|
||||
turnDistance = laserBarrageLocationDistance;
|
||||
|
||||
// Use a lerp to smoothly scale up velocity and turn speed
|
||||
if (calamityGlobalNPC.newAI[3] == 0f)
|
||||
{
|
||||
chargeVelocityScalar += laserBarrageVelocityScalarIncrement;
|
||||
if (chargeVelocityScalar > 1f)
|
||||
chargeVelocityScalar = 1f;
|
||||
}
|
||||
|
||||
baseVelocity *= laserBarragePhaseVelocityMult;
|
||||
turnSpeed *= laserBarragePhaseTurnSpeedMult;
|
||||
|
||||
if ((destination - npc.Center).Length() < laserBarrageLocationDistance || calamityGlobalNPC.newAI[2] > 0f)
|
||||
{
|
||||
calamityGlobalNPC.newAI[2] += 1f;
|
||||
|
||||
if (SecondaryAIState != (float)SecondaryPhase.Passive && SecondaryAIState != (float)SecondaryPhase.PassiveAndImmune)
|
||||
{
|
||||
if (calamityGlobalNPC.newAI[2] >= laserBarrageDuration)
|
||||
{
|
||||
// Use a lerp to smoothly scale down velocity and turn speed
|
||||
chargeVelocityScalar -= laserBarrageVelocityScalarDecrement;
|
||||
if (chargeVelocityScalar < 0f)
|
||||
chargeVelocityScalar = 0f;
|
||||
|
||||
calamityGlobalNPC.newAI[3] += 1f;
|
||||
if (calamityGlobalNPC.newAI[3] >= velocityAdjustTime)
|
||||
{
|
||||
npc.localAI[0] = 1f;
|
||||
AIState = (float)Phase.Charge;
|
||||
calamityGlobalNPC.newAI[2] = 0f;
|
||||
calamityGlobalNPC.newAI[3] = 0f;
|
||||
chargeVelocityScalar = 0f;
|
||||
npc.TargetClosest();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
// Move close to target, reduce velocity and turn speed when close enough, create telegraph beams, reduce turn speed, fire deathray
|
||||
case (int)Phase.Deathray:
|
||||
|
||||
// Head is vulnerable while charging and firing deathray
|
||||
vulnerable = true;
|
||||
|
||||
// If close enough to the target, prepare to fire deathray
|
||||
bool readyToFireDeathray = distanceFromTarget < 800f;
|
||||
if (readyToFireDeathray)
|
||||
npc.localAI[2] = 1f;
|
||||
|
||||
// Use a lerp to smoothly scale up velocity and turn speed
|
||||
if (calamityGlobalNPC.newAI[3] == 0f)
|
||||
{
|
||||
chargeVelocityScalar += chargeVelocityScalarIncrement;
|
||||
if (chargeVelocityScalar >= 1f)
|
||||
{
|
||||
chargeVelocityScalar = 1f;
|
||||
|
||||
// If ready to fire deathray, start reducing the velocity scalar
|
||||
if (npc.localAI[2] == 1f)
|
||||
calamityGlobalNPC.newAI[3] = 1f;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
chargeVelocityScalar -= chargeVelocityScalarDecrement;
|
||||
if (chargeVelocityScalar < 0f)
|
||||
chargeVelocityScalar = 0f;
|
||||
}
|
||||
|
||||
baseVelocity *= deathrayVelocityMult;
|
||||
turnSpeed *= deathrayTurnSpeedMult;
|
||||
turnDistance = chargeLocationDistance;
|
||||
|
||||
// Gradually turn and move slower if within 50 tiles of the target
|
||||
if (npc.localAI[2] == 1f)
|
||||
{
|
||||
baseVelocity *= distanceFromTarget / 800f;
|
||||
turnSpeed *= distanceFromTarget / 800f;
|
||||
|
||||
if (calamityGlobalNPC.newAI[2] < deathrayTelegraphDuration)
|
||||
{
|
||||
// Fire deathray telegraph beams
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Fire deathray
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (calamityGlobalNPC.newAI[2] >= deathrayTelegraphDuration + deathrayDuration)
|
||||
{
|
||||
npc.localAI[0] = 0f;
|
||||
npc.localAI[2] = 0f;
|
||||
AIState = (float)Phase.Charge;
|
||||
calamityGlobalNPC.newAI[2] = 0f;
|
||||
calamityGlobalNPC.newAI[3] = 0f;
|
||||
chargeVelocityScalar = 0f;
|
||||
npc.TargetClosest();
|
||||
}
|
||||
calamityGlobalNPC.newAI[2] += 1f;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
// Homing only works if vulnerable is true
|
||||
npc.chaseable = vulnerable;
|
||||
|
||||
// Adjust DR based on vulnerable
|
||||
npc.Calamity().DR = vulnerable ? 0f : 0.99f;
|
||||
npc.Calamity().unbreakableDR = !vulnerable;
|
||||
|
||||
// Vent noise and steam
|
||||
if (vulnerable)
|
||||
{
|
||||
// Noise
|
||||
if (npc.localAI[1] == 0f)
|
||||
Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ThanatosVent"), npc.Center);
|
||||
|
||||
// Steam
|
||||
float maxSteamTime = 180f;
|
||||
int maxGores = 4;
|
||||
if (npc.localAI[1] < maxSteamTime)
|
||||
{
|
||||
npc.localAI[1] += 1f;
|
||||
int goreAmt = maxGores - (int)Math.Round(npc.localAI[1] / 60f);
|
||||
CalamityUtils.ExplosionGores(npc.Center, goreAmt, true, npc.velocity);
|
||||
}
|
||||
}
|
||||
else
|
||||
npc.localAI[1] = 0f;
|
||||
|
||||
// Increase velocity if velocity is ever zero
|
||||
if (npc.velocity == Vector2.Zero)
|
||||
npc.velocity = Vector2.Normalize(player.Center - npc.Center).SafeNormalize(Vector2.Zero) * baseVelocity;
|
||||
|
||||
// Acceleration
|
||||
if (!((destination - npc.Center).Length() < turnDistance))
|
||||
{
|
||||
float targetAngle = npc.AngleTo(destination);
|
||||
float f = npc.velocity.ToRotation().AngleTowards(targetAngle, turnSpeed);
|
||||
npc.velocity = f.ToRotationVector2() * baseVelocity;
|
||||
}
|
||||
|
||||
// Velocity upper limit
|
||||
if (npc.velocity.Length() > baseVelocity)
|
||||
npc.velocity = npc.velocity.SafeNormalize(Vector2.Zero) * baseVelocity;
|
||||
|
||||
// Reduce Y velocity if it's less than 1
|
||||
if (Math.Abs(npc.velocity.Y) < 1f)
|
||||
npc.velocity.Y -= 0.1f;
|
||||
}
|
||||
|
||||
public override bool CanHitPlayer(Player target, ref int cooldownSlot)
|
||||
{
|
||||
cooldownSlot = 1;
|
||||
|
||||
Rectangle targetHitbox = target.Hitbox;
|
||||
|
||||
float dist1 = Vector2.Distance(npc.Center, targetHitbox.TopLeft());
|
||||
float dist2 = Vector2.Distance(npc.Center, targetHitbox.TopRight());
|
||||
float dist3 = Vector2.Distance(npc.Center, targetHitbox.BottomLeft());
|
||||
float dist4 = Vector2.Distance(npc.Center, targetHitbox.BottomRight());
|
||||
|
||||
float minDist = dist1;
|
||||
if (dist2 < minDist)
|
||||
minDist = dist2;
|
||||
if (dist3 < minDist)
|
||||
minDist = dist3;
|
||||
if (dist4 < minDist)
|
||||
minDist = dist4;
|
||||
|
||||
return minDist <= 50f && npc.Opacity == 1f;
|
||||
}
|
||||
|
||||
public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit)
|
||||
{
|
||||
return !CalamityUtils.AntiButcher(npc, ref damage, 0.5f);
|
||||
}
|
||||
|
||||
public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position)
|
||||
{
|
||||
scale = 1.5f;
|
||||
return null;
|
||||
}
|
||||
|
||||
public override void FindFrame(int frameHeight) // 5 total frames
|
||||
{
|
||||
// Swap between venting and non-venting frames
|
||||
if (AIState == (float)Phase.Charge || AIState == (float)Phase.UndergroundLaserBarrage)
|
||||
{
|
||||
npc.frameCounter += 1D;
|
||||
if (npc.frameCounter >= 12D)
|
||||
{
|
||||
npc.frame.Y -= frameHeight;
|
||||
npc.frameCounter = 0D;
|
||||
}
|
||||
if (npc.frame.Y < 0)
|
||||
npc.frame.Y = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
npc.frameCounter += 1D;
|
||||
if (npc.frameCounter >= 12D)
|
||||
{
|
||||
npc.frame.Y += frameHeight;
|
||||
npc.frameCounter = 0D;
|
||||
}
|
||||
if (npc.frame.Y >= frameHeight * Main.npcFrameCount[npc.type])
|
||||
npc.frame.Y = frameHeight * Main.npcFrameCount[npc.type];
|
||||
}
|
||||
}
|
||||
|
||||
public override void PostDraw(SpriteBatch spriteBatch, Color drawColor)
|
||||
{
|
||||
SpriteEffects spriteEffects = SpriteEffects.None;
|
||||
if (npc.spriteDirection == 1)
|
||||
spriteEffects = SpriteEffects.FlipHorizontally;
|
||||
|
||||
Texture2D texture = Main.npcTexture[npc.type];
|
||||
Vector2 vector = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2);
|
||||
|
||||
Vector2 center = npc.Center - Main.screenPosition;
|
||||
center -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f;
|
||||
center += vector * npc.scale + new Vector2(0f, 4f + npc.gfxOffY);
|
||||
spriteBatch.Draw(texture, center, npc.frame, npc.GetAlpha(drawColor), npc.rotation, vector, npc.scale, spriteEffects, 0f);
|
||||
|
||||
texture = ModContent.GetTexture("CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosHeadGlow");
|
||||
spriteBatch.Draw(texture, center, npc.frame, Color.White * npc.Opacity, npc.rotation, vector, npc.scale, spriteEffects, 0f);
|
||||
}
|
||||
|
||||
public override void NPCLoot()
|
||||
{
|
||||
/*DropHelper.DropItem(npc, ModContent.ItemType<Voidstone>(), 80, 100);
|
||||
DropHelper.DropItem(npc, ModContent.ItemType<EidolicWail>());
|
||||
DropHelper.DropItem(npc, ModContent.ItemType<SoulEdge>());
|
||||
DropHelper.DropItem(npc, ModContent.ItemType<HalibutCannon>());
|
||||
|
||||
DropHelper.DropItemCondition(npc, ModContent.ItemType<Lumenite>(), CalamityWorld.downedCalamitas, 1, 50, 108);
|
||||
DropHelper.DropItemCondition(npc, ModContent.ItemType<Lumenite>(), CalamityWorld.downedCalamitas && Main.expertMode, 2, 15, 27);
|
||||
DropHelper.DropItemCondition(npc, ItemID.Ectoplasm, NPC.downedPlantBoss, 1, 21, 32);*/
|
||||
}
|
||||
|
||||
public override void HitEffect(int hitDirection, double damage)
|
||||
{
|
||||
for (int k = 0; k < 3; k++)
|
||||
Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1f);
|
||||
|
||||
if (npc.life <= 0)
|
||||
{
|
||||
for (int num193 = 0; num193 < 2; num193++)
|
||||
{
|
||||
Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f);
|
||||
}
|
||||
for (int num194 = 0; num194 < 20; num194++)
|
||||
{
|
||||
int num195 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f);
|
||||
Main.dust[num195].noGravity = true;
|
||||
Main.dust[num195].velocity *= 3f;
|
||||
num195 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f);
|
||||
Main.dust[num195].velocity *= 2f;
|
||||
Main.dust[num195].noGravity = true;
|
||||
}
|
||||
|
||||
Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Thanatos/ThanatosHead"), 1f);
|
||||
Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Thanatos/ThanatosHead2"), 1f);
|
||||
Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Thanatos/ThanatosHead3"), 1f);
|
||||
}
|
||||
}
|
||||
|
||||
public override bool CheckActive() => false;
|
||||
|
||||
public override void ScaleExpertStats(int numPlayers, float bossLifeScale)
|
||||
{
|
||||
npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale);
|
||||
npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier());
|
||||
}
|
||||
|
||||
public override void OnHitPlayer(Player player, int damage, bool crit)
|
||||
{
|
||||
if (npc.Opacity == 1f)
|
||||
{
|
||||
int duration = vulnerable ? 180 : 90;
|
||||
player.AddBuff(BuffID.Ichor, duration);
|
||||
player.AddBuff(BuffID.CursedInferno, duration);
|
||||
player.AddBuff(ModContent.BuffType<ExoFreeze>(), duration / 4);
|
||||
player.AddBuff(ModContent.BuffType<BrimstoneFlames>(), duration);
|
||||
player.AddBuff(ModContent.BuffType<Plague>(), duration);
|
||||
player.AddBuff(ModContent.BuffType<HolyFlames>(), duration);
|
||||
player.AddBuff(BuffID.Frostburn, duration);
|
||||
player.AddBuff(BuffID.OnFire, duration);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 9.4 KiB |
@@ -0,0 +1,523 @@
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Buffs.StatDebuffs;
|
||||
using CalamityMod.Projectiles.Boss;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using System.IO;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.NPCs.ExoMechs.Thanatos
|
||||
{
|
||||
public class ThanatosTail : ModNPC
|
||||
{
|
||||
// Whether the tail is venting heat or not, it is vulnerable to damage during venting
|
||||
private bool vulnerable = false;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Thanatos");
|
||||
Main.npcFrameCount[npc.type] = 5;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
npc.Calamity().canBreakPlayerDefense = true;
|
||||
npc.npcSlots = 5f;
|
||||
npc.GetNPCDamage();
|
||||
npc.width = 84;
|
||||
npc.height = 118;
|
||||
npc.defense = 120;
|
||||
npc.DR_NERD(0.99f);
|
||||
npc.Calamity().unbreakableDR = true;
|
||||
npc.LifeMaxNERB(1000000, 1150000);
|
||||
double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01;
|
||||
npc.lifeMax += (int)(npc.lifeMax * HPBoost);
|
||||
npc.aiStyle = -1;
|
||||
aiType = -1;
|
||||
npc.knockBackResist = 0f;
|
||||
npc.Opacity = 0f;
|
||||
npc.behindTiles = true;
|
||||
npc.noGravity = true;
|
||||
npc.noTileCollide = true;
|
||||
npc.HitSound = SoundID.NPCHit4;
|
||||
npc.DeathSound = SoundID.NPCDeath14;
|
||||
npc.netAlways = true;
|
||||
npc.dontCountMe = true;
|
||||
npc.chaseable = false;
|
||||
npc.boss = true;
|
||||
music = /*CalamityMod.Instance.GetMusicFromMusicMod("AdultEidolonWyrm") ??*/ MusicID.Boss3;
|
||||
}
|
||||
|
||||
public override void SendExtraAI(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(npc.chaseable);
|
||||
writer.Write(npc.dontTakeDamage);
|
||||
writer.Write(vulnerable);
|
||||
writer.Write(npc.localAI[0]);
|
||||
writer.Write(npc.localAI[1]);
|
||||
for (int i = 0; i < 4; i++)
|
||||
writer.Write(npc.Calamity().newAI[i]);
|
||||
}
|
||||
|
||||
public override void ReceiveExtraAI(BinaryReader reader)
|
||||
{
|
||||
npc.chaseable = reader.ReadBoolean();
|
||||
npc.dontTakeDamage = reader.ReadBoolean();
|
||||
vulnerable = reader.ReadBoolean();
|
||||
npc.localAI[0] = reader.ReadSingle();
|
||||
npc.localAI[1] = reader.ReadSingle();
|
||||
for (int i = 0; i < 4; i++)
|
||||
npc.Calamity().newAI[i] = reader.ReadSingle();
|
||||
}
|
||||
|
||||
public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) => false;
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
if (npc.ai[2] > 0f)
|
||||
npc.realLife = (int)npc.ai[2];
|
||||
|
||||
// Check if other segments are still alive, if not, die
|
||||
bool shouldDespawn = true;
|
||||
for (int i = 0; i < Main.maxNPCs; i++)
|
||||
{
|
||||
if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType<ThanatosHead>())
|
||||
shouldDespawn = false;
|
||||
}
|
||||
if (!shouldDespawn)
|
||||
{
|
||||
if (npc.ai[1] > 0f)
|
||||
shouldDespawn = false;
|
||||
else if (Main.npc[(int)npc.ai[1]].life > 0)
|
||||
shouldDespawn = false;
|
||||
}
|
||||
if (shouldDespawn)
|
||||
{
|
||||
npc.life = 0;
|
||||
npc.HitEffect(0, 10.0);
|
||||
npc.checkDead();
|
||||
npc.active = false;
|
||||
}
|
||||
|
||||
// Set vulnerable to false by default
|
||||
vulnerable = false;
|
||||
|
||||
CalamityGlobalNPC calamityGlobalNPC_Head = Main.npc[(int)npc.ai[2]].Calamity();
|
||||
|
||||
bool invisiblePhase = calamityGlobalNPC_Head.newAI[1] == (float)ThanatosHead.SecondaryPhase.PassiveAndImmune;
|
||||
npc.dontTakeDamage = invisiblePhase;
|
||||
if (!invisiblePhase)
|
||||
{
|
||||
if (Main.npc[(int)npc.ai[1]].Opacity > 0.5f)
|
||||
{
|
||||
npc.Opacity += 0.15f;
|
||||
if (npc.Opacity > 1f)
|
||||
npc.Opacity = 1f;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
npc.Opacity -= 0.05f;
|
||||
if (npc.Opacity < 0f)
|
||||
npc.Opacity = 0f;
|
||||
}
|
||||
|
||||
// Set timer to whoAmI so that segments don't all fire lasers at the same time
|
||||
if (npc.localAI[2] == 0f)
|
||||
npc.localAI[2] = npc.ai[0];
|
||||
|
||||
bool shootTrackingLasers = (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge || calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.UndergroundLaserBarrage) && calamityGlobalNPC_Head.newAI[2] > 0f;
|
||||
if (shootTrackingLasers)
|
||||
{
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
npc.ai[3] += 1f;
|
||||
if (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge)
|
||||
{
|
||||
float divisor = 180f;
|
||||
if ((npc.ai[3] % divisor == 0f && npc.localAI[2] % 10f == 0f) || npc.Calamity().newAI[0] > 0f)
|
||||
{
|
||||
// Body is vulnerable while firing lasers
|
||||
vulnerable = true;
|
||||
|
||||
if (npc.Calamity().newAI[1] == 0f)
|
||||
{
|
||||
npc.Calamity().newAI[0] += 1f;
|
||||
if (npc.Calamity().newAI[0] >= 72f)
|
||||
{
|
||||
npc.Calamity().newAI[1] = 1f;
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
int maxTargets = 3;
|
||||
int[] whoAmIArray = new int[maxTargets];
|
||||
Vector2[] targetCenterArray = new Vector2[maxTargets];
|
||||
int numProjectiles = 0;
|
||||
float maxDistance = 2400f;
|
||||
|
||||
for (int i = 0; i < Main.maxPlayers; i++)
|
||||
{
|
||||
if (!Main.player[i].active || Main.player[i].dead)
|
||||
continue;
|
||||
|
||||
Vector2 playerCenter = Main.player[i].Center;
|
||||
float distance = Vector2.Distance(playerCenter, npc.Center);
|
||||
if (distance < maxDistance)
|
||||
{
|
||||
whoAmIArray[numProjectiles] = i;
|
||||
targetCenterArray[numProjectiles] = playerCenter;
|
||||
int projectileLimit = numProjectiles + 1;
|
||||
numProjectiles = projectileLimit;
|
||||
if (projectileLimit >= targetCenterArray.Length)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
float laserVelocity = 12f;
|
||||
for (int i = 0; i < numProjectiles; i++)
|
||||
{
|
||||
// Normal laser
|
||||
Vector2 projectileDestination = targetCenterArray[i] - npc.Center;
|
||||
Vector2 projectileVelocity = Vector2.Normalize(projectileDestination) * laserVelocity;
|
||||
int type = ModContent.ProjectileType<ExoDestroyerLaser>();
|
||||
int damage = npc.GetProjectileDamage(type);
|
||||
Projectile.NewProjectile(npc.Center, projectileVelocity, type, damage, 0f, Main.myPlayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
npc.Calamity().newAI[0] -= 1f;
|
||||
if (npc.Calamity().newAI[0] <= 0f)
|
||||
{
|
||||
npc.Calamity().newAI[0] = 0f;
|
||||
npc.Calamity().newAI[1] = 0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
npc.ai[3] += 1f;
|
||||
float shootProjectile = 60f;
|
||||
float timer = npc.ai[0] + 15f;
|
||||
float divisor = timer + shootProjectile;
|
||||
if (npc.ai[3] % divisor == 0f || npc.Calamity().newAI[0] > 0f)
|
||||
{
|
||||
// Body is vulnerable while firing lasers
|
||||
vulnerable = true;
|
||||
|
||||
if (npc.Calamity().newAI[1] == 0f)
|
||||
{
|
||||
npc.Calamity().newAI[0] += 1f;
|
||||
if (npc.Calamity().newAI[0] >= 72f)
|
||||
{
|
||||
npc.Calamity().newAI[1] = 1f;
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
int maxTargets = 3;
|
||||
int[] whoAmIArray = new int[maxTargets];
|
||||
Vector2[] targetCenterArray = new Vector2[maxTargets];
|
||||
int numProjectiles = 0;
|
||||
float maxDistance = 2400f;
|
||||
|
||||
for (int i = 0; i < Main.maxPlayers; i++)
|
||||
{
|
||||
if (!Main.player[i].active || Main.player[i].dead)
|
||||
continue;
|
||||
|
||||
Vector2 playerCenter = Main.player[i].Center;
|
||||
float distance = Vector2.Distance(playerCenter, npc.Center);
|
||||
if (distance < maxDistance)
|
||||
{
|
||||
whoAmIArray[numProjectiles] = i;
|
||||
targetCenterArray[numProjectiles] = playerCenter;
|
||||
int projectileLimit = numProjectiles + 1;
|
||||
numProjectiles = projectileLimit;
|
||||
if (projectileLimit >= targetCenterArray.Length)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
float predictionAmt = 20f;
|
||||
float laserVelocity = 12f;
|
||||
Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), npc.Center);
|
||||
for (int i = 0; i < numProjectiles; i++)
|
||||
{
|
||||
// Fire normal lasers if head is in passive state
|
||||
if (calamityGlobalNPC_Head.newAI[1] == (float)ThanatosHead.SecondaryPhase.Passive)
|
||||
{
|
||||
// Normal laser
|
||||
Vector2 projectileDestination = targetCenterArray[i] - npc.Center;
|
||||
Vector2 projectileVelocity = Vector2.Normalize(projectileDestination) * laserVelocity;
|
||||
int type = ModContent.ProjectileType<ExoDestroyerLaser>();
|
||||
int damage = npc.GetProjectileDamage(type);
|
||||
Projectile.NewProjectile(npc.Center, projectileVelocity, type, damage, 0f, Main.myPlayer);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Predictive laser
|
||||
Vector2 projectileDestination = targetCenterArray[i] + Main.player[whoAmIArray[i]].velocity * predictionAmt - npc.Center;
|
||||
Vector2 projectileVelocity = Vector2.Normalize(projectileDestination) * laserVelocity;
|
||||
int type = ModContent.ProjectileType<ExoDestroyerLaser>();
|
||||
int damage = npc.GetProjectileDamage(type);
|
||||
Projectile.NewProjectile(npc.Center, projectileVelocity, type, damage, 0f, Main.myPlayer);
|
||||
|
||||
// Opposite laser
|
||||
projectileDestination = targetCenterArray[i] - Main.player[whoAmIArray[i]].velocity * predictionAmt - npc.Center;
|
||||
projectileVelocity = Vector2.Normalize(projectileDestination) * laserVelocity;
|
||||
Projectile.NewProjectile(npc.Center, projectileVelocity, type, damage, 0f, Main.myPlayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
npc.Calamity().newAI[0] -= 1f;
|
||||
if (npc.Calamity().newAI[0] <= 0f)
|
||||
{
|
||||
npc.Calamity().newAI[0] = 0f;
|
||||
npc.Calamity().newAI[1] = 0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Set alternating laser-firing body segments every 3 seconds
|
||||
npc.localAI[1] += 1f;
|
||||
if (npc.localAI[1] >= 180f)
|
||||
{
|
||||
npc.localAI[1] = 0f;
|
||||
npc.localAI[2] += 1f;
|
||||
}
|
||||
|
||||
npc.Calamity().newAI[0] -= 1f;
|
||||
if (npc.Calamity().newAI[0] <= 0f)
|
||||
{
|
||||
npc.Calamity().newAI[0] = 0f;
|
||||
npc.Calamity().newAI[1] = 0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Body is vulnerable while venting
|
||||
vulnerable = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Homing only works if vulnerable is true
|
||||
npc.chaseable = vulnerable;
|
||||
|
||||
// Adjust DR based on vulnerable
|
||||
npc.Calamity().DR = vulnerable ? 0f : 0.99f;
|
||||
npc.Calamity().unbreakableDR = !vulnerable;
|
||||
|
||||
// Vent noise and steam
|
||||
if (vulnerable)
|
||||
{
|
||||
// Noise
|
||||
if (npc.localAI[0] == 0f)
|
||||
Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ThanatosVent"), npc.Center);
|
||||
|
||||
// Steam
|
||||
float maxSteamTime = 180f;
|
||||
int maxGores = 4;
|
||||
if (npc.localAI[0] < maxSteamTime)
|
||||
{
|
||||
npc.localAI[0] += 1f;
|
||||
int goreAmt = maxGores - (int)Math.Round(npc.localAI[0] / 60f);
|
||||
CalamityUtils.ExplosionGores(npc.Center, goreAmt, true, npc.velocity);
|
||||
}
|
||||
}
|
||||
else
|
||||
npc.localAI[0] = 0f;
|
||||
|
||||
Vector2 vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f);
|
||||
float num191 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2);
|
||||
float num192 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2);
|
||||
num191 = (int)(num191 / 16f) * 16;
|
||||
num192 = (int)(num192 / 16f) * 16;
|
||||
vector18.X = (int)(vector18.X / 16f) * 16;
|
||||
vector18.Y = (int)(vector18.Y / 16f) * 16;
|
||||
num191 -= vector18.X;
|
||||
num192 -= vector18.Y;
|
||||
|
||||
float num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192);
|
||||
if (npc.ai[1] > 0f && npc.ai[1] < Main.npc.Length)
|
||||
{
|
||||
try
|
||||
{
|
||||
vector18 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f);
|
||||
num191 = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - vector18.X;
|
||||
num192 = Main.npc[(int)npc.ai[1]].position.Y + (Main.npc[(int)npc.ai[1]].height / 2) - vector18.Y;
|
||||
} catch
|
||||
{
|
||||
}
|
||||
|
||||
npc.rotation = (float)Math.Atan2(num192, num191) + MathHelper.PiOver2;
|
||||
num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192);
|
||||
int num194 = npc.width;
|
||||
num193 = (num193 - num194) / num193;
|
||||
num191 *= num193;
|
||||
num192 *= num193;
|
||||
npc.velocity = Vector2.Zero;
|
||||
npc.position.X = npc.position.X + num191;
|
||||
npc.position.Y = npc.position.Y + num192;
|
||||
|
||||
if (num191 < 0f)
|
||||
npc.spriteDirection = -1;
|
||||
else if (num191 > 0f)
|
||||
npc.spriteDirection = 1;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool CanHitPlayer(Player target, ref int cooldownSlot)
|
||||
{
|
||||
cooldownSlot = 1;
|
||||
|
||||
Rectangle targetHitbox = target.Hitbox;
|
||||
|
||||
float dist1 = Vector2.Distance(npc.Center, targetHitbox.TopLeft());
|
||||
float dist2 = Vector2.Distance(npc.Center, targetHitbox.TopRight());
|
||||
float dist3 = Vector2.Distance(npc.Center, targetHitbox.BottomLeft());
|
||||
float dist4 = Vector2.Distance(npc.Center, targetHitbox.BottomRight());
|
||||
|
||||
float minDist = dist1;
|
||||
if (dist2 < minDist)
|
||||
minDist = dist2;
|
||||
if (dist3 < minDist)
|
||||
minDist = dist3;
|
||||
if (dist4 < minDist)
|
||||
minDist = dist4;
|
||||
|
||||
return minDist <= 45f && npc.Opacity == 1f;
|
||||
}
|
||||
|
||||
public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit)
|
||||
{
|
||||
return !CalamityUtils.AntiButcher(npc, ref damage, 0.5f);
|
||||
}
|
||||
|
||||
public override void FindFrame(int frameHeight) // 5 total frames
|
||||
{
|
||||
// Swap between venting and non-venting frames
|
||||
CalamityGlobalNPC calamityGlobalNPC_Head = Main.npc[(int)npc.ai[2]].Calamity();
|
||||
bool shootTrackingLasers = (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge || calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.UndergroundLaserBarrage) && calamityGlobalNPC_Head.newAI[2] > 0f;
|
||||
if (shootTrackingLasers)
|
||||
{
|
||||
npc.frameCounter += 1D;
|
||||
if (npc.Calamity().newAI[1] == 0f)
|
||||
{
|
||||
if (npc.frameCounter >= 12D)
|
||||
{
|
||||
npc.frame.Y += frameHeight;
|
||||
npc.frameCounter = 0D;
|
||||
}
|
||||
if (npc.frame.Y >= frameHeight * Main.npcFrameCount[npc.type])
|
||||
npc.frame.Y = frameHeight * Main.npcFrameCount[npc.type];
|
||||
}
|
||||
else
|
||||
{
|
||||
npc.frameCounter += 1D;
|
||||
if (npc.frameCounter >= 12D)
|
||||
{
|
||||
npc.frame.Y -= frameHeight;
|
||||
npc.frameCounter = 0D;
|
||||
}
|
||||
if (npc.frame.Y < 0)
|
||||
npc.frame.Y = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
npc.frameCounter += 1D;
|
||||
if (npc.frameCounter >= 12D)
|
||||
{
|
||||
npc.frame.Y -= frameHeight;
|
||||
npc.frameCounter = 0D;
|
||||
}
|
||||
if (npc.frame.Y < 0)
|
||||
npc.frame.Y = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public override void PostDraw(SpriteBatch spriteBatch, Color drawColor)
|
||||
{
|
||||
SpriteEffects spriteEffects = SpriteEffects.None;
|
||||
if (npc.spriteDirection == 1)
|
||||
spriteEffects = SpriteEffects.FlipHorizontally;
|
||||
|
||||
Texture2D texture = Main.npcTexture[npc.type];
|
||||
Vector2 vector = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2);
|
||||
|
||||
Vector2 center = npc.Center - Main.screenPosition;
|
||||
center -= new Vector2(texture.Width, texture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f;
|
||||
center += vector * npc.scale + new Vector2(0f, 4f + npc.gfxOffY);
|
||||
spriteBatch.Draw(texture, center, npc.frame, npc.GetAlpha(drawColor), npc.rotation, vector, npc.scale, spriteEffects, 0f);
|
||||
|
||||
texture = ModContent.GetTexture("CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosTailGlow");
|
||||
spriteBatch.Draw(texture, center, npc.frame, Color.White * npc.Opacity, npc.rotation, vector, npc.scale, spriteEffects, 0f);
|
||||
}
|
||||
|
||||
public override bool CheckActive() => false;
|
||||
|
||||
public override bool PreNPCLoot() => false;
|
||||
|
||||
public override void HitEffect(int hitDirection, double damage)
|
||||
{
|
||||
int baseDust = vulnerable ? 3 : 1;
|
||||
for (int k = 0; k < baseDust; k++)
|
||||
Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1f);
|
||||
|
||||
if (npc.life <= 0)
|
||||
{
|
||||
for (int num193 = 0; num193 < 2; num193++)
|
||||
{
|
||||
Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f);
|
||||
}
|
||||
for (int num194 = 0; num194 < 20; num194++)
|
||||
{
|
||||
int num195 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f);
|
||||
Main.dust[num195].noGravity = true;
|
||||
Main.dust[num195].velocity *= 3f;
|
||||
num195 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f);
|
||||
Main.dust[num195].velocity *= 2f;
|
||||
Main.dust[num195].noGravity = true;
|
||||
}
|
||||
|
||||
Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Thanatos/ThanatosTail"), 1f);
|
||||
Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Thanatos/ThanatosTail2"), 1f);
|
||||
Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Thanatos/ThanatosTail3"), 1f);
|
||||
Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Thanatos/ThanatosTail4"), 1f);
|
||||
}
|
||||
}
|
||||
|
||||
public override void ScaleExpertStats(int numPlayers, float bossLifeScale)
|
||||
{
|
||||
npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale);
|
||||
npc.damage = (int)(npc.damage * npc.GetExpertDamageMultiplier());
|
||||
}
|
||||
|
||||
public override void OnHitPlayer(Player player, int damage, bool crit)
|
||||
{
|
||||
if (npc.Opacity == 1f)
|
||||
{
|
||||
int duration = vulnerable ? 60 : 30;
|
||||
player.AddBuff(BuffID.Ichor, duration);
|
||||
player.AddBuff(BuffID.CursedInferno, duration);
|
||||
player.AddBuff(ModContent.BuffType<ExoFreeze>(), duration / 4);
|
||||
player.AddBuff(ModContent.BuffType<BrimstoneFlames>(), duration);
|
||||
player.AddBuff(ModContent.BuffType<Plague>(), duration);
|
||||
player.AddBuff(ModContent.BuffType<HolyFlames>(), duration);
|
||||
player.AddBuff(BuffID.Frostburn, duration);
|
||||
player.AddBuff(BuffID.OnFire, duration);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 5.5 KiB |
@@ -56,7 +56,12 @@ namespace CalamityMod.NPCs.NormalNPCs
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
bool adultWyrmAlive = NPC.AnyNPCs(ModContent.NPCType<EidolonWyrmHeadHuge>());
|
||||
bool adultWyrmAlive = false;
|
||||
if (CalamityGlobalNPC.adultEidolonWyrmHead != -1)
|
||||
{
|
||||
if (Main.npc[CalamityGlobalNPC.adultEidolonWyrmHead].active)
|
||||
adultWyrmAlive = true;
|
||||
}
|
||||
|
||||
npc.Opacity += 0.15f;
|
||||
if (npc.Opacity > 1f)
|
||||
|
||||
@@ -648,7 +648,6 @@ namespace CalamityMod.NPCs.SlimeGod
|
||||
// This loot code is shared with every other Slime God component.
|
||||
public static void DropSlimeGodLoot(NPC npc)
|
||||
{
|
||||
CalamityMod mod = ModContent.GetInstance<CalamityMod>();
|
||||
DropHelper.DropBags(npc);
|
||||
|
||||
DropHelper.DropItemChance(npc, ModContent.ItemType<SlimeGodTrophy>(), 10);
|
||||
|
||||
@@ -39,9 +39,8 @@ namespace CalamityMod.Projectiles.Boss
|
||||
projectile.frameCounter = 0;
|
||||
}
|
||||
if (projectile.frame > 2)
|
||||
{
|
||||
projectile.frame = 0;
|
||||
}
|
||||
|
||||
if (projectile.velocity.X < 0f)
|
||||
{
|
||||
projectile.spriteDirection = -1;
|
||||
@@ -52,14 +51,14 @@ namespace CalamityMod.Projectiles.Boss
|
||||
projectile.spriteDirection = 1;
|
||||
projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X);
|
||||
}
|
||||
|
||||
Lighting.AddLight(projectile.Center, 0.3f, 0.3f, 0f);
|
||||
|
||||
projectile.ai[0] += 1f;
|
||||
if (projectile.ai[0] > 9f)
|
||||
{
|
||||
if (projectile.alpha > 0)
|
||||
{
|
||||
projectile.alpha -= 5;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System.IO;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Boss
|
||||
{
|
||||
// Code used in the demonstration video.
|
||||
// This comment should be removed when implemented.
|
||||
/*for (int b = 0; b < 6; b++)
|
||||
* {
|
||||
int beam = Projectile.NewProjectile(npc.Center, Vector2.Zero, ModContent.ProjectileType<ExoDestroyerBeamTelegraph>(), 0, 0f, 255, npc.whoAmI);
|
||||
|
||||
// Determine the initial offset angle of telegraph. It will be smoothened to give a "stretch" effect.
|
||||
if (Main.projectile.IndexInRange(beam))
|
||||
{
|
||||
float squishedRatio = (float)Math.Pow((float)Math.Sin(MathHelper.Pi * b / 6f), 2D);
|
||||
float smoothenedRatio = MathHelper.SmoothStep(0f, 1f, squishedRatio);
|
||||
Main.projectile[beam].ai[1] = MathHelper.Lerp(-0.74f, 0.74f, smoothenedRatio);
|
||||
}
|
||||
}
|
||||
Projectile.NewProjectile(npc.Center, Vector2.Zero, ModContent.ProjectileType<ExoDestroyerBeamTelegraph>(), 0, 0f, 255, npc.whoAmI);
|
||||
*/
|
||||
public class ExoDestroyerBeamTelegraph : ModProjectile
|
||||
{
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
|
||||
public NPC ThingToAttachTo => Main.npc.IndexInRange((int)projectile.ai[0]) ? Main.npc[(int)projectile.ai[0]] : null;
|
||||
public float ConvergenceRatio => MathHelper.SmoothStep(0f, 1f, Utils.InverseLerp(25f, 120f, Time, true));
|
||||
public ref float StartingRotationalOffset => ref projectile.ai[1];
|
||||
public ref float ConvergenceAngle => ref projectile.localAI[0];
|
||||
public ref float Time => ref projectile.localAI[1];
|
||||
public const int Lifetime = 180;
|
||||
public const float TelegraphWidth = 3600f;
|
||||
public override void SetStaticDefaults() => DisplayName.SetDefault("Telegraph");
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
projectile.width = projectile.height = 4;
|
||||
projectile.ignoreWater = true;
|
||||
projectile.tileCollide = false;
|
||||
projectile.alpha = 255;
|
||||
projectile.penetrate = -1;
|
||||
projectile.extraUpdates = 1;
|
||||
projectile.timeLeft = Lifetime;
|
||||
}
|
||||
|
||||
public override void SendExtraAI(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(ConvergenceAngle);
|
||||
writer.Write(Time);
|
||||
}
|
||||
|
||||
public override void ReceiveExtraAI(BinaryReader reader)
|
||||
{
|
||||
ConvergenceAngle = reader.ReadSingle();
|
||||
Time = reader.ReadSingle();
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
// Die if the thing to attach to disappears.
|
||||
if (ThingToAttachTo is null || !ThingToAttachTo.active)
|
||||
{
|
||||
projectile.Kill();
|
||||
return;
|
||||
}
|
||||
|
||||
projectile.Center = ThingToAttachTo.Center;
|
||||
|
||||
// May want to change the ThingToAttachTo.velocity.ToRotation() part to instead just point towards a certain destination vector.
|
||||
projectile.rotation = StartingRotationalOffset.AngleLerp(ConvergenceAngle, ConvergenceRatio) + ThingToAttachTo.velocity.ToRotation();
|
||||
Time++;
|
||||
}
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
||||
{
|
||||
Texture2D laserTelegraph = ModContent.GetTexture("CalamityMod/ExtraTextures/LaserWallTelegraphBeam");
|
||||
|
||||
float verticalScale = Utils.InverseLerp(0f, 20f, Time, true) * Utils.InverseLerp(0f, 16f, projectile.timeLeft, true) * 4f;
|
||||
|
||||
Vector2 origin = laserTelegraph.Size() * new Vector2(0f, 0.5f);
|
||||
Vector2 scaleInner = new Vector2(TelegraphWidth / laserTelegraph.Width, verticalScale);
|
||||
Vector2 scaleOuter = scaleInner * new Vector2(1f, 2.2f);
|
||||
|
||||
Color colorOuter = Color.Lerp(Color.Red, Color.Crimson, Time / Lifetime * 2f % 1f); // Iterate through crimson and red twice and then flash.
|
||||
colorOuter = Color.Lerp(colorOuter, Color.White, Utils.InverseLerp(40f, 0f, projectile.timeLeft, true) * 0.8f);
|
||||
Color colorInner = Color.Lerp(colorOuter, Color.White, 0.5f);
|
||||
|
||||
colorInner *= 0.85f;
|
||||
colorOuter *= 0.7f;
|
||||
|
||||
spriteBatch.Draw(laserTelegraph, projectile.Center - Main.screenPosition, null, colorOuter, projectile.rotation, origin, scaleOuter, SpriteEffects.None, 0f);
|
||||
spriteBatch.Draw(laserTelegraph, projectile.Center - Main.screenPosition, null, colorInner, projectile.rotation, origin, scaleInner, SpriteEffects.None, 0f);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,176 @@
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System.IO;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Boss
|
||||
{
|
||||
public class ExoDestroyerLaser : ModProjectile
|
||||
{
|
||||
public float TelegraphDelay
|
||||
{
|
||||
get => projectile.ai[0];
|
||||
set => projectile.ai[0] = value;
|
||||
}
|
||||
|
||||
public Vector2 OldVelocity;
|
||||
public const float TelegraphTotalTime = 30f;
|
||||
public const float TelegraphFadeTime = 15f;
|
||||
public const float TelegraphWidth = 4200f;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Death Beam");
|
||||
Main.projFrames[projectile.type] = 4;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
projectile.Calamity().canBreakPlayerDefense = true;
|
||||
projectile.width = 22;
|
||||
projectile.height = 22;
|
||||
projectile.hostile = true;
|
||||
projectile.ignoreWater = true;
|
||||
projectile.tileCollide = false;
|
||||
projectile.alpha = 255;
|
||||
projectile.penetrate = -1;
|
||||
projectile.extraUpdates = 1;
|
||||
projectile.timeLeft = 300;
|
||||
cooldownSlot = 1;
|
||||
}
|
||||
|
||||
public override void SendExtraAI(BinaryWriter writer)
|
||||
{
|
||||
writer.WriteVector2(OldVelocity);
|
||||
}
|
||||
|
||||
public override void ReceiveExtraAI(BinaryReader reader)
|
||||
{
|
||||
OldVelocity = reader.ReadVector2();
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
// Determine the relative opacities for each player based on their distance.
|
||||
// This has a lower bound of 0.35 to prevent the laser from going completely invisible and players getting hit by cheap shots.
|
||||
if (projectile.localAI[0] == 0f)
|
||||
{
|
||||
projectile.localAI[0] = 1f;
|
||||
projectile.netUpdate = true;
|
||||
}
|
||||
|
||||
projectile.frameCounter++;
|
||||
if (projectile.frameCounter > 8)
|
||||
{
|
||||
projectile.frame++;
|
||||
projectile.frameCounter = 0;
|
||||
}
|
||||
if (projectile.frame > 3)
|
||||
projectile.frame = 0;
|
||||
|
||||
Lighting.AddLight(projectile.Center, 0.6f, 0f, 0f);
|
||||
|
||||
// Fade in after telegraphs have faded.
|
||||
if (TelegraphDelay > TelegraphTotalTime)
|
||||
{
|
||||
if (projectile.alpha > 0)
|
||||
projectile.alpha -= 25;
|
||||
if (projectile.alpha < 0)
|
||||
projectile.alpha = 0;
|
||||
|
||||
// If an old velocity is in reserve, set the true velocity to it and make it as "taken" by setting it to <0,0>
|
||||
if (OldVelocity != Vector2.Zero)
|
||||
{
|
||||
projectile.velocity = OldVelocity * (CalamityWorld.malice ? 1.25f : 1f);
|
||||
OldVelocity = Vector2.Zero;
|
||||
projectile.netUpdate = true;
|
||||
}
|
||||
|
||||
if (projectile.velocity.X < 0f)
|
||||
{
|
||||
projectile.spriteDirection = -1;
|
||||
projectile.rotation = (float)Math.Atan2((double)-(double)projectile.velocity.Y, (double)-(double)projectile.velocity.X);
|
||||
}
|
||||
else
|
||||
{
|
||||
projectile.spriteDirection = 1;
|
||||
projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X);
|
||||
}
|
||||
}
|
||||
// Otherwise, be sure to save the velocity the projectile started with. It will be set again when the telegraph is over.
|
||||
else if (OldVelocity == Vector2.Zero)
|
||||
{
|
||||
OldVelocity = projectile.velocity;
|
||||
projectile.velocity = Vector2.Zero;
|
||||
projectile.netUpdate = true;
|
||||
|
||||
if (projectile.velocity.X < 0f)
|
||||
{
|
||||
projectile.spriteDirection = -1;
|
||||
projectile.rotation = (float)Math.Atan2((double)-(double)OldVelocity.Y, (double)-(double)OldVelocity.X);
|
||||
}
|
||||
else
|
||||
{
|
||||
projectile.spriteDirection = 1;
|
||||
projectile.rotation = (float)Math.Atan2((double)OldVelocity.Y, (double)OldVelocity.X);
|
||||
}
|
||||
}
|
||||
|
||||
TelegraphDelay++;
|
||||
}
|
||||
|
||||
public override bool CanHitPlayer(Player target) => TelegraphDelay > TelegraphTotalTime;
|
||||
|
||||
public override void OnHitPlayer(Player target, int damage, bool crit)
|
||||
{
|
||||
if (TelegraphDelay > TelegraphTotalTime)
|
||||
{
|
||||
target.AddBuff(ModContent.BuffType<BrimstoneFlames>(), 180);
|
||||
target.AddBuff(BuffID.OnFire, 180);
|
||||
}
|
||||
}
|
||||
|
||||
public override Color? GetAlpha(Color lightColor)
|
||||
{
|
||||
return new Color(255, 255, 255, projectile.alpha);
|
||||
}
|
||||
|
||||
public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit)
|
||||
{
|
||||
target.Calamity().lastProjectileHit = projectile;
|
||||
}
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
||||
{
|
||||
if (TelegraphDelay >= TelegraphTotalTime)
|
||||
return true;
|
||||
|
||||
Texture2D laserTelegraph = ModContent.GetTexture("CalamityMod/ExtraTextures/LaserWallTelegraphBeam");
|
||||
|
||||
float yScale = 4f;
|
||||
if (TelegraphDelay < TelegraphFadeTime)
|
||||
yScale = MathHelper.Lerp(0f, 4f, TelegraphDelay / 15f);
|
||||
if (TelegraphDelay > TelegraphTotalTime - TelegraphFadeTime)
|
||||
yScale = MathHelper.Lerp(4f, 0f, (TelegraphDelay - (TelegraphTotalTime - TelegraphFadeTime)) / 15f);
|
||||
|
||||
Vector2 scaleInner = new Vector2(TelegraphWidth / laserTelegraph.Width, yScale);
|
||||
Vector2 origin = laserTelegraph.Size() * new Vector2(0f, 0.5f);
|
||||
Vector2 scaleOuter = scaleInner * new Vector2(1f, 2.2f);
|
||||
|
||||
Color colorOuter = Color.Lerp(Color.Red, Color.Crimson, TelegraphDelay / TelegraphTotalTime * 2f % 1f); // Iterate through crimson and red once and then flash.
|
||||
Color colorInner = Color.Lerp(colorOuter, Color.White, 0.75f);
|
||||
|
||||
colorOuter *= 0.7f;
|
||||
colorInner *= 0.7f;
|
||||
|
||||
spriteBatch.Draw(laserTelegraph, projectile.Center - Main.screenPosition, null, colorInner, OldVelocity.ToRotation(), origin, scaleInner, SpriteEffects.None, 0f);
|
||||
spriteBatch.Draw(laserTelegraph, projectile.Center - Main.screenPosition, null, colorOuter, OldVelocity.ToRotation(), origin, scaleOuter, SpriteEffects.None, 0f);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 662 B |
@@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
public override void AI()
|
||||
{
|
||||
projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver4;
|
||||
CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 200f, 12f, 20f);
|
||||
CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 200f, 12f, 20f);
|
||||
}
|
||||
|
||||
public override void Kill(int timeLeft)
|
||||
@@ -36,21 +36,21 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
Main.PlaySound(SoundID.Item14, projectile.Center);
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
int dustInt = Dust.NewDust(projectile.position, projectile.width, projectile.height, 138, 0f, 0f, 100, default, 1.2f);
|
||||
Main.dust[dustInt].velocity *= 3f;
|
||||
if (Main.rand.NextBool(2))
|
||||
{
|
||||
Main.dust[dustInt].scale = 0.5f;
|
||||
Main.dust[dustInt].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
|
||||
}
|
||||
int dustInt = Dust.NewDust(projectile.position, projectile.width, projectile.height, 138, 0f, 0f, 100, default, 1.2f);
|
||||
Main.dust[dustInt].velocity *= 3f;
|
||||
if (Main.rand.NextBool(2))
|
||||
{
|
||||
Main.dust[dustInt].scale = 0.5f;
|
||||
Main.dust[dustInt].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
|
||||
}
|
||||
}
|
||||
for (int j = 0; j < 3; j++)
|
||||
{
|
||||
int moreDust = Dust.NewDust(projectile.position, projectile.width, projectile.height, 138, 0f, 0f, 100, default, 1.7f);
|
||||
Main.dust[moreDust].noGravity = true;
|
||||
Main.dust[moreDust].velocity *= 5f;
|
||||
moreDust = Dust.NewDust(projectile.position, projectile.width, projectile.height, 138, 0f, 0f, 100, default, 1f);
|
||||
Main.dust[moreDust].velocity *= 2f;
|
||||
int moreDust = Dust.NewDust(projectile.position, projectile.width, projectile.height, 138, 0f, 0f, 100, default, 1.7f);
|
||||
Main.dust[moreDust].noGravity = true;
|
||||
Main.dust[moreDust].velocity *= 5f;
|
||||
moreDust = Dust.NewDust(projectile.position, projectile.width, projectile.height, 138, 0f, 0f, 100, default, 1f);
|
||||
Main.dust[moreDust].velocity *= 2f;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
projectile.localAI[1] = Main.rand.Next(8, 14); // 8 to 13 frames between each spearfall
|
||||
|
||||
int type = ModContent.ProjectileType<EclipsesSmol>();
|
||||
int smolDamage = (int)(projectile.damage * 0.14f); // SS overall used to have a 0.275x mult, meaning 0.11 to 0.165 damage here.
|
||||
int smolDamage = (int)(projectile.damage * 0.28f);
|
||||
float smolKB = 3f;
|
||||
// Used to be a 50% chance each spearfall for 1 or 2. Now is consistent.
|
||||
int numSpears = spawnTwoSpears ? 2 : 1;
|
||||
|
||||
@@ -4,6 +4,7 @@ using CalamityMod.Events;
|
||||
using CalamityMod.NPCs.AstrumDeus;
|
||||
using CalamityMod.NPCs.CeaselessVoid;
|
||||
using CalamityMod.NPCs.DevourerofGods;
|
||||
using CalamityMod.NPCs.ExoMechs.Thanatos;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using Terraria;
|
||||
@@ -20,7 +21,11 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
bool validBoss = npc.boss && npc.type != ModContent.NPCType<CeaselessVoid>()
|
||||
&& npc.type != ModContent.NPCType<DevourerofGodsBody>()
|
||||
&& npc.type != ModContent.NPCType<DevourerofGodsBodyS>()
|
||||
&& npc.type != ModContent.NPCType<AstrumDeusBodySpectral>();
|
||||
&& npc.type != ModContent.NPCType<AstrumDeusBodySpectral>()
|
||||
&& npc.type != ModContent.NPCType<ThanatosHead>()
|
||||
&& npc.type != ModContent.NPCType<ThanatosBody1>()
|
||||
&& npc.type != ModContent.NPCType<ThanatosBody2>()
|
||||
&& npc.type != ModContent.NPCType<ThanatosTail>();
|
||||
if (validBoss)
|
||||
return true;
|
||||
bool bossMinion = CalamityLists.bossMinionList.Contains(npc.type);
|
||||
|
||||
@@ -6,6 +6,7 @@ using CalamityMod.NPCs.Calamitas;
|
||||
using CalamityMod.NPCs.CeaselessVoid;
|
||||
using CalamityMod.NPCs.DesertScourge;
|
||||
using CalamityMod.NPCs.DevourerofGods;
|
||||
using CalamityMod.NPCs.ExoMechs.Thanatos;
|
||||
using CalamityMod.NPCs.GreatSandShark;
|
||||
using CalamityMod.NPCs.NormalNPCs;
|
||||
using CalamityMod.NPCs.Perforator;
|
||||
@@ -192,8 +193,11 @@ namespace CalamityMod.UI
|
||||
ModContent.NPCType<DevourerofGodsBody>(),
|
||||
ModContent.NPCType<DevourerofGodsTail>(),
|
||||
ModContent.NPCType<DevourerofGodsBodyS>(),
|
||||
ModContent.NPCType<DevourerofGodsTailS>()
|
||||
};
|
||||
ModContent.NPCType<DevourerofGodsTailS>(),
|
||||
ModContent.NPCType<ThanatosBody1>(),
|
||||
ModContent.NPCType<ThanatosBody2>(),
|
||||
ModContent.NPCType<ThanatosTail>()
|
||||
};
|
||||
}
|
||||
|
||||
private static void SetupMinibossHPBarList()
|
||||
|
||||
@@ -10,6 +10,7 @@ using System.Text;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.Localization;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod
|
||||
{
|
||||
@@ -221,34 +222,58 @@ namespace CalamityMod
|
||||
/// </summary>
|
||||
/// <param name="goreSource">The spot to spawn the explosion clouds</param>
|
||||
/// <param name="goreAmt">Number of times it loops to spawn gores</param>
|
||||
public static void ExplosionGores(Vector2 goreSource, int goreAmt)
|
||||
public static void ExplosionGores(Vector2 goreSource, int goreAmt, bool thanatos = false, Vector2 thanatosVelocity = default)
|
||||
{
|
||||
Vector2 source = new Vector2(goreSource.X - 24f, goreSource.Y - 24f);
|
||||
for (int goreIndex = 0; goreIndex < goreAmt; goreIndex++)
|
||||
{
|
||||
float velocityMult = 0.33f;
|
||||
if (goreIndex < (int)(goreAmt / 3))
|
||||
if (goreIndex < (goreAmt / 3))
|
||||
{
|
||||
velocityMult = 0.66f;
|
||||
}
|
||||
if (goreIndex >= (int)((2 * goreAmt) / 3))
|
||||
if (goreIndex >= (2 * goreAmt / 3))
|
||||
{
|
||||
velocityMult = 1f;
|
||||
}
|
||||
int smoke = Gore.NewGore(source, default, Main.rand.Next(61, 64), 1f);
|
||||
Mod mod = ModContent.GetInstance<CalamityMod>();
|
||||
int type = thanatos ? Main.rand.Next(mod.GetGoreSlot("Gores/Thanatos/ThanatosVentParticle1"), mod.GetGoreSlot("Gores/Thanatos/ThanatosVentParticle3") + 1) : Main.rand.Next(61, 64);
|
||||
int smoke = Gore.NewGore(source, default, type, 1f);
|
||||
Gore gore = Main.gore[smoke];
|
||||
if (thanatos)
|
||||
{
|
||||
gore.velocity = thanatosVelocity * -0.5f;
|
||||
}
|
||||
gore.velocity *= velocityMult;
|
||||
gore.velocity.X += 1f;
|
||||
gore.velocity.Y += 1f;
|
||||
smoke = Gore.NewGore(source, default, Main.rand.Next(61, 64), 1f);
|
||||
type = thanatos ? Main.rand.Next(mod.GetGoreSlot("Gores/Thanatos/ThanatosVentParticle1"), mod.GetGoreSlot("Gores/Thanatos/ThanatosVentParticle3") + 1) : Main.rand.Next(61, 64);
|
||||
smoke = Gore.NewGore(source, default, type, 1f);
|
||||
gore = Main.gore[smoke];
|
||||
if (thanatos)
|
||||
{
|
||||
gore.velocity = thanatosVelocity * -0.5f;
|
||||
}
|
||||
gore.velocity *= velocityMult;
|
||||
gore.velocity.X -= 1f;
|
||||
gore.velocity.Y += 1f;
|
||||
smoke = Gore.NewGore(source, default, Main.rand.Next(61, 64), 1f);
|
||||
type = thanatos ? Main.rand.Next(mod.GetGoreSlot("Gores/Thanatos/ThanatosVentParticle1"), mod.GetGoreSlot("Gores/Thanatos/ThanatosVentParticle3") + 1) : Main.rand.Next(61, 64);
|
||||
smoke = Gore.NewGore(source, default, type, 1f);
|
||||
gore = Main.gore[smoke];
|
||||
if (thanatos)
|
||||
{
|
||||
gore.velocity = thanatosVelocity * -0.5f;
|
||||
}
|
||||
gore.velocity *= velocityMult;
|
||||
gore.velocity.X += 1f;
|
||||
gore.velocity.Y -= 1f;
|
||||
smoke = Gore.NewGore(source, default, Main.rand.Next(61, 64), 1f);
|
||||
type = thanatos ? Main.rand.Next(mod.GetGoreSlot("Gores/Thanatos/ThanatosVentParticle1"), mod.GetGoreSlot("Gores/Thanatos/ThanatosVentParticle3") + 1) : Main.rand.Next(61, 64);
|
||||
smoke = Gore.NewGore(source, default, type, 1f);
|
||||
gore = Main.gore[smoke];
|
||||
if (thanatos)
|
||||
{
|
||||
gore.velocity = thanatosVelocity * -0.5f;
|
||||
}
|
||||
gore.velocity *= velocityMult;
|
||||
gore.velocity.X -= 1f;
|
||||
gore.velocity.Y -= 1f;
|
||||
|
||||
@@ -12,6 +12,7 @@ using CalamityMod.NPCs.CeaselessVoid;
|
||||
using CalamityMod.NPCs.Crags;
|
||||
using CalamityMod.NPCs.Cryogen;
|
||||
using CalamityMod.NPCs.DevourerofGods;
|
||||
using CalamityMod.NPCs.ExoMechs.Thanatos;
|
||||
using CalamityMod.NPCs.Leviathan;
|
||||
using CalamityMod.NPCs.NormalNPCs;
|
||||
using CalamityMod.NPCs.OldDuke;
|
||||
@@ -194,6 +195,11 @@ namespace CalamityMod
|
||||
{ ModContent.NPCType<SCalWormBodyWeak>(), new Tuple<bool, int[]>(true, new int[] { }) },
|
||||
{ ModContent.NPCType<SCalWormTail>(), new Tuple<bool, int[]>(true, new int[] { }) },
|
||||
|
||||
{ ModContent.NPCType<ThanatosHead>(), new Tuple<bool, int[]>(true, new int[] { }) },
|
||||
{ ModContent.NPCType<ThanatosBody1>(), new Tuple<bool, int[]>(true, new int[] { }) },
|
||||
{ ModContent.NPCType<ThanatosBody2>(), new Tuple<bool, int[]>(true, new int[] { }) },
|
||||
{ ModContent.NPCType<ThanatosTail>(), new Tuple<bool, int[]>(true, new int[] { }) },
|
||||
|
||||
{ ModContent.NPCType<EidolonWyrmHeadHuge>(), new Tuple<bool, int[]>(false, CalamityMod.abyssEnemyImmunities) },
|
||||
{ ModContent.NPCType<EidolonWyrmBodyHuge>(), new Tuple<bool, int[]>(true, new int[] { }) },
|
||||
{ ModContent.NPCType<EidolonWyrmBodyAltHuge>(), new Tuple<bool, int[]>(true, new int[] { }) },
|
||||
|
||||
@@ -11,6 +11,7 @@ using CalamityMod.NPCs.Crabulon;
|
||||
using CalamityMod.NPCs.Cryogen;
|
||||
using CalamityMod.NPCs.DesertScourge;
|
||||
using CalamityMod.NPCs.DevourerofGods;
|
||||
using CalamityMod.NPCs.ExoMechs.Thanatos;
|
||||
using CalamityMod.NPCs.HiveMind;
|
||||
using CalamityMod.NPCs.Leviathan;
|
||||
using CalamityMod.NPCs.NormalNPCs;
|
||||
@@ -283,6 +284,11 @@ namespace CalamityMod
|
||||
|
||||
{ ModContent.NPCType<SupremeCalamitas>(), 0.8 },
|
||||
|
||||
{ ModContent.NPCType<ThanatosHead>(), 0.8 },
|
||||
{ ModContent.NPCType<ThanatosBody1>(), 0.8 },
|
||||
{ ModContent.NPCType<ThanatosBody2>(), 0.8 },
|
||||
{ ModContent.NPCType<ThanatosTail>(), 0.8 },
|
||||
|
||||
{ ModContent.NPCType<EidolonWyrmHeadHuge>(), 0.8 }
|
||||
};
|
||||
|
||||
@@ -538,6 +544,11 @@ namespace CalamityMod
|
||||
|
||||
{ ModContent.NPCType<SupremeCalamitas>(), new int[] { 350, 560, 592, 608, 768 } },
|
||||
|
||||
{ ModContent.NPCType<ThanatosHead>(), new int[] { 400, 640, 680, 704, 864 } },
|
||||
{ ModContent.NPCType<ThanatosBody1>(), new int[] { 330, 528, 560, 576, 690 } },
|
||||
{ ModContent.NPCType<ThanatosBody2>(), new int[] { 330, 528, 560, 576, 690 } },
|
||||
{ ModContent.NPCType<ThanatosTail>(), new int[] { 260, 416, 446, 464, 570 } },
|
||||
|
||||
{ ModContent.NPCType<EidolonWyrmHeadHuge>(), new int[] { 400, 800, 850, 880, 1000 } }
|
||||
};
|
||||
|
||||
@@ -793,6 +804,10 @@ namespace CalamityMod
|
||||
{ new Tuple<int, int>(ModContent.NPCType<SupremeCatastrophe>(), ModContent.ProjectileType<BrimstoneHellblast2>()), new int[] { 400, 600, 632, 648, 948 } },
|
||||
{ new Tuple<int, int>(ModContent.NPCType<SupremeCatastrophe>(), ModContent.ProjectileType<BrimstoneBarrage>()), new int[] { 350, 528, 556, 572, 834 } },
|
||||
|
||||
{ new Tuple<int, int>(ModContent.NPCType<ThanatosBody1>(), ModContent.ProjectileType<ExoDestroyerLaser>()), new int[] { 350, 528, 556, 572, 834 } },
|
||||
{ new Tuple<int, int>(ModContent.NPCType<ThanatosBody2>(), ModContent.ProjectileType<ExoDestroyerLaser>()), new int[] { 350, 528, 556, 572, 834 } },
|
||||
{ new Tuple<int, int>(ModContent.NPCType<ThanatosTail>(), ModContent.ProjectileType<ExoDestroyerLaser>()), new int[] { 350, 528, 556, 572, 834 } },
|
||||
|
||||
{ new Tuple<int, int>(ModContent.NPCType<EidolonWyrmHeadHuge>(), ProjectileID.CultistBossIceMist), new int[] { 400, 600, 632, 648, 948 } },
|
||||
{ new Tuple<int, int>(ModContent.NPCType<EidolonWyrmHeadHuge>(), ProjectileID.CultistBossLightningOrbArc), new int[] { 500, 752, 788, 808, 1182 } },
|
||||
{ new Tuple<int, int>(ModContent.NPCType<EidolonWyrmHeadHuge>(), ProjectileID.AncientDoomProjectile), new int[] { 400, 600, 632, 648, 948 } },
|
||||
|
||||
@@ -230,6 +230,11 @@ namespace CalamityMod.World
|
||||
CalamityGlobalNPC.fireEye = -1;
|
||||
CalamityGlobalNPC.brimstoneElemental = -1;
|
||||
CalamityGlobalNPC.signus = -1;
|
||||
CalamityGlobalNPC.draedonExoMechPrime = -1;
|
||||
CalamityGlobalNPC.draedonExoMechTwinGreen = -1;
|
||||
CalamityGlobalNPC.draedonExoMechTwinRed = -1;
|
||||
CalamityGlobalNPC.draedonExoMechWorm = -1;
|
||||
CalamityGlobalNPC.adultEidolonWyrmHead = -1;
|
||||
BossRushEvent.BossRushStage = 0;
|
||||
DoGSecondStageCountdown = 0;
|
||||
ArmoredDiggerSpawnCooldown = 0;
|
||||
@@ -1666,9 +1671,16 @@ namespace CalamityMod.World
|
||||
|
||||
if (modPlayer.ZoneAbyss)
|
||||
{
|
||||
if (player.chaosState)
|
||||
if (player.chaosState && !player.dead)
|
||||
{
|
||||
if (!NPC.AnyNPCs(ModContent.NPCType<EidolonWyrmHeadHuge>()) && Main.netMode != NetmodeID.MultiplayerClient)
|
||||
bool adultWyrmAlive = false;
|
||||
if (CalamityGlobalNPC.adultEidolonWyrmHead != -1)
|
||||
{
|
||||
if (Main.npc[CalamityGlobalNPC.adultEidolonWyrmHead].active)
|
||||
adultWyrmAlive = true;
|
||||
}
|
||||
|
||||
if (!adultWyrmAlive && Main.netMode != NetmodeID.MultiplayerClient)
|
||||
NPC.SpawnOnPlayer(closestPlayer, ModContent.NPCType<EidolonWyrmHeadHuge>());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1102,7 +1102,6 @@ namespace CalamityMod.World
|
||||
Tile tile = Main.tile[x, y];
|
||||
int type = tile.type;
|
||||
int wallType = tile.wall;
|
||||
Mod mod = ModContent.GetInstance<CalamityMod>();
|
||||
|
||||
if (WorldGen.InWorld(x, y, 1))
|
||||
{
|
||||
|
||||