Finish set bonuses, add more options to the Avali Trader
This commit is contained in:
@@ -1,14 +1,69 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.GameContent.Personalities;
|
||||
using Terraria.Localization;
|
||||
using ForgottenWawiTech;
|
||||
|
||||
namespace ForgottenWawiTech.Content.NPCs.TownNPCs
|
||||
{
|
||||
public class AvalianTrader : ModNPC
|
||||
{
|
||||
private static readonly Condition HasDefeatedAnyMechBoss = new("Mods.ForgottenWawiTech.Conditions.HasDefeatedAnyMechBoss", () =>
|
||||
NPC.downedMechBoss1 || NPC.downedMechBoss2 || NPC.downedMechBoss3);
|
||||
|
||||
private static readonly Condition HasDefeatedLexy = new("Mods.ForgottenWawiTech.Conditions.HasDefeatedLexy", () =>
|
||||
Main.hardMode && WorldDefeatedBosses.Lexy);
|
||||
|
||||
private static readonly Condition HasDefeatedNiko = new("Mods.ForgottenWawiTech.Conditions.HasDefeatedNiko", () =>
|
||||
Main.hardMode && WorldDefeatedBosses.Niko);
|
||||
|
||||
private static readonly Condition HasDefeatedNeptune = new("Mods.ForgottenWawiTech.Conditions.HasDefeatedNeptune", () =>
|
||||
Main.hardMode && WorldDefeatedBosses.Neptune);
|
||||
|
||||
private static readonly Condition HasDefeatedLyyka = new("Mods.ForgottenWawiTech.Conditions.HasDefeatedLyyka", () =>
|
||||
Main.hardMode && WorldDefeatedBosses.Lyyka);
|
||||
|
||||
private static readonly Condition HasDefeatedCorruptedSwarm = new("Mods.ForgottenWawiTech.Conditions.HasDefeatedCorruptedSwarm", () =>
|
||||
Main.hardMode && WorldDefeatedBosses.Niko); // TODO: Replace with Corrupted Swarm flag once implemented.
|
||||
|
||||
private static readonly Condition HasDefeatedExoMechs = new("Mods.ForgottenWawiTech.Conditions.HasDefeatedExoMechs", CheckExoMechsDowned);
|
||||
|
||||
private static readonly Condition HasDefeatedMoonLord = new("Mods.ForgottenWawiTech.Conditions.HasDefeatedMoonLord", () =>
|
||||
NPC.downedMoonlord);
|
||||
|
||||
private static bool CheckExoMechsDowned()
|
||||
{
|
||||
if (!ModLoader.TryGetMod("CalamityMod", out Mod calamityMod))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var calamityWorldType = calamityMod.Code?.GetType("CalamityMod.World.CalamityWorld");
|
||||
if (calamityWorldType == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
const BindingFlags flags = BindingFlags.Public | BindingFlags.Static;
|
||||
|
||||
var field = calamityWorldType.GetField("downedExoMechs", flags);
|
||||
if (field?.GetValue(null) is bool fieldValue)
|
||||
{
|
||||
return fieldValue;
|
||||
}
|
||||
|
||||
var property = calamityWorldType.GetProperty("downedExoMechs", flags);
|
||||
if (property?.GetValue(null) is bool propertyValue)
|
||||
{
|
||||
return propertyValue;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
Main.npcFrameCount[NPC.type] = 25; // The amount of frames the NPC has
|
||||
@@ -92,48 +147,119 @@ namespace ForgottenWawiTech.Content.NPCs.TownNPCs
|
||||
|
||||
public override void AddShops()
|
||||
{
|
||||
Item rainbowBrick = new();
|
||||
rainbowBrick.SetDefaults(ItemID.RainbowBrick);
|
||||
rainbowBrick.value = Item.buyPrice(silver: 90);
|
||||
|
||||
new NPCShop(Type)
|
||||
.Add<Items.Materials.RGBass>(Condition.DownedMoonLord)
|
||||
.Add<Items.Materials.VisorShard>(Condition.Hardmode)
|
||||
.Add(ItemID.RainbowBrick, Condition.Hardmode) // TODO: Force Rainbow Brick to not have No Value.
|
||||
.Add<Items.Materials.VisorShard>(HasDefeatedLexy)
|
||||
.Add<Items.Materials.FallenAngelFeather>(HasDefeatedNiko)
|
||||
.Add<Items.Materials.HalfEatenFish>(HasDefeatedNeptune)
|
||||
.Add<Items.Materials.LyykaBossDrop>(HasDefeatedLyyka)
|
||||
.Add<Items.Materials.UnstableMatter>(HasDefeatedCorruptedSwarm)
|
||||
.Add(rainbowBrick, Condition.Hardmode)
|
||||
.Add<Items.Materials.AvaliFeather>()
|
||||
.Add<Items.Materials.RGBAlloy>(HasDefeatedMoonLord)
|
||||
.Add<Items.Materials.EnergyCore>(HasDefeatedAnyMechBoss)
|
||||
.Add<Items.Materials.ContainmentUnit>(HasDefeatedExoMechs)
|
||||
.Add<Items.Materials.ControlledSingularity>(HasDefeatedExoMechs)
|
||||
.Add<Items.Materials.MiniSingularity>(HasDefeatedExoMechs)
|
||||
.Add<Items.Materials.SingularityAlloy>(HasDefeatedExoMechs)
|
||||
.Add<Items.Materials.RGBass>(HasDefeatedMoonLord)
|
||||
.Register();
|
||||
}
|
||||
public override string GetChat()
|
||||
{
|
||||
switch (Main.rand.Next(15))
|
||||
List<string> lines = new()
|
||||
{
|
||||
case 0:
|
||||
return "*avalian chirping*";
|
||||
case 1:
|
||||
return "Welcome! I've traveled far from Avalon to bring you the finest technology.";
|
||||
case 2:
|
||||
return "These feathers? They're not just for show - they're quite valuable!";
|
||||
case 3:
|
||||
return "RGB technology is all the rage back home. Everything needs more colors!";
|
||||
case 4:
|
||||
return "The visor shards I sell are fragments from our most advanced equipment.";
|
||||
case 5:
|
||||
return "My pack may be small, but I've traversed dimensions to get here.";
|
||||
case 6:
|
||||
return "*chirps excitedly* Oh, you're interested in our wares?";
|
||||
case 7:
|
||||
return "Avalon sends its regards! And its finest materials.";
|
||||
case 8:
|
||||
return "Don't underestimate the power of a well-crafted alloy.";
|
||||
case 9:
|
||||
return "The journey here was long, but your world has such fascinating resources!";
|
||||
case 10:
|
||||
return "*preens feathers* Presentation is important in any trade.";
|
||||
case 11:
|
||||
return "RGBass - it's not just a material, it's a lifestyle.";
|
||||
case 12:
|
||||
return "I wonder what the other traders back on Avalon would think of this place...";
|
||||
case 13:
|
||||
return "My species may be small, but we're excellent engineers!";
|
||||
default:
|
||||
return "Need something? My shop is always open!";
|
||||
"*avalian chirping*",
|
||||
"Welcome! I've traveled far from Avalon to bring you the finest technology.",
|
||||
"My pack may be small, but I've traversed dimensions to get here.",
|
||||
"*chirps excitedly* Oh, you're interested in our wares?",
|
||||
"RGBass - it's not just a material, it's a lifestyle.",
|
||||
"Those rainbow bricks? Ninety silver each. I have transport costs, you know.",
|
||||
"The journey here was long, but your world has such fascinating resources!",
|
||||
"Need something? My shop is always open!",
|
||||
"Avalian markets never sleep; neither does my inventory.",
|
||||
"If you see a hover sled parked outside, please don't touch the controls.",
|
||||
"Try not to lick the stock. Some of it bites back.",
|
||||
"The atmosphere here is thick, but profits make it worth the acclimation.",
|
||||
"I keep a thermal blanket under the clothes —these nights get cold even for an Avali.",
|
||||
"Do you have any idea how much customs paperwork interstellar trade requires?",
|
||||
"If you hear humming, that's just the containment field. Probably."
|
||||
};
|
||||
|
||||
if (HasDefeatedLexy.IsMet())
|
||||
{
|
||||
lines.Add("Defeated Lexy, have you? His visor shards always sell out fast.");
|
||||
lines.Add("Lexy's visor tech makes for excellent souvenirs. Stock up while I have them.");
|
||||
}
|
||||
else if (Main.hardMode)
|
||||
{
|
||||
lines.Add("Still hunting Lexy? Bring me his visor and I'll unlock some premium stock.");
|
||||
}
|
||||
|
||||
if (HasDefeatedNiko.IsMet())
|
||||
{
|
||||
lines.Add("Astramora's Fallen Angel Feathers? Delicate, pricey, worth every coin.");
|
||||
lines.Add("I've reinforced the shipping crates just for Astramora's volatile feathers.");
|
||||
}
|
||||
else if (Main.hardMode)
|
||||
{
|
||||
lines.Add("I've heard whispers of a rat angel around these parts of the galaxy...");
|
||||
}
|
||||
|
||||
if (HasDefeatedNeptune.IsMet())
|
||||
{
|
||||
lines.Add("Neptune leaves quite the mess. Half-eaten fish, anyone?");
|
||||
lines.Add("Neptune's half-eaten catches sell faster than I'd like—apparently otter bites add flavor.");
|
||||
}
|
||||
else if (Main.hardMode)
|
||||
{
|
||||
lines.Add("If you're braving the tides, bring Neptune down and I'll import his catches.");
|
||||
}
|
||||
|
||||
if (HasDefeatedLyyka.IsMet())
|
||||
{
|
||||
lines.Add("Avalon sends its regards! Lyyka's gear is highly sought after.");
|
||||
lines.Add("Lyyka's encore was explosive. Her gear? Even more so.");
|
||||
}
|
||||
else if (Main.hardMode)
|
||||
{
|
||||
lines.Add("Bring down Lyyka and I'll uncrate her signature alloys.");
|
||||
}
|
||||
|
||||
if (HasDefeatedCorruptedSwarm.IsMet())
|
||||
{
|
||||
lines.Add("Unstable Matter? Just delicate enough for my clientele.");
|
||||
lines.Add("Careful with the Unstable Matter; Avalon still has a watchful eye on it.");
|
||||
}
|
||||
else if (Main.hardMode)
|
||||
{
|
||||
lines.Add("Rumor says there is a swarm of corrupted tech out there. If you defeat it, I might have something worth the risk.");
|
||||
}
|
||||
|
||||
if (HasDefeatedAnyMechBoss.IsMet())
|
||||
{
|
||||
lines.Add("Mechanical husks make great recycling. Fancy some RGB alloys?");
|
||||
}
|
||||
|
||||
if (HasDefeatedMoonLord.IsMet())
|
||||
{
|
||||
lines.Add("Moon Lord down? Excellent. His trinkets pair nicely with Avalian engineering.");
|
||||
}
|
||||
|
||||
if (HasDefeatedExoMechs.IsMet())
|
||||
{
|
||||
lines.Add("The Exo Mechs are no more? Splendid! I've got singularities ready for purchase.");
|
||||
lines.Add("You walked away from the Exo Mechs? Take these singularities before they destabilize.");
|
||||
}
|
||||
else if (ModLoader.TryGetMod("CalamityMod", out _))
|
||||
{
|
||||
lines.Add("Calamity's Exo Mechs still stalk your skies. Ground them and my singularity cache opens.");
|
||||
}
|
||||
|
||||
return lines.Count > 0 ? lines[Main.rand.Next(lines.Count)] : "Need something? My shop is always open!";
|
||||
}
|
||||
|
||||
public override void TownNPCAttackStrength(ref int damage, ref float knockback)
|
||||
|
||||
Reference in New Issue
Block a user