Familiars
Functions
checkFamiliar
▸ checkFamiliar(player
, collectibleType
, targetCount
, familiarVariant
, familiarSubType?
): void
Helper function to add and remove familiars based on a target amount that you specify.
This is a convenience wrapper around the EntityPlayer.CheckFamiliar
method. Use this helper
function instead so that you do not have to retrieve the ItemConfigItem
and so that you do not
specify an incorrect RNG object. (The vanilla method is bugged in that it does not increment the
RNG object; see the documentation of the method for more details.)
This function is meant to be called in the EVALUATE_CACHE
callback (when the cache flag is
equal to CacheFlag.FAMILIARS
).
Note that this function is only meant to be used in special circumstances where the familiar
count is completely custom and does not correspond to the amount of collectibles. For the general
case, use the checkFamiliarFromCollectibles
helper function instead.
Note that this will spawn familiars with a completely random InitSeed
. When calculating random
events for this familiar, you should use a data structure that maps familiar InitSeed
to RNG
objects that are initialized based on the seed from
EntityPlayer.GetCollectibleRNG(collectibleType)
.
Parameters
Name | Type | Description |
---|---|---|
player | EntityPlayer | The player that owns the familiars. |
collectibleType | CollectibleType | The collectible type of the collectible associated with this familiar. |
targetCount | int | The number of familiars that should exist. This function will add or remove familiars until it matches the target count. |
familiarVariant | FamiliarVariant | The variant of the familiar to spawn or remove. |
familiarSubType? | int | Optional. The sub-type of the familiar to spawn or remove. If not specified, it will search for existing familiars of all sub-types, and spawn new familiars with a sub-type of 0. |
Returns
void
Defined in
packages/isaacscript-common/src/functions/familiars.ts:48
checkFamiliarFromCollectibles
▸ checkFamiliarFromCollectibles(player
, collectibleType
, familiarVariant
, familiarSubType?
): void
Helper function to add and remove familiars based on the amount of associated collectibles that a player has.
Use this helper function instead of invoking the EntityPlayer.CheckFamiliar
method directly so
that the target count is handled automatically.
This function is meant to be called in the EVALUATE_CACHE
callback (when the cache flag is
equal to CacheFlag.FAMILIARS
).
Use this function when the amount of familiars should be equal to the amount of associated
collectibles that the player has (plus any extras from having used Box of Friends or Monster
Manual). If you instead need to have a custom amount of familiars, use the checkFamiliars
function instead.
Note that this will spawn familiars with a completely random InitSeed
. When calculating random
events for this familiar, you should use a data structure that maps familiar InitSeed
to RNG
objects that are initialized based on the seed from
EntityPlayer.GetCollectibleRNG(collectibleType)
.
Parameters
Name | Type | Description |
---|---|---|
player | EntityPlayer | The player that owns the familiars and collectibles. |
collectibleType | CollectibleType | The collectible type of the collectible associated with this familiar. |
familiarVariant | FamiliarVariant | The variant of the familiar to spawn or remove. |
familiarSubType? | int | Optional. The sub-type of the familiar to spawn or remove. If not specified, it will search for existing familiars of all sub-types, and spawn new familiars with a sub-type of 0. |
Returns
void
Defined in
packages/isaacscript-common/src/functions/familiars.ts:94
getPlayerFamiliars
▸ getPlayerFamiliars(player
): readonly EntityFamiliar
[]
Helper function to get only the familiars that belong to a specific player.
Parameters
Name | Type |
---|---|
player | EntityPlayer |
Returns
readonly EntityFamiliar
[]
Defined in
packages/isaacscript-common/src/functions/familiars.ts:121
getSirenHelper
▸ getSirenHelper(familiar
): Entity
| undefined
Helper function to get the corresponding "Siren Helper" entity for a stolen familiar.
When The Siren boss "steals" your familiars, a hidden "Siren Helper" entity is spawned to control each familiar stolen. (Checking for the presence of this entity seems to be the only way to detect when the Siren steals a familiar.)
Parameters
Name | Type | Description |
---|---|---|
familiar | EntityFamiliar | The familiar to be checked. |
Returns
Entity
| undefined
Returns the hidden "Siren Helper" entity corresponding to the given familiar, if it exists. Returns undefined otherwise.
Defined in
packages/isaacscript-common/src/functions/familiars.ts:143
isFamiliarStolenBySiren
▸ isFamiliarStolenBySiren(familiar
): boolean
Helper function to detect if the given familiar is "stolen" by The Siren boss.
This function is useful because some familiars may need to behave differently when under The Siren's control (e.g. if they auto-target enemies).
Parameters
Name | Type |
---|---|
familiar | EntityFamiliar |
Returns
boolean
Defined in
packages/isaacscript-common/src/functions/familiars.ts:160
isFamiliarThatShootsPlayerTears
▸ isFamiliarThatShootsPlayerTears(familiar
): boolean
Helper function to check if a familiar is the type that shoots tears that mimic the players tears, like Incubus, Fate's Reward, Sprinkler, and so on.
Parameters
Name | Type |
---|---|
familiar | EntityFamiliar |
Returns
boolean