Init Commit because im an Init Twat

This commit is contained in:
2025-10-30 23:50:31 +00:00
commit 7a9b03d1d0
59 changed files with 1978 additions and 0 deletions
+136
View File
@@ -0,0 +1,136 @@
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Microsoft.Xna.Framework;
using Terraria.Chat;
using Terraria.Localization;
namespace ForgottenWawiTech.Content.NPCs.OriginalNeptune
{
[AutoloadBossHead]
public class Neptune : ModNPC
{
public override void SetStaticDefaults()
{
// DisplayName.SetDefault("Original Neptune");
Main.npcFrameCount[NPC.type] = 1;
}
public override void SetDefaults()
{
NPC.width = 40;
NPC.height = 40;
NPC.damage = 1786;
NPC.defense = 290;
NPC.lifeMax = 1000000;
NPC.HitSound = SoundID.NPCHit1;
NPC.DeathSound = SoundID.NPCDeath1;
NPC.knockBackResist = 0f;
NPC.boss = true;
NPC.aiStyle = -1;
NPC.value = Item.buyPrice(0, 1, 0, 0);
}
public override void AI()
{
// Phased boss AI: at 50% HP spawn Raccoon. Neptune becomes invulnerable and does not attack
// until Raccoon is defeated, then move to Phase 2.
NPC.TargetClosest(false);
Player target = Main.player[NPC.target];
if (!target.active || target.dead)
{
NPC.timeLeft = 300;
return;
}
int phase = (int)NPC.ai[0]; // 0 = phase 1 (initial), 1 = waiting for raccoon, 2 = phase 2
int flags = (int)NPC.ai[1]; // bitflags: bit0 = raccoon spawned
// Phase 0: before Raccoon summoned
if (phase == 0)
{
// If at or below 50% life and raccoon hasn't been spawned, spawn it and enter waiting state
if (NPC.life <= NPC.lifeMax / 2 && (flags & 1) == 0)
{
flags |= 1;
NPC.ai[1] = flags;
// Make Neptune invulnerable and enter waiting phase
NPC.dontTakeDamage = true;
NPC.ai[0] = 1;
NPC.netUpdate = true;
string announce = "A mischievous raccoon scurries into the battlefield!";
}
// Simple approach movement when not waiting
if (NPC.ai[0] == 0)
{
Vector2 dir = (target.Center - NPC.Center);
if (dir.Length() > 8f)
{
dir.Normalize();
NPC.velocity = Vector2.Lerp(NPC.velocity, dir * 3f, 0.02f);
}
}
}
// Phase 1: waiting for Raccoon to be defeated
else if (phase == 1)
{
bool raccoonAlive = false;
int raccoonType = ModContent.NPCType<Raccoon>();
for (int i = 0; i < Main.maxNPCs; i++)
{
NPC check = Main.npc[i];
if (check.active && check.type == raccoonType)
{
raccoonAlive = true;
break;
}
}
// Stay invulnerable and idle until raccoon is gone
if (!raccoonAlive)
{
NPC.dontTakeDamage = false;
NPC.ai[0] = 2; // enter Phase 2
NPC.netUpdate = true;
}
else
{
// idle drift while waiting
NPC.velocity *= 0.98f;
}
}
// Phase 2+: normal behaviour (placeholder movement)
else
{
Vector2 dir = (target.Center - NPC.Center);
if (dir.Length() > 8f)
{
dir.Normalize();
NPC.velocity = Vector2.Lerp(NPC.velocity, dir * 4f, 0.02f);
}
NPC.spriteDirection = NPC.direction = (target.Center.X < NPC.Center.X) ? -1 : 1;
}
}
public override void OnKill()
{
/* // Spawn NeptuneNPC when killed
if (Main.netMode != NetmodeID.MultiplayerClient)
{
NPC.NewNPC(NPC.GetSource_Death(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType<NeptuneNPC>());
}
else
{
NetMessage.SendData(MessageID.SpawnNPC, number: ModContent.NPCType<NeptuneNPC>(), number2: NPC.whoAmI);
} */
// Set a world flag or similar to indicate Neptune has been defeated
WorldDefeatedBosses.Neptune = true;
// Immediate sync of world flags
WorldDefeatedBosses.Sync(ModContent.GetInstance<ForgottenWawiTech>());
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 504 B

+125
View File
@@ -0,0 +1,125 @@
using System.Collections.Generic;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.GameContent.Personalities;
using Terraria.Localization;
namespace ForgottenWawiTech.Content.NPCs.OriginalNeptune
{
[AutoloadHead]
public class NeptuneNPC : ModNPC
{
public override void SetStaticDefaults()
{
// DisplayName.SetDefault("Neptune");
Main.npcFrameCount[NPC.type] = 25;
NPCID.Sets.ExtraFramesCount[NPC.type] = 9;
NPCID.Sets.AttackFrameCount[NPC.type] = 4;
NPCID.Sets.DangerDetectRange[NPC.type] = 700;
NPCID.Sets.AttackType[NPC.type] = 0;
NPCID.Sets.AttackTime[NPC.type] = 90;
NPCID.Sets.AttackAverageChance[NPC.type] = 30;
NPCID.Sets.HatOffsetY[NPC.type] = 4;
NPCID.Sets.NPCBestiaryDrawModifiers drawModifiers = new NPCID.Sets.NPCBestiaryDrawModifiers(0)
{
Velocity = 1f,
Direction = 1
};
NPCID.Sets.NPCBestiaryDrawOffset.Add(Type, drawModifiers);
}
public override void SetDefaults()
{
NPC.townNPC = true;
NPC.friendly = true;
NPC.width = 18;
NPC.height = 40;
NPC.aiStyle = 7;
NPC.damage = 10;
NPC.defense = 15;
NPC.lifeMax = 250;
NPC.HitSound = SoundID.NPCHit1;
NPC.DeathSound = SoundID.NPCDeath1;
NPC.knockBackResist = 0.5f;
AnimationType = NPCID.Guide;
}
public override bool CanTownNPCSpawn(int numTownNPCs)
{
return WorldDefeatedBosses.Neptune;
}
public override List<string> SetNPCNameList()
{
return new List<string>() {
"Neptune"
};
}
public override void SetChatButtons(ref string button, ref string button2)
{
button = Language.GetTextValue("LegacyInterface.28"); // "Shop"
}
public override void OnChatButtonClicked(bool firstButton, ref string shop)
{
if (firstButton)
{
shop = "Shop";
}
}
public override void AddShops()
{
var npcShop = new NPCShop(Type)
.Add(ItemID.LightningBug)
.Add(ItemID.Sunflower);
npcShop.Register();
}
public override string GetChat()
{
switch (Main.rand.Next(4))
{
case 0:
return "*Splashing water sounds*";
case 1:
return "The ocean calls...";
case 2:
return "Do you like water?";
default:
return "Waves crash eternally...";
}
}
public override void TownNPCAttackStrength(ref int damage, ref float knockback)
{
damage = 20;
knockback = 4f;
}
public override void TownNPCAttackCooldown(ref int cooldown, ref int randExtraCooldown)
{
cooldown = 30;
randExtraCooldown = 30;
}
public override void TownNPCAttackProj(ref int projType, ref int attackDelay)
{
projType = ProjectileID.WaterBolt;
attackDelay = 1;
}
public override void TownNPCAttackProjSpeed(ref float multiplier, ref float gravityCorrection, ref float randomOffset)
{
multiplier = 12f;
randomOffset = 2f;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 504 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 504 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 504 B

+69
View File
@@ -0,0 +1,69 @@
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Microsoft.Xna.Framework;
namespace ForgottenWawiTech.Content.NPCs.OriginalNeptune
{
[AutoloadBossHead]
public class Raccoon : ModNPC
{
public override void SetStaticDefaults()
{
// DisplayName.SetDefault("Raccoon");
Main.npcFrameCount[NPC.type] = 1;
}
public override void SetDefaults()
{
NPC.width = 40;
NPC.height = 40;
NPC.damage = 70;
NPC.defense = 16;
NPC.lifeMax = 18000;
NPC.HitSound = SoundID.NPCHit1;
NPC.DeathSound = SoundID.NPCDeath1;
NPC.knockBackResist = 0f;
NPC.boss = true;
NPC.aiStyle = -1; // custom behavior later
NPC.value = Item.buyPrice(0, 1, 75, 0);
}
public override void AI()
{
// Placeholder AI: dash toward player occasionally
Player target = Main.player[NPC.target];
if (!target.active || target.dead)
{
NPC.TargetClosest(false);
target = Main.player[NPC.target];
if (!target.active || target.dead)
{
NPC.velocity.Y -= 0.1f;
}
}
NPC.ai[0]++;
if (NPC.ai[0] < 60)
{
// approach
Vector2 dir = target.Center - NPC.Center;
dir.Normalize();
NPC.velocity = dir * 3f;
}
else if (NPC.ai[0] == 60)
{
// dash
Vector2 dash = target.Center - NPC.Center;
dash.Normalize();
NPC.velocity = dash * 10f;
}
else if (NPC.ai[0] > 120)
{
NPC.ai[0] = 0;
}
NPC.spriteDirection = NPC.direction = (target.Center.X < NPC.Center.X) ? -1 : 1;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 504 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 504 B