125 lines
3.5 KiB
C#
125 lines
3.5 KiB
C#
using System.Collections.Generic;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
using Terraria.GameContent.Personalities;
|
|
using Terraria.Localization;
|
|
|
|
namespace ForgottenWawiTech.Content.NPCs.OriginalLyyka
|
|
{
|
|
[AutoloadHead]
|
|
public class LyykaNPC : ModNPC
|
|
{
|
|
public override void SetStaticDefaults()
|
|
{
|
|
// DisplayName.SetDefault("Lyyka");
|
|
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.Lyyka;
|
|
}
|
|
|
|
public override List<string> SetNPCNameList()
|
|
{
|
|
return new List<string>() {
|
|
"Lyyka"
|
|
};
|
|
}
|
|
|
|
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 "Meow!";
|
|
case 1:
|
|
return "Want some cookies?";
|
|
case 2:
|
|
return "Time for a catnap...";
|
|
default:
|
|
return "Purr...";
|
|
}
|
|
}
|
|
|
|
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.SwordBeam;
|
|
attackDelay = 1;
|
|
}
|
|
|
|
public override void TownNPCAttackProjSpeed(ref float multiplier, ref float gravityCorrection, ref float randomOffset)
|
|
{
|
|
multiplier = 12f;
|
|
randomOffset = 2f;
|
|
}
|
|
}
|
|
} |