Deleted Cosmic Guardian
No files matched your search
@@ -530,9 +530,6 @@ namespace CalamityMod
|
||||
{ ModContent.NPCType<DevourerofGodsHead>(), new int[] { 250, 500, 535, 600, 750 } },
|
||||
{ ModContent.NPCType<DevourerofGodsBody>(), new int[] { 150, 300, 330, 380, 450 } },
|
||||
{ ModContent.NPCType<DevourerofGodsTail>(), new int[] { 100, 200, 220, 270, 300 } },
|
||||
{ ModContent.NPCType<CosmicGuardianHead>(), new int[] { 150, 300, 330, 360, 450 } },
|
||||
{ ModContent.NPCType<CosmicGuardianBody>(), new int[] { 150, 300, 330, 360, 450 } },
|
||||
{ ModContent.NPCType<CosmicGuardianTail>(), new int[] { 150, 300, 330, 360, 450 } },
|
||||
|
||||
{ ModContent.NPCType<Yharon>(), new int[] { 300, 448, 480, 512, 900 } },
|
||||
|
||||
|
||||
@@ -373,7 +373,7 @@ namespace CalamityMod.Events
|
||||
|
||||
SoundEngine.PlaySound(DevourerofGodsHead.SpawnSound, player.Center);
|
||||
NPC.SpawnOnPlayer(ClosestPlayerToWorldCenter, type);
|
||||
}, usesSpecialSound: true, permittedNPCs: new int[] { ModContent.NPCType<DevourerofGodsBody>(), ModContent.NPCType<DevourerofGodsTail>(), ModContent.NPCType<CosmicGuardianHead>(), ModContent.NPCType<CosmicGuardianBody>(), ModContent.NPCType<CosmicGuardianTail>() }),
|
||||
}, usesSpecialSound: true, permittedNPCs: new int[] { ModContent.NPCType<DevourerofGodsBody>(), ModContent.NPCType<DevourerofGodsTail>() }),
|
||||
|
||||
new Boss(ModContent.NPCType<Yharon>(), spawnContext: type =>
|
||||
{
|
||||
|
||||
@@ -35,8 +35,7 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
|
||||
public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
bool isDoGSegment = target.type == ModContent.NPCType<DevourerofGodsBody>() || target.type == ModContent.NPCType<CosmicGuardianBody>();
|
||||
if (!isDoGSegment || Main.rand.NextBool(3))
|
||||
if (target.type != ModContent.NPCType<DevourerofGodsBody>() || Main.rand.NextBool(3))
|
||||
{
|
||||
CalamityPlayer.HorsemansBladeOnHit(player, target.whoAmI, Item.damage, Item.knockBack, 0, ModContent.ProjectileType<MourningSkull>());
|
||||
CalamityPlayer.HorsemansBladeOnHit(player, target.whoAmI, Item.damage, Item.knockBack, 1);
|
||||
|
||||
@@ -1,240 +0,0 @@
|
||||
using System.IO;
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Events;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
using Terraria;
|
||||
using Terraria.GameContent;
|
||||
using Terraria.ID;
|
||||
using Terraria.Localization;
|
||||
using Terraria.ModLoader;
|
||||
namespace CalamityMod.NPCs.DevourerofGods
|
||||
{
|
||||
[HasPierceResist]
|
||||
[LongDistanceNetSync(SyncWith = typeof(CosmicGuardianHead))]
|
||||
public class CosmicGuardianBody : ModNPC
|
||||
{
|
||||
public int invinceTime = 180;
|
||||
public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.CosmicGuardianHead.DisplayName");
|
||||
|
||||
public static Asset<Texture2D> GlowTexture;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
this.HideFromBestiary();
|
||||
if (!Main.dedServ)
|
||||
{
|
||||
GlowTexture = ModContent.Request<Texture2D>(Texture + "Glow", AssetRequestMode.AsyncLoad);
|
||||
}
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
NPC.GetNPCDamage();
|
||||
NPC.width = 34;
|
||||
NPC.height = 34;
|
||||
NPC.defense = 60;
|
||||
CalamityGlobalNPC global = NPC.Calamity();
|
||||
global.DR = 0.5f;
|
||||
global.unbreakableDR = true;
|
||||
NPC.lifeMax = 50000;
|
||||
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;
|
||||
|
||||
// Scale stats in Expert and Master
|
||||
CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC);
|
||||
CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC);
|
||||
}
|
||||
|
||||
public override void SendExtraAI(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(invinceTime);
|
||||
writer.Write(NPC.dontTakeDamage);
|
||||
}
|
||||
|
||||
public override void ReceiveExtraAI(BinaryReader reader)
|
||||
{
|
||||
invinceTime = reader.ReadInt32();
|
||||
NPC.dontTakeDamage = reader.ReadBoolean();
|
||||
}
|
||||
|
||||
public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
if (invinceTime > 0)
|
||||
{
|
||||
invinceTime--;
|
||||
NPC.damage = 0;
|
||||
NPC.dontTakeDamage = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
NPC.damage = NPC.defDamage;
|
||||
NPC.dontTakeDamage = false;
|
||||
}
|
||||
|
||||
if (NPC.ai[2] > 0f)
|
||||
NPC.realLife = (int)NPC.ai[2];
|
||||
|
||||
// Check if other segments are still alive, if not, die
|
||||
bool shouldDespawn = !NPC.AnyNPCs(ModContent.NPCType<CosmicGuardianHead>());
|
||||
if (!shouldDespawn)
|
||||
{
|
||||
if (NPC.ai[1] <= 0f)
|
||||
shouldDespawn = true;
|
||||
else if (Main.npc[(int)NPC.ai[1]].life <= 0)
|
||||
shouldDespawn = true;
|
||||
}
|
||||
if (shouldDespawn)
|
||||
{
|
||||
NPC.life = 0;
|
||||
NPC.HitEffect(0, 10.0);
|
||||
NPC.checkDead();
|
||||
NPC.active = false;
|
||||
}
|
||||
|
||||
NPC.Opacity = Main.npc[(int)NPC.ai[2]].Opacity;
|
||||
|
||||
Vector2 segmentPosition = NPC.Center;
|
||||
float targetX = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2);
|
||||
float targetY = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2);
|
||||
targetX = (int)(targetX / 16f) * 16;
|
||||
targetY = (int)(targetY / 16f) * 16;
|
||||
segmentPosition.X = (int)(segmentPosition.X / 16f) * 16;
|
||||
segmentPosition.Y = (int)(segmentPosition.Y / 16f) * 16;
|
||||
targetX -= segmentPosition.X;
|
||||
targetY -= segmentPosition.Y;
|
||||
float targetDistance = (float)System.Math.Sqrt(targetX * targetX + targetY * targetY);
|
||||
if (NPC.ai[1] > 0f && NPC.ai[1] < Main.npc.Length)
|
||||
{
|
||||
try
|
||||
{
|
||||
segmentPosition = NPC.Center;
|
||||
targetX = Main.npc[(int)NPC.ai[1]].position.X + (Main.npc[(int)NPC.ai[1]].width / 2) - segmentPosition.X;
|
||||
targetY = Main.npc[(int)NPC.ai[1]].position.Y + (Main.npc[(int)NPC.ai[1]].height / 2) - segmentPosition.Y;
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
NPC.rotation = (float)System.Math.Atan2(targetY, targetX) + 1.57f;
|
||||
targetDistance = (float)System.Math.Sqrt(targetX * targetX + targetY * targetY);
|
||||
int segmentWidth = NPC.width;
|
||||
targetDistance = (targetDistance - segmentWidth) / targetDistance;
|
||||
targetX *= targetDistance;
|
||||
targetY *= targetDistance;
|
||||
NPC.velocity = Vector2.Zero;
|
||||
NPC.position.X = NPC.position.X + targetX;
|
||||
NPC.position.Y = NPC.position.Y + targetY;
|
||||
}
|
||||
|
||||
// Calculate contact damage based on velocity
|
||||
float segmentVelocity = BossRushEvent.BossRushActive ? 30f : CalamityWorld.revenge ? 25f : 23f;
|
||||
float minimalContactDamageVelocity = segmentVelocity * 0.25f;
|
||||
float minimalDamageVelocity = segmentVelocity * 0.5f;
|
||||
float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length();
|
||||
if (bodyAndTailVelocity <= minimalContactDamageVelocity)
|
||||
{
|
||||
NPC.damage = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f);
|
||||
NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar);
|
||||
}
|
||||
}
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor)
|
||||
{
|
||||
SpriteEffects spriteEffects = SpriteEffects.None;
|
||||
if (NPC.spriteDirection == 1)
|
||||
spriteEffects = SpriteEffects.FlipHorizontally;
|
||||
|
||||
Texture2D texture2D15 = TextureAssets.Npc[Type].Value;
|
||||
Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[Type].Value.Width / 2), (float)(TextureAssets.Npc[Type].Value.Height / 2));
|
||||
|
||||
Vector2 drawLocation = NPC.Center - screenPos;
|
||||
drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f;
|
||||
drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY);
|
||||
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
|
||||
|
||||
texture2D15 = GlowTexture.Value;
|
||||
Color glowmaskColor = Color.Lerp(Color.White, Color.Fuchsia, 0.5f);
|
||||
|
||||
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool CanHitPlayer(Player target, ref int cooldownSlot)
|
||||
{
|
||||
cooldownSlot = ImmunityCooldownID.Bosses;
|
||||
return NPC.Opacity >= 1f && invinceTime <= 0;
|
||||
}
|
||||
|
||||
public override bool CheckActive()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void HitEffect(NPC.HitInfo hit)
|
||||
{
|
||||
if (NPC.life <= 0)
|
||||
{
|
||||
if (!Main.dedServ)
|
||||
{
|
||||
float randomSpread = Main.rand.Next(-200, 201) / 100f;
|
||||
Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.Find<ModGore>("DoT2").Type, 1f);
|
||||
Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.Find<ModGore>("DoT3").Type, 1f);
|
||||
Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.Find<ModGore>("DoT4").Type, 1f);
|
||||
Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.Find<ModGore>("DoT5").Type, 1f);
|
||||
}
|
||||
NPC.position.X = NPC.position.X + (float)(NPC.width / 2);
|
||||
NPC.position.Y = NPC.position.Y + (float)(NPC.height / 2);
|
||||
NPC.width = 50;
|
||||
NPC.height = 50;
|
||||
NPC.position.X = NPC.position.X - (float)(NPC.width / 2);
|
||||
NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2);
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
int cosmiliteDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f);
|
||||
Main.dust[cosmiliteDust].velocity *= 3f;
|
||||
if (Main.rand.NextBool())
|
||||
{
|
||||
Main.dust[cosmiliteDust].scale = 0.5f;
|
||||
Main.dust[cosmiliteDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
|
||||
}
|
||||
}
|
||||
for (int j = 0; j < 20; j++)
|
||||
{
|
||||
int cosmiliteDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f);
|
||||
Main.dust[cosmiliteDust2].noGravity = true;
|
||||
Main.dust[cosmiliteDust2].velocity *= 5f;
|
||||
cosmiliteDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f);
|
||||
Main.dust[cosmiliteDust2].velocity *= 2f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo)
|
||||
{
|
||||
if (hurtInfo.Damage > 0)
|
||||
target.AddBuff(ModContent.BuffType<GodSlayerInferno>(), 120);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 599 B |
@@ -1,457 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Events;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
using Terraria;
|
||||
using Terraria.GameContent;
|
||||
using Terraria.GameContent.Bestiary;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.NPCs.DevourerofGods
|
||||
{
|
||||
[HasPierceResist]
|
||||
[LongDistanceNetSync]
|
||||
public class CosmicGuardianHead : ModNPC
|
||||
{
|
||||
private bool tail = false;
|
||||
private const int minLength = 10;
|
||||
private const int maxLength = 11;
|
||||
private int invinceTime = 180;
|
||||
|
||||
public static Asset<Texture2D> GlowTexture;
|
||||
public static Asset<Texture2D> GlowTexture2;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
NPCID.Sets.BossBestiaryPriority.Add(Type);
|
||||
NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers()
|
||||
{
|
||||
Scale = 0.75f,
|
||||
PortraitScale = 0.75f,
|
||||
PortraitPositionXOverride = 40,
|
||||
PortraitPositionYOverride = 40
|
||||
};
|
||||
value.Position.X += 62f;
|
||||
value.Position.Y += 35f;
|
||||
NPCID.Sets.NPCBestiaryDrawOffset[Type] = value;
|
||||
if (!Main.dedServ)
|
||||
{
|
||||
GlowTexture = ModContent.Request<Texture2D>(Texture + "Glow", AssetRequestMode.AsyncLoad);
|
||||
GlowTexture2 = ModContent.Request<Texture2D>(Texture + "Glow2", AssetRequestMode.AsyncLoad);
|
||||
}
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
NPC.Calamity().canBreakPlayerDefense = true;
|
||||
NPC.GetNPCDamage();
|
||||
NPC.width = 64;
|
||||
NPC.height = 76;
|
||||
NPC.defense = 40;
|
||||
NPC.lifeMax = 30000;
|
||||
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;
|
||||
|
||||
// Scale stats in Expert and Master
|
||||
CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC);
|
||||
CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC);
|
||||
}
|
||||
|
||||
public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry)
|
||||
{
|
||||
int associatedNPCType = ModContent.NPCType<DevourerofGodsHead>();
|
||||
bestiaryEntry.UIInfoProvider = new CommonEnemyUICollectionInfoProvider(ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[associatedNPCType], quickUnlock: true);
|
||||
|
||||
bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[]
|
||||
{
|
||||
new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.CosmicGuardian")
|
||||
});
|
||||
}
|
||||
|
||||
public override void SendExtraAI(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(invinceTime);
|
||||
writer.Write(NPC.dontTakeDamage);
|
||||
}
|
||||
|
||||
public override void ReceiveExtraAI(BinaryReader reader)
|
||||
{
|
||||
invinceTime = reader.ReadInt32();
|
||||
NPC.dontTakeDamage = reader.ReadBoolean();
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
if (invinceTime > 0)
|
||||
{
|
||||
invinceTime--;
|
||||
NPC.damage = 0;
|
||||
NPC.dontTakeDamage = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
NPC.damage = NPC.defDamage;
|
||||
NPC.dontTakeDamage = false;
|
||||
}
|
||||
|
||||
Vector2 vector = NPC.Center;
|
||||
|
||||
if (NPC.ai[2] > 0f)
|
||||
NPC.realLife = (int)NPC.ai[2];
|
||||
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
if (!tail && NPC.ai[0] == 0f)
|
||||
{
|
||||
int Previous = NPC.whoAmI;
|
||||
for (int segmentSpawn = 0; segmentSpawn < maxLength; segmentSpawn++)
|
||||
{
|
||||
int segment;
|
||||
if (segmentSpawn >= 0 && segmentSpawn < minLength)
|
||||
{
|
||||
segment = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType<CosmicGuardianBody>(), NPC.whoAmI);
|
||||
}
|
||||
else
|
||||
{
|
||||
segment = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType<CosmicGuardianTail>(), NPC.whoAmI);
|
||||
}
|
||||
Main.npc[segment].realLife = NPC.whoAmI;
|
||||
Main.npc[segment].ai[2] = NPC.whoAmI;
|
||||
Main.npc[segment].ai[1] = Previous;
|
||||
Main.npc[Previous].ai[0] = segment;
|
||||
NPC.netUpdate = true;
|
||||
Previous = segment;
|
||||
}
|
||||
tail = true;
|
||||
}
|
||||
if (!NPC.active && Main.dedServ)
|
||||
{
|
||||
NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, NPC.whoAmI, -1f, 0f, 0f, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (CalamityGlobalNPC.DoGHead < 0 || !Main.npc[CalamityGlobalNPC.DoGHead].active)
|
||||
{
|
||||
NPC.velocity.Y -= 4f;
|
||||
|
||||
if ((double)NPC.position.Y < Main.topWorld + 16f)
|
||||
{
|
||||
for (int a = 0; a < Main.maxNPCs; a++)
|
||||
{
|
||||
if (Main.npc[a].type == NPC.type || Main.npc[a].type == ModContent.NPCType<CosmicGuardianBody>() || Main.npc[a].type == ModContent.NPCType<CosmicGuardianTail>())
|
||||
Main.npc[a].active = false;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = Main.player[Main.npc[CalamityGlobalNPC.DoGHead].target];
|
||||
|
||||
bool increaseSpeed = Vector2.Distance(player.Center, vector) > CalamityGlobalNPC.CatchUpDistance200Tiles;
|
||||
bool increaseSpeedMore = Vector2.Distance(player.Center, vector) > CalamityGlobalNPC.CatchUpDistance350Tiles;
|
||||
|
||||
NPC.Opacity = Main.npc[CalamityGlobalNPC.DoGHead].Opacity;
|
||||
|
||||
// Fly up and despawn if DoG enters phase 2 and isn't in the final Cosmic Guardian spawn phase.
|
||||
bool flyAwayAndDespawn = (Main.npc[CalamityGlobalNPC.DoGHead].life / (float)Main.npc[CalamityGlobalNPC.DoGHead].lifeMax < 0.6f && Main.npc[CalamityGlobalNPC.DoGHead].life / (float)Main.npc[CalamityGlobalNPC.DoGHead].lifeMax > 0.2f) || Main.npc[CalamityGlobalNPC.DoGHead].life <= 1;
|
||||
if (flyAwayAndDespawn)
|
||||
{
|
||||
// Prevents them from doing damage while despawning.
|
||||
NPC.Opacity = 0.99f;
|
||||
|
||||
NPC.velocity.Y -= 4f;
|
||||
|
||||
if ((double)NPC.position.Y < Main.topWorld + 16f)
|
||||
{
|
||||
for (int a = 0; a < Main.maxNPCs; a++)
|
||||
{
|
||||
if (Main.npc[a].type == NPC.type || Main.npc[a].type == ModContent.NPCType<CosmicGuardianBody>() || Main.npc[a].type == ModContent.NPCType<CosmicGuardianTail>())
|
||||
Main.npc[a].active = false;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Vector2 segmentDirection = NPC.Center;
|
||||
float dogHeadX = Main.npc[CalamityGlobalNPC.DoGHead].position.X + (Main.npc[CalamityGlobalNPC.DoGHead].width / 2);
|
||||
float dogHeadY = Main.npc[CalamityGlobalNPC.DoGHead].position.Y + (Main.npc[CalamityGlobalNPC.DoGHead].height / 2);
|
||||
float segmentVelocity = BossRushEvent.BossRushActive ? 30f : CalamityWorld.revenge ? 25f : 23f;
|
||||
float velocityMult = BossRushEvent.BossRushActive ? 0.9f : CalamityWorld.revenge ? 0.75f : 0.23f;
|
||||
float maxDistanceFromDoGHead = 160f;
|
||||
|
||||
if (increaseSpeedMore)
|
||||
velocityMult *= 4f;
|
||||
else if (increaseSpeed)
|
||||
velocityMult *= 2f;
|
||||
|
||||
foreach (NPC n in Main.ActiveNPCs)
|
||||
{
|
||||
if ((n.type == NPC.type || n.type == ModContent.NPCType<DevourerofGodsHead>()) && n.whoAmI != NPC.whoAmI)
|
||||
{
|
||||
Vector2 distFromHead = n.Center - NPC.Center;
|
||||
if (distFromHead.Length() < maxDistanceFromDoGHead)
|
||||
{
|
||||
distFromHead.Normalize();
|
||||
distFromHead *= maxDistanceFromDoGHead;
|
||||
dogHeadX -= distFromHead.X;
|
||||
dogHeadY -= distFromHead.Y;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
float higherMaxDistance = segmentVelocity * 1.3f;
|
||||
float lowerMaxDistance = segmentVelocity * 0.7f;
|
||||
float npcSpeed = NPC.velocity.Length();
|
||||
if (npcSpeed > 0f)
|
||||
{
|
||||
if (npcSpeed > higherMaxDistance)
|
||||
{
|
||||
NPC.velocity.Normalize();
|
||||
NPC.velocity *= higherMaxDistance;
|
||||
}
|
||||
else if (npcSpeed < lowerMaxDistance)
|
||||
{
|
||||
NPC.velocity.Normalize();
|
||||
NPC.velocity *= lowerMaxDistance;
|
||||
}
|
||||
}
|
||||
|
||||
dogHeadX = (int)(dogHeadX / 16f) * 16;
|
||||
dogHeadY = (int)(dogHeadY / 16f) * 16;
|
||||
segmentDirection.X = (int)(segmentDirection.X / 16f) * 16;
|
||||
segmentDirection.Y = (int)(segmentDirection.Y / 16f) * 16;
|
||||
dogHeadX -= segmentDirection.X;
|
||||
dogHeadY -= segmentDirection.Y;
|
||||
float targetDistance = (float)Math.Sqrt(dogHeadX * dogHeadX + dogHeadY * dogHeadY);
|
||||
float absoluteDoGX = Math.Abs(dogHeadX);
|
||||
float absoluteDoGY = Math.Abs(dogHeadY);
|
||||
float timeToReachTarget = segmentVelocity / targetDistance;
|
||||
dogHeadX *= timeToReachTarget;
|
||||
dogHeadY *= timeToReachTarget;
|
||||
if ((NPC.velocity.X > 0f && dogHeadX > 0f) || (NPC.velocity.X < 0f && dogHeadX < 0f) || (NPC.velocity.Y > 0f && dogHeadY > 0f) || (NPC.velocity.Y < 0f && dogHeadY < 0f))
|
||||
{
|
||||
if (NPC.velocity.X < dogHeadX)
|
||||
{
|
||||
NPC.velocity.X = NPC.velocity.X + velocityMult;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (NPC.velocity.X > dogHeadX)
|
||||
{
|
||||
NPC.velocity.X = NPC.velocity.X - velocityMult;
|
||||
}
|
||||
}
|
||||
if (NPC.velocity.Y < dogHeadY)
|
||||
{
|
||||
NPC.velocity.Y = NPC.velocity.Y + velocityMult;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (NPC.velocity.Y > dogHeadY)
|
||||
{
|
||||
NPC.velocity.Y = NPC.velocity.Y - velocityMult;
|
||||
}
|
||||
}
|
||||
if (Math.Abs(dogHeadY) < segmentVelocity * 0.2 && ((NPC.velocity.X > 0f && dogHeadX < 0f) || (NPC.velocity.X < 0f && dogHeadX > 0f)))
|
||||
{
|
||||
if (NPC.velocity.Y > 0f)
|
||||
{
|
||||
NPC.velocity.Y = NPC.velocity.Y + velocityMult * 2f;
|
||||
}
|
||||
else
|
||||
{
|
||||
NPC.velocity.Y = NPC.velocity.Y - velocityMult * 2f;
|
||||
}
|
||||
}
|
||||
if (Math.Abs(dogHeadX) < segmentVelocity * 0.2 && ((NPC.velocity.Y > 0f && dogHeadY < 0f) || (NPC.velocity.Y < 0f && dogHeadY > 0f)))
|
||||
{
|
||||
if (NPC.velocity.X > 0f)
|
||||
{
|
||||
NPC.velocity.X = NPC.velocity.X + velocityMult * 2f; //changed from 2
|
||||
}
|
||||
else
|
||||
{
|
||||
NPC.velocity.X = NPC.velocity.X - velocityMult * 2f; //changed from 2
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (absoluteDoGX > absoluteDoGY)
|
||||
{
|
||||
if (NPC.velocity.X < dogHeadX)
|
||||
{
|
||||
NPC.velocity.X = NPC.velocity.X + velocityMult * 1.1f; //changed from 1.1
|
||||
}
|
||||
else if (NPC.velocity.X > dogHeadX)
|
||||
{
|
||||
NPC.velocity.X = NPC.velocity.X - velocityMult * 1.1f; //changed from 1.1
|
||||
}
|
||||
if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < segmentVelocity * 0.5)
|
||||
{
|
||||
if (NPC.velocity.Y > 0f)
|
||||
{
|
||||
NPC.velocity.Y = NPC.velocity.Y + velocityMult;
|
||||
}
|
||||
else
|
||||
{
|
||||
NPC.velocity.Y = NPC.velocity.Y - velocityMult;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (NPC.velocity.Y < dogHeadY)
|
||||
{
|
||||
NPC.velocity.Y = NPC.velocity.Y + velocityMult * 1.1f;
|
||||
}
|
||||
else if (NPC.velocity.Y > dogHeadY)
|
||||
{
|
||||
NPC.velocity.Y = NPC.velocity.Y - velocityMult * 1.1f;
|
||||
}
|
||||
if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < segmentVelocity * 0.5)
|
||||
{
|
||||
if (NPC.velocity.X > 0f)
|
||||
{
|
||||
NPC.velocity.X = NPC.velocity.X + velocityMult;
|
||||
}
|
||||
else
|
||||
{
|
||||
NPC.velocity.X = NPC.velocity.X - velocityMult;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Calculate contact damage based on velocity
|
||||
float minimalContactDamageVelocity = segmentVelocity * 0.25f;
|
||||
float minimalDamageVelocity = segmentVelocity * 0.5f;
|
||||
if (NPC.velocity.Length() <= minimalContactDamageVelocity)
|
||||
{
|
||||
NPC.damage = (int)Math.Round(NPC.defDamage * 0.5);
|
||||
}
|
||||
else
|
||||
{
|
||||
float velocityDamageScalar = MathHelper.Clamp((NPC.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f);
|
||||
NPC.damage = (int)MathHelper.Lerp((float)Math.Round(NPC.defDamage * 0.5), NPC.defDamage, velocityDamageScalar);
|
||||
}
|
||||
|
||||
NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X) + MathHelper.PiOver2;
|
||||
}
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor)
|
||||
{
|
||||
if (NPC.IsABestiaryIconDummy)
|
||||
NPC.Opacity = 1f;
|
||||
|
||||
SpriteEffects spriteEffects = SpriteEffects.None;
|
||||
if (NPC.spriteDirection == 1)
|
||||
spriteEffects = SpriteEffects.FlipHorizontally;
|
||||
|
||||
Texture2D texture2D15 = TextureAssets.Npc[Type].Value;
|
||||
Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[Type].Value.Width / 2), (float)(TextureAssets.Npc[Type].Value.Height / 2));
|
||||
|
||||
|
||||
if (NPC.IsABestiaryIconDummy)
|
||||
{
|
||||
return CalamityUtils.DrawAnimatedBestiaryWorm(spriteBatch, NPC, drawColor, texture2D15, TextureAssets.Npc[ModContent.NPCType<CosmicGuardianBody>()].Value, 8, 26, 0.2f, new Vector2(-10, 0), 4, 5);
|
||||
}
|
||||
|
||||
Vector2 distFromHead3 = NPC.Center - screenPos;
|
||||
distFromHead3 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f;
|
||||
distFromHead3 += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY);
|
||||
spriteBatch.Draw(texture2D15, distFromHead3, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
|
||||
|
||||
texture2D15 = GlowTexture.Value;
|
||||
Color glowmaskColor = Color.Lerp(Color.White, Color.Fuchsia, 0.5f);
|
||||
|
||||
spriteBatch.Draw(texture2D15, distFromHead3, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
|
||||
|
||||
texture2D15 = GlowTexture2.Value;
|
||||
glowmaskColor = Color.Lerp(Color.White, Color.Cyan, 0.5f);
|
||||
|
||||
spriteBatch.Draw(texture2D15, distFromHead3, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void OnKill()
|
||||
{
|
||||
int heartAmt = Main.rand.Next(3) + 3;
|
||||
for (int i = 0; i < heartAmt; i++)
|
||||
Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart);
|
||||
}
|
||||
|
||||
public override bool CanHitPlayer(Player target, ref int cooldownSlot)
|
||||
{
|
||||
cooldownSlot = ImmunityCooldownID.Bosses;
|
||||
return NPC.Opacity >= 1f && invinceTime <= 0;
|
||||
}
|
||||
|
||||
public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position)
|
||||
{
|
||||
scale = 1.5f;
|
||||
return null;
|
||||
}
|
||||
|
||||
public override bool CheckActive()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void HitEffect(NPC.HitInfo hit)
|
||||
{
|
||||
if (NPC.life <= 0)
|
||||
{
|
||||
if (!Main.dedServ)
|
||||
{
|
||||
Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find<ModGore>("DoT").Type, 1f);
|
||||
}
|
||||
NPC.position.X = NPC.position.X + (float)(NPC.width / 2);
|
||||
NPC.position.Y = NPC.position.Y + (float)(NPC.height / 2);
|
||||
NPC.width = 50;
|
||||
NPC.height = 50;
|
||||
NPC.position.X = NPC.position.X - (float)(NPC.width / 2);
|
||||
NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2);
|
||||
for (int i = 0; i < 15; i++)
|
||||
{
|
||||
int cosmiliteDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f);
|
||||
Main.dust[cosmiliteDust].velocity *= 3f;
|
||||
if (Main.rand.NextBool())
|
||||
{
|
||||
Main.dust[cosmiliteDust].scale = 0.5f;
|
||||
Main.dust[cosmiliteDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
|
||||
}
|
||||
}
|
||||
for (int j = 0; j < 30; j++)
|
||||
{
|
||||
int cosmiliteDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f);
|
||||
Main.dust[cosmiliteDust2].noGravity = true;
|
||||
Main.dust[cosmiliteDust2].velocity *= 5f;
|
||||
cosmiliteDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f);
|
||||
Main.dust[cosmiliteDust2].velocity *= 2f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo)
|
||||
{
|
||||
if (hurtInfo.Damage > 0)
|
||||
target.AddBuff(ModContent.BuffType<GodSlayerInferno>(), 240);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 366 B |
|
Before Width: | Height: | Size: 573 B |
@@ -1,237 +0,0 @@
|
||||
using System.IO;
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Events;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
using Terraria;
|
||||
using Terraria.GameContent;
|
||||
using Terraria.ID;
|
||||
using Terraria.Localization;
|
||||
using Terraria.ModLoader;
|
||||
namespace CalamityMod.NPCs.DevourerofGods
|
||||
{
|
||||
[HasPierceResist]
|
||||
[LongDistanceNetSync(SyncWith = typeof(CosmicGuardianHead))]
|
||||
public class CosmicGuardianTail : ModNPC
|
||||
{
|
||||
public int invinceTime = 180;
|
||||
public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.CosmicGuardianHead.DisplayName");
|
||||
|
||||
public static Asset<Texture2D> GlowTexture;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
this.HideFromBestiary();
|
||||
if (!Main.dedServ)
|
||||
{
|
||||
GlowTexture = ModContent.Request<Texture2D>(Texture + "Glow", AssetRequestMode.AsyncLoad);
|
||||
}
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
NPC.GetNPCDamage();
|
||||
NPC.width = 30;
|
||||
NPC.height = 50;
|
||||
NPC.defense = 70;
|
||||
NPC.lifeMax = 50000;
|
||||
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;
|
||||
|
||||
// Scale stats in Expert and Master
|
||||
CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC);
|
||||
CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC);
|
||||
}
|
||||
|
||||
public override void SendExtraAI(BinaryWriter writer)
|
||||
{
|
||||
writer.Write(invinceTime);
|
||||
writer.Write(NPC.dontTakeDamage);
|
||||
}
|
||||
|
||||
public override void ReceiveExtraAI(BinaryReader reader)
|
||||
{
|
||||
invinceTime = reader.ReadInt32();
|
||||
NPC.dontTakeDamage = reader.ReadBoolean();
|
||||
}
|
||||
|
||||
public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
if (invinceTime > 0)
|
||||
{
|
||||
invinceTime--;
|
||||
NPC.damage = 0;
|
||||
NPC.dontTakeDamage = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
NPC.damage = NPC.defDamage;
|
||||
NPC.dontTakeDamage = false;
|
||||
}
|
||||
|
||||
if (NPC.ai[2] > 0f)
|
||||
NPC.realLife = (int)NPC.ai[2];
|
||||
|
||||
// Check if other segments are still alive, if not, die
|
||||
bool shouldDespawn = !NPC.AnyNPCs(ModContent.NPCType<CosmicGuardianHead>());
|
||||
if (!shouldDespawn)
|
||||
{
|
||||
if (NPC.ai[1] <= 0f)
|
||||
shouldDespawn = true;
|
||||
else if (Main.npc[(int)NPC.ai[1]].life <= 0)
|
||||
shouldDespawn = true;
|
||||
}
|
||||
if (shouldDespawn)
|
||||
{
|
||||
NPC.life = 0;
|
||||
NPC.HitEffect(0, 10.0);
|
||||
NPC.checkDead();
|
||||
NPC.active = false;
|
||||
}
|
||||
|
||||
NPC.Opacity = Main.npc[(int)NPC.ai[2]].Opacity;
|
||||
|
||||
Vector2 segmentPosition = NPC.Center;
|
||||
float targetX = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2);
|
||||
float targetY = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2);
|
||||
targetX = (int)(targetX / 16f) * 16;
|
||||
targetY = (int)(targetY / 16f) * 16;
|
||||
segmentPosition.X = (int)(segmentPosition.X / 16f) * 16;
|
||||
segmentPosition.Y = (int)(segmentPosition.Y / 16f) * 16;
|
||||
targetX -= segmentPosition.X;
|
||||
targetY -= segmentPosition.Y;
|
||||
float targetDistance = (float)System.Math.Sqrt(targetX * targetX + targetY * targetY);
|
||||
if (NPC.ai[1] > 0f && NPC.ai[1] < Main.npc.Length)
|
||||
{
|
||||
try
|
||||
{
|
||||
segmentPosition = NPC.Center;
|
||||
targetX = Main.npc[(int)NPC.ai[1]].position.X + (Main.npc[(int)NPC.ai[1]].width / 2) - segmentPosition.X;
|
||||
targetY = Main.npc[(int)NPC.ai[1]].position.Y + (Main.npc[(int)NPC.ai[1]].height / 2) - segmentPosition.Y;
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
NPC.rotation = (float)System.Math.Atan2(targetY, targetX) + 1.57f;
|
||||
targetDistance = (float)System.Math.Sqrt(targetX * targetX + targetY * targetY);
|
||||
int segmentWidth = NPC.width;
|
||||
targetDistance = (targetDistance - segmentWidth) / targetDistance;
|
||||
targetX *= targetDistance;
|
||||
targetY *= targetDistance;
|
||||
NPC.velocity = Vector2.Zero;
|
||||
NPC.position.X = NPC.position.X + targetX;
|
||||
NPC.position.Y = NPC.position.Y + targetY;
|
||||
}
|
||||
|
||||
// Calculate contact damage based on velocity
|
||||
float segmentVelocity = BossRushEvent.BossRushActive ? 30f : CalamityWorld.revenge ? 25f : 23f;
|
||||
float minimalContactDamageVelocity = segmentVelocity * 0.25f;
|
||||
float minimalDamageVelocity = segmentVelocity * 0.5f;
|
||||
float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length();
|
||||
if (bodyAndTailVelocity <= minimalContactDamageVelocity)
|
||||
{
|
||||
NPC.damage = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f);
|
||||
NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar);
|
||||
}
|
||||
}
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor)
|
||||
{
|
||||
SpriteEffects spriteEffects = SpriteEffects.None;
|
||||
if (NPC.spriteDirection == 1)
|
||||
spriteEffects = SpriteEffects.FlipHorizontally;
|
||||
|
||||
Texture2D texture2D15 = TextureAssets.Npc[Type].Value;
|
||||
Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[Type].Value.Width / 2), (float)(TextureAssets.Npc[Type].Value.Height / 2));
|
||||
|
||||
Vector2 drawLocation = NPC.Center - screenPos;
|
||||
drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f;
|
||||
drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY);
|
||||
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
|
||||
|
||||
texture2D15 = GlowTexture.Value;
|
||||
Color glowmaskColor = Color.Lerp(Color.White, Color.Cyan, 0.5f);
|
||||
|
||||
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool CanHitPlayer(Player target, ref int cooldownSlot)
|
||||
{
|
||||
cooldownSlot = ImmunityCooldownID.Bosses;
|
||||
return NPC.Opacity >= 1f && invinceTime <= 0;
|
||||
}
|
||||
|
||||
public override void HitEffect(NPC.HitInfo hit)
|
||||
{
|
||||
if (NPC.life <= 0)
|
||||
{
|
||||
if (!Main.dedServ)
|
||||
{
|
||||
float randomSpread = Main.rand.Next(-200, 201) / 100f;
|
||||
Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.Find<ModGore>("DoT2").Type, 1f);
|
||||
Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.Find<ModGore>("DoT3").Type, 1f);
|
||||
Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.Find<ModGore>("DoT4").Type, 1f);
|
||||
Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.Find<ModGore>("DoT5").Type, 1f);
|
||||
}
|
||||
NPC.position.X = NPC.position.X + (float)(NPC.width / 2);
|
||||
NPC.position.Y = NPC.position.Y + (float)(NPC.height / 2);
|
||||
NPC.width = 50;
|
||||
NPC.height = 50;
|
||||
NPC.position.X = NPC.position.X - (float)(NPC.width / 2);
|
||||
NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2);
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
int cosmiliteDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f);
|
||||
Main.dust[cosmiliteDust].velocity *= 3f;
|
||||
if (Main.rand.NextBool())
|
||||
{
|
||||
Main.dust[cosmiliteDust].scale = 0.5f;
|
||||
Main.dust[cosmiliteDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
|
||||
}
|
||||
}
|
||||
for (int j = 0; j < 20; j++)
|
||||
{
|
||||
int cosmiliteDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f);
|
||||
Main.dust[cosmiliteDust2].noGravity = true;
|
||||
Main.dust[cosmiliteDust2].velocity *= 5f;
|
||||
cosmiliteDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f);
|
||||
Main.dust[cosmiliteDust2].velocity *= 2f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override bool CheckActive()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo)
|
||||
{
|
||||
if (hurtInfo.Damage > 0)
|
||||
target.AddBuff(ModContent.BuffType<GodSlayerInferno>(), 60, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 640 B |
@@ -1,26 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using CalamityMod.NPCs.DevourerofGods;
|
||||
using Terraria.ModLoader;
|
||||
using static Terraria.ModLoader.ModContent;
|
||||
|
||||
namespace CalamityMod.Systems.Collections
|
||||
{
|
||||
public sealed class CosmicGuardianIDList : ModSystem
|
||||
{
|
||||
public static IList<int> List { get; private set; }
|
||||
|
||||
public override void OnModLoad()
|
||||
{
|
||||
List =
|
||||
[
|
||||
NPCType<CosmicGuardianHead>(),
|
||||
NPCType<CosmicGuardianBody>(),
|
||||
NPCType<CosmicGuardianTail>()
|
||||
];
|
||||
}
|
||||
|
||||
public override void Unload() => List = null;
|
||||
|
||||
public static bool Includes(int npcType) => List.Contains(npcType);
|
||||
}
|
||||
}
|
||||
@@ -84,9 +84,6 @@ namespace CalamityMod.Systems.Collections
|
||||
NPCType<AureusSpawn>(),
|
||||
NPCType<Brimling>(),
|
||||
NPCType<CrabShroom>(),
|
||||
NPCType<CosmicGuardianBody>(),
|
||||
NPCType<CosmicGuardianTail>(),
|
||||
NPCType<CosmicGuardianHead>(),
|
||||
NPCType<DankCreeper>(),
|
||||
NPCType<HiveBlob>(),
|
||||
NPCType<HiveBlob2>(),
|
||||
|
||||
@@ -281,9 +281,6 @@ namespace CalamityMod
|
||||
{ ModContent.NPCType<DevourerofGodsHead>(), immuneToEverything },
|
||||
{ ModContent.NPCType<DevourerofGodsBody>(), immuneToEverything },
|
||||
{ ModContent.NPCType<DevourerofGodsTail>(), immuneToEverything },
|
||||
{ ModContent.NPCType<CosmicGuardianHead>(), immuneToEverything },
|
||||
{ ModContent.NPCType<CosmicGuardianBody>(), immuneToEverything },
|
||||
{ ModContent.NPCType<CosmicGuardianTail>(), immuneToEverything },
|
||||
|
||||
{ ModContent.NPCType<Yharon>(), new(GeneralImmunityStatus.None, new int[] { BuffID.OnFire, ModContent.BuffType<Dragonfire>() }) },
|
||||
|
||||
|
||||