Terraria ModLoader  0.11.7.8
A mod to make and play Terraria mods
ModNPC.cs
Go to the documentation of this file.
1 using Microsoft.Xna.Framework;
2 using Microsoft.Xna.Framework.Graphics;
3 using System;
4 using System.IO;
5 using System.Text.RegularExpressions;
6 using Terraria.ID;
7 using Terraria.Localization;
8 
9 namespace Terraria.ModLoader
10 {
14  public class ModNPC
15  {
16  //add modNPC property to Terraria.NPC (internal set)
17  //set modNPC to null at beginning of Terraria.NPC.SetDefaults
21  public NPC npc {
22  get;
23  internal set;
24  }
25 
29  public Mod mod {
30  get;
31  internal set;
32  }
33 
37  public string Name {
38  get;
39  internal set;
40  }
41 
45  public ModTranslation DisplayName {
46  get;
47  internal set;
48  }
49 
53  public virtual string Texture => (GetType().Namespace + "." + Name).Replace('.', '/');
57  public virtual string[] AltTextures => new string[0];
61  public virtual string HeadTexture => Texture + "_Head";
65  public virtual string BossHeadTexture => Texture + "_Head_Boss";
69  public int aiType = 0;
73  public int animationType = 0;
77  public int bossBag = -1;
78  //make changes to Terraria.Main.UpdateMusic (see patch files)
82  public int music = -1;
86  public MusicPriority musicPriority = MusicPriority.BossLow;
87  //in Terraria.Main.NPCAddHeight at end of else if chain add
88  // else if(Main.npc[i].modNPC != null) { num = Main.npc[i].modNPC.drawOffsetY; }
92  public float drawOffsetY = 0f;
93  //in Terraria.Item.NPCToBanner before returning 0 add
94  // if(i >= NPCID.Count) { return NPCLoader.npcs[i].banner; }
95  //in Terraria.Item.BannerToNPC before returning 0 add
96  // if(i >= NPCID.Count) { return i; }
100  public int banner = 0;
101  //in Terraria.NPC.NPCLoot after if statements setting num6 add
102  // if(num3 >= NPCID.Count) { num6 = NPCLoader.npcs[num3].bannerItem; }
106  public int bannerItem = 0;
107 
111  public ModNPC() {
112  npc = new NPC();
113  npc.modNPC = this;
114  }
115 
121  public virtual bool Autoload(ref string name) {
122  return mod.Properties.Autoload;
123  }
124 
125  internal void SetupNPC(NPC npc) {
126  ModNPC newNPC = (ModNPC)(CloneNewInstances ? MemberwiseClone() : Activator.CreateInstance(GetType()));
127  newNPC.npc = npc;
128  npc.modNPC = newNPC;
129  newNPC.mod = mod;
130  newNPC.Name = Name;
131  newNPC.SetDefaults();
132  }
133 
137  public virtual bool CloneNewInstances => false;
138 
145  public virtual ModNPC Clone() => (ModNPC)MemberwiseClone();
146 
153  public virtual ModNPC NewInstance(NPC npcClone) {
154  if (CloneNewInstances) {
155  ModNPC clone = Clone();
156  clone.npc = npcClone;
157  return clone;
158  }
159 
160  ModNPC copy = (ModNPC)Activator.CreateInstance(GetType());
161  copy.npc = npcClone;
162  copy.mod = mod;
163  copy.Name = Name;
164  copy.aiType = aiType;
165  copy.animationType = animationType;
166  copy.bossBag = bossBag;
167  copy.music = music;
168  copy.drawOffsetY = drawOffsetY;
169  copy.banner = banner;
170  copy.bannerItem = bannerItem;
171  return copy;
172  }
173 
177  public virtual void SetDefaults() {
178  }
179 
183  public virtual void SetStaticDefaults() {
184  }
185 
189  public virtual void AutoStaticDefaults() {
190  Main.npcTexture[npc.type] = ModContent.GetTexture(Texture);
191  if (banner != 0 && bannerItem != 0) {
192  NPCLoader.bannerToItem[banner] = bannerItem;
193  }
194  else if (banner != 0 || bannerItem != 0) {
195  Logging.tML.Warn(Language.GetTextValue("tModLoader.LoadWarningBannerOrBannerItemNotSet", mod.DisplayName, Name));
196  }
197  if (npc.lifeMax > 32767 || npc.boss) {
198  Main.npcLifeBytes[npc.type] = 4;
199  }
200  else if (npc.lifeMax > 127) {
201  Main.npcLifeBytes[npc.type] = 2;
202  }
203  else {
204  Main.npcLifeBytes[npc.type] = 1;
205  }
206 
207  string[] altTextures = AltTextures;
208  int altTextureCount = altTextures.Length;
209  NPCID.Sets.ExtraTextureCount[npc.type] = altTextureCount;
210  Main.npcAltTextures[npc.type] = new Texture2D[altTextureCount + 1];
211  if (altTextureCount > 0) {
212  Main.npcAltTextures[npc.type][0] = Main.npcTexture[npc.type];
213  }
214  for (int k = 1; k <= altTextureCount; k++) {
215  Main.npcAltTextures[npc.type][k] = ModContent.GetTexture(altTextures[k - 1]);
216  }
217 
218  if (DisplayName.IsDefault())
219  DisplayName.SetDefault(Regex.Replace(Name, "([A-Z])", " $1").Trim());
220  }
221 
227  public virtual void ScaleExpertStats(int numPlayers, float bossLifeScale) {
228  }
229 
233  public virtual void ResetEffects() {
234  }
235 
240  public virtual bool PreAI() {
241  return true;
242  }
243 
247  public virtual void AI() {
248  }
249 
250  //Allows you to determine how this NPC behaves. This will be called regardless of what PreAI returns.
251  public virtual void PostAI() {
252  }
253 
258  public virtual void SendExtraAI(BinaryWriter writer) {
259  }
260 
265  public virtual void ReceiveExtraAI(BinaryReader reader) {
266  }
267 
272  public virtual void FindFrame(int frameHeight) {
273  }
274 
280  public virtual void HitEffect(int hitDirection, double damage) {
281  }
282 
287  public virtual void UpdateLifeRegen(ref int damage) {
288  }
289 
294  public virtual bool CheckActive() {
295  return true;
296  }
297 
302  public virtual bool CheckDead() {
303  return true;
304  }
305 
310  public virtual bool SpecialNPCLoot() {
311  return false;
312  }
313 
318  public virtual bool PreNPCLoot() {
319  return true;
320  }
321 
325  public virtual void NPCLoot() {
326  }
327 
333  public virtual void OnCatchNPC(Player player, Item item) {
334  }
335 
341  public virtual void BossLoot(ref string name, ref int potionType) {
342  }
343 
350  public virtual bool CanHitPlayer(Player target, ref int cooldownSlot) {
351  return true;
352  }
353 
360  public virtual void ModifyHitPlayer(Player target, ref int damage, ref bool crit) {
361  }
362 
369  public virtual void OnHitPlayer(Player target, int damage, bool crit) {
370  }
371 
377  public virtual bool? CanHitNPC(NPC target) {
378  return null;
379  }
380 
388  public virtual void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit) {
389  }
390 
398  public virtual void OnHitNPC(NPC target, int damage, float knockback, bool crit) {
399  }
400 
407  public virtual bool? CanBeHitByItem(Player player, Item item) {
408  return null;
409  }
410 
419  public virtual void ModifyHitByItem(Player player, Item item, ref int damage, ref float knockback, ref bool crit) {
420  }
421 
430  public virtual void OnHitByItem(Player player, Item item, int damage, float knockback, bool crit) {
431  }
432 
438  public virtual bool? CanBeHitByProjectile(Projectile projectile) {
439  return null;
440  }
441 
450  public virtual void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) {
451  }
452 
460  public virtual void OnHitByProjectile(Projectile projectile, int damage, float knockback, bool crit) {
461  }
462 
472  public virtual bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) {
473  return true;
474  }
475 
480  public virtual void BossHeadSlot(ref int index) {
481  }
482 
487  public virtual void BossHeadRotation(ref float rotation) {
488  }
489 
494  public virtual void BossHeadSpriteEffects(ref SpriteEffects spriteEffects) {
495  }
496 
502  public virtual Color? GetAlpha(Color drawColor) {
503  return null;
504  }
505 
510  public virtual void DrawEffects(ref Color drawColor) {
511  }
512 
519  public virtual bool PreDraw(SpriteBatch spriteBatch, Color drawColor) {
520  return true;
521  }
522 
528  public virtual void PostDraw(SpriteBatch spriteBatch, Color drawColor) {
529  }
530 
536  public virtual void DrawBehind(int index)
537  {
538  }
539 
547  public virtual bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) {
548  return null;
549  }
550 
556  public virtual float SpawnChance(NPCSpawnInfo spawnInfo) {
557  return 0f;
558  }
559 
566  public virtual int SpawnNPC(int tileX, int tileY) {
567  return NPC.NewNPC(tileX * 16 + 8, tileY * 16, npc.type);
568  }
569 
576  public virtual bool CanTownNPCSpawn(int numTownNPCs, int money) {
577  return false;
578  }
579 
588  public virtual bool CheckConditions(int left, int right, int top, int bottom) {
589  return true;
590  }
591 
596  public virtual string TownNPCName() {
597  return Language.GetTextValue("tModLoader.DefaultTownNPCName");
598  }
599 
604  public virtual bool UsesPartyHat() {
605  return true;
606  }
607 
612  public virtual bool CanChat() {
613  return npc.townNPC;
614  }
615 
620  public virtual string GetChat() {
621  return Language.GetTextValue("tModLoader.DefaultTownNPCChat");
622  }
623 
629  public virtual void SetChatButtons(ref string button, ref string button2) {
630  }
631 
637  public virtual void OnChatButtonClicked(bool firstButton, ref bool shop) {
638  }
639 
645  public virtual void SetupShop(Chest shop, ref int nextSlot) {
646  }
647 
652  public virtual bool CanGoToStatue(bool toKingStatue) {
653  return false;
654  }
655 
661  public virtual void OnGoToStatue(bool toKingStatue) {
662  }
663 
669  public virtual void TownNPCAttackStrength(ref int damage, ref float knockback) {
670  }
671 
677  public virtual void TownNPCAttackCooldown(ref int cooldown, ref int randExtraCooldown) {
678  }
679 
685  public virtual void TownNPCAttackProj(ref int projType, ref int attackDelay) {
686  }
687 
694  public virtual void TownNPCAttackProjSpeed(ref float multiplier, ref float gravityCorrection, ref float randomOffset) {
695  }
696 
701  public virtual void TownNPCAttackShoot(ref bool inBetweenShots) {
702  }
703 
708  public virtual void TownNPCAttackMagic(ref float auraLightMultiplier) {
709  }
710 
716  public virtual void TownNPCAttackSwing(ref int itemWidth, ref int itemHeight) {
717  }
718 
725  public virtual void DrawTownAttackGun(ref float scale, ref int item, ref int closeness) {
726  }
727 
735  public virtual void DrawTownAttackSwing(ref Texture2D item, ref int itemSize, ref float scale, ref Vector2 offset) {
736  }
737  }
738 }
virtual void AutoStaticDefaults()
Automatically sets certain static defaults. Override this if you do not want the properties to be set...
Definition: ModNPC.cs:189
string Name
The internal name of this NPC.
Definition: ModNPC.cs:37
virtual void TownNPCAttackStrength(ref int damage, ref float knockback)
Allows you to determine the damage and knockback of this town NPC&#39;s attack before the damage is scale...
Definition: ModNPC.cs:669
virtual bool CheckActive()
Whether or not to run the code for checking whether this NPC will remain active. Return false to stop...
Definition: ModNPC.cs:294
virtual void TownNPCAttackShoot(ref bool inBetweenShots)
Allows you to tell the game that this town NPC has already created a projectile and will still create...
Definition: ModNPC.cs:701
MusicPriority
This enum dictates from low to high which music selections take priority. Setting appropriate MusicPr...
Definition: MusicPriority.cs:7
virtual void SetDefaults()
Allows you to set all your NPC&#39;s properties, such as width, damage, aiStyle, lifeMax, etc.
Definition: ModNPC.cs:177
This class serves as a place for you to place all your properties and hooks for each NPC...
Definition: ModNPC.cs:14
virtual void FindFrame(int frameHeight)
Allows you to modify the frame from this NPC&#39;s texture that is drawn, which is necessary in order to ...
Definition: ModNPC.cs:272
virtual bool PreNPCLoot()
Allows you to determine whether or not this NPC will drop anything at all. Return false to stop the N...
Definition: ModNPC.cs:318
virtual bool PreDraw(SpriteBatch spriteBatch, Color drawColor)
Allows you to draw things behind this NPC, or to modify the way this NPC is drawn. Return false to stop the game from drawing the NPC (useful if you&#39;re manually drawing the NPC). Returns true by default.
Definition: ModNPC.cs:519
virtual void DrawEffects(ref Color drawColor)
Allows you to add special visual effects to this NPC (such as creating dust), and modify the color in...
Definition: ModNPC.cs:510
static Texture2D GetTexture(string name)
Gets the texture with the specified name. The name is in the format of "ModFolder/OtherFolders/FileNa...
Definition: ModContent.cs:72
virtual bool CanHitNPC(NPC target)
Allows you to determine whether this NPC can hit the given friendly NPC. Return true to allow hitting...
Definition: ModNPC.cs:377
virtual void ResetEffects()
This is where you reset any fields you add to your subclass to their default states. This is necessary in order to reset your fields if they are conditionally set by a tick update but the condition is no longer satisfied. (Note: This hook is only really useful for GlobalNPC, but is included in ModNPC for completion.)
Definition: ModNPC.cs:233
virtual float SpawnChance(NPCSpawnInfo spawnInfo)
Whether or not this NPC can spawn with the given spawning conditions. Return the weight for the chanc...
Definition: ModNPC.cs:556
A struct that stores information regarding where an NPC is naturally spawning and the player it is sp...
Definition: NPCSpawnInfo.cs:6
virtual void ReceiveExtraAI(BinaryReader reader)
Use this to receive information that was sent in SendExtraAI.
Definition: ModNPC.cs:265
Mod mod
The mod that added this ModNPC.
Definition: ModNPC.cs:29
virtual void OnHitByProjectile(Projectile projectile, int damage, float knockback, bool crit)
Allows you to create special effects when this NPC is hit by a projectile.
Definition: ModNPC.cs:460
virtual void BossHeadSpriteEffects(ref SpriteEffects spriteEffects)
Allows you to flip this NPC&#39;s boss head icon on the map.
Definition: ModNPC.cs:494
virtual bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit)
Allows you to use a custom damage formula for when this NPC takes damage from any source...
Definition: ModNPC.cs:472
virtual void BossHeadSlot(ref int index)
Allows you to customize the boss head texture used by this NPC based on its state. Set index to -1 to stop the texture from being displayed.
Definition: ModNPC.cs:480
virtual void TownNPCAttackCooldown(ref int cooldown, ref int randExtraCooldown)
Allows you to determine the cooldown between each of this town NPC&#39;s attack. The cooldown will be a n...
Definition: ModNPC.cs:677
virtual void SetupShop(Chest shop, ref int nextSlot)
Allows you to add items to this NPC&#39;s shop. Add an item by setting the defaults of shop...
Definition: ModNPC.cs:645
float drawOffsetY
The vertical offset used for drawing this NPC. Defaults to 0.
Definition: ModNPC.cs:92
virtual void TownNPCAttackMagic(ref float auraLightMultiplier)
Allows you to control the brightness of the light emitted by this town NPC&#39;s aura when it performs a ...
Definition: ModNPC.cs:708
int banner
The type of NPC that this NPC will be considered as when determining banner drops and banner bonuses...
Definition: ModNPC.cs:100
virtual void TownNPCAttackProj(ref int projType, ref int attackDelay)
Allows you to determine the projectile type of this town NPC&#39;s attack, and how long it takes for the ...
Definition: ModNPC.cs:685
virtual bool CanChat()
Allows you to determine whether this NPC can talk with the player. By default, returns if the NPC is ...
Definition: ModNPC.cs:612
virtual bool SpecialNPCLoot()
Allows you to call NPCLoot on your own when the NPC dies, rather then letting vanilla call it on its ...
Definition: ModNPC.cs:310
virtual bool CheckConditions(int left, int right, int top, int bottom)
Allows you to define special conditions required for this town NPC&#39;s house. For example, Truffle requires the house to be in an aboveground mushroom biome.
Definition: ModNPC.cs:588
virtual void DrawBehind(int index)
When used in conjunction with "npc.hide = true", allows you to specify that this npc should be drawn ...
Definition: ModNPC.cs:536
virtual void NPCLoot()
Allows you to make things happen when this NPC dies (for example, dropping items and setting ModWorld...
Definition: ModNPC.cs:325
virtual int SpawnNPC(int tileX, int tileY)
Allows you to customize how this NPC is created when it naturally spawns (for example, its position or ai array). Return the return value of NPC.NewNPC. By default this method spawns this NPC on top of the tile at the given coordinates.
Definition: ModNPC.cs:566
NPC npc
The NPC object that this ModNPC controls.
Definition: ModNPC.cs:21
int music
The ID of the music that plays when this NPC is on or near the screen. Defaults to -1...
Definition: ModNPC.cs:82
virtual bool CanHitPlayer(Player target, ref int cooldownSlot)
Allows you to determine whether this NPC can hit the given player. Return false to block this NPC fro...
Definition: ModNPC.cs:350
virtual void SetChatButtons(ref string button, ref string button2)
Allows you to set the text for the buttons that appear on this NPC&#39;s chat window. A parameter left as...
Definition: ModNPC.cs:629
virtual bool CheckDead()
Whether or not this NPC should be killed when it reaches 0 health. You may program extra effects in t...
Definition: ModNPC.cs:302
virtual bool PreAI()
Allows you to determine how this NPC behaves. Return false to stop the vanilla AI and the AI hook fro...
Definition: ModNPC.cs:240
Manages content added by mods. Liasons between mod content and Terraria&#39;s arrays and oversees the Loa...
Definition: ModContent.cs:26
int aiType
Determines which type of vanilla NPC this ModNPC will copy the behavior (AI) of. Leave as 0 to not co...
Definition: ModNPC.cs:69
virtual void SetStaticDefaults()
Allows you to set all your NPC&#39;s static properties, such as names/translations and the arrays in NPCI...
Definition: ModNPC.cs:183
virtual bool CanGoToStatue(bool toKingStatue)
Whether this NPC can be telported to a King or Queen statue. Returns false by default.
Definition: ModNPC.cs:652
virtual bool CanBeHitByItem(Player player, Item item)
Allows you to determine whether this NPC can be hit by the given melee weapon when swung...
Definition: ModNPC.cs:407
virtual void ModifyHitPlayer(Player target, ref int damage, ref bool crit)
Allows you to modify the damage, etc., that this NPC does to a player.
Definition: ModNPC.cs:360
virtual void ModifyHitByItem(Player player, Item item, ref int damage, ref float knockback, ref bool crit)
Allows you to modify the damage, knockback, etc., that this NPC takes from a melee weapon...
Definition: ModNPC.cs:419
virtual bool Autoload(ref string name)
Allows you to automatically load an NPC instead of using Mod.AddNPC. Return true to allow autoloading...
Definition: ModNPC.cs:121
virtual void TownNPCAttackSwing(ref int itemWidth, ref int itemHeight)
Allows you to determine the width and height of the item this town NPC swings when it attacks...
Definition: ModNPC.cs:716
virtual void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit)
Allows you to modify the damage, knockback, etc., that this NPC does to a friendly NPC...
Definition: ModNPC.cs:388
virtual void UpdateLifeRegen(ref int damage)
Allows you to make the NPC either regenerate health or take damage over time by setting npc...
Definition: ModNPC.cs:287
virtual void OnCatchNPC(Player player, Item item)
Allows you to make things happen when this NPC is caught. Ran Serverside
Definition: ModNPC.cs:333
virtual void OnChatButtonClicked(bool firstButton, ref bool shop)
Allows you to make something happen whenever a button is clicked on this NPC&#39;s chat window...
Definition: ModNPC.cs:637
virtual Color GetAlpha(Color drawColor)
Allows you to determine the color and transparency in which this NPC is drawn. Return null to use the...
Definition: ModNPC.cs:502
virtual string GetChat()
Allows you to give this NPC a chat message when a player talks to it. By default returns something em...
Definition: ModNPC.cs:620
virtual void OnGoToStatue(bool toKingStatue)
Allows you to make things happen when this NPC teleports to a King or Queen statue. This method is only called server side.
Definition: ModNPC.cs:661
virtual bool CanBeHitByProjectile(Projectile projectile)
Allows you to determine whether this NPC can be hit by the given projectile. Return true to allow hit...
Definition: ModNPC.cs:438
virtual void BossLoot(ref string name, ref int potionType)
Allows you to customize what happens when this boss dies, such as which name is displayed in the defe...
Definition: ModNPC.cs:341
virtual void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
Allows you to modify the damage, knockback, etc., that this NPC takes from a projectile. This method is only called for the owner of the projectile, meaning that in multi-player, projectiles owned by a player call this method on that client, and projectiles owned by the server such as enemy projectiles call this method on the server.
Definition: ModNPC.cs:450
virtual void BossHeadRotation(ref float rotation)
Allows you to customize the rotation of this NPC&#39;s boss head icon on the map.
Definition: ModNPC.cs:487
int bannerItem
The type of the item this NPC drops for every 50 times it is defeated. For any ModNPC whose banner fi...
Definition: ModNPC.cs:106
virtual bool UsesPartyHat()
Allows you to determine whether this town NPC wears a party hat during a party. Returns true by defau...
Definition: ModNPC.cs:604
virtual void PostAI()
Definition: ModNPC.cs:251
This serves as the central class from which NPC-related functions are carried out. It also stores a list of mod NPCs by ID.
Definition: NPCLoader.cs:19
virtual void AI()
Allows you to determine how this NPC behaves. This will only be called if PreAI returns true...
Definition: ModNPC.cs:247
virtual bool CanTownNPCSpawn(int numTownNPCs, int money)
Whether or not the conditions have been met for this town NPC to be able to move into town...
Definition: ModNPC.cs:576
virtual void DrawTownAttackSwing(ref Texture2D item, ref int itemSize, ref float scale, ref Vector2 offset)
Allows you to customize how this town NPC&#39;s weapon is drawn when this NPC is swinging it (this NPC mu...
Definition: ModNPC.cs:735
ModNPC()
ModNPC constructor.
Definition: ModNPC.cs:111
Mod is an abstract class that you will override. It serves as a central place from which the mod&#39;s co...
Definition: Mod.cs:24
virtual void SendExtraAI(BinaryWriter writer)
If you are storing AI information outside of the npc.ai array, use this to send that AI information b...
Definition: ModNPC.cs:258
virtual void PostDraw(SpriteBatch spriteBatch, Color drawColor)
Allows you to draw things in front of this NPC. This method is called even if PreDraw returns false...
Definition: ModNPC.cs:528
virtual void OnHitNPC(NPC target, int damage, float knockback, bool crit)
Allows you to create special effects when this NPC hits a friendly NPC.
Definition: ModNPC.cs:398
int bossBag
The item type of the boss bag that is dropped when DropBossBags is called for this NPC...
Definition: ModNPC.cs:77
virtual void TownNPCAttackProjSpeed(ref float multiplier, ref float gravityCorrection, ref float randomOffset)
Allows you to determine the speed at which this town NPC throws a projectile when it attacks...
Definition: ModNPC.cs:694
int animationType
Determines which type of vanilla NPC this ModNPC will copy the animation (FindFrame) of...
Definition: ModNPC.cs:73
virtual string TownNPCName()
Allows you to give this town NPC any name when it spawns. By default returns something embarrassing...
Definition: ModNPC.cs:596
virtual void HitEffect(int hitDirection, double damage)
Allows you to make things happen whenever this NPC is hit, such as creating dust or gores...
Definition: ModNPC.cs:280
virtual void OnHitByItem(Player player, Item item, int damage, float knockback, bool crit)
Allows you to create special effects when this NPC is hit by a melee weapon.
Definition: ModNPC.cs:430
virtual void OnHitPlayer(Player target, int damage, bool crit)
Allows you to create special effects when this NPC hits a player (for example, inflicting debuffs)...
Definition: ModNPC.cs:369
virtual void DrawTownAttackGun(ref float scale, ref int item, ref int closeness)
Allows you to customize how this town NPC&#39;s weapon is drawn when this NPC is shooting (this NPC must ...
Definition: ModNPC.cs:725
virtual void ScaleExpertStats(int numPlayers, float bossLifeScale)
Allows you to customize this NPC&#39;s stats in expert mode. This is useful because expert mode&#39;s doublin...
Definition: ModNPC.cs:227
virtual bool DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position)
Allows you to control how the health bar for this NPC is drawn. The hbPosition parameter is the same ...
Definition: ModNPC.cs:547
virtual ModNPC NewInstance(NPC npcClone)
Create a new instance of this ModNPC for an NPC instance. Called at the end of NPC.SetDefaults. If CloneNewInstances is true, just calls Clone() Otherwise calls the default constructor and copies fields
Definition: ModNPC.cs:153