Untitled
unknown
plain_text
2 years ago
3.9 kB
8
Indexable
namespace AncientLegacy.Content.NPCs.Traders
{
[AutoloadHead]
public class Hunter : ModNPC
{
public override void SetStaticDefaults()
{
NPCID.Sets.HatOffsetY[Type] = 4;
NPCID.Sets.ShimmerTownTransform[Type] = false;
Main.npcFrameCount[Type] = 26;
NPCID.Sets.AttackFrameCount[Type] = 5;
NPCID.Sets.DangerDetectRange[Type] = 700;
NPCID.Sets.AttackType[Type] = 1;
NPCID.Sets.AttackTime[Type] = 20;
NPCID.Sets.AttackAverageChance[NPC.type] = 5;
// Influences how the NPC looks in the Bestiary
NPCID.Sets.NPCBestiaryDrawModifiers drawModifiers = new NPCID.Sets.NPCBestiaryDrawModifiers(0)
{
Velocity = 1f, // Draws the NPC in the bestiary as if its walking +2 tiles in the x direction
Direction = -1 // -1 is left and 1 is right.
};
NPCID.Sets.NPCBestiaryDrawOffset.Add(Type, drawModifiers);
NPC.Happiness
.SetBiomeAffection<ForestBiome>(AffectionLevel.Like)
// .SetBiomeAffection<SnowBiome>(AffectionLevel.Dislike)
.SetBiomeAffection<DungeonBiome>(AffectionLevel.Love)
.SetNPCAffection(NPCID.DD2Bartender, AffectionLevel.Love) // Loves living near the dryad.
.SetNPCAffection(NPCID.ArmsDealer, AffectionLevel.Love) // Loves living near the dryad.
.SetNPCAffection(NPCID.Clothier, AffectionLevel.Like) // Likes living near the guide.
.SetNPCAffection(NPCID.Dryad, AffectionLevel.Like) // Likes living near the guide.
.SetNPCAffection(NPCID.TaxCollector, AffectionLevel.Dislike) // Dislikes living near the merchant.
.SetNPCAffection(NPCID.Merchant, AffectionLevel.Hate) // Hates living near the demolitionist.
.SetNPCAffection(NPCID.Angler, AffectionLevel.Hate) // Hates living near the demolitionist.
; // < Mind the semicolon!
}
public override bool CanTownNPCSpawn(int numTownNPCs)
{ // Requirements for the town NPC to spawn.
int NZoologist = NPC.FindFirstNPC(NPCID.BestiaryGirl);
for (int k = 0; k < 255; k++) {
Player player = Main.player[k];
if (!player.active) {
continue;
}
// Player has to have either an ExampleItem or an ExampleBlock in order for the NPC to spawn
if (NZoologist >= 0)
{
return true;
}
}
return false;
}
public override void SetDefaults()
{
NPC.townNPC = true; // Sets NPC to be a Town NPC
NPC.friendly = true; // NPC Will not attack player
NPC.width = 18;
NPC.height = 40;
NPC.aiStyle = 7;
NPC.damage = 10;
NPC.defense = 15;
NPC.lifeMax = 500;
NPC.HitSound = SoundID.NPCHit1;
NPC.DeathSound = SoundID.NPCDeath1;
NPC.knockBackResist = 0.5f;
AnimationType = NPCID.Guide;
}
public override void TownNPCAttackStrength(ref int damage, ref float knockback)
{
damage = 15;
knockback = 1f;
if (Main.hardMode) damage = 35;
}
public override void TownNPCAttackCooldown(ref int cooldown, ref int randExtraCooldown) {
cooldown = 18;
randExtraCooldown = 4;
}
public override void DrawTownAttackGun(ref Texture2D item, ref Rectangle itemFrame, ref float scale, ref int horizontalHoldoutOffset)
{
scale = 1f;
horizontalHoldoutOffset = 4;
Main.GetItemDrawFrame(ItemID.SilverBow, out item, out itemFrame);
if (Main.hardMode) Main.GetItemDrawFrame(ItemID.IceBow, out item, out itemFrame);
}
public override void TownNPCAttackProj(ref int projType, ref int attackDelay) {
projType = ProjectileID.WoodenArrowFriendly;
attackDelay = 20;
if (Main.hardMode) attackDelay = 15;
}
public override void TownNPCAttackProjSpeed(ref float multiplier, ref float gravityCorrection, ref float randomOffset) {
multiplier = 12f;
randomOffset = 2f;
// SparklingBall is not affected by gravity, so gravityCorrection is left alone.
}
}
}Editor is loading...
Leave a Comment