Terraria v1.4.4.9
Terraria source code documentation
All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events Macros
Terraria.NPC Class Reference

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)
 
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 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 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 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 ()
 
bool IsDamageDodgeable ()
 
void NPCLoot ()
 
bool IsNPCValidForBestiaryKillCredit ()
 
bool ExcludedFromDeathTally ()
 
bool GetWereThereAnyInteractions ()
 
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)
 
int checkArmorPenetration (int armorPenetration, float armorPenetrationPercent)
 
double StrikeNPCNoInteraction (int Damage, float knockBack, int hitDirection, bool crit=false, bool noEffect=false, bool fromNet=false)
 
double StrikeNPC (int Damage, float knockBack, int hitDirection, bool crit=false, bool noEffect=false, bool fromNet=false)
 
void HitEffect (int hitDirection=0, double dmg=10.0)
 
int FindBuffIndex (int type)
 
void AddBuff (int type, int time, bool quiet=false)
 
void RequestBuffRemoval (int buffTypeToRemove)
 
void DelBuff (int buffIndex)
 
Rectangle getRect ()
 
bool CanBeChasedBy (object attacker=null, bool ignoreDontTakeDamage=false)
 
bool HittableForOnHitRewards ()
 
void moneyPing (Vector2 pos)
 
void IdleSounds ()
 
void UpdateAltTexture ()
 
void UpdateNPC (int i)
 
IEntitySource GetItemSource_Misc (int itemSourceId)
 
IEntitySource GetSpawnSource_NPCHurt ()
 
IEntitySource GetSpawnSource_ForProjectile ()
 
IEntitySource GetSpawnSourceForProjectileNPC ()
 
IEntitySource GetSpawnSourceForNPCFromNPCAI ()
 
IEntitySource GetItemSource_Loot ()
 
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 ()
 
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)
 

Static Public Member Functions

static int[,,,] InitializeMoonLordAttacks ()
 
static int[,] InitializeMoonLordAttacks2 ()
 
static string GetFullnameByID (int npcID)
 
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 string getNewNPCName (int npcType)
 
static void setNPCName (string newName, int npcType, bool resetExtras=false)
 
static string firstNPCName (int npcType)
 
static string GetFirstNPCNameOrNull (int npcType)
 
static bool MechSpawn (float x, float y, int type)
 
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)
 
static void ResetKillCount ()
 
static void SetEventFlagCleared (ref bool eventFlag, int gameEventId)
 
static void OnGameEventClearedForTheFirstTime (int gameEventId)
 
static void ResetBadgerHatTime ()
 
static int GetStackForSlimeItemDrop (int item)
 
static void CatchNPC (int i, int who=-1)
 
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)
 
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)
 
static bool AnyHelpfulFairies ()
 
static bool AnyNPCs (int Type)
 
static int FindFirstNPC (int Type)
 
static bool NearSpikeBall (int x, int y)
 
static void ResetNetOffsets ()
 
static IEntitySource GetSpawnSource_NPCRelease (int whoReleasedIt)
 
static IEntitySource GetSpawnSource_NPCCatch (int whoCatchedIt)
 
static IEntitySource GetSpawnSourceForNaturalSpawn ()
 
static IEntitySource GetSpawnSourceForTownSpawn ()
 
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)
 

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
 
short catchItem
 
short releaseOwner = 255
 
int rarity
 
bool[] playerInteraction = new bool[256]
 
int lastInteraction = 255
 
float takenDamageMultiplier = 1f
 
float gfxOffY
 
float stepSpeed
 
bool teleporting
 
bool stairFall
 
Vector2[] oldPos = new Vector2[10]
 
float[] oldRot = new float[10]
 
bool setFrameSize
 
int netSkip
 
bool netAlways
 
int realLife = -1
 
float npcSlots = 1f
 
float shimmerTransparency
 
bool dontCountMe
 
int[] buffType = new int[maxBuffs]
 
int[] buffTime = new int[maxBuffs]
 
bool[] buffImmune = new bool[BuffID.Count]
 
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]
 
int directionY = 1
 
int type
 
float[] ai = new float[maxAI]
 
float[] localAI = new float[maxAI]
 
int aiAction
 
int aiStyle
 
bool justHit
 
int timeLeft
 
int target = -1
 
int damage
 
int defense
 
int defDamage
 
int defDefense
 
bool coldDamage
 
bool trapImmune
 
LegacySoundStyle HitSound
 
LegacySoundStyle DeathSound
 
int life
 
int lifeMax
 
Rectangle targetRect
 
double frameCounter
 
