Return of the Ungodly Serpent (gfb armored digger)

This commit is contained in:
GinYuH committed 2023-01-13 01:43:24 -08:00
1 parent 20bdd21e33
commit 302ae637dc
4 files changed
+92 -9

No files matched your search

+49 -5
View File
@@ -1,4 +1,5 @@
using CalamityMod.Items.Placeables.Banners;
using CalamityMod.Projectiles.Boss;
using Microsoft.Xna.Framework;
using System;
using Terraria;
@@ -46,7 +47,7 @@ namespace CalamityMod.NPCs.NormalNPCs
public override void AI()
{
if (NPC.ai[3] > 0f)
if (NPC.ai[3] > 0f && Main.npc[(int)NPC.ai[3]].type == ModContent.NPCType<ArmoredDiggerHead>())
{
NPC.realLife = (int)NPC.ai[3];
}
@@ -65,9 +66,33 @@ namespace CalamityMod.NPCs.NormalNPCs
}
if (flag)
{
NPC.life = 0;
NPC.HitEffect(0, 10.0);
NPC.checkDead();
if (!Main.getGoodWorld) // move to zenith seed later
{
NPC.life = 0;
NPC.HitEffect(0, 10.0);
NPC.checkDead();
}
else
{
// find a new npc to attatch to in gfb, it's not a bug, it's a feature:tm:
for (int i = 0; i < Main.maxNPCs; i++)
{
NPC host = Main.npc[i];
if (host.active && !host.friendly && !host.dontTakeDamage && host.type != ModContent.NPCType<ArmoredDiggerHead>() && host.type != ModContent.NPCType<ArmoredDiggerBody>() && host.type != ModContent.NPCType<ArmoredDiggerTail>())
{
NPC.ai[1] = host.whoAmI;
NPC.ai[3] = host.whoAmI;
break;
}
}
// if it goes through the loop withuot finding an npc to attatch to (aka, ai[1] never changes and the head is still dead) kill as normal
if (Main.npc[(int)NPC.ai[1]].life <= 0)
{
NPC.life = 0;
NPC.HitEffect(0, 10.0);
NPC.checkDead();
}
}
}
if (Main.netMode != NetmodeID.MultiplayerClient)
{
@@ -88,7 +113,7 @@ namespace CalamityMod.NPCs.NormalNPCs
num6 *= num8;
num7 *= num8;
int num9 = 30;
int num10 = ProjectileID.SaucerScrap;
int num10 = Main.getGoodWorld ? ModContent.ProjectileType<ProvidenceCrystalShard>() : ProjectileID.SaucerScrap; // move to zenith seed later
vector.X += num6 * 5f;
vector.Y += num7 * 5f;
Projectile.NewProjectile(NPC.GetSource_FromAI(), vector.X, vector.Y, num6, num7, num10, num9, 0f, Main.myPlayer, 0f, 0f);
@@ -152,5 +177,24 @@ namespace CalamityMod.NPCs.NormalNPCs
{
return false;
}
public override void ModifyTypeName(ref string typeName)
{
// Move to zenith seed later
if (Main.getGoodWorld)
{
typeName = "Mechanized Serpent";
}
}
public override Color? GetAlpha(Color drawColor)
{
// Move to zenith seed later
// Every other body segment is pink while the rest are orange in gfb
Color baseColor = NPC.whoAmI % 2 == 0 ? Color.Orange : Color.Pink;
Color lightColor = baseColor * drawColor.A;
Color newColor = Main.getGoodWorld ? lightColor : new Color(255, 255, 255, drawColor.A);
return newColor * NPC.Opacity;
}
}
}
+22 -1
View File
@@ -1,5 +1,6 @@
using CalamityMod.Items.Materials;
using CalamityMod.Items.Placeables.Banners;
using CalamityMod.Items.Weapons.Summon;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using System;
@@ -8,6 +9,7 @@ using Terraria.GameContent.Bestiary;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.Audio;
using Terraria.GameContent.ItemDropRules;
namespace CalamityMod.NPCs.NormalNPCs
{
@@ -188,7 +190,7 @@ namespace CalamityMod.NPCs.NormalNPCs
NPC.localAI[1] = 0f;
}
float num17 = death ? 13.5f : 10f;
if (Main.player[NPC.target].dead || (double)Main.player[NPC.target].position.Y < Main.rockLayer * 16.0)
if (Main.player[NPC.target].dead || (!Main.getGoodWorld && (double)Main.player[NPC.target].position.Y < Main.rockLayer * 16.0)) // move to zenith seed later
{
flag2 = false;
NPC.velocity.Y = NPC.velocity.Y + 1f;
@@ -458,6 +460,25 @@ namespace CalamityMod.NPCs.NormalNPCs
npcLoot.Add(ModContent.ItemType<DemonicBoneAsh>(), 1, 2, 4);
npcLoot.Add(ModContent.ItemType<MysteriousCircuitry>(), 1, 4, 8);
npcLoot.Add(ModContent.ItemType<DubiousPlating>(), 1, 4, 8);
npcLoot.AddIf(() => Main.getGoodWorld, ModContent.ItemType<UnholyEssence>(), 1, 3, 6); // move to zenith seed later
npcLoot.AddIf(() => Main.getGoodWorld, ModContent.ItemType<EnergyStaff>(), 10);
}
public override void ModifyTypeName(ref string typeName)
{
// Move to zenith seed later
if (Main.getGoodWorld)
{
typeName = "Mechanized Serpent";
}
}
public override Color? GetAlpha(Color drawColor)
{
// Move to zenith seed later
Color lightColor = Color.Orange * drawColor.A;
Color newColor = Main.getGoodWorld ? lightColor : new Color(255, 255, 255, drawColor.A);
return newColor * NPC.Opacity;
}
}
}
+19 -2
View File
@@ -46,7 +46,7 @@ namespace CalamityMod.NPCs.NormalNPCs
public override void AI()
{
if (NPC.ai[3] > 0f)
if (NPC.ai[3] > 0f && Main.npc[(int)NPC.ai[3]].type == ModContent.NPCType<ArmoredDiggerHead>())
{
NPC.realLife = (int)NPC.ai[3];
}
@@ -63,7 +63,7 @@ namespace CalamityMod.NPCs.NormalNPCs
{
flag = true;
}
if (flag)
if (flag && !Main.getGoodWorld) // move to zenith seed later
{
NPC.life = 0;
NPC.HitEffect(0, 10.0);
@@ -125,5 +125,22 @@ namespace CalamityMod.NPCs.NormalNPCs
}
}
}
public override void ModifyTypeName(ref string typeName)
{
// Move to zenith seed later
if (Main.getGoodWorld)
{
typeName = "Mechanized Serpent";
}
}
public override Color? GetAlpha(Color drawColor)
{
// Move to zenith seed later
Color lightColor = Color.Orange * drawColor.A;
Color newColor = Main.getGoodWorld ? lightColor : new Color(255, 255, 255, drawColor.A);
return newColor * NPC.Opacity;
}
}
}
+2 -1
View File
@@ -339,7 +339,8 @@ namespace CalamityMod.Systems
#region Handle Armored Digger Random Spawns
public static void TrySpawnArmoredDigger(Player player, CalamityPlayer modPlayer)
{
if (player.ZoneRockLayerHeight && !player.ZoneUnderworldHeight && !player.ZoneDungeon && !player.ZoneJungle && !modPlayer.ZoneSunkenSea && !modPlayer.ZoneAbyss && !CalamityPlayer.areThereAnyDamnBosses)
bool gfbCondition = Main.getGoodWorld && (player.ZoneHallow || player.ZoneUnderworldHeight) && NPC.downedMoonlord; // move to zenith seed later
if ((gfbCondition || (player.ZoneRockLayerHeight && !player.ZoneUnderworldHeight && !player.ZoneJungle && !Main.getGoodWorld)) && !player.ZoneDungeon && !modPlayer.ZoneSunkenSea && !modPlayer.ZoneAbyss && !CalamityPlayer.areThereAnyDamnBosses)
{
if (NPC.downedPlantBoss && player.townNPCs < 3f)
{