|
TModLoader v1.4.4.9
TModLoader source code documentation
|
Inheritance diagram for Terraria.NPC:
Collaboration diagram for Terraria.NPC:Classes | |
| struct | HitInfo |
| Represents a finalized damage calculation for damage about to be applied to an NPC. This is the result of the all modifications done previously in a T:Terraria.NPC.HitModifiers. More... | |
| struct | HitModifiers |
| Represents a damage calculation in the process of being calculated for damage to be applied to an NPC. The final damage calculation will be present in the resulting T:Terraria.NPC.HitInfo. More... | |
| struct | NPCNameFakeLanguageCategoryPassthrough |
Public Member Functions | |
| NPCAimedTarget | GetTargetData (bool ignorePlayerTankPets=true) |
| int | GetAttackDamage_ScaledByStrength (float normalDamage) |
| float | GetAttackDamage_LerpBetweenFinalValuesFloat (float normalDamage, float expertDamage) |
| int | GetAttackDamage_LerpBetweenFinalValues (float normalDamage, float expertDamage) |
| int | GetAttackDamage_ForProjectiles (float normalDamage, float expertDamage) |
| int | GetAttackDamage_ForProjectiles_MultiLerp (float normalDamage, float expertDamage, float masterDamage) |
| void | SpawnWithHigherTime (int timeMult) |
| void | EncourageDespawn (int despawnTime) |
| void | DiscourageDespawn (int despawnTime) |
| string | getNewNPCName () |
| NetworkText | GetTypeNetName () |
| void | GetLifeStats (out int statLife, out int statLifeMax) |
| float | GetLifePercent () |
| NetworkText | GetFullNetName () |
| NetworkText | GetGivenOrTypeNetName () |
| NetworkText | GetGivenNetName () |
| int | GetBossHeadTextureIndex () |
| float | GetBossHeadRotation () |
| SpriteEffects | GetBossHeadSpriteEffects () |
| int | BannerID () |
| void | CloneDefaults (int Type) |
| void | SetDefaultsKeepPlayerInteraction (int Type) |
| void | SetDefaults_ForNetId (int Type, float scaleOverride) |
| void | SetDefaults_ForNetId (int Type, NPCSpawnParams spawnparams, float scaleOverride) |
| void | SetNetShimmerEffect () |
| void | SetDefaults (int Type, NPCSpawnParams spawnparams=default(NPCSpawnParams)) |
| NPCSpawnParams | GetMatchingSpawnParams () |
| void | ScaleStats (int? activePlayersCount, GameModeData gameModeData, float? strengthOverride) |
| void | ScaleStats_UseStrengthMultiplier (float strength) |
| float | GetMyBalance () |
| void | PopAllAttachedProjectilesAndTakeDamageForThem () |
| bool | AI_AttemptToFindTeleportSpot (ref Vector2 chosenTile, int targetTileX, int targetTileY, int rangeFromTargetTile=20, int telefragPreventionDistanceInTiles=5, int solidTileCheckFluff=1, bool solidTileCheckCentered=false, bool teleportInAir=false) |
| void | AI () |
| void | VanillaAI () |
| void | AI_122_PirateGhost () |
| void | AI_000_TransformBoundNPC (int playerID, int npcType) |
| bool | AI_120_HallowBoss_IsInPhase2 () |
| bool | AI_120_HallowBoss_IsGenuinelyEnraged () |
| bool | Boss_CanShootExtraAt (int playerIndex, int rotationIndexToAttack, int rotationSize, float attackScanDistance, bool alwaysSkipMainTarget=true) |
| NPC | AI_113_WindyBalloon_GetSlaveNPC () |
| void | CopyInteractions (NPC npc) |
| Vector2 | GetMechQueenCenter () |
| void | UpdateHomeTileState (bool homeless, int x, int y) |
| Color | GetMagicAuraColor () |
| bool | NPCCanStickToWalls () |
| void | AI_001_SetRainbowSlimeColor () |
| void | ReflectProjectiles (Rectangle myRect) |
| bool | CanReflectProjectile (Projectile proj) |
| void | BloodNautilus_GetMouthPositionAndRotation (out Vector2 mouthPosition, out Vector2 mouthDirection) |
| void | ReflectProjectile (Projectile proj) |
| int | GetShootingFrame (float circleY) |
| Tuple< Vector2, float > | GetSwingStats (int swingMax, int swingCurrent, int aimDir, int itemWidth, int itemHeight) |
| void | TweakSwingStats (int swingMax, int swingCurrent, int aimDir, ref Rectangle itemRectangle) |
| bool | UsesPartyHat () |
| PartyHatColor | GetPartyHatColor () |
| void | SetFrameSize () |
| void | FindFrame () |
| void | VanillaFindFrame (int num, bool isLikeATownNPC, int type) |
| void | SimpleFlyMovement (Vector2 desiredVelocity, float moveSpeed) |
| void | HealEffect (int healAmount, bool broadcast=true) |
| int | FindClosestPlayer () |
| int | FindClosestPlayer (out float distanceToPlayer) |
| void | BigMimicSpawnSmoke () |
| bool | ShouldFaceTarget (ref NPCUtils.TargetSearchResults searchResults, NPCUtils.TargetType? overrideTargetType=null) |
| void | FaceTarget () |
| void | TargetClosestUpgraded (bool faceTarget=true, Vector2? checkPosition=null) |
| void | TargetClosest (bool faceTarget=true) |
| void | TargetClosest_WOF (bool faceTarget=true) |
| bool | DoesntDespawnToInactivityAndCountsNPCSlots () |
| bool | DoesntDespawnToInactivity () |
| void | CheckActive () |
| void | checkDead () |
| void | DropTombstoneTownNPC (NetworkText deathText) |
| bool | AnyInteractions () |
| Returns true if any player has damaged this NPC. Individual player participation can be determined by checking F:Terraria.NPC.playerInteraction directly. Use M:Terraria.NPC.GetWereThereAnyInteractions if F:Terraria.NPC.realLife might be in use. | |
| bool | IsDamageDodgeable () |
| void | NPCLoot () |
| bool | IsNPCValidForBestiaryKillCredit () |
| bool | ExcludedFromDeathTally () |
| bool | GetWereThereAnyInteractions () |
| Returns true if any player has damaged this NPC. Individual player participation can be determined by checking F:Terraria.NPC.playerInteraction directly. | |
| void | DropItemInstanced (Vector2 Position, Vector2 HitboxSize, int itemType, int itemStack=1, bool interactionRequired=true) |
| void | PlayerInteraction (int player) |
| void | ApplyInteraction (int player) |
| bool | RerollVariation () |
| void | TransformVisuals (int oldType, int newType) |
| void | Teleport (Vector2 newPos, int Style=0, int extraInfo=0) |
| void | Transform (int newType) |
| HitModifiers | GetIncomingStrikeModifiers (DamageClass damageType, int hitDirection, bool ignoreArmorDebuffs=false) |
| Initializes a T:Terraria.NPC.HitModifiers calculation with the properties of this NPC, including calling M:Terraria.ModLoader.NPCLoader.ModifyIncomingHit(Terraria.NPC,Terraria.NPC.HitModifiers@) | |
| HitInfo | CalculateHitInfo (int damage, int hitDirection, bool crit=false, float knockBack=0f, DamageClass damageType=null, bool damageVariation=false, float luck=0f) |
| Runs M:Terraria.ModLoader.NPCLoader.ModifyIncomingHit(Terraria.NPC,Terraria.NPC.HitModifiers@) hooks and and does the full damage calculations. The result P:Terraria.NPC.HitInfo.Damage will contain the health the NPC will lose when applied. | |
| int | SimpleStrikeNPC (int damage, int hitDirection, bool crit=false, float knockBack=0f, DamageClass damageType=null, bool damageVariation=false, float luck=0f, bool noPlayerInteraction=false) |
| Calls M:Terraria.NPC.CalculateHitInfo(System.Int32,System.Int32,System.Boolean,System.Single,Terraria.ModLoader.DamageClass,System.Boolean,System.Single), M:Terraria.NPC.StrikeNPC(Terraria.NPC.HitInfo,System.Boolean,System.Boolean) and then M:Terraria.NetMessage.SendStrikeNPC(Terraria.NPC,Terraria.NPC.HitInfo@,System.Int32) (in multiplayer) | |
| void | StrikeInstantKill () |
| Helper method for calling M:Terraria.NPC.StrikeNPC(Terraria.NPC.HitInfo,System.Boolean,System.Boolean) with a F:Terraria.NPC.HitInfo.InstantKill strike. Use to butcher your own NPCs. Not recommended for use on multiplayer clients because the net packet will trigger M:Terraria.NPC.PlayerInteraction(System.Int32) on the server. | |
| int | StrikeNPC (HitInfo hit, bool fromNet=false, bool noPlayerInteraction=false) |
| Directly deals damage to the NPC, spawns combat text, plays hit sound, deals knockback based on the provided T:Terraria.NPC.HitInfo Calls M:Terraria.NPC.HitEffect(Terraria.NPC.HitInfo) and associated hooks after dealing damage. Calls M:Terraria.NPC.checkDead Does not automatically send packets. Use M:Terraria.NetMessage.SendStrikeNPC(Terraria.NPC,Terraria.NPC.HitInfo@,System.Int32) to synchronize hits. | |
| void | HitEffect (int hitDirection=0, double dmg=10.0, bool? instantKill=null) |
| void | HitEffect (HitInfo hit) |
| int | FindBuffIndex (int type) |
| void | AddBuff (int type, int time, bool quiet=false) |
| Gives this NPC the provided buff. This accounts for if the NPC is immune to the buff. If the NPC already has the buff, the re-apply logic will happen. Vanilla buff types are found in T:Terraria.ID.BuffID and modded buffs are typically retrieved using M:Terraria.ModLoader.ModContent.BuffType``1. The quiet parameter will determine if the network sync message should happen. This should always stay false. | |
| void | RequestBuffRemoval (int buffTypeToRemove) |
| Removes the buff type and shuffles the remaining buff indexes down to fill the gap. Note that only buffs contained in F:Terraria.ID.BuffID.Sets.CanBeRemovedByNetMessage can be removed with this method. The intention is that those specific buffs are "owned" by the player who inflicts them, so they can be freely removed by multiplayer clients. In all other cases code running on the server or in single player is in charge of the NPC debuffs and M:Terraria.NPC.DelBuff(System.Int32) should be used directly. | |
| void | DelBuff (int buffIndex) |
| Removes the buff at the provided index and shuffles the remaining buff indexes down to fill the gap. The buff types and times will then be synced to clients. This method should only be called on the server or in single player. | |
| Rectangle | getRect () |
| bool | CanBeChasedBy (object attacker=null, bool ignoreDontTakeDamage=false) |
| bool | HittableForOnHitRewards () |
| void | moneyPing (Vector2 pos) |
| void | IdleSounds () |
| void | UpdateAltTexture () |
| void | UpdateNPC (int i) |
| bool | CanApplyHunterPotionEffects () |
| Color | GetNPCColorTintedByBuffs (Color npcColor) |
| void | AttemptToConvertNPCToEvil (bool crimson) |
| void | UpdateNPC_BuffSetFlags (bool lowerBuffTime=true) |
| void | GetImmuneTime (int fromWho, int time) |
| void | GetTileCollisionParameters (out Vector2 cPosition, out int cWidth, out int cHeight) |
| Color | GetBestiaryEntryColor () |
| Color | GetAlpha (Color newColor) |
| Color | GetShimmerColor (Color newColor) |
| Color | GetColor (Color newColor) |
| bool | ShouldBestiaryGirlBeLycantrope () |
| string | GetChat () |
| object | Clone () |
| bool | HasLuckTextForWizard (out string specialEventText) |
| bool | HasSpecialEventText (string specialTextCategoryKey, out string specialEventText) |
| bool | GetSpecialEventTextIfNotEmpty (string specialTextKey, object substitutes, ref string specialEventText) |
| void | CheckDrowning () |
| void | TryPortalJumping () |
| string | GetBestiaryCreditId () |
| override string | ToString () |
| T | GetGlobalNPC< T > () |
| Gets the instance of the specified GlobalNPC type. This will throw exceptions on failure. | |
| T | GetGlobalNPC< T > (T baseInstance) |
| Gets the local instance of the type of the specified GlobalNPC instance. This will throw exceptions on failure. | |
| bool | TryGetGlobalNPC< T > (out T result) |
| Gets the instance of the specified GlobalNPC type. | |
| bool | TryGetGlobalNPC< T > (T baseInstance, out T result) |
| Safely attempts to get the local instance of the type of the specified GlobalNPC instance. | |
| NPC () | |
| bool | HasBuff (int type) |
| Returns whether or not this NPC currently has a (de)buff of the provided type. | |
| bool | HasBuff< T > () |
| void | SitDown (Point anchorTilePosition, out int direction, out Vector2 bottom) |
| Helper method for getting the parameters for seating a town NPC. Assumes the tile at anchorTilePosition is a valid tile for sitting. | |
| int | GetPartyHatGore () |
| Returns the gore type of the party hat this NPC is currently wearing. If the NPC isn't wearing a party hat, 0 is returned. | |
| void | BecomeImmuneTo (int buffType) |
| Adjusts F:Terraria.NPC.buffImmune to make this NPC immune to the provided buff as well as all other buffs that inherit the immunity of that buff (via F:Terraria.ID.BuffID.Sets.GrantImmunityWith). This method can be followed by M:Terraria.NPC.ClearImmuneToBuffs(System.Boolean@) if the NPC should clear any buff it currently has that it is now immune to. | |
| void | ClearImmuneToBuffs (out bool anyBuffsCleared) |
| IEntitySource | GetSource_Buff (int buffIndex) |
| float | AngleTo (Vector2 Destination) |
| float | AngleFrom (Vector2 Source) |
| float | Distance (Vector2 Other) |
| float | DistanceSQ (Vector2 Other) |
| Vector2 | DirectionTo (Vector2 Destination) |
| Vector2 | DirectionFrom (Vector2 Source) |
| bool | WithinRange (Vector2 Target, float MaxRange) |
| IEntitySource | GetSource_FromThis (string? context=null) |
| IEntitySource | GetSource_FromAI (string? context=null) |
| IEntitySource | GetSource_DropAsItem (string? context=null) |
| IEntitySource | GetSource_Loot (string? context=null) |
| IEntitySource | GetSource_GiftOrReward (string? context=null) |
| IEntitySource | GetSource_OnHit (Entity victim, string? context=null) |
| IEntitySource | GetSource_OnHurt (Entity? attacker, string? context=null) |
| IEntitySource | GetSource_Death (string? context=null) |
| IEntitySource | GetSource_Misc (string context) |
| IEntitySource | GetSource_TileInteraction (int tileCoordsX, int tileCoordsY, string? context=null) |
| IEntitySource | GetSource_ReleaseEntity (string? context=null) |
| IEntitySource | GetSource_CatchEntity (Entity caughtEntity, string? context=null) |
Static Public Member Functions | |
| static int[,,,] | InitializeMoonLordAttacks () |
| static int[,] | InitializeMoonLordAttacks2 () |
| static string | GetFullnameByID (int npcID) |
| Returns the P:Terraria.NPC.FullName of the first active NPC of the given type in the world. If not found, the type name is returned instead. | |
| static bool | BusyWithAnyInvasionOfSorts () |
| static bool | SpawnAllowed_Demolitionist () |
| static bool | SpawnAllowed_ArmsDealer () |
| static bool | SpawnAllowed_DyeTrader () |
| static bool | SpawnAllowed_Nurse () |
| static bool | SpawnAllowed_Merchant () |
| static void | ClearFoundActiveNPCs () |
| static void | UpdateFoundActiveNPCs () |
| static void | ClearFoundNPCTypesForBestiary () |
| static void | UpdateRGBPeriheralProbe () |
| static bool | WouldBeEncouragedToDespawn (int aistyle, int type) |
| static void | setNPCName (string newName, int npcType, bool resetExtras=false) |
| static string | GetFirstNPCNameOrNull (int npcType) |
| Returns the P:Terraria.NPC.GivenOrTypeName of the first active NPC of the given type in the world. If not found, null is returned. | |
| static bool | MechSpawn (float x, float y, int type) |
| Use to check if a mechanism is allowed to spawn an NPC of the provided type at the provided world coordinates. Checks nearby area to see if the Spawn Limitshave been reached. | |
| static int | TypeToDefaultHeadIndex (int type) |
| static void | SetWorldSpecificMonstersByWorldID () |
| static float | GetBalance () |
| static int | GetActivePlayerCount () |
| static void | GetStatScalingFactors (int numPlayers, out float balance, out float boost) |
| static bool | GetNPCLocation (int i, bool seekHead, bool averageDirection, out int index, out Vector2 pos) |
| static void | TransformElderSlime (int npcIndex) |
| static void | TransformCopperSlime (int npcIndex) |
| static void | HaveDryadDoStardewAnimation () |
| static bool | SpawnMechQueen (int onWhichPlayer) |
| static bool | IsDeerclopsHostile () |
| static bool | IsADeerclopsNearScreen () |
| static Color | AI_121_QueenSlime_GetDustColor () |
| static bool | ShouldEmpressBeEnraged () |
| static void | FairyEffects (Vector2 Position, int type) |
| static int | GetEaterOfWorldsSegmentsCount () |
| static int | GetEaterOfWorldsSegmentsCountByGamemode (int gamemode) |
| static int | GetBrainOfCthuluCreepersCount () |
| static int | GetDestroyerSegmentsCount () |
| static bool | DespawnEncouragement_AIStyle2_FloatingEye_IsDiscouraged (int npcID, Vector2 npcPosition, int target=255) |
| static bool | DespawnEncouragement_AIStyle3_Fighters_NotDiscouraged (int npcID, Vector2 position, NPC npcInstance) |
| static bool | DespawnEncouragement_AIStyle3_Fighters_CanBeBusyWithAction (int npcID) |
| static void | HealEffect (Rectangle r, int healAmount, bool broadcast=true) |
| static bool | BigMimicSummonCheck (int x, int y, Player user) |
| static int | GetNPCInvasionGroup (int npcID) |
| Gets the T:Terraria.ID.InvasionID associated with the given NPC type (F:Terraria.NPC.type). | |
| static void | ResetKillCount () |
| static void | SetEventFlagCleared (ref bool eventFlag, int gameEventId) |
| static void | OnGameEventClearedForTheFirstTime (int gameEventId) |
| static void | ResetBadgerHatTime () |
| static bool | CanReleaseNPCs (int who) |
| static int | ReleaseNPC (int x, int y, int Type, int Style, int who) |
| static void | SlimeRainSpawns (int plr) |
| static bool | Spawning_SandstoneCheck (int x, int y) |
| static bool | Spawning_FlyingAntlionCheck (int x, int y) |
| static void | ResetRemixHax () |
| static void | SetRemixHax () |
| static bool | SpawnTileOrAboveHasAnyWallInSet (int x, int y, bool[] wallTypes) |
| static void | SpawnNPC () |
| static void | SpawnNPC_SpawnFrog (int spawnTileX, int spawnTileY, int plr) |
| static int | SpawnNPC_GetGemBunnyToSpawn () |
| static int | SpawnNPC_GetGemSquirrelToSpawn () |
| static bool | IsValidSpawningGroundTile (int x, int y) |
| static bool | FindCattailTop (int landX, int landY, out int cattailX, out int cattailY) |
| static bool | FindTreeBranch (int landX, int landY, out int treeBranchX, out int treeBranchY) |
| static bool | AnyDanger (bool quickBossNPCCheck=false, bool ignorePillarsAndMoonlordCountdown=false) |
| static bool | AnyoneNearCultists () |
| static void | SpawnWOF (Vector2 pos) |
| static void | SpawnSkeletron (int onWho) |
| static void | SpawnFaelings (int plr) |
| static void | SpawnOnPlayer (int plr, int Type) |
| static int | GetAvailableAmountOfNPCsToSpawnUpToSlot (int amountWeWant, int highestNPCSlotIndexWeWillPick=100) |
| static IEntitySource | GetBossSpawnSource (int targetPlayerIndex) |
| static void | SpawnBoss (int spawnPositionX, int spawnPositionY, int Type, int targetPlayerIndex) |
| static int | NewNPC (IEntitySource source, int X, int Y, int Type, int Start=0, float ai0=0f, float ai1=0f, float ai2=0f, float ai3=0f, int Target=255) |
| Spawns an NPC into the game world with the given type. This method should not be called on multiplayer clients. The X and Y parameters dictate the centered spawn position. >ai0, ai1, ai2, ai3 will initialize the NPC.ai[] array with the supplied values. This can be used to pass in information to the NPC. The NPC AI code will have to be written to utilize those values. | |
| static void | UnlockOrExchangePet (ref bool petBoughtFlag, int npcType, string textKeyForLicense, int netMessageData) |
| static bool | RerollVariationForNPCType (int npcType) |
| static void | LadyBugKilled (Vector2 Position, bool GoldLadyBug=false) |
| static int | CountNPCS (int Type) |
| Returns the number of active NPC in the world of the given NPC type (F:Terraria.NPC.type). | |
| static bool | AnyHelpfulFairies () |
| static bool | AnyNPCs (int Type) |
| Returns true if there are any active NPC in the world of the given NPC type (F:Terraria.NPC.type). | |
| static int | FindFirstNPC (int Type) |
| Returns the index within F:Terraria.Main.npc of the the first active NPC in the world of the given NPC type (F:Terraria.NPC.type). | |
| static bool | NearSpikeBall (int x, int y) |
| static void | ResetNetOffsets () |
| static Color | buffColor (Color newColor, float R, float G, float B, float A) |
| static void | setFireFlyChance () |
| static void | GetMeleeCollisionData (Rectangle victimHitbox, int enemyIndex, ref int specialHitSetter, ref float damageMultiplier, ref Rectangle npcRect) |
| static NPC | NewNPCDirect (IEntitySource source, int x, int y, int type, int start=0, float ai0=0f, float ai1=0f, float ai2=0f, float ai3=0f, int target=255) |
This particular overload returns the actual NPC instance rather than the index of the spawned NPC within the F:Terraria.Main.npc array. A short-hand for | |
| static NPC | NewNPCDirect (IEntitySource source, Vector2 position, int type, int start=0, float ai0=0f, float ai1=0f, float ai2=0f, float ai3=0f, int target=255) |
This particular overload returns the actual NPC instance rather than the index of the spawned NPC within the F:Terraria.Main.npc array. It also uses a Vector2 for the spawn position instead of X and Y. A short-hand for | |
| static bool | CheckCatchNPC (NPC npc, Rectangle catchToolRectangle, Item item, Player player, bool lavaProofTool=false) |
| Runs most code related to the process of checking whether or not an NPC can be caught. After that, M:Terraria.ModLoader.CombinedHooks.OnCatchNPC(Terraria.Player,Terraria.NPC,Terraria.Item,System.Boolean) is run, followed by the code responsible for catching the NPC if applicable. You will need to call this manually if you want to make an NPC-catching tool which acts differently from vanilla's, such as one that uses a projectile instead of an item. As a note, if calling this manually, you will need to check npc.active && npc.catchItem > 0 yourself. | |
| static ? IEntitySource | GetSource_None () |
| static ? IEntitySource | InheritSource (Entity entity) |
| static IEntitySource | GetSource_NaturalSpawn () |
| static IEntitySource | GetSource_TownSpawn () |
Public Attributes | |
| bool | IsABestiaryIconDummy |
| bool | ForcePartyHatOn |
| float | waterMovementSpeed = 0.5f |
| float | lavaMovementSpeed = 0.5f |
| float | honeyMovementSpeed = 0.25f |
| float | shimmerMovementSpeed = 0.375f |
| int | teleportStyle |
| float | teleportTime |
| int | netSpam |
| float | nameOver |
| bool | SpawnedFromStatue |
| bool | CanBeReplacedByOtherNPCs |
| bool | dripping |
| bool | drippingSlime |
| bool | drippingSparkleSlime |
| int | altTexture |
| int | townNpcVariationIndex |
| Vector2 | netOffset = Vector2.Zero |
| int | catchItem |
| The numerical ID of the item that this NPC becomes when caught. Mainly used for critters that can be caught with bug nets, such as butterflies and worms. Bug nets and other catching tools will only work on NPCs with this field set to something greater than 0. | |
| short | releaseOwner = 255 |
| Identifies the player who released this NPC into the world. Used mainly for released critters. Helps limit how many critters a player can release. Default to 255, indicating that the npc was not released by a player. | |
| int | rarity |
| How rare the NPC is for the Lifeform Analyzer. For example: 4 is for Tim and Mimics, 1 is for bound town NPCs. Defaults to 0. | |
| bool[] | playerInteraction = new bool[256] |
| Tracks which T:Terraria.Players have damaged this NPC. Damaging boss minions or other parts of a boss is usually counted as damaging the main body of the boss. Used to determine which players participated in a boss fight and should receive a boss bag. Indexed by each players F:Terraria.Entity.whoAmI (or F:Terraria.Main.myPlayer for code running locally). F:Terraria.NPC.lastInteraction tracks which player was the last player to damage this NPC. M:Terraria.NPC.AnyInteractions can be used to easily check if any player has damaged the NPC. | |
| int | lastInteraction = 255 |
| The F:Terraria.Entity.whoAmI of the T:Terraria.Player that last damaged this NPC. Used to award Banner items to the player that killed the NPC, but can be used for many other effects. The default value is 255. If the value is 255, the NPC has not been damaged by any T:Terraria.Player. The F:Terraria.NPC.playerInteraction array tracks all players that have damaged this NPC. | |
| float | takenDamageMultiplier = 1f |
| float | gfxOffY |
| An offset from the actual position of the npc that will be added to the draw position. Used to fake the effect of NPC smoothly traveling up single block obstacles. | |
| float | stepSpeed |
| Has nothing to do with the speed that this NPC travels, that is dictated by AI code adjusting F:Terraria.Entity.velocity. | |
| bool | teleporting |
| bool | stairFall |
| Vector2[] | oldPos = (Vector2[])(object)new Vector2[10] |
| float[] | oldRot = new float[10] |
| bool | setFrameSize |
| int | netSkip |
| bool | netAlways |
| int | realLife = -1 |
| Stores the index (the F:Terraria.Entity.whoAmI) of a single NPC. This NPC will then share a health pool with that NPC. Used for the Destroyer's various segments and the Wall of Flesh's eyes and mouth. This is useful for worm enemies. All the segments will point to the same npc, usually the "head" of the npc, and the head and all other non-multi-part NPCs will have the default value of -1 still. Defaults to -1. | |
| float | npcSlots = 1f |
| Represents how much this npc counts towards the npc spawn limit. Small critters like worms or flies have values around 0.1f and 0.25f. Enemies that are more difficult than normal have values higher than 1f, and bosses and mini bosses have values around 6. Proper npcSlots values help balance the game and prevents the player from randomly being overwhelmed by powerful enemies. The Spawn rates section on the NPC spawning wiki pagelists vanilla npcSlots values. Use this as a guide to find a suitable value. Defaults to 1f. | |
| float | shimmerTransparency |
| bool | dontCountMe |
| int[] | buffType = new int[maxBuffs] |
| int[] | buffTime = new int[maxBuffs] |
| bool[] | buffImmune = new bool[BuffLoader.BuffCount] |
| Contains the NPC buff immunities for this NPC. The default values in this array are populated from F:Terraria.ID.NPCID.Sets.ImmuneToAllBuffs, F:Terraria.ID.NPCID.Sets.ImmuneToRegularBuffs, F:Terraria.ID.NPCID.Sets.SpecificDebuffImmunity, and F:Terraria.ID.BuffID.Sets.GrantImmunityWith. | |
| bool | canDisplayBuffs = true |
| bool | midas |
| bool | ichor |
| bool | onFire |
| bool | onFire2 |
| bool | onFire3 |
| bool | onFrostBurn |
| bool | onFrostBurn2 |
| bool | poisoned |
| bool | markedByScytheWhip |
| bool | venom |
| bool | shadowFlame |
| bool | soulDrain |
| bool | shimmering |
| int | lifeRegen |
| int | lifeRegenCount |
| int | lifeRegenExpectedLossPerSecond = -1 |
| bool | confused |
| bool | loveStruck |
| bool | stinky |
| bool | dryadWard |
| bool | immortal |
| bool | chaseable = true |
| bool | canGhostHeal = true |
| bool | javelined |
| bool | tentacleSpiked |
| bool | bloodButchered |
| bool | celled |
| bool | dryadBane |
| bool | daybreak |
| bool | dontTakeDamageFromHostiles |
| bool | betsysCurse |
| bool | oiled |
| int | soundDelay |
| int[] | immune = new int[256] |
| This determines if an NPC can be hit by a item or projectile owned by a particular player (it is an array, each slot corresponds to different players (whoAmI)). It is decremented towards 0 every update. Melee items set immune[Player.whoAmI] to Player.itemAnimation, which starts at item.useAnimation and decrements towards 0. Penetrating projectiles usually set immune to 10, while non-penetrating projectiles do not set immune. ExamplePiercingProjectile.csexplains more about options for npc and projectile immunity. | |
| int | directionY = 1 |
| int | type |
The NPC ID of this NPC. The NPC ID is a unique number assigned to each NPC loaded into the game. This will be equal to either an T:Terraria.ID.NPCID entry or M:Terraria.ModLoader.ModContent.NPCType``1, for example F:Terraria.ID.NPCID.AngryBones or ModContent.NPCType<MyModNPC>(). To check if an NPC instance is a specific NPC, check NPC.type == NPCID.VanillaNPCHere or NPC.type == ModContent.NPCType<ModdedNPCHere>() in an if statement. | |
| float[] | ai = new float[maxAI] |
| An array with 4 slots used for any sort of data storage, which is occasionally synced from the server to clients. Each vanilla T:Terraria.ID.NPCAIStyleID uses these slots for different purposes. Set F:Terraria.NPC.netUpdate to true to manually sync. The advantage of using these 4 floats is that they are synced automatically. Using fields in your P:Terraria.NPC.ModNPC class will work just the same, but they might need to be synced via M:Terraria.ModLoader.ModNPC.SendExtraAI(System.IO.BinaryWriter) and M:Terraria.ModLoader.ModNPC.ReceiveExtraAI(System.IO.BinaryReader) if necessary. Clever use of Reference return valuesas seen in ExampleCustomAISlimeNPC.cscan be used to reuse the ai array entries with readable names. Defaults to the values passed into M:Terraria.NPC.NewNPC(Terraria.DataStructures.IEntitySource,System.Int32,System.Int32,System.Int32,System.Int32,System.Single,System.Single,System.Single,System.Single,System.Int32), usually [0, 0, 0, 0]. | |
| float[] | localAI = new float[maxAI] |
| Acts like F:Terraria.NPC.ai, but does not sync to the server. Many vanilla T:Terraria.ID.NPCAIStyleID use these slots for various purposes. Defaults to [0, 0, 0, 0]. | |
| int | aiAction |
| int | aiStyle |
| Selects which vanilla code to use for the AI method. Vanilla NPC AI styles are enumerated in the T:Terraria.ID.NPCAIStyleID class. Modders can use vanilla aiStyle and optionally P:Terraria.ModLoader.ModNPC.AIType to mimic AI code already in the game. This is usually only useful as a prototyping tool since it is difficult to customize existing aiStyle code. See P:Terraria.ModLoader.ModNPC.AIType and PartyZombieto see how to use vanilla ai. If you are using custom AI code, there is no need to set this field. Customizing an existing aiStyle usually requires following the Vanilla Code Adaption Guide. If you are using completely custom AI, set this to -1 since an aiStyle of 0 will face the player automatically, which may interfere with your logic. Defaults to 0. | |
| bool | justHit |
| int | timeLeft |
| int | target = -1 |
| int | damage |
| The amount of contact damage this NPC deals. Changing this WILL NOT change the amount of damage done by projectiles. Usually damage is scaled by some factor when NPC spawn projectiles with Projectile.NewProjectile in AI code. For example, passing in (int)(NPC.damage * 0.5f) as the Damage parameter. The List of NPCs wiki pagecan be useful for finding appropriate values. | |
| int | defense |
| How resistant to damage this NPC is. The List of NPCs wiki pagecan be useful for finding appropriate values. | |
| int | defDamage |
| Stores the value of F:Terraria.NPC.damage at the end of SetDefaults. Useful for scaling damage in AI code conditionally. | |
| int | defDefense |
| Stores the value of F:Terraria.NPC.defense at the end of SetDefaults. Useful for scaling defense in AI code, like how King Slime changes defense as it gets smaller. | |
| bool | coldDamage |
| Denotes whether or not this NPC counts as dealing cold damage for the purposes of the Warmth Potion. Defaults to false. | |
| bool | trapImmune |
| SoundStyle? | HitSound |
| The sound that plays when this npc is hit. Set this to an existing T:Terraria.ID.SoundID entry or assign to a new T:Terraria.Audio.SoundStyle for a custom sound. The Basic Sounds Guideteaches how to find existing sounds to use, how to use custom sounds, and how to customize the playback properties of the sounds. For example NPC.HitSound = SoundID.NPCHit1; can be used for the typical NPC hit sound. Defaults to null. | |
| SoundStyle? | DeathSound |
| The sound that plays when this npc dies. Set this to an existing T:Terraria.ID.SoundID entry or assign to a new T:Terraria.Audio.SoundStyle for a custom sound. The Basic Sounds Guideteaches how to find existing sounds to use, how to use custom sounds, and how to customize the playback properties of the sounds. For example NPC.DeathSound = SoundID.NPCDeath1; can be used for the typical NPC kill sound. Defaults to null. | |
| int | life |
| The current life of the NPC. Automatically set to the value of F:Terraria.NPC.lifeMax at the end of SetDefaults. | |
| int | lifeMax |
| The maximum life of this NPC. | |
| Rectangle | targetRect |
| double | frameCounter |
| Rectangle | frame |
| Color | color |
| int | alpha |
| 0 is opaque, and 255 is transparent. Note that this is the opposite of how alpha is typically expressed in computer graphics. Can be used to fade an NPC in and out. Use P:Terraria.NPC.Opacity instead for a 0f to 1f scaling that uses the high value for fully opaque, as is more typical in computer graphics. Defaults to 0. | |
| bool | hide |
| Indicates that this NPC is drawn at a specific layer in the render order. Must use in conjunction with M:Terraria.ModLoader.ModNPC.DrawBehind(System.Int32). See ExampleDrawBehindNPCfor examples of how to use this and all available layers to draw in. | |
| float | scale = 1f |
| Makes the NPC bigger or smaller. Bigger than 1f is bigger. Defaults to 1f. | |
| float | knockBackResist = 1f |
| How much of the knockback it receives will actually apply. 1f: full knockback; 0f: no knockback. Defaults to 1f. | |
| int | oldDirectionY |
| int | oldTarget |
| float | rotation |
| bool | noGravity |
| If true, the npc will not be affected by gravity. Demon Eyes and other floating npc use this. Defaults to false. | |
| bool | noTileCollide |
| If true, the npc does not collide with tiles, making the npc pass through tiles freely. Meteor Head and Worm npc use this. Defaults to false. | |
| bool | netUpdate |
| bool | netUpdate2 |
| bool | collideX |
| bool | collideY |
| bool | boss |
Set to true if the NPC is a boss. Prevents off-screen despawn. Bosses also need [AutoloadBossHead] annotated on the ModNPC class itself to fully register as a boss. | |
| int | spriteDirection = -1 |
| bool | behindTiles |
| Indicates that this NPC draws behind solid tiles. See ExampleDrawBehindNPCfor examples of how to use this and other options for layers to draw in. | |
| bool | lavaImmune |
| float | value |
| How many copper coins the NPC will drop when killed (100 copper coins = 1 silver coin etc.). | |
| int | extraValue |
| bool | dontTakeDamage |
| int | netID |
| Similar to F:Terraria.NPC.type, but accounts for negative T:Terraria.ID.NPCID values. | |
| int | statsAreScaledForThisManyPlayers |
| float | strengthMultiplier = 1f |
| bool | townNPC |
| bool | homeless |
| int | homeTileX = -1 |
| int | homeTileY = -1 |
| int | housingCategory |
| bool | oldHomeless |
| int | oldHomeTileX = -1 |
| int | oldHomeTileY = -1 |
| bool | friendly |
| Indicates that an NPC is friendly to players. If true, a player won't damage the NPC and the NPC won't deal contact damage to players, unless otherwise forced. Mostly set to true for town npc and rescuable town npc. Naturally spawned critter NPC that are F:Terraria.Main.npcCatchable will automatically be friendly for 1.5 seconds after spawning. | |
| bool | closeDoor |
| int | doorX |
| int | doorY |
| int | friendlyRegen |
| int | breath |
| int | breathCounter |
| bool | reflectsProjectiles |
| int | lastPortalColorIndex |
| bool | despawnEncouraged |
| MultipliableFloat | GravityMultiplier = MultipliableFloat.One |
| Multiply this value in order to change the NPCs active gravity, this can be done in AI as gravity values are reset slightly beforehand, and used slightly after. | |
| MultipliableFloat | MaxFallSpeedMultiplier = MultipliableFloat.One |
| Multiply this value in order to change the NPCs active maxFallSpeed, this can be done in AI as gravity values are reset slightly beforehand. | |
| bool | GravityIgnoresType |
| Set to disable vanilla type and AI based NPC gravity calculations. Affects types 258, 425, 576, 577, 427, 426, 541, and the aiStyle 7. Use with caution. | |
| bool | GravityIgnoresSpace |
| Set to disable the effect of being in space on NPC gravity. | |
| bool | GravityIgnoresLiquid |
| Set to disable the effect of being submerged in liquid on NPC gravity. Note that being submerged in liquid overrides both type and space effects. | |
| int | whoAmI |
| The index of this Entity within its specific array. These arrays track the entities in the world. Item: unused Projectile: F:Terraria.Main.projectile NPC: F:Terraria.Main.npc Player: F:Terraria.Main.player | |
| bool | active |
| If true, the Entity actually exists within the game world. Within the specific entity array, if active is false, the entity is junk data. Always check active if iterating over the entity array. | |
| Vector2 | position |
| The position of this Entity in world coordinates. | |
| Vector2 | velocity |
| The velocity of this Entity in world coordinates per tick. | |
| Vector2 | oldPosition |
| Vector2 | oldVelocity |
| int | oldDirection |
| int | direction = 1 |
| int | width |
| The width of this Entity's hitbox, in pixels. | |
| int | height |
| The height of this Entity's hitbox, in pixels. | |
| bool | wet |
| The Entity is currently in water. Projectile: Affects movement speed and some projectiles die when wet. F:Terraria.Projectile.ignoreWater prevents this. | |
| bool | shimmerWet |
| bool | honeyWet |
| byte | wetCount |
| bool | lavaWet |
Static Public Attributes | |
| static readonly int[,,,] | MoonLordAttacksArray = InitializeMoonLordAttacks() |
| static readonly int[,] | MoonLordAttacksArray2 = InitializeMoonLordAttacks2() |
| static int | MoonLordFightingDistance = 4500 |
| static int | MoonLordCountdown = 0 |
| static int | MaxMoonLordCountdown = 3600 |
| const int | NaturalMoonlordCountdownTime = 3600 |
| const int | ItemMoonlordCountdownTime = 720 |
| static int | immuneTime = 20 |
| static int | maxAI = 4 |
| static int | goldCritterChance = 400 |
| static int[] | killCount = new int[NPCID.Count] |
| static float | totalInvasionPoints = 0f |
| static float | waveKills = 0f |
| static int | waveNumber = 0 |
| const float | nameOverIncrement = 0.025f |
| const float | nameOverDistance = 350f |
| static readonly int | AFKTimeNeededForNoWorms = 300 |
| static bool[] | ShimmeredTownNPCs = new bool[NPCID.Count] |
| static bool | taxCollector = false |
| static bool | freeCake = false |
| static int | fireFlyFriendly = 0 |
| static int | fireFlyChance = 0 |
| static int | fireFlyMultiple = 0 |
| static int | butterflyChance = 0 |
| static int | stinkBugChance = 0 |
| static int | golemBoss = -1 |
| static int | plantBoss = -1 |
| static int | crimsonBoss = -1 |
| static int | deerclopsBoss = -1 |
| static int | sWidth = 1920 |
| static int | sHeight = 1080 |
| static int | safeRangeX = (int)((double)(sWidth / 16) * 0.52) |
| static int | safeRangeY = (int)((double)(sHeight / 16) * 0.52) |
| static int | activeTime = 750 |
| static readonly int | maxBuffs = 20 |
| static bool | savedTaxCollector = false |
| static bool | savedGoblin = false |
| static bool | savedWizard = false |
| static bool | savedMech = false |
| static bool | savedAngler = false |
| static bool | savedStylist = false |
| static bool | savedBartender = false |
| static bool | savedGolfer = false |
| static bool | boughtCat = false |
| static bool | boughtDog = false |
| static bool | boughtBunny = false |
| static bool | unlockedSlimeBlueSpawn = false |
| static bool | unlockedSlimeGreenSpawn = false |
| static bool | unlockedSlimeOldSpawn = false |
| static bool | unlockedSlimePurpleSpawn = false |
| static bool | unlockedSlimeRainbowSpawn = false |
| static bool | unlockedSlimeRedSpawn = false |
| static bool | unlockedSlimeYellowSpawn = false |
| static bool | unlockedSlimeCopperSpawn = false |
| static bool | unlockedMerchantSpawn = false |
| static bool | unlockedDemolitionistSpawn = false |
| static bool | unlockedPartyGirlSpawn = false |
| static bool | unlockedDyeTraderSpawn = false |
| static bool | unlockedTruffleSpawn = false |
| static bool | unlockedArmsDealerSpawn = false |
| static bool | unlockedNurseSpawn = false |
| static bool | unlockedPrincessSpawn = false |
| static bool | combatBookWasUsed = false |
| Denotes whether or not Advanced Combat Techniques has been used in the current world. | |
| static bool | combatBookVolumeTwoWasUsed = false |
| static bool | peddlersSatchelWasUsed = false |
| static bool | downedBoss1 = false |
| Denotes whether or not the Eye of Cthulhu has been defeated at least once in the current world. | |
| static bool | downedBoss2 = false |
| Denotes whether or not the Eater of Worlds OR the Brain of Cthulhu have been defeated at least once in the current world. This does NOT track the two of them separately; you will need to establish your own fields in a T:Terraria.ModLoader.ModSystem for that. | |
| static bool | downedBoss3 = false |
| Denotes whether or not Skeletron has been defeated at least once in the current world. | |
| static bool | downedQueenBee = false |
| Denotes whether or not at least one Queen Bee has been defeated in the current world. | |
| static bool | downedSlimeKing = false |
| Denotes whether or not King Slime has been defeated at least once in the current world. | |
| static bool | downedGoblins = false |
| Denotes whether or not at least one Goblin Army has been defeated in the current world. | |
| static bool | downedFrost = false |
| Denotes whether or not the Frost Legion has been defeated at least once in the current world. | |
| static bool | downedPirates = false |
| Denotes whether or not at least one Pirate Invasion has been defeated in the current world. | |
| static bool | downedClown = false |
| Denotes whether or not at least one Clown has been killed in the current world. Only used to make the Clothier sell the Clown set once at least one has been killed. | |
| static bool | downedPlantBoss = false |
| Denotes whether or not Plantera has been defeated at least once in the current world. | |
| static bool | downedGolemBoss = false |
| Denotes whether or not Golem has been defeated at least once in the current world. | |
| static bool | downedMartians = false |
| Denotes whether or not at least one Martian Madness event has been cleared in the current world. | |
| static bool | downedFishron = false |
| Denotes whether or not Duke Fishron has been defeated at least once in the current world. | |
| static bool | downedHalloweenTree = false |
| Denotes whether or not at least one Mourning Wood has been defeated in the current world. | |
| static bool | downedHalloweenKing = false |
| Denotes whether or not at least one Pumpking has been defeated in the current world. | |
| static bool | downedChristmasIceQueen = false |
| Denotes whether or not at least one Ice Queen has been defeated in the current world. | |
| static bool | downedChristmasTree = false |
| Denotes whether or not at least one Everscream has been defeated in the current world. | |
| static bool | downedChristmasSantank = false |
| Denotes whether or not at least one Santa-NK1 has been defeated in the current world. | |
| static bool | downedAncientCultist = false |
| Denotes whether or not the Lunatic Cultist has been defeated at least once in the current world. | |
| static bool | downedMoonlord = false |
| Denotes whether or not the Moon Lord has been defeated at least once in the current world. | |
| static bool | downedTowerSolar = false |
| Denotes whether or not the Solar Pillar has been defeated at least once in the current world. | |
| static bool | downedTowerVortex = false |
| Denotes whether or not the Vortex Pillar has been defeated at least once in the current world. | |
| static bool | downedTowerNebula = false |
| Denotes whether or not the Nebula Pillar has been defeated at least once in the current world. | |
| static bool | downedTowerStardust = false |
| Denotes whether or not the Stardust Pillar has been defeated at least once in the current world. | |
| static bool | downedEmpressOfLight = false |
| Denotes whether or not the Empress of Light has been defeated at least once in the current world. | |
| static bool | downedQueenSlime = false |
| Denotes whether or not Queen Slime has been defeated at least once in the current world. | |
| static bool | downedDeerclops = false |
| Denotes whether or not the Deerclops has been defeated at least once in the current world. | |
| static int | ShieldStrengthTowerSolar = 0 |
| static int | ShieldStrengthTowerVortex = 0 |
| static int | ShieldStrengthTowerNebula = 0 |
| static int | ShieldStrengthTowerStardust = 0 |
| static int | LunarShieldPowerNormal = 100 |
| static int | LunarShieldPowerMax = 100 |
| static bool | TowerActiveSolar = false |
| static bool | TowerActiveVortex = false |
| static bool | TowerActiveNebula = false |
| static bool | TowerActiveStardust = false |
| static bool | LunarApocalypseIsUp = false |
| static bool | downedMechBossAny = false |
| Denotes whether or not ANY Mechanical Boss has been defeated at least once in the current world. | |
| static bool | downedMechBoss1 = false |
| Denotes whether or not the Destroyer has been defeated at least once in the current world. | |
| static bool | downedMechBoss2 = false |
| Denotes whether or not the Twins have been defeated at least once in the current world. | |
| static bool | downedMechBoss3 = false |
| Denotes whether or not Skeletron Prime has been defeated at least once in the current world. | |
| static bool[] | npcsFoundForCheckActive = new bool[NPCID.Count] |
| static int[] | lazyNPCOwnedProjectileSearchArray = new int[200] |
| static CoinLossRevengeSystem | RevengeManager = new CoinLossRevengeSystem() |
| static bool | travelNPC = false |
| const int | breathMax = 200 |
| static int[,] | cavernMonsterType = new int[2, 3] |
| static int | mechQueen = -1 |
| static int | brainOfGravity = -1 |
| static bool | empressRageMode = false |
| static int[] | MoonEventRequiredPointsPerWaveLookup |
| static bool | fairyLog = false |
| static int | ladyBugGoodLuckTime = 43200 |
| static int | ladyBugBadLuckTime = -10800 |
| static int | offSetDelayTime = 60 |
| static bool | PreventJojaColaDialog = false |
| static int | RerollDryadText = 0 |
Package Functions | |
| int | StrikeNPCNoInteraction (int Damage, float knockBack, int hitDirection) |
| int | StrikeNPC (int Damage, float knockBack, int hitDirection, bool crit=false, bool fromNet=false, bool noPlayerInteraction=false) |
| HitInfo | CalculateStrikeFromLegacyValues (int Damage, float knockBack, int hitDirection, bool crit) |
| IEntitySource | GetItemSource_Misc (int itemSourceId) |
| IEntitySource | GetSpawnSource_NPCHurt () |
| IEntitySource | GetSpawnSource_ForProjectile () |
| IEntitySource | GetSpawnSourceForProjectileNPC () |
| IEntitySource | GetSpawnSourceForNPCFromNPCAI () |
| IEntitySource | GetItemSource_Loot () |
Static Package Functions | |
| static void | CatchNPC (int i, int who=-1) |
| static IEntitySource | GetSpawnSource_NPCRelease (int whoReleasedIt) |
| static IEntitySource | GetSpawnSource_NPCCatch (int whoCaughtIt, Entity caughtEntity) |
| static IEntitySource | GetSpawnSourceForNaturalSpawn () |
| static IEntitySource | GetSpawnSourceForTownSpawn () |
Package Attributes | |
| readonly IEntitySource | thisEntitySourceCache |
| GlobalNPC[] | _globals |
| long | entityId |
Properties | |
| bool | CanTalk [get] |
| bool | CanBeTalkedTo [get] |
| bool | HasValidTarget [get] |
| bool | HasPlayerTarget [get] |
| bool | HasNPCTarget [get] |
| bool | SupportsNPCTargets [get] |
| int | TranslatedTargetIndex [get] |
| int | WhoAmIToTargettingIndex [get] |
| bool | IsShimmerVariant [get] |
| string | TypeName [get] |
| The TYPE name of this NPC. Type names are the base titles given to any NPC, and are typically shared amongst all instances of an NPC. For example, the Stylist's type name will always be "Stylist". To modify the type name of a specific NPC, make use of the ModifyTypeName hooks in T:Terraria.ModLoader.GlobalNPC and T:Terraria.ModLoader.ModNPC, according to your needs. | |
| string | FullName [get] |
| The FULL name of this NPC. If the NPC doesn't have a given name, this will just return the type name. A Stylist without a given name will always return "Stylist" here. If the NPC does have a given name, this will return the NPC's full name; given name first, then type name. Full name with a given name is given in the format of "X the Y", where X is their given name and Y is their type name. For example, a Stylist might return "Scarlett the Stylist" here; with Scarlett being her given name, and Stylist being her type name. | |
| bool | HasGivenName [get] |
| Whether or not this NPC has a given name. | |
| string | GivenOrTypeName [get] |
| If this NPC has a given name, returns their given name; otherwise, returns their type name. | |
| string | GivenName [get, set] |
| The GIVEN name of this NPC. Can be set directly. Given names are unique to each NPC, though two NPCs can have the same given name. Some vanilla examples of given names are Andrew (for the Guide), Yorai (for the Princess), Whitney (for the Steampunker), or Scarlett (for the Stylist). | |
| static bool | downedTowers [get] |
| static int | ShieldStrengthTowerMax [get] |
| static bool | TowersDefeated [get] |
| float | Opacity [get, set] |
| bool | isLikeATownNPC [get] |
| static bool | IsMechQueenUp [get] |
| static bool | TooWindyForButterflies [get] |
| bool | CountsAsACritter [get] |
| ModNPC | ModNPC [get, set] |
| int IEntityWithGlobals< GlobalNPC >. | Type [get] |
| RefReadOnlyArray< GlobalNPC > | EntityGlobals [get] |
| EntityGlobalsEnumerator< GlobalNPC > | Globals [get] |
| NPCHappiness | Happiness [get] |
| Provides access to (static) happiness data associated with this NPC's type. | |
| bool | ShowNameOnHover [get, set] |
| bool | SuperArmor [get, set] |
| Helper property for defense >= 9999. Extremely high defense is interpreted as 'super armor' where attacks will only do 1 damage (or 2 for crits), no matter how strong they are. Passed to P:Terraria.NPC.HitModifiers.SuperArmor when doing damage calculations. See the docs there for more info. The only way to bypass super armor is to call M:Terraria.NPC.StrikeNPC(Terraria.NPC.HitInfo,System.Boolean,System.Boolean), or set NPC life directly. | |
| bool | HideStrikeDamage [get, set] |
| If true, damage combat text will not be shown by M:Terraria.NPC.StrikeNPC(Terraria.NPC.HitInfo,System.Boolean,System.Boolean) and dps meter will not record damage against this NPC. Recommended for use with F:Terraria.NPC.immortal | |
| IBigProgressBar | BossBar [get, set] |
| Assign a special boss bar, vanilla or modded. Not used by vanilla. | |
| float | gravity [get, private set] |
| The current change in velocity due to gravity applied every frame. Multiply F:Terraria.NPC.GravityMultiplier to modify this value. | |
| float | maxFallSpeed [get, private set] |
| The current fall speed cap in velocity applied every frame. Multiply F:Terraria.NPC.MaxFallSpeedMultiplier to modify this value. | |
| static float[] | GravityWetMultipliers [get] |
| The effect of different liquids on NPC gravity. Provided for reference only, modifying these will have no effect. Corresponds with wet, lavaWet, honetWet, and shimmerWet. | |
| static float[] | MaxFallSpeedWetMultipliers = new float[4] { 0.7f, 0.7f, 0.4f, 0.55f } [get] |
| The effect of different liquids on NPC maxFallSpeed. Provided for reference only, modifying these will have no effect. Corresponds with wet, lavaWet, honetWet, and shimmerWet. | |
| virtual Vector2 | VisualPosition [get] |
| Vector2 | Center [get, set] |
| Vector2 | Left [get, set] |
| Vector2 | Right [get, set] |
| Vector2 | Top [get, set] |
| Vector2 | TopLeft [get, set] |
| Vector2 | TopRight [get, set] |
| Vector2 | Bottom [get, set] |
| Vector2 | BottomLeft [get, set] |
| Vector2 | BottomRight [get, set] |
| Vector2 | Size [get, set] |
| Rectangle | Hitbox [get, set] |
Private Attributes | |
| int | netStream |
| int[] | streamPlayer = new int[255] |
| bool | needsUniqueInfoUpdate = true |
| string | _givenName = "" |
| int | catchableNPCTempImmunityCounter |
| bool | netShimmer |
| bool | catchableNPCOriginallyFriendly |
| float | vanillaGravity = 0.3f |
| Used to keep vanilla and modded gravity effects working neatly. | |
| float | vanillaMaxFallSpeed = 10f |
| Used to keep vanilla and modded gravity effects working neatly. | |
Static Private Attributes | |
| const int | NPC_TARGETS_START = 300 |
| static int | spawnSpaceX = 3 |
| static int | spawnSpaceY = 3 |
| static int | maxAttack = 20 |
| static int[] | attackNPC = new int[maxAttack] |
| static int | spawnRangeX = (int)((double)(sWidth / 16) * 0.7) |
| static int | spawnRangeY = (int)((double)(sHeight / 16) * 0.7) |
| static int | activeRangeX = (int)((double)sWidth * 2.1) |
| static int | activeRangeY = (int)((double)sHeight * 2.1) |
| static int | townRangeX = sWidth |
| static int | townRangeY = sHeight |
| static bool | noSpawnCycle = false |
| static int | defaultSpawnRate = 600 |
| static int | defaultMaxSpawns = 5 |
| static int | spawnRate = defaultSpawnRate |
| static int | maxSpawns = defaultMaxSpawns |
| static readonly int[] | _deerclopsAttack1Frames |
| static readonly int[] | _deerclopsAttack2Frames |
| static readonly int[] | _deerclopsAttack3Frames |
| static bool | EoCKilledToday |
| static bool | WoFKilledToday |
| static bool | dayTimeHax |
| static bool | rainingHax |
| static float | cloudAlphaHax |
| static int | ladyBugRainTime = 1800 |
| static int | maximumAmountOfTimesLadyBugRainCanStack = 10 * ladyBugRainTime |