Rectangle frame
 
Color color
 
int alpha
 
bool hide
 
float scale = 1f
 
float knockBackResist = 1f
 
int oldDirectionY
 
int oldTarget
 
float rotation
 
bool noGravity
 
bool noTileCollide
 
bool netUpdate
 
bool netUpdate2
 
bool collideX
 
bool collideY
 
bool boss
 
int spriteDirection = -1
 
bool behindTiles
 
bool lavaImmune
 
float value
 
int extraValue
 
bool dontTakeDamage
 
int netID
 
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
 
bool closeDoor
 
int doorX
 
int doorY
 
int friendlyRegen
 
int breath
 
int breathCounter
 
bool reflectsProjectiles
 
int lastPortalColorIndex
 
bool despawnEncouraged
 
int whoAmI
 
bool active
 
Vector2 position
 
Vector2 velocity
 
Vector2 oldPosition
 
Vector2 oldVelocity
 
int oldDirection
 
int direction = 1
 
int width
 
int height
 
bool wet
 
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 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
 
static bool combatBookVolumeTwoWasUsed = false
 
static bool peddlersSatchelWasUsed = false
 
static bool downedBoss1 = false
 
static bool downedBoss2 = false
 
static bool downedBoss3 = false
 
static bool downedQueenBee = false
 
static bool downedSlimeKing = false
 
static bool downedGoblins = false
 
static bool downedFrost = false
 
static bool downedPirates = false
 
static bool downedClown = false
 
static bool downedPlantBoss = false
 
static bool downedGolemBoss = false
 
static bool downedMartians = false
 
static bool downedFishron = false
 
static bool downedHalloweenTree = false
 
static bool downedHalloweenKing = false
 
static bool downedChristmasIceQueen = false
 
static bool downedChristmasTree = false
 
static bool downedChristmasSantank = false
 
static bool downedAncientCultist = false
 
static bool downedMoonlord = false
 
static bool downedTowerSolar = false
 
static bool downedTowerVortex = false
 
static bool downedTowerNebula = false
 
static bool downedTowerStardust = false
 
static bool downedEmpressOfLight = false
 
static bool downedQueenSlime = false
 
static bool downedDeerclops = false
 
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
 
static bool downedMechBoss1 = false
 
static bool downedMechBoss2 = false
 
static bool downedMechBoss3 = false
 
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 Attributes

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]
 
string FullName [get]
 
bool HasGivenName [get]
 
string GivenOrTypeName [get]
 
string GivenName [get, set]
 
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]
 
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 Member Functions

void SetDefaultsFromNetId (int id, NPCSpawnParams spawnparams=default(NPCSpawnParams))
 
void getTenthAnniversaryAdjustments ()
 
void getZenithSeedAdjustmentsBeforeEverything ()
 
void getGoodAdjustments ()
 
void LazySetLiquidMovementDD2 ()
 
void ScaleStats_ApplyExpertTweaks ()
 
void ScaleStats_ApplyGameMode (GameModeData gameModeData)
 
void ScaleStats_ApplyMultiplayerStats (int numPlayers, float balance, float boost, float bossAdjustment)
 
void AI_047_GolemFist ()
 
void AI_045_Golem ()
 
void AI_124_ElderSlimeChest ()
 
void AI_125_ClumsySlimeBalloon ()
 
void SpawnStardustMark_StardustTower ()
 
void SpawnStardustMark_StardustWorm ()
 
void AI_123_Deerclops ()
 
bool ShouldRunAway (ref NPCAimedTarget targetData, bool isChasing)
 
void SpawnPassiveShadowHands (float lifePercent, int shadowHandDamage)
 
void AI_123_Deerclops_ShootRubbleUp (ref NPCAimedTarget targetData, ref Point sourceTileCoords, int howMany, int distancedByThisManyTiles, float upBiasPerSpike, int whichOne)
 
void AI_123_Deerclops_MakeSpikesForward (int AISLOT_PhaseCounter, NPCAimedTarget targetData)
 
void AI_123_Deerclops_MakeSpikesBothSides (int AISLOT_PhaseCounter, NPCAimedTarget targetData)
 
void AI_123_Deerclops_FindSpotToSpawnSpike (int howMany, int whichOne, ref int x, ref int y)
 
void AI_123_Deerclops_TryMakingSpike (ref Point sourceTileCoords, int dir, int howMany, int whichOne, int xOffset)
 
int AI_123_Deerclops_TryMakingSpike_FindBestY (ref Point sourceTileCoords, int x)
 
