set up basics for calamitas npc
This commit is contained in:
1 parent
c5da3dce00
commit
109eadb2f1
6 files changed
+359
No files matched your search
@@ -132,6 +132,7 @@ namespace CalamityMod.CalPlayer
|
||||
public bool newCirrusInventory = false;
|
||||
public bool newAmidiasInventory = false;
|
||||
public bool newBanditInventory = false;
|
||||
public bool newCalamitasInventory = false;
|
||||
#endregion
|
||||
|
||||
#region Stat Meter
|
||||
@@ -972,6 +973,7 @@ namespace CalamityMod.CalPlayer
|
||||
newCirrusInventory = false;
|
||||
newAmidiasInventory = false;
|
||||
newBanditInventory = false;
|
||||
newCalamitasInventory = false;
|
||||
}
|
||||
|
||||
public override TagCompound Save()
|
||||
@@ -1019,6 +1021,7 @@ namespace CalamityMod.CalPlayer
|
||||
boost.AddWithCondition("newCirrusInventory", newCirrusInventory);
|
||||
boost.AddWithCondition("newAmidiasInventory", newAmidiasInventory);
|
||||
boost.AddWithCondition("newBanditInventory", newBanditInventory);
|
||||
boost.AddWithCondition("newCalamitasInventory", newCalamitasInventory);
|
||||
|
||||
return new TagCompound
|
||||
{
|
||||
@@ -1090,6 +1093,7 @@ namespace CalamityMod.CalPlayer
|
||||
newCirrusInventory = boost.Contains("newCirrusInventory");
|
||||
newAmidiasInventory = boost.Contains("newAmidiasInventory");
|
||||
newBanditInventory = boost.Contains("newBanditInventory");
|
||||
newCalamitasInventory = boost.Contains("newCalamitasInventory");
|
||||
|
||||
rage = tag.GetAsInt("stress");
|
||||
adrenaline = tag.GetAsInt("adrenaline");
|
||||
@@ -1191,6 +1195,7 @@ namespace CalamityMod.CalPlayer
|
||||
|
||||
BitsByte flags6 = reader.ReadByte();
|
||||
newBanditInventory = flags6[0];
|
||||
newCalamitasInventory = flags6[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -4670,6 +4670,10 @@ namespace CalamityMod.NPCs
|
||||
{
|
||||
DrawNewInventoryAlert(npc);
|
||||
}
|
||||
else if (npc.type == NPCType<WITCH>() && Main.LocalPlayer.Calamity().newCalamitasInventory)
|
||||
{
|
||||
DrawNewInventoryAlert(npc);
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (npc.type)
|
||||
@@ -5736,6 +5740,10 @@ namespace CalamityMod.NPCs
|
||||
{
|
||||
Main.LocalPlayer.Calamity().newBanditInventory = true;
|
||||
}
|
||||
else if (types[i] == NPCType<WITCH>())
|
||||
{
|
||||
Main.LocalPlayer.Calamity().newCalamitasInventory = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (types[i])
|
||||
|
||||
@@ -0,0 +1,334 @@
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Items.Accessories;
|
||||
using CalamityMod.Items.Tools;
|
||||
using CalamityMod.Items.Weapons.Magic;
|
||||
using CalamityMod.Items.Weapons.Melee;
|
||||
using CalamityMod.Items.Weapons.Ranged;
|
||||
using CalamityMod.Items.Weapons.Rogue;
|
||||
using CalamityMod.Items.Weapons.Summon;
|
||||
using CalamityMod.Projectiles.Magic;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System.Collections.Generic;
|
||||
using Terraria;
|
||||
using Terraria.GameContent.Events;
|
||||
using Terraria.ID;
|
||||
using Terraria.Localization;
|
||||
using Terraria.ModLoader;
|
||||
using static Terraria.ModLoader.ModContent;
|
||||
namespace CalamityMod.NPCs.TownNPCs
|
||||
{
|
||||
[AutoloadHead]
|
||||
public class WITCH : ModNPC
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Brimstone Witch");
|
||||
|
||||
Main.npcFrameCount[npc.type] = 26;
|
||||
NPCID.Sets.ExtraFramesCount[npc.type] = 9;
|
||||
NPCID.Sets.AttackFrameCount[npc.type] = 4;
|
||||
NPCID.Sets.DangerDetectRange[npc.type] = 700;
|
||||
NPCID.Sets.AttackType[npc.type] = 2;
|
||||
NPCID.Sets.AttackTime[npc.type] = 90;
|
||||
NPCID.Sets.AttackAverageChance[npc.type] = 15;
|
||||
NPCID.Sets.MagicAuraColor[npc.type] = new Color(250, 50, 50);
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
npc.townNPC = true;
|
||||
npc.friendly = true;
|
||||
npc.lavaImmune = true;
|
||||
npc.width = 18;
|
||||
npc.height = 40;
|
||||
npc.aiStyle = 7;
|
||||
npc.damage = 10;
|
||||
//Has the same amount of life, defense, and dr as SCal
|
||||
npc.Calamity().DR = CalamityWorld.death ? 0.75f : 0.7f;
|
||||
npc.defense = 120;
|
||||
npc.lifeMax = (int)((CalamityWorld.revenge ? 5500000 : 5000000) * (Main.expertMode ? 1.6f : 1f));
|
||||
npc.HitSound = SoundID.NPCHit1;
|
||||
npc.DeathSound = SoundID.NPCDeath6;
|
||||
npc.knockBackResist = 0.8f;
|
||||
animationType = NPCID.Wizard;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
//To account for revengeance/death mode switching
|
||||
if (npc.lifeMax != (int)((CalamityWorld.revenge ? 5500000 : 5000000) * (Main.expertMode ? 1.6f : 1f)))
|
||||
{
|
||||
npc.lifeMax = (int)((CalamityWorld.revenge ? 5500000 : 5000000) * (Main.expertMode ? 1.6f : 1f));
|
||||
}
|
||||
if (npc.Calamity().DR != (CalamityWorld.death ? 0.75f : 0.7f))
|
||||
{
|
||||
npc.Calamity().DR = CalamityWorld.death ? 0.75f : 0.7f;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool CanTownNPCSpawn(int numTownNPCs, int money) => CalamityWorld.downedSCal;
|
||||
|
||||
public override string TownNPCName() => "Calamitas";
|
||||
|
||||
public override string GetChat()
|
||||
{
|
||||
if (npc.homeless) //not sure how to check if he has ever found a home before (to make this dialogue only run when he first spawns)
|
||||
{
|
||||
if (Main.rand.NextBool(2))
|
||||
return "I deeply appreciate you rescuing me from being trapped within my frozen castle... It's been many, many years...";
|
||||
else
|
||||
return "Thank you for saving me...though now I admit I am without a home since mine got destroyed.";
|
||||
}
|
||||
|
||||
IList<string> dialogue = new List<string>();
|
||||
|
||||
if (Main.dayTime)
|
||||
{
|
||||
dialogue.Add("I must admit...I am not quite used to this weather. It's too warm for my taste...");
|
||||
dialogue.Add("My dear! What is it you would like to talk about today?");
|
||||
dialogue.Add("Why...I don't have to worry about any time of the day! If it is hot...then I can use my ice magic to cool down!");
|
||||
dialogue.Add("I do usually prefer a spot of humidity for my ice magic. It likes to come out as steam when it's too hot and dry...");
|
||||
dialogue.Add("Magic is a skill that must be learned and practiced! You seem to have an inherent talent for it at your age. I have spent all of my life honing it...");
|
||||
dialogue.Add("Why ice magic, you ask? Well, my parents were both pyromaniacs...");
|
||||
}
|
||||
else
|
||||
{
|
||||
dialogue.Add("There be monsters lurking in the darkness. Most...unnatural monsters.");
|
||||
dialogue.Add("You could break the icy stillness in the air tonight.");
|
||||
dialogue.Add("Hmm...some would say that an unforeseen outside force is the root of the blood moon...");
|
||||
dialogue.Add("I was once the greatest Archmage of ice that ever hailed the lands. Whether or not that is still applicable, I am not sure...");
|
||||
dialogue.Add("There used to be other Archmages of other elements. I wonder where they are now...if they are also alive...");
|
||||
dialogue.Add("Oh...I wish I could tell you all about my life and the lessons I have learned, but it appears you have a great many things to do...");
|
||||
}
|
||||
|
||||
dialogue.Add("I assure you, I will do my best to act as the cool grandfather figure you always wanted.");
|
||||
|
||||
if (BirthdayParty.PartyIsUp)
|
||||
dialogue.Add("Sometimes...I feel like all I'm good for during these events is making ice cubes and slushies.");
|
||||
|
||||
if (NPC.downedMoonlord)
|
||||
{
|
||||
dialogue.Add("Tread carefully, my friend... Now that the Moon Lord has been defeated, many powerful creatures will crawl out to challenge you...");
|
||||
dialogue.Add("I feel the balance of nature tilting farther than ever before. Is it due to you, or because of the events leading to now...?");
|
||||
}
|
||||
|
||||
if (CalamityWorld.downedPolterghast)
|
||||
dialogue.Add("I felt a sudden chill down my spine. I sense something dangerous stirring in the Abyss...");
|
||||
|
||||
if (CalamityWorld.downedYharon)
|
||||
dialogue.Add("...Where is Lord Yharim? He must be up to something...");
|
||||
|
||||
int dryad = NPC.FindFirstNPC(NPCID.Dryad);
|
||||
if (dryad != -1)
|
||||
dialogue.Add("Yes, I am older than " + Main.npc[dryad].GivenName + ". You can stop asking now...");
|
||||
|
||||
if (Main.player[Main.myPlayer].Calamity().chibii)
|
||||
dialogue.Add("What an adorable tiny companion you have! Where in the world did you find such a...creature...? Actually, I'd rather not know.");
|
||||
|
||||
if (Main.player[Main.myPlayer].Calamity().cryogenSoul)
|
||||
dialogue.Add(Main.player[Main.myPlayer].name + "...just between us, I think I forgot my soul in the ice castle. If you see it, please do let me know.");
|
||||
|
||||
if (Main.hardMode)
|
||||
dialogue.Add("It wouldn't be the first time something unknown and powerful dropped from the heavens...I would tread carefully if I were you...");
|
||||
|
||||
return dialogue[Main.rand.Next(dialogue.Count)];
|
||||
}
|
||||
|
||||
public override void SetChatButtons(ref string button, ref string button2)
|
||||
{
|
||||
button = Language.GetTextValue("LegacyInterface.28");
|
||||
}
|
||||
|
||||
public override void OnChatButtonClicked(bool firstButton, ref bool shop)
|
||||
{
|
||||
if (firstButton)
|
||||
{
|
||||
Main.LocalPlayer.Calamity().newCalamitasInventory = false;
|
||||
shop = true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void SetupShop(Chest shop, ref int nextSlot)
|
||||
{
|
||||
//Melee weapons
|
||||
if (Main.LocalPlayer.HasItem(ItemType<Animus>()))
|
||||
{
|
||||
shop.item[nextSlot].SetDefaults(ItemType<Animus>());
|
||||
nextSlot++;
|
||||
}
|
||||
if (Main.LocalPlayer.HasItem(ItemType<Azathoth>()))
|
||||
{
|
||||
shop.item[nextSlot].SetDefaults(ItemType<Azathoth>());
|
||||
nextSlot++;
|
||||
}
|
||||
if (Main.LocalPlayer.HasItem(ItemType<DraconicDestruction>()))
|
||||
{
|
||||
shop.item[nextSlot].SetDefaults(ItemType<DraconicDestruction>());
|
||||
nextSlot++;
|
||||
}
|
||||
if (Main.LocalPlayer.HasItem(ItemType<Earth>()))
|
||||
{
|
||||
shop.item[nextSlot].SetDefaults(ItemType<Earth>());
|
||||
nextSlot++;
|
||||
}
|
||||
if (Main.LocalPlayer.HasItem(ItemType<RedSun>()))
|
||||
{
|
||||
shop.item[nextSlot].SetDefaults(ItemType<RedSun>());
|
||||
nextSlot++;
|
||||
}
|
||||
//Ranged weapons
|
||||
if (Main.LocalPlayer.HasItem(ItemType<Contagion>()))
|
||||
{
|
||||
shop.item[nextSlot].SetDefaults(ItemType<Contagion>());
|
||||
nextSlot++;
|
||||
}
|
||||
if (Main.LocalPlayer.HasItem(ItemType<SomaPrime>()))
|
||||
{
|
||||
shop.item[nextSlot].SetDefaults(ItemType<SomaPrime>());
|
||||
nextSlot++;
|
||||
}
|
||||
if (Main.LocalPlayer.HasItem(ItemType<Svantechnical>()))
|
||||
{
|
||||
shop.item[nextSlot].SetDefaults(ItemType<Svantechnical>());
|
||||
nextSlot++;
|
||||
}
|
||||
if (Main.LocalPlayer.HasItem(ItemType<Megafleet>()))
|
||||
{
|
||||
shop.item[nextSlot].SetDefaults(ItemType<Megafleet>());
|
||||
nextSlot++;
|
||||
}
|
||||
//Magic weapons
|
||||
if (Main.LocalPlayer.HasItem(ItemType<Judgement>()))
|
||||
{
|
||||
shop.item[nextSlot].SetDefaults(ItemType<Judgement>());
|
||||
nextSlot++;
|
||||
}
|
||||
if (Main.LocalPlayer.HasItem(ItemType<Fabstaff>()))
|
||||
{
|
||||
shop.item[nextSlot].SetDefaults(ItemType<Fabstaff>());
|
||||
nextSlot++;
|
||||
}
|
||||
if (Main.LocalPlayer.HasItem(ItemType<BlushieStaff>()))
|
||||
{
|
||||
shop.item[nextSlot].SetDefaults(ItemType<BlushieStaff>());
|
||||
nextSlot++;
|
||||
}
|
||||
//Summon weapons
|
||||
if (Main.LocalPlayer.HasItem(ItemType<Endogenesis>()))
|
||||
{
|
||||
shop.item[nextSlot].SetDefaults(ItemType<Endogenesis>());
|
||||
nextSlot++;
|
||||
}
|
||||
if (Main.LocalPlayer.HasItem(ItemType<BensUmbrella>()))
|
||||
{
|
||||
shop.item[nextSlot].SetDefaults(ItemType<BensUmbrella>());
|
||||
nextSlot++;
|
||||
}
|
||||
//Rogue weapons
|
||||
if (Main.LocalPlayer.HasItem(ItemType<ScarletDevil>()))
|
||||
{
|
||||
shop.item[nextSlot].SetDefaults(ItemType<ScarletDevil>());
|
||||
nextSlot++;
|
||||
}
|
||||
//Hybrid weapons
|
||||
if (Main.LocalPlayer.HasItem(ItemType<RoyalKnivesMelee>()) || Main.LocalPlayer.HasItem(ItemType<RoyalKnives>()))
|
||||
{
|
||||
shop.item[nextSlot].SetDefaults(ItemType<RoyalKnivesMelee>());
|
||||
nextSlot++;
|
||||
shop.item[nextSlot].SetDefaults(ItemType<RoyalKnives>());
|
||||
nextSlot++;
|
||||
}
|
||||
if (Main.LocalPlayer.HasItem(ItemType<NanoblackReaperMelee>()) || Main.LocalPlayer.HasItem(ItemType<NanoblackReaperRogue>()))
|
||||
{
|
||||
shop.item[nextSlot].SetDefaults(ItemType<NanoblackReaperMelee>());
|
||||
nextSlot++;
|
||||
shop.item[nextSlot].SetDefaults(ItemType<NanoblackReaperRogue>());
|
||||
nextSlot++;
|
||||
}
|
||||
if (Main.LocalPlayer.HasItem(ItemType<TriactisTruePaladinianMageHammerofMightMelee>()) || Main.LocalPlayer.HasItem(ItemType<TriactisTruePaladinianMageHammerofMight>()))
|
||||
{
|
||||
shop.item[nextSlot].SetDefaults(ItemType<TriactisTruePaladinianMageHammerofMightMelee>());
|
||||
nextSlot++;
|
||||
shop.item[nextSlot].SetDefaults(ItemType<TriactisTruePaladinianMageHammerofMight>());
|
||||
nextSlot++;
|
||||
}
|
||||
//Accessories
|
||||
if (Main.LocalPlayer.HasItem(ItemType<PrototypeAndromechaRing>()))
|
||||
{
|
||||
shop.item[nextSlot].SetDefaults(ItemType<PrototypeAndromechaRing>());
|
||||
nextSlot++;
|
||||
}
|
||||
if (Main.LocalPlayer.HasItem(ItemType<ProfanedSoulCrystal>()))
|
||||
{
|
||||
shop.item[nextSlot].SetDefaults(ItemType<ProfanedSoulCrystal>());
|
||||
nextSlot++;
|
||||
}
|
||||
//Tools
|
||||
if (Main.LocalPlayer.HasItem(ItemType<CrystylCrusher>()))
|
||||
{
|
||||
shop.item[nextSlot].SetDefaults(ItemType<CrystylCrusher>());
|
||||
nextSlot++;
|
||||
}
|
||||
}
|
||||
|
||||
// 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 = 10f;
|
||||
}
|
||||
|
||||
public override void TownNPCAttackCooldown(ref int cooldown, ref int randExtraCooldown)
|
||||
{
|
||||
cooldown = 10;
|
||||
randExtraCooldown = 50;
|
||||
}
|
||||
|
||||
//public override void TownNPCAttackMagic(ref float auraLightMultiplier)
|
||||
|
||||
public override void TownNPCAttackProj(ref int projType, ref int attackDelay)
|
||||
{
|
||||
projType = ProjectileType<SeethingDischargeBrimstoneHellblast>();
|
||||
attackDelay = 1;
|
||||
}
|
||||
|
||||
public override void TownNPCAttackProjSpeed(ref float multiplier, ref float gravityCorrection, ref float randomOffset)
|
||||
{
|
||||
multiplier = 2f;
|
||||
}
|
||||
|
||||
//Explode into red dust when die
|
||||
public override void HitEffect(int hitDirection, double damage)
|
||||
{
|
||||
if (npc.life <= 0)
|
||||
{
|
||||
npc.position = npc.Center;
|
||||
npc.width = npc.height = 50;
|
||||
npc.position.X -= npc.width / 2;
|
||||
npc.position.Y -= npc.height / 2;
|
||||
for (int dustIndex = 0; dustIndex < 5; dustIndex++)
|
||||
{
|
||||
int brimstone = Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f);
|
||||
Main.dust[brimstone].velocity *= 3f;
|
||||
if (Main.rand.NextBool(2))
|
||||
{
|
||||
Main.dust[brimstone].scale = 0.5f;
|
||||
Main.dust[brimstone].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
|
||||
}
|
||||
}
|
||||
for (int indexDust = 0; indexDust < 10; indexDust++)
|
||||
{
|
||||
int fire = Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f);
|
||||
Main.dust[fire].noGravity = true;
|
||||
Main.dust[fire].velocity *= 5f;
|
||||
fire = Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f);
|
||||
Main.dust[fire].velocity *= 2f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 4.3 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 342 B |
@@ -10,6 +10,8 @@ namespace CalamityMod.Projectiles.Magic
|
||||
{
|
||||
public class SeethingDischargeBrimstoneHellblast : ModProjectile
|
||||
{
|
||||
private bool initialized = false;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Hellblast");
|
||||
@@ -33,6 +35,16 @@ namespace CalamityMod.Projectiles.Magic
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
if (!initialized)
|
||||
{
|
||||
if (projectile.npcProj)
|
||||
{
|
||||
projectile.usesLocalNPCImmunity = true;
|
||||
projectile.localNPCHitCooldown = 5;
|
||||
projectile.penetrate = 10;
|
||||
}
|
||||
initialized = true;
|
||||
}
|
||||
projectile.frameCounter++;
|
||||
if (projectile.frameCounter >= 10)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user