Delete NPCS directory

This commit is contained in:
Tomat authored and Cameron Ewell committed 2023-05-27 21:56:29 -04:00
1 parent 0bb180d9ad
commit c4ebacf44e
1 file changed
-347
-347
View File
@@ -1,347 +0,0 @@
using CalamityMod.Items.Accessories;
using CalamityMod.Items.Pets;
using CalamityMod.Items.Weapons.Rogue;
using CalamityMod.Projectiles.Rogue;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System.Collections.Generic;
using Terraria;
using Terraria.GameContent.Bestiary;
using Terraria.GameContent.Events;
using Terraria.GameContent.Personalities;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
using Terraria.Audio;
using CalamityMod.Items;
namespace CalamityMod.NPCs.TownNPCs
{
[AutoloadHead]
public class THIEF : ModNPC
{
public static List<string> PossibleNames = new List<string>()
{
// Patron names
"Xplizzy", // <@!98826096237109248> (Whitegiraffe#6342)
"Freakish", // <@!750363283520749598> (Freakish#0001)
"Calder", // <@!601897959176798228> (Paltham#8859)
"Hunter Jinx", // <@!757401399783850134> (Jinx_enthusiast#1580)
"Goose", // <@!591421917706321962> (DullElili#8016)
"Jackson", // <@!525827730646892549> (ChowChow, Sin of Sleep Schedules#1235)
// Original names
"Laura", "Mie", "Bonnie",
"Sarah", "Diane", "Kate",
"Penelope", "Marisa", "Maribel",
"Valerie", "Jessica", "Rowan",
"Jessie", "Jade", "Hearn",
"Amber", "Anne", "Indiana"
};
public override void SetStaticDefaults()
{
// DisplayName.SetDefault("Bandit");
Main.npcFrameCount[NPC.type] = 23;
NPCID.Sets.ExtraFramesCount[NPC.type] = 9;
NPCID.Sets.AttackFrameCount[NPC.type] = 4;
NPCID.Sets.DangerDetectRange[NPC.type] = 500;
NPCID.Sets.AttackType[NPC.type] = 0;
NPCID.Sets.AttackTime[NPC.type] = 60;
NPCID.Sets.AttackAverageChance[NPC.type] = 10;
NPC.Happiness
.SetBiomeAffection<DesertBiome>(AffectionLevel.Like)
.SetBiomeAffection<JungleBiome>(AffectionLevel.Dislike)
.SetNPCAffection(NPCID.GoblinTinkerer, AffectionLevel.Like)
.SetNPCAffection(NPCID.Dryad, AffectionLevel.Dislike)
;
NPCID.Sets.NPCBestiaryDrawModifiers drawModifiers = new NPCID.Sets.NPCBestiaryDrawModifiers(0) {
Velocity = 1f // Draws the NPC in the bestiary as if its walking +1 tiles in the x direction
};
NPCID.Sets.NPCBestiaryDrawOffset.Add(NPC.type, drawModifiers);
}
public override void SetDefaults()
{
NPC.townNPC = true;
NPC.friendly = true;
NPC.lavaImmune = false;
NPC.width = 18;
NPC.height = 44;
NPC.aiStyle = NPCAIStyleID.Passive;
NPC.damage = 10;
NPC.defense = 15;
NPC.lifeMax = 250; //Im not special :(
NPC.HitSound = SoundID.NPCHit1;
NPC.DeathSound = SoundID.NPCDeath1;
NPC.knockBackResist = 0.5f;
AnimationType = NPCID.PartyGirl;
}
public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry)
{
bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] {
BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Desert,
// Will move to localization whenever that is cleaned up.
new FlavorTextBestiaryInfoElement("A kleptomaniac who is a bit of a coward when it comes to face-to-face fights. She's rather good at getting herself both into and out of dicey situations.")
});
}
public override void AI()
{
if (!CalamityWorld.spawnedBandit)
{
CalamityWorld.spawnedBandit = true;
}
}
public override bool CanTownNPCSpawn(int numTownNPCs)/* tModPorter Suggestion: Copy the implementation of NPC.SpawnAllowed_Merchant in vanilla if you to count money, and be sure to set a flag when unlocked, so you don't count every tick. */
{
for (int k = 0; k < Main.maxPlayers; k++)
{
Player player = Main.player[k];
bool rich = player.InventoryHas(ItemID.PlatinumCoin) || player.PortableStorageHas(ItemID.PlatinumCoin);
if (player.active && rich)
{
return NPC.downedBoss3 || CalamityWorld.spawnedBandit;
}
}
return CalamityWorld.spawnedBandit;
}
public override List<string> SetNPCNameList() => PossibleNames;
public override string GetChat()
{
List<string> PossibleDialogs = new List<string>();
if (!Main.dayTime && Main.bloodMoon)
{
PossibleDialogs.Add("Oy, watch where you're going or I might just use you for dart practice.");
PossibleDialogs.Add("Bet you'd look good as a pincushion, amiright?");
PossibleDialogs.Add("Zombies don't dodge very well. Maybe you'll do a bit better.");
PossibleDialogs.Add("Hey, careful over there. I've rigged the place. One wrong step and you're going to get a knife in your forehead.");
}
else if (!Main.dayTime && !Main.bloodMoon)
{
PossibleDialogs.Add("Hm, the stars are too bright tonight. Makes sneaking around a little more difficult.");
PossibleDialogs.Add("You think those stars that fall occasionally would make good throwing weapons?");
}
if (BirthdayParty.PartyIsUp)
{
PossibleDialogs.Add("Where is my party hat? Well, I stole it of course.");
}
if (NPC.GivenName == "Laura")
{
PossibleDialogs.Add("The nice thing about maps is I can track anything that has fallen.");
}
if (NPC.GivenName == "Penelope")
{
PossibleDialogs.Add("Imagine how fast you could throw if you just had more hands.");
}
if (NPC.GivenName == "Valerie")
{
PossibleDialogs.Add("I also take food for currency.");
}
if (NPC.GivenName == "Rowan")
{
PossibleDialogs.Add("Usually I only think of animals as food or target practice, but dragons are an exception.");
}
PossibleDialogs.Add("Anything is a weapon if you throw it hard enough.");
PossibleDialogs.Add("That's your chucking arm? You need to work out more.");
PossibleDialogs.Add("Listen here. It's all in the wrist, the wrist! Oh, forget it.");
PossibleDialogs.Add("Eh you know how it goes; steal from the rich, give to the poor, but I do take a cut of the profit.");
PossibleDialogs.Add("Snakes! Why does it always have to be snakes!");
PossibleDialogs.Add("It's super nice you know, to just have everything you want. Some people never got that luxury.");
PossibleDialogs.Add("It's not stealing! I'm just borrowing it until I die!");
if (Main.LocalPlayer.InventoryHas(ItemID.BoneGlove))
{
PossibleDialogs.Add("Wouldn't be the first time I used remains as weapons.");
}
if (Main.hardMode)
{
PossibleDialogs.Add("All sorts of new weapons to be found and looted. Get to that, and I'll share some of my collection too!");
PossibleDialogs.Add("There's so much scrap around this land with valuable parts to them. Makes you wonder who could afford to leave em all around.");
PossibleDialogs.Add("Crypts, tombs, dungeons, those're all just treasure troves to me. The dead are dead, they've got nothing to do with it.");
}
if (NPC.downedMoonlord)
{
PossibleDialogs.Add("If you find anything cool, make sure to drop by and show it to me, I promise I'll keep my hands off it.");
PossibleDialogs.Add("So many new things to steal, I can't think of where to start!");
PossibleDialogs.Add("If I end up angering some deities or whatever, would you mind taking the blame for me?");
}
if (Main.LocalPlayer.InventoryHas(ModContent.ItemType<Valediction>()))
{
PossibleDialogs.Add("Oh man, did you rip that off a shark!? Now that's a weapon!");
}
if (Main.LocalPlayer.ZoneJungle)
{
PossibleDialogs.Add("I'd rather not be here. This place has bad vibes, y'know? It brings back some unpleasant memories.");
}
int merchantIndex = NPC.FindFirstNPC(NPCID.Merchant);
if (merchantIndex != -1)
{
NPC nerd = Main.npc[merchantIndex];
PossibleDialogs.Add($"Don't tell {nerd.GivenName}, but I took some of his stuff and replaced it with Angel Statues.");
}
int witch = NPC.FindFirstNPC(ModContent.NPCType<WITCH>());
if(witch != -1)
{
PossibleDialogs.Add("Hey, hey, has Calamitas seriously moved in here with us? Why???");
}
int cirrusIndex = NPC.FindFirstNPC(ModContent.NPCType<FAP>());
if (cirrusIndex != -1)
{
NPC cirrus = Main.npc[cirrusIndex]; //please help me I'm stuck in a children's video game - Fabsol
PossibleDialogs.Add($"I learned never to steal {cirrus.GivenName}'s drinks. She doesn't appreciate me right now, so I'll go back to hiding.");
}
int armsDealerIndex = NPC.FindFirstNPC(NPCID.ArmsDealer);
int nurseIndex = NPC.FindFirstNPC(NPCID.Nurse);
if (armsDealerIndex != -1 && nurseIndex != -1)
{
NPC cheeseMachine = Main.npc[nurseIndex];
NPC minisharkMan = Main.npc[armsDealerIndex];
PossibleDialogs.Add($"Don't tell {cheeseMachine.GivenName} that I was responsible for {minisharkMan.GivenName}'s injuries.");
}
return PossibleDialogs[Main.rand.Next(PossibleDialogs.Count)];
}
public string Refund()
{
int goblinIndex = NPC.FindFirstNPC(NPCID.GoblinTinkerer);
if (goblinIndex != -1 && CalamityWorld.Reforges >= 1)
{
CalamityWorld.Reforges = 0;
int[] coinCounts = Utils.CoinsSplit(CalamityWorld.MoneyStolenByBandit);
if (coinCounts[0] > 0)
Item.NewItem(NPC.GetSource_Loot(), NPC.Hitbox, ItemID.CopperCoin, coinCounts[0]);
if (coinCounts[1] > 0)
Item.NewItem(NPC.GetSource_Loot(), NPC.Hitbox, ItemID.SilverCoin, coinCounts[1]);
if (coinCounts[2] > 0)
Item.NewItem(NPC.GetSource_Loot(), NPC.Hitbox, ItemID.GoldCoin, coinCounts[2]);
if (coinCounts[3] > 0)
Item.NewItem(NPC.GetSource_Loot(), NPC.Hitbox, ItemID.PlatinumCoin, coinCounts[3]);
CalamityWorld.MoneyStolenByBandit = 0;
NPC goblinFucker = Main.npc[goblinIndex];
SoundEngine.PlaySound(SoundID.Coins); // Money dink sound
switch (Main.rand.Next(2))
{
case 0:
return $"Want in on a little secret? Since {goblinFucker.GivenName} always gets so much cash from you, I've been stealing some of it as we go. I need you to keep quiet about it, so here.";
case 1:
return "Hey, if government officials can get tax, why can't I? The heck do you mean that these two things are nothing alike?";
}
CalamityNetcode.SyncWorld();
}
return "Sorry, I got nothing. Perhaps you could reforge something and come back later...";
}
public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor)
{
var something = NPC.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally;
spriteBatch.Draw(ModContent.Request<Texture2D>("CalamityMod/NPCs/TownNPCs/THIEF" + (BirthdayParty.PartyIsUp ? "Alt" : "")).Value, NPC.Center - screenPos + new Vector2(0, NPC.gfxOffY) - new Vector2(0f, 6f), NPC.frame, drawColor, NPC.rotation, NPC.frame.Size() / 2, NPC.scale, something, 0);
return false;
}
public override void SetChatButtons(ref string button, ref string button2)
{
button = Language.GetTextValue("LegacyInterface.28");
button2 = "Refund";
}
public override void OnChatButtonClicked(bool firstButton, ref string shopName)
{
if (firstButton)
{
Main.LocalPlayer.Calamity().newBanditInventory = false;
shopName = "Shop";
}
else
{
Main.npcChatText = Refund();
}
}
public override void AddShops()
{
Condition potionSells = new("While the Town NPC Potion Selling configuration option is enabled", () => CalamityConfig.Instance.PotionSelling);
Condition downedCalclone = new("If the Calamitas Clone has been defeated", () => DownedBossSystem.downedCalamitasClone);
Condition downedDoG = new("If The Devourer of Gods has been defeated", () => DownedBossSystem.downedDoG);
Condition downedYharon = new("If Yharon has been defeated", () => DownedBossSystem.downedYharon);
NPCShop shop = new(Type);
shop.AddWithCustomValue(ModContent.ItemType<Cinquedea>(), Item.buyPrice(gold: 9))
.AddWithCustomValue(ModContent.ItemType<Glaive>(), Item.buyPrice(gold: 9))
.AddWithCustomValue(ModContent.ItemType<Kylie>(), Item.buyPrice(gold: 9))
.AddWithCustomValue(ModContent.ItemType<OldDie>(), Item.buyPrice(gold: 40))
.Add(ItemID.TigerClimbingGear)
.AddWithCustomValue(ItemID.InvisibilityPotion, Item.buyPrice(silver: 25), potionSells, Condition.HappyEnough)
.AddWithCustomValue(ItemID.NightOwlPotion, Item.buyPrice(silver: 25), potionSells, Condition.HappyEnough)
.AddWithCustomValue(ItemID.TrapsightPotion, Item.buyPrice(gold: 4), potionSells, Condition.HappyEnough)
.AddWithCustomValue(ModContent.ItemType<SlickCane>(), Item.buyPrice(gold: 25), Condition.Hardmode)
.Add(ModContent.ItemType<ThiefsDime>(), Condition.DownedPirates)
.AddWithCustomValue(ModContent.ItemType<MomentumCapacitor>(), Item.buyPrice(gold: 60), Condition.DownedMechBossAll)
.Add(ModContent.ItemType<DeepWounder>(), downedCalclone)
.Add(ModContent.ItemType<MonkeyDarts>(), Condition.DownedPlantera)
.Add(ModContent.ItemType<GloveOfPrecision>(), Condition.DownedPlantera)
.Add(ModContent.ItemType<GloveOfRecklessness>(), Condition.DownedPlantera)
.AddWithCustomValue(ModContent.ItemType<EtherealExtorter>(), Item.buyPrice(1), Condition.DownedGolem)
.AddWithCustomValue(ModContent.ItemType<CelestialReaper>(), Item.buyPrice(2), Condition.DownedMoonLord)
.AddWithCustomValue(ModContent.ItemType<VeneratedLocket>(), Item.buyPrice(25), downedDoG)
.AddWithCustomValue(ModContent.ItemType<DragonScales>(), Item.buyPrice(40), downedYharon)
.Add(ModContent.ItemType<BearsEye>()) //:BearWatchingYou:
.Register();
}
public override void HitEffect(NPC.HitInfo hit)
{
if (NPC.life <= 0)
{
if (Main.netMode != NetmodeID.Server)
{
Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find<ModGore>("Bandit").Type, 1f);
Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find<ModGore>("Bandit2").Type, 1f);
Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find<ModGore>("Bandit3").Type, 1f);
Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find<ModGore>("Bandit4").Type, 1f);
}
}
}
// Make this Town NPC teleport to the Queen statue when triggered.
public override bool CanGoToStatue(bool toKingStatue) => !toKingStatue;
public override void TownNPCAttackStrength(ref int damage, ref float knockback)
{
damage = 50;
knockback = 2f;
}
public override void TownNPCAttackCooldown(ref int cooldown, ref int randExtraCooldown)
{
cooldown = 180;
randExtraCooldown = 60;
}
public override void TownNPCAttackProj(ref int projType, ref int attackDelay)
{
projType = ModContent.ProjectileType<CinquedeaProj>();
attackDelay = 1;
}
public override void TownNPCAttackProjSpeed(ref float multiplier, ref float gravityCorrection, ref float randomOffset)
{
multiplier = 6f;
}
}
}