void AI_123_Deerclops_Movement (bool haltMovement, bool goHome)
 
void AI_124_DeerclopsLeg ()
 
void AI_87_BigMimic_FireStuffCannonBurst ()
 
void AI_87_BigMimic_ShootItem (int itemID)
 
void AI_065_Butterflies ()
 
void AI_121_QueenSlime_FlyMovement ()
 
void AI_121_QueenSlime ()
 
void AI_120_HallowBoss_DoMagicEffect (Vector2 spot, int effectType, float progress)
 
void AI_120_HallowBoss ()
 
void AI_120_HallowBoss_DashTo (Vector2 targetPosition)
 
void AI_119_Dandelion ()
 
void AI_118_Seahorses ()
 
void AI_117_BloodNautilus ()
 
void BloodNautilus_CallForHelp ()
 
void AI_116_WaterStriders ()
 
void AI_115_LadyBugs ()
 
void AI_114_Dragonflies ()
 
void AI_113_WindyBalloon ()
 
void AI_112_FairyCritter ()
 
void GetBirdFlightRecommendation (int downScanRange, int upRange, Point tCoords, out bool goDownwards, out bool goUpwards)
 
Vector2 GetFairyCircleOffset (float elapsedTime, float circleRotation, float circleHeight)
 
bool GetFairyTreasureCoords (out Point treasureCoords)
 
void AI_069_DukeFishron ()
 
void AI_037_Destroyer ()
 
void AI_005_EaterOfSouls ()
 
void AI_006_Worms ()
 
void AI_002_FloatingEye ()
 
void StingerExplosion ()
 
bool AI_007_TownEntities_IsInAGoodRestingSpot (int tileX, int tileY, int idealRestX, int idealRestY)
 
void AI_007_FindGoodRestingSpot (int myTileX, int myTileY, out int floorX, out int floorY)
 
void AI_007_TryForcingSitting (int homeFloorX, int homeFloorY)
 
void AI_007_TownEntities ()
 
void AI_007_TownEntities_Shimmer_TeleportToLandingSpot ()
 
Vector2AI_007_TownEntities_Shimmer_ScanForBestSpotToLandOn ()
 
void AI_007_TownEntities_TeleportToHome (int homeFloorX, int homeFloorY)
 
void AI_007_TownEntities_GetWalkPrediction (int myTileX, int homeFloorX, bool canBreathUnderWater, bool currentlyDrowning, int tileX, int tileY, out bool keepwalking, out bool avoidFalling)
 
bool AI_007_TownEntities_CheckIfWillDrown (bool currentlyDrowning)
 
void AI_007_AttemptToPlayIdleAnimationsForPets (int petIdleChance)
 
bool AI_003_Gnomes_ShouldTurnToStone ()
 
void AI_003_Fighters ()
 
void AI_001_Slimes ()
 
void AI_110_Betsy ()
 
void AI_026_Unicorns ()
 
void AI_107_ImprovedWalkers ()
 
void AI_084_LunaticCultist ()
 
void AI_108_DivingFlyer ()
 
void AI_109_DarkMage ()
 
void AI_111_DD2LightningBug ()
 
void TryTrackingTarget (ref float distance, ref float realDist, ref bool t, ref int tankTarget, int j)
 
void SetTargetTrackingValues (bool faceTarget, float realDist, int tankTarget)
 
void CheckActive_WormSegments ()
 
void AddIntoPlayersTownNPCSlots ()
 
void DropEoWLoot (bool fromCheckDead=true)
 
float GetMoonEventPointScalar ()
 
void CheckProgressFrostMoon ()
 
void CheckProgressPumpkinMoon ()
 
void DoDeathEvents_BeforeLoot (Player closestPlayer)
 
void NPCLoot_DropItems (Player closestPlayer)
 
void DoDeathEvents_DropBossPotionsAndHearts ()
 
void DoDeathEvents_CelebrateBossDeath ()
 
void CreateBrickBoxForWallOfFlesh ()
 
void DoDeathEvents_SummonDungeonSpirit (Player closestPlayer)
 
void DoDeathEvents_AdvanceSlimeRain (Player closestPlayer)
 
void NPCLoot_DropHeals (Player closestPlayer)
 
void DoDeathEvents (Player closestPlayer)
 
void ViolentlySpawnNerdySlime ()
 
void NPCLoot_DropCommonLifeAndMana (Player closestPlayer)
 
void NPCLoot_DropMoney (Player closestPlayer)
 
void CountKillForBannersAndDropThem ()
 
void CountKillForAchievements ()
 
bool TryTeleportingCaughtMysticFrog ()
 
void LadyBugLuck (int plr, bool GoldLadyBug=false)
 
void NPCLuck ()
 
void MakeTransitionEffectsForTextureChanges (int oldAltTexture, int currentAltTexture)
 
void SubAI_HandleTemporaryCatchableNPCPlayerInvulnerability ()
 
void TrySyncingUniqueTownNPCData (int npcIndex)
 
void UpdateNetworkCode (int i)
 
void UpdateNPC_UpdateTrails ()
 
void UpdateNPC_UpdateGravity (out float maxFallSpeed)
 
void UpdateNPC_SoulDrainDebuff ()
 
void UpdateNPC_BuffApplyVFX ()
 
void GetShimmered ()
 
void UpdateNPC_BuffApplyDOTs ()
 
void UpdateNPC_BuffClearExpiredBuffs ()
 
void UpdateNPC_BloodMoonTransformations ()
 
void UpdateNPC_BuffFlagsReset ()
 
void UpdateNPC_TeleportVisuals ()
 
void UpdateNPC_CritterSounds ()
 
void UpdateNPC_CastLights ()
 
void GetHurtByOtherNPCs (bool[] acceptableNPCIDs)
 
void BeHurtByOtherNPC (int npcIndex, NPC thatNPC)
 
void CheckLifeRegen ()
 
void UpdateCollision ()
 
void Collision_MoveWhileDry ()
 
void ApplyTileCollision (bool fall, Vector2 cPosition, int cWidth, int cHeight)
 
void Collision_MoveSlopesAndStairFall (bool fall)
 
void Collision_MoveSnailOnSlopes ()
 
void Collision_MoveNormal (bool fall, Vector2 cPosition, int cWidth, int cHeight)
 
void Collision_MoveSandshark (bool fall, Vector2 cPosition, int cWidth, int cHeight)
 
void Collision_MoveSolarSroller (bool fall, Vector2 cPosition, int cWidth, int cHeight)
 
void Collision_MoveStardustCell (bool fall, Vector2 cPosition, int cWidth, int cHeight)
 
void Collision_MoveBlazingWheel ()
 
void Collision_MoveWhileWet (Vector2 oldDryVelocity, float Slowdown=0.5f)
 
void FishTransformationDuringRain ()
 
bool Collision_DecideFallThroughPlatforms ()
 
bool Collision_WaterCollision (bool lava)
 
bool Collision_LavaCollision ()
 
void Collision_WalkDownSlopes ()
 

Static Private Member Functions

static string getNewNPCNameInner (int npcType)
 
static ? float TryFindingFloor (Vector2 searchStartPositionInWorld, int searchRange, out int tilesTraveled)
 
static int AI_001_Slimes_GenerateItemInsideBody (bool isBallooned)
 
static int FindFrame_FromSequence (int sequenceFrame, int[] frames)
 
static int FindFrame_Deerclops_GetAttack1Frame (int sequenceFrame)
 
static int FindFrame_Deerclops_GetAttack2Frame (int sequenceFrame)
 
static int FindFrame_Deerclops_GetAttack3Frame (int sequenceFrame)
 
static int RollDragonflyType (int tileType=2)
 
static bool SpawnNPC_CheckToSpawnRockGolem (int spawnTileX, int spawnTileY, int plr, int tileType)
 
static bool SpawnNPC_CheckToSpawnUndergroundFairy (int spawnTileX, int spawnTileY, int plr)
 
static int SpawnNPC_SpawnLavaBaitCritters (int spawnTileX, int spawnTileY)
 
static int SpawnNPC_TryFindingProperGroundTileType (int spawnTileType, int x, int y)
 
static int GetAvailableNPCSlot (int Type, int startIndex)
 
static void GiveTownUniqueDataToNPCsThatNeedIt (int Type, int nextNPC)
 

Private Attributes

int netStream
 
int[] streamPlayer = new int[255]
 
bool needsUniqueInfoUpdate = true
 
string _givenName = ""
 
int catchableNPCTempImmunityCounter
 
bool netShimmer
 

Static Private Attributes

const int NPC_TARGETS_START = 300
 
static int spawnSpaceX = 3
 
static int spawnSpaceY = 3
 
static float gravity = 0.3f
 
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 activeTime = 750
 
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 ignorePlayerInteractions = 0
 
static int ladyBugRainTime = 1800
 
static int maximumAmountOfTimesLadyBugRainCanStack = 10 * ladyBugRainTime
 

Detailed Description

Definition at line 29 of file NPC.cs.


The documentation for this class was generated from the following file: