#include "entity_familiar.h" #include "entity_npc.h" #include "entity_player.h" #include "game.h" #include "level.h" #include "log.h" #include "lua_engine.h" #include "manager.h" #include "room.h" #include #include constexpr int COLLECTIBLE_BINKY = 438; constexpr int COLLECTIBLE_BOBS_CURSE = 140; constexpr int COLLECTIBLE_BOOMERANG = 338; constexpr int COLLECTIBLE_CONE_HEAD = 457; constexpr int COLLECTIBLE_DOGMA = 633; constexpr int COLLECTIBLE_DULL_RAZOR = 486; constexpr int COLLECTIBLE_EVIL_CHARM = 632; constexpr int COLLECTIBLE_GLASS_CANNON = 352; constexpr int COLLECTIBLE_HOST_HAT = 375; constexpr int COLLECTIBLE_HOT_BOMBS = 256; constexpr int COLLECTIBLE_HYPERCOAGULATION = 724; constexpr int COLLECTIBLE_INNER_CHILD = 688; constexpr int COLLECTIBLE_IPECAC = 149; constexpr int COLLECTIBLE_ISAACS_HEART = 276; constexpr int COLLECTIBLE_JELLY_BELLY = 690; constexpr int COLLECTIBLE_LARYNX = 611; constexpr int COLLECTIBLE_MARBLES = 538; constexpr int COLLECTIBLE_METAL_PLATE = 449; constexpr int COLLECTIBLE_MOMS_BRACELET = 604; constexpr int COLLECTIBLE_PLUTO = 598; constexpr int COLLECTIBLE_PYROMANIAC = 223; constexpr int COLLECTIBLE_SCAPULAR = 142; constexpr int COLLECTIBLE_SHOOP_DA_WHOOP = 49; constexpr int COLLECTIBLE_SPIRIT_SHACKLES = 674; constexpr int COLLECTIBLE_ASTRAL_PROJECTION = 677; constexpr int COLLECTIBLE_BERSERK = 704; constexpr int COLLECTIBLE_BLACK_CANDLE = 260; constexpr int COLLECTIBLE_THE_NAIL = 83; constexpr int TRINKET_BLIND_RAGE = 81; constexpr int TRINKET_CALLUS = 14; constexpr int TRINKET_CROW_HEART = 107; constexpr int TRINKET_FINGER_BONE = 128; constexpr int TRINKET_MONKEY_PAW = 20; constexpr int TRINKET_PERFECTION = 145; constexpr int TRINKET_SWALLOWED_M80 = 178; constexpr int TRINKET_WALNUT = 108; constexpr int NULLITEM_BOOMERANG = 30; constexpr int NULLITEM_DOUBLE_DAMAGE = 29; constexpr int NULLITEM_SHACKLES_GHOST = 101; constexpr int PLAYER_FORM_ADULT = 11; constexpr int PLAYER_FORM_BEELZEBUB = 13; constexpr int PLAYER_FORM_BOB = 4; constexpr int SAMSON_B_HIT_CHARGE = 10000; constexpr int BLEED_OUT_HEALTH = 600; // The items and trinkets a landed hit sets off, by id, from Infestation's flies to Tonsil and Pinking Shears. constexpr int HIT_COLLECTIBLES[] = {148, 525, 658, 696, 162, 117, 610, 274, 156, 180, 214, 204, 219, 225, 227, 211, 262, 301, 303, 392, 157, 695, 186, 371, 407, 412, 448, 452, 560, 675, 702, 502, 513}; constexpr int HIT_TRINKETS[] = {40, 48, 29, 1, 8, 67, 158, 97, 105, 33, 104, 122}; constexpr int CROWN_OF_LIGHT = 415; constexpr int HYPERCOAGULATION_IGNORED = 0x10040000; constexpr int ENTITY_MOM = 45; constexpr int ENTITY_MOMS_HEART = 78; constexpr int ENTITY_BISHOP = 805; constexpr int ENTITY_SEGMENTED_WORM = 903; constexpr int ENTITY_DAMAGE_RELAY = 966; constexpr int SEGMENTED_WORM_VARIANT = 10; constexpr int WHITE_FIRE_VARIANT = 4; constexpr int EFFECT_SELF_DAMAGE = 19; constexpr int EFFECT_POISON_CLOUD = 123; constexpr int FAMILIAR_WISP = 206; constexpr int ITEM_STATE_HOLD_STILL = 47; constexpr int ENEMY_TYPE_FIRST = 10; constexpr int ENEMY_TYPE_LAST = 999; constexpr int BABY_GHOST = 59; constexpr int BABY_HALO = 24; constexpr int BABY_SHIELD = 11; constexpr int BABY_BOMB = 20; constexpr int BABY_FART = 17; constexpr int BABY_BOOK = 44; // The thieves that knock a coin loose: Greed and its likes by their hits or shots, the Ultra Greeds also by what they // spawn. constexpr int COIN_THIEF_TYPES[] = {50, 86, 90, 294, 299, 406}; constexpr int COIN_SHOOTER_TYPES[] = {50, 86, 90}; constexpr int ULTRA_GREED = 406; constexpr int ULTRA_GREED_DOOR = 294; constexpr uint32_t CHALLENGE_PAY_TO_PLAY = 24; constexpr int SOUND_FIREDEATH_HISS = 43; constexpr int SOUND_ISAAC_HURT_GRUNT = 55; constexpr int SOUND_NAIL_HURT_1 = 104; constexpr int SOUND_NAIL_HURT_2 = 106; constexpr int SOUND_MOM_VOX = 84; constexpr int SOUND_HEARTBEAT = 86; constexpr int SOUND_BOSS_DELAY_RANDOM = 130; constexpr int SOUND_BOSS_DELAY_MIN = 50; constexpr int SOUND_FRAME_DELAY = 2; constexpr uint64_t DAMAGE_RED_HEARTS = 1ull << 5; constexpr uint64_t DAMAGE_INVINCIBLE_IGNORED = 1ull << 13; constexpr uint64_t DAMAGE_SPAWN_FLY = 1ull << 14; constexpr uint64_t DAMAGE_FAKE = 1ull << 21; constexpr uint64_t DAMAGE_NO_MODIFIERS = 1ull << 25; constexpr uint64_t DAMAGE_NO_PENALTIES = 1ull << 28; constexpr uint64_t DAMAGE_IGNORED = 1ull << 34; constexpr uint64_t DAMAGE_THROUGH_COOLDOWN = 1ull << 35; constexpr uint64_t DAMAGE_NO_HURT_EFFECTS = 0x100d0400; constexpr uint64_t DAMAGE_ISAACS_HEART_PIERCE = 0x2820; constexpr uint64_t DAMAGE_UNPENALIZED = DAMAGE_NO_PENALTIES | DAMAGE_RED_HEARTS; constexpr int LEVEL_STATE_DAMAGED = 5; constexpr int LAST_DAMAGE_STAGE_MAX = 13; constexpr int HURT_FRAMES_PER_HEART = 60; constexpr int HURT_HEARTS_MAX = 2; constexpr int HIT_COOLDOWN = 4; constexpr int MC_ENTITY_TAKE_DMG = 11; constexpr uint32_t DEBUG_INFINITE_HP = 1 << 2; constexpr uint32_t DEBUG_DAMAGE_VALUES = 1 << 6; constexpr uint32_t STAGE_FULL_HEART_DAMAGE = 7; constexpr int MASSIVE_DAMAGE = 24; constexpr int EVIL_CHARM_GRACE_FRAMES = 30; constexpr int COOLDOWN_SCALE_MIN = 16; constexpr int COOLDOWN_SCALE_SHIFT = 3; constexpr int CROW_HEART_KEEP_2 = 25; constexpr int CROW_HEART_KEEP_3 = 50; constexpr float DAMAGE_ROUNDING = 0.5f; constexpr float HALVED_DAMAGE = 0.5f; constexpr float HALVED_DAMAGE_DEATHMATCH = 0.75f; constexpr float DOUBLED_DAMAGE_DEATHMATCH = 1.25f; constexpr float VOICE_PITCH_PLAYER = 1; constexpr float VOICE_PITCH_BABY = 1.5f; constexpr float VOICE_PITCH_PER_PILL = 0.1f; constexpr float VOICE_PITCH_PLUTO = 0.5f; constexpr float VOICE_PITCH_STEP = 0.2f; constexpr float VOICE_PITCH_MIN = 0.5f; constexpr float VOICE_PITCH_MAX = 2; constexpr float REMOTE_VOLUME_SCALE = 0.1f; constexpr int PILL_EFFECT_PUBERTY = 33; constexpr int PILL_EFFECT_HELIUM = 32; // The extra lives the HUD counts: 1up!, Ankh, Guppy's Collar, Judas' Shadow, Lazarus' Rags and Inner Child. constexpr int EXTRA_LIFE_ITEMS[] = {11, 161, 212, 311, 332, 688}; constexpr int TAINTED_LOST_BIRTHRIGHT = 619; // The hazards Evil Charm protects from: fires, creep, and the effects that hurt on contact. constexpr int EVIL_CHARM_EFFECTS[] = {22, 23, 24, 25, 26, 32, 37, 44, 45, 46, 53, 54, 56, 78, 90, 94, 141, 147, 155, 169, 204}; constexpr int EVIL_CHARM_GRID_VARIANT = 10000; // The temporary effects that make the player invincible to any hit: Gamekid, My Little Unicorn, Unicorn Stump and // Teleport. constexpr int INVINCIBLE_EFFECTS[] = {93, 77, 298, 44}; constexpr int COLLECTIBLE_BREATH_OF_LIFE = 326; constexpr int COLLECTIBLE_DARK_ARTS = 705; constexpr int COLLECTIBLE_GNAWED_LEAF = 210; constexpr int NULLITEM_INVINCIBLE_SHIELD = 59; constexpr int BLOOD_DONATION_VARIANT = 2; constexpr int BLOOD_BANK_VARIANT = 5; constexpr float GNAWED_LEAF_MASS = 1000; constexpr int BREATH_OF_LIFE_WINDOW = 5; // Whether a hit passes the player by: its own self damage, friendly sources, another's Dark Esau, a dead player, // Isaac's Heart, Evil Charm's hazards, and a co-op baby still appearing. static bool is_damage_ignored(Entity_Player& player, const EntityRef& source, uint64_t damageFlags) { Game& game = *g_game; Entity* entity = source.entity; if (source.type == ENTITY_EFFECT && source.variant == EFFECT_SELF_DAMAGE && source.spawnerType == ENTITY_PLAYER) return true; if (source.IsFriendly() && !game.deathmatchManager.is_active()) return true; if (source.IsFriendly()) reconstruction_missing("Entity_Player::TakeDamage 007729d0 (friendly fire in versus)"); if (damageFlags & DAMAGE_IGNORED) return true; Entity* darkEsau = player.darkEsau.get(); bool isOtherEsau = entity && entity->type == ENTITY_DARK_ESAU && entity != darkEsau && (entity->parent.get() != darkEsau || !darkEsau) && (entity->child.get() != darkEsau || !darkEsau) && entity->spawnerEntity.get() != &player && entity->spawnerEntity.get() != darkEsau; if (isOtherEsau || player.isDead) return true; Entity_Player* heartOwner = player.playerType == PLAYER_THESOUL_B && player.twin_get() ? player.twin_get() : &player; bool isHeartProtected = heartOwner->HasCollectible(COLLECTIBLE_ISAACS_HEART) || player.playerType == PLAYER_THEFORGOTTEN_B; if (isHeartProtected && !(damageFlags & DAMAGE_ISAACS_HEART_PIERCE)) return true; if (player.is_evil_charm_immune(source)) return true; bool isAppearing = player.sprite.IsPlaying("Appear") || player.sprite.IsPlaying("Glitch"); if ((player.variant == PLAYER_VARIANT_COOP_BABY || player.isCoopGhost) && isAppearing) return true; if (source.type == ENTITY_SEGMENTED_WORM && source.variant == SEGMENTED_WORM_VARIANT && entity) reconstruction_missing("Entity_Player::TakeDamage 007729d0 (a worm segment of the player's own)"); return false; } // Whether a Bishop the player charmed stands in the room to take the hit (find_nearest_enemy 004e7d10). static bool is_bishop_present() { return std::ranges::any_of(g_game->room->entityList.updateEL, [](Entity* entity) { return entity->type == ENTITY_BISHOP && entity->HasEntityFlags(FLAG_CHARM); }); } // Whether a wisp of the player's could take the hit (FUN_007c7b10). static bool is_wisp_shield_present(Entity_Player& player) { return std::ranges::any_of(g_game->room->entityList.updateEL, [&](Entity* entity) { return !entity->isDead && entity->IsFamiliar() && entity->variant == FAMILIAR_WISP && entity->subtype == COLLECTIBLE_DULL_RAZOR && static_cast(entity)->player == &player; }); } // The items that answer a hit before it lands, each stopping or turning it, none written yet. static void damage_reactions_check(Entity_Player& player, uint64_t damageFlags) { bool isExplosion = damageFlags & DAMAGE_EXPLOSION; bool isFire = damageFlags & DAMAGE_FIRE; if (is_bishop_present()) reconstruction_missing("Entity_Player::TakeDamage 007729d0 (a charmed Bishop's shield)"); if (player.HasTrinket(TRINKET_WALNUT) && isExplosion) reconstruction_missing("Entity_Player::TakeDamage 007729d0 (Walnut)"); if (player.HasCollectible(COLLECTIBLE_PYROMANIAC) && (isFire || isExplosion)) reconstruction_missing("Entity_Player::TakeDamage 007729d0 (Pyromaniac)"); if (player.HasCollectible(COLLECTIBLE_HOST_HAT)) reconstruction_missing("Entity_Player::TakeDamage 007729d0 (Host Hat)"); bool isFetus = player.HasWeaponType(WEAPON_BOMBS) || player.HasWeaponType(WEAPON_BONE); if (isFetus && player.HasCollectible(COLLECTIBLE_IPECAC) && isExplosion) reconstruction_missing("Entity_Player::TakeDamage 007729d0 (Ipecac with Dr. Fetus)"); if (player.HasCollectible(COLLECTIBLE_HOT_BOMBS) && isFire) reconstruction_missing("Entity_Player::TakeDamage 007729d0 (Hot Bombs)"); if (player.variant == PLAYER_VARIANT_COOP_BABY && player.babySkin == BABY_BOMB && isExplosion) reconstruction_missing("Entity_Player::TakeDamage 007729d0 (the bomb baby)"); if (player.HasCollectible(COLLECTIBLE_JELLY_BELLY) && !(damageFlags & (DAMAGE_NO_MODIFIERS | DAMAGE_FAKE))) reconstruction_missing("Entity_Player::TakeDamage 007729d0 (Jelly Belly)"); if (player.HasCollectible(COLLECTIBLE_METAL_PLATE) || player.HasCollectible(COLLECTIBLE_CONE_HEAD)) reconstruction_missing("Entity_Player::TakeDamage 007729d0 (Metal Plate and Cone Head)"); } // Whether a list of ids has one. template static bool is_listed(const int (&ids)[N], int id) { return std::ranges::find(ids, id) != std::end(ids); } // A random number below max, or 0 for none (Isaac::Random 0067f010). static int random_below(int max) { return max == 0 ? 0 : (int)(Random() % (uint32_t)max); } // 007db330 A damage cooldown in frames, scaled down in versus. static int damage_cooldown_scale(int frames) { if (!g_game->deathmatchManager.is_active()) return frames; return frames > COOLDOWN_SCALE_MIN - 1 ? frames >> COOLDOWN_SCALE_SHIFT : 1; } // The bestiary count an enemy adds to, unless the save is frozen or the enemy has no page. static void bestiary_count_add(std::map& counts, int type, int variant) { PersistentGameData& data = g_manager->persistentGameData; EntityConfig_Entity* entity = data.isReadOnly ? nullptr : g_manager->entityConfig.GetBestiaryConfig(type, variant); if (entity && entity->isBestiary) counts[entity->id << 20 | entity->variant << 8]++; } // Plays one of the player's sounds at a volume and pitch, unless the seeds swap it for a fart. static void voice_play(int sound, float volume, int frameDelay, float pitch) { seed_fart_sound_override(&sound); g_manager->sfxManager.Play(sound, {.volume = volume, .frameDelay = frameDelay, .pitch = pitch}); } // The damage a hit deals in half hearts: rounded, two from the Womb on or on a victory lap, halved by the Wafer and // its likes, doubled by the double damage effect, and set by the seeds that hurt more. static int damage_amount_get(Entity_Player& player, float damage, uint64_t damageFlags, const EntityRef& source) { Game& game = *g_game; bool isDeathmatch = game.deathmatchManager.is_active(); int amount = (int)(damage + DAMAGE_ROUNDING); if (isDeathmatch && amount == 0 && damage > 0) amount = 1; if (damageFlags & DAMAGE_NO_MODIFIERS) return amount; if (!game.IsGreedMode() && (game.stage >= STAGE_FULL_HEART_DAMAGE || game.victoryLap >= 1 || game.IsAscent())) amount = std::max(amount, 2); bool isHardMode = game.difficulty == DIFFICULTY_HARD || game.difficulty == DIFFICULTY_GREEDIER; bool isHalved = player.HasCollectible(COLLECTIBLE_WAFER) || player.temporaryEffects.HasCollectibleEffect(COLLECTIBLE_WAFER) || player.GetTrinketMultiplier(TRINKET_CALLUS) > 2 || (source.flags & ENTITY_REF_WEAKNESS) || (player.HasCollectible(COLLECTIBLE_DOGMA) && !isHardMode); if (isHalved && amount > 1) amount = std::max((int)((float)amount * (isDeathmatch ? HALVED_DAMAGE_DEATHMATCH : HALVED_DAMAGE) + DAMAGE_ROUNDING), 1); if (player.temporaryEffects.HasNullEffect(NULLITEM_DOUBLE_DAMAGE)) amount = (int)((float)std::max(amount, 2) * (isDeathmatch ? DOUBLED_DAMAGE_DEATHMATCH : 1)); if (player.GetHealthType() == HEALTH_COIN) amount = 2; if (game.seedEffects.HasSeedEffect(SEED_ISAAC_TAKES_HIGH_DAMAGE)) amount = std::max(amount, 2); if (game.seedEffects.HasSeedEffect(SEED_ISAAC_TAKES_MASSIVE_DAMAGE)) amount = std::max(amount, MASSIVE_DAMAGE); return amount; } // Takes a hit's half hearts from soul hearts first, then red ones, marking the floor as hurt for the red heart deals. // Bone hearts, Crow Heart and red heart hits are not written yet. static void hearts_remove(Entity_Player& player, int amount, uint64_t damageFlags, bool isPenalized) { if (player.boneHearts > 0) reconstruction_missing("Entity_Player::TakeDamage 007729d0 (bone hearts)"); if ((damageFlags & DAMAGE_RED_HEARTS) || player.HasTrinket(TRINKET_CROW_HEART)) reconstruction_missing("Entity_Player::TakeDamage 007729d0 (hits that take red hearts first)"); int soulBoneCount = (player.soulHearts + 1) / 2 + player.boneHearts; int filledCount = (std::min(player.redHearts, player.maxHearts) + 1) / 2; if (player.soulHearts > 0) { amount = std::min(amount, player.soulHearts); for (int heart = player.soulHearts; heart > player.soulHearts - amount; heart--) if (player.IsBlackHeart(heart)) reconstruction_missing("Entity_Player::TakeDamage 007729d0 (black hearts)"); if (player.eternalHearts > 0 && player.redHearts < 1 && player.boneHearts < 1 && player.soulHearts - amount < 1) { amount = std::max(amount - player.eternalHearts, 0); player.eternalHearts = 0; } if (amount > 0) player.soulHearts -= std::min(player.soulHearts, amount); } else { if (player.rottenHearts > 0 && player.eternalHearts < 1) amount += std::min(player.rottenHearts, amount); if (player.eternalHearts > 0) { amount = std::max(amount - player.eternalHearts, 0); player.eternalHearts = 0; } bool isRedLost = amount > player.rottenHearts * 2; player.rottenHearts = std::max(player.rottenHearts - (amount + 1) / 2, 0); player.AddHearts(-amount, false, false); bool isKeeper = player.playerType == PLAYER_KEEPER || player.playerType == PLAYER_KEEPER_B; if (player.playerType == PLAYER_MAGDALENE_B) reconstruction_missing("Entity_Player::TakeDamage 007729d0 (Tainted Magdalene's red heart damage)"); if (isRedLost && !isKeeper && !player.parent && isPenalized && amount > 0 && player.redHearts < player.maxHearts) { int multiplier = player.GetTrinketMultiplier(TRINKET_CROW_HEART); uint32_t keptChance = multiplier == 2 ? CROW_HEART_KEEP_2 : multiplier >= 3 ? CROW_HEART_KEEP_3 : 0; if (player.GetTrinketRNG(TRINKET_CROW_HEART).RandomInt(100) >= keptChance) { g_game->SetRedHeartDamage(); g_game->room->isRedHeartDamaged = true; } } } player.update_greeds_gullet(); int golden = player.goldenHearts; int newSoulBoneCount = (player.soulHearts + 1) / 2 + player.boneHearts; int newFilledCount = (std::min(player.redHearts, player.maxHearts) + 1) / 2; for (; soulBoneCount > newSoulBoneCount && player.goldenHearts > 0; soulBoneCount--) player.goldenHearts--; for (; filledCount > newFilledCount && player.goldenHearts > 0; filledCount--) player.goldenHearts--; if (player.goldenHearts < golden) player.BreakGoldenHearts(golden - player.goldenHearts); } // The items a landed hit sets off, none written yet, then Tainted Samson's rage. Bleeding out restarts its timer. static void hit_items_check(Entity_Player& player, uint64_t damageFlags, bool isPenalized) { bool isItemHit = std::ranges::any_of(HIT_COLLECTIBLES, [&](int item) { return player.HasCollectible(item); }) || std::ranges::any_of(HIT_TRINKETS, [&](int trinket) { return player.HasTrinket(trinket); }) || (isPenalized && player.HasTrinket(TRINKET_PERFECTION)) || player.HasPlayerForm(PLAYER_FORM_BEELZEBUB) || (player.HasCollectible(CROWN_OF_LIGHT) && !g_game->deathmatchManager.is_active()) || (player.HasCollectible(COLLECTIBLE_HYPERCOAGULATION) && !(damageFlags & HYPERCOAGULATION_IGNORED)) || std::ranges::any_of(player.activeItems, [](const ActiveItemDesc& active) { return active.item == COLLECTIBLE_LARYNX; }); if (isItemHit) reconstruction_missing("Entity_Player::TakeDamage 007729d0 (the items and trinkets a hit sets off)"); if (player.playerType == PLAYER_SAMSON_B && (player.redHearts > 0 || player.soulHearts > 0 || player.boneHearts > 0)) player.add_samson_berserk_charge(SAMSON_B_HIT_CHARGE); if (player.HasEntityFlags(FLAG_BLEED_OUT) && player.bleedSource.entity == &player && player.bleedOutHealth > 0) player.bleedOutHealth = BLEED_OUT_HEALTH; if (!player.proceduralItems.empty()) reconstruction_missing("Entity_Player::TakeDamage 007729d0 (glitched items, trigger_set_dispatch)"); } // 007729d0 The player takes a hit: the hit is ignored or turned by many items, then costs its hearts, plays the hurt // grunt and the Hit animation, starts the invincibility frames, and kills the player out of hearts. True when it hurt. bool Entity_Player::TakeDamage(float damage, uint64_t damageFlags, const EntityRef& source, int damageCountdown) { Game& game = *g_game; Entity_Player* twin = twin_get(); if (playerType == PLAYER_THESOUL_B && twin && !twin->HasCollectible(COLLECTIBLE_ISAACS_HEART)) reconstruction_missing("Entity_Player::TakeDamage 007729d0 (the Forgotten's soul passing the hit on)"); if (source.entity && (source.type == ENTITY_DAMAGE_RELAY || source.type == ENTITY_FAMILIAR)) reconstruction_missing("Entity_Player::TakeDamage 007729d0 (a familiar or relay source)"); if (is_wisp_shield_present(*this)) reconstruction_missing("Entity_Player::TakeDamage 007729d0 (wisp shields)"); if (source.type == ENTITY_FIREPLACE && source.variant == WHITE_FIRE_VARIANT) { bool isGhost = playerType == PLAYER_THELOST || playerType == PLAYER_THELOST_B || playerType == PLAYER_THESOUL_B; if (isGhost || HasInstantDeathCurse() || isDead) return false; reconstruction_missing("Entity_Player::TakeDamage 007729d0 (white fire's lost curse)"); } if (IsHologram() || is_damage_ignored(*this, source, damageFlags)) return false; damage_reactions_check(*this, damageFlags); if (!(damageFlags & DAMAGE_NO_HURT_EFFECTS)) play_hurt_effects(); bool isSeedProtected = game.seedEffects.HasSeedEffect(SEED_INVINCIBLE) || (variant == PLAYER_VARIANT_COOP_BABY && game.seedEffects.HasSeedEffect(SEED_KIDS_MODE)) || (game.deathmatchManager.is_active() && isInvincible); if (isSeedProtected) { damageCooldown = std::min((int)(damage + DAMAGE_ROUNDING), HURT_HEARTS_MAX) * HURT_FRAMES_PER_HEART; return false; } bool isPoisonImmune = HasPoisonImmunity() && !(source.type == ENTITY_EFFECT && source.variant == EFFECT_POISON_CLOUD); if (damage <= 0 && (damageFlags & DAMAGE_POISON_BURN) && !isPoisonImmune) { damageEvents.push_back({.source = source, .damage = damage, .damageFlags = damageFlags}); pendingDamageFlags |= damageFlags; pendingDamage += damage; } int hurtFrames = (int)(damage + DAMAGE_ROUNDING); int amount = damage_amount_get(*this, damage, damageFlags, source); bool isFake = damageFlags & DAMAGE_FAKE; if (isFake) amount = 0; if (damageFlags & DAMAGE_SPAWN_FLY) reconstruction_missing("Entity_Player::TakeDamage 007729d0 (a fly for the hit)"); bool isInvincibleNow = HasInvincibility(damageFlags, source); bool isPenalized = !(damageFlags & DAMAGE_UNPENALIZED); if (variant == PLAYER_VARIANT_COOP_BABY && babySkin == BABY_SHIELD && hasBabyRoomShield) { isInvincibleNow = true; hasBabyRoomShield = false; } bool isBlocked = (damageCooldown > 0 && !(damageFlags & DAMAGE_THROUGH_COOLDOWN)) || damage <= 0 || isInvincibleNow; if (isBlocked && !isFake) return false; if (temporaryEffects.HasCollectibleEffect(COLLECTIBLE_HOLY_MANTLE) && !(damageFlags & DAMAGE_RED_HEARTS)) reconstruction_missing("Entity_Player::TakeDamage 007729d0 (Holy Mantle's shield)"); if (hallowedGroundCountdown > 0 && !(damageFlags & DAMAGE_NO_MODIFIERS)) reconstruction_missing("Entity_Player::TakeDamage 007729d0 (Hallowed Ground)"); if (static_cast(g_luaEngine)->enabledCallbacks.test(MC_ENTITY_TAKE_DMG)) reconstruction_missing("Entity_Player::TakeDamage 007729d0 (LuaEngine::EntityTakeDamage 00864560)"); (void)damageCountdown; if (try_end_astral_projection()) return false; if (playerType == PLAYER_JACOB_B && source.type == ENTITY_DARK_ESAU) reconstruction_missing("Entity_Player::TakeDamage 007729d0 (Tainted Jacob's ghost form)"); // The online stats tally (Player_stats_add 00425ac0) is not written yet: only the online stats screen shows it. lastDamageSource = source; lastDamageFlags = damageFlags; isHurtThisRoom = true; maggyHealthDrainCooldown = 0; damageCooldown = HIT_COOLDOWN; float volume = local_volume_get(); if (isPenalized) { roomDamageTaken += amount; if (playerType == PLAYER_MAGDALENE_B) reconstruction_missing("Entity_Player::TakeDamage 007729d0 (Tainted Magdalene's damage taken)"); totalDamageTaken += amount; } if (source.type >= ENEMY_TYPE_FIRST && source.type <= ENEMY_TYPE_LAST) bestiary_count_add(g_manager->persistentGameData.bestiary.hits, source.type, source.variant); if (game.debugFlags & DEBUG_DAMAGE_VALUES) reconstruction_missing("Entity_Player::TakeDamage 007729d0 (spawn_debug_damage_text)"); if ((damageFlags & (DAMAGE_FIRE | DAMAGE_POOP)) && !(damageFlags & DAMAGE_EXPLOSION)) voice_play(SOUND_FIREDEATH_HISS, 1, SOUND_FRAME_DELAY, 1); bool isThief = is_listed(COIN_THIEF_TYPES, source.type) || source.spawnerType == ULTRA_GREED || source.spawnerType == ULTRA_GREED_DOOR || (source.type == ENTITY_PROJECTILE && is_listed(COIN_SHOOTER_TYPES, source.spawnerType)); if ((isThief || game.challenge == CHALLENGE_PAY_TO_PLAY) && numCoins > 0) reconstruction_missing("Entity_Player::TakeDamage 007729d0 (dropping coins to Greed)"); if (variant == PLAYER_VARIANT_COOP_BABY && (babySkin == BABY_FART || babySkin == BABY_BOMB || babySkin == BABY_BOOK)) reconstruction_missing("Entity_Player::TakeDamage 007729d0 (the co-op babies that answer hits)"); if (HasCollectible(COLLECTIBLE_MARBLES) && (trinkets[0] != 0 || queuedItem.item)) reconstruction_missing("Entity_Player::TakeDamage 007729d0 (Marbles)"); float pitch = get_voice_pitch(); int grunt = SOUND_ISAAC_HURT_GRUNT; if (temporaryEffects.HasCollectibleEffect(COLLECTIBLE_THE_NAIL)) grunt = random_below(2) ? SOUND_NAIL_HURT_1 : SOUND_NAIL_HURT_2; voice_play(grunt, volume, SOUND_FRAME_DELAY, pitch); if (source.type == ENTITY_MOM || source.type == ENTITY_MOMS_HEART) voice_play(source.type == ENTITY_MOM ? SOUND_MOM_VOX : SOUND_HEARTBEAT, 1, random_below(SOUND_BOSS_DELAY_RANDOM) + SOUND_BOSS_DELAY_MIN, 1); hit_items_check(*this, damageFlags, isPenalized); for (size_t i = 0; i < game.room->entityList.updateEL.size(); i++) { Entity* entity = game.room->entityList.updateEL[i]; if (entity->IsFamiliar() && static_cast(entity)->player == this) reconstruction_missing("Entity_Familiar::trigger_player_damage 0062b750"); else if (!entity->IsFamiliar() && entity->IsEnemy()) static_cast(entity)->on_player_damaged(); } if (isPenalized && !parent) { game.SetStateFlag(LEVEL_STATE_DAMAGED, true); game.lastLevelWithDamage = std::clamp((int)game.stage, 0, LAST_DAMAGE_STAGE_MAX); } if (game.debugFlags & DEBUG_INFINITE_HP) amount = 0; else if (amount > 0 && game.deathmatchManager.is_active()) reconstruction_missing("Entity_Player::TakeDamage 007729d0 (versus hearts)"); else if (amount > 0) hearts_remove(*this, amount, damageFlags, isPenalized); bool isAstral = HasCollectible(COLLECTIBLE_ASTRAL_PROJECTION) && !game.room->IsClear() && !temporaryEffects.HasCollectibleEffect(COLLECTIBLE_ASTRAL_PROJECTION) && !astralProjectionBody; bool isInstantDeath = HasInstantDeathCurse() && amount > 0; bool isDeathSkipped = isAstral || temporaryEffects.HasCollectibleEffect(COLLECTIBLE_BERSERK); bool isHurt = true; if ((redHearts < 1 && soulHearts < 1 && boneHearts < 1) || isInstantDeath) { if (HasCollectible(COLLECTIBLE_HEARTBREAK)) reconstruction_missing("Entity_Player::TakeDamage 007729d0 (Heartbreak)"); if (damageFlags & DAMAGE_NOKILL) TryPreventDeath(); else { if (isInstantDeath) { redHearts = 0; soulHearts = 0; blackHearts = 0; boneHearts = 0; eternalHearts = 0; rottenHearts = 0; } if (!isDeathSkipped) { if (isInstantDeath) Kill(EntityRef()); bool isKilled = try_trigger_astral_projection(); lastDamageSource = source; if (isKilled && game.deathmatchManager.is_active()) reconstruction_missing("Entity_Player::TakeDamage 007729d0 (a versus kill, trigger_npc_death)"); if (isDead) death_count(source, damageFlags); } } } if (!isDead && HasCollectible(COLLECTIBLE_CURSED_EYE) && !HasCollectible(COLLECTIBLE_BLACK_CANDLE) && weapons[1]) reconstruction_missing("Entity_Player::TakeDamage 007729d0 (Cursed Eye's teleport)"); bool isHitAnimated = pitfallState == 0 && isHurt; if (HasTrinket(TRINKET_CURSED_SKULL) && !isDead) reconstruction_missing("Entity_Player::TakeDamage 007729d0 (Cursed Skull)"); if (redHearts <= scale_for_hard_difficulty(1)) { if (HasCollectible(COLLECTIBLE_POLAROID) || HasCollectible(COLLECTIBLE_NEGATIVE)) reconstruction_missing("Entity_Player::TakeDamage 007729d0 (the Polaroid and the Negative)"); bool isLastHeart = soulHearts < 1 || (redHearts < 1 && soulHearts == scale_for_hard_difficulty(1)); if (isLastHeart && (HasCollectible(COLLECTIBLE_SCAPULAR) || (HasTrinket(TRINKET_MONKEY_PAW) && variant == PLAYER_VARIANT_PLAYER))) reconstruction_missing("Entity_Player::TakeDamage 007729d0 (Scapular and Monkey Paw)"); } damageCooldown = damage_cooldown_scale(std::min(hurtFrames, HURT_HEARTS_MAX) * HURT_FRAMES_PER_HEART); flags &= ~FLAG_NO_DAMAGE_BLINK; if (isAstral) reconstruction_missing("Entity_Player::TakeDamage 007729d0 (Astral Projection)"); if (HasTrinket(TRINKET_BLIND_RAGE) || HasTrinket(TRINKET_FINGER_BONE)) reconstruction_missing("Entity_Player::TakeDamage 007729d0 (Blind Rage and Finger Bone)"); if (isPenalized && HasCollectible(COLLECTIBLE_GLASS_CANNON)) reconstruction_missing("Entity_Player::TakeDamage 007729d0 (Glass Cannon)"); if (isHitAnimated) { if (twin && twin->playerType == PLAYER_THESOUL_B) twin->PlayExtraAnimation("Hit"); else if (game.challenge != CHALLENGE_GUARDIAN) PlayExtraAnimation("Hit"); if (itemState != ITEM_STATE_HOLD_STILL) ResetItemState(); } isHurtPending = true; // Rumble is not wired to the controllers here. ClampGoldenHearts(false); update_bone_hearts(); if (damageCooldown > 0 && !isDead && twin && twin->damageCooldown < damageCooldown && !twin->isDead) twin->damageCooldown = damageCooldown; if (HasTrinket(TRINKET_SWALLOWED_M80) && !(damageFlags & DAMAGE_NO_PENALTIES)) reconstruction_missing("Entity_Player::TakeDamage 007729d0 (Swallowed M80)"); bool isGlitching = isPlayingExtraAnimation && sprite.IsPlaying("Glitch"); if (!isDead && playerType == PLAYER_EDEN_B && isPenalized && !isGlitching) reconstruction_missing("Entity_Player::TakeDamage 007729d0 (Tainted Eden's reroll)"); return true; } // Counts the player's death in the bestiary of the enemy behind the hit. Dying to one's own Ipecac unlocks an // achievement that is not written yet. void Entity_Player::death_count(const EntityRef& source, uint64_t damageFlags) { PersistentGameData_Bestiary& bestiary = g_manager->persistentGameData.bestiary; if (source.type >= ENEMY_TYPE_FIRST && source.type <= ENEMY_TYPE_LAST) bestiary_count_add(bestiary.deaths, source.type, source.variant); else if (source.spawnerType >= ENEMY_TYPE_FIRST && source.spawnerType <= ENEMY_TYPE_LAST) bestiary_count_add(bestiary.deaths, source.spawnerType, (int)source.spawnerVariant); if ((damageFlags & DAMAGE_EXPLOSION) && source.type == ENTITY_TEAR && source.entity) reconstruction_missing("Entity_Player::TakeDamage 007729d0 (the achievement for dying to Ipecac)"); } // 007db6b0 Whether a hit kills at once: the Lost's curse, or Tainted Jacob's ghost. bool Entity_Player::HasInstantDeathCurse() { return (!temporaryEffects.isDisabled && std::ranges::any_of(temporaryEffects.effects, [](const TemporaryEffect& effect) { return effect.item->type == ITEM_NULL && effect.item->id == NULLITEM_LOST_CURSE; })) || playerType == PLAYER_JACOB2_B; } // 007bf670 The lives the HUD counts: Dead Cat's and the items that revive, Lazarus's own and Tainted Lost's Birthright. int Entity_Player::GetExtraLives() { int lives = deadCatLives; for (int item : EXTRA_LIFE_ITEMS) lives += collectibleCounts[item]; if (playerType == PLAYER_THELOST_B) lives += collectibleCounts[TAINTED_LOST_BIRTHRIGHT]; return lives + (playerType == PLAYER_LAZARUS); } // 0075d900 Whether an item's costume shows on a layer of the player's sprite, or on any layer for a negative one. bool Entity_Player::IsItemCostumeVisible(ItemConfig_Item* item, int playerSpriteLayerID) { int first = std::max(playerSpriteLayerID, 0); int end = playerSpriteLayerID < 0 ? COSTUME_LAYER_COUNT : playerSpriteLayerID + 1; for (int layer = first; layer < end; layer++) if (playerCostumeMap[layer].index >= 0 && costumeSpriteDescs[playerCostumeMap[layer].index].item == item) return true; return false; } // 0075d980 Whether a null item's costume shows on a layer, as IsItemCostumeVisible for an id out of range asks of none. bool Entity_Player::IsNullItemCostumeVisible(int nullItemID, int playerSpriteLayerID) { std::vector>& nullItems = g_manager->itemConfig.nullItems; bool isKnown = nullItemID >= 0 && nullItemID < (int)nullItems.size(); return IsItemCostumeVisible(isKnown ? nullItems[nullItemID].get() : nullptr, playerSpriteLayerID); } // 007c3100 Whether a hit passes the player by: the invincibility items' effects, Gnawed Leaf's statue, Breath of Life, // Taurus's charge, the shields red heart hits still pass, the halo baby and a co-op ghost. Book of Shadows lets a blood // donation hurt. bool Entity_Player::HasInvincibility(uint64_t damageFlags, const EntityRef& source) { if (damageFlags & DAMAGE_INVINCIBLE_IGNORED) return false; TemporaryEffects& effects = temporaryEffects; bool isRedHit = damageFlags & DAMAGE_RED_HEARTS; bool isInvincible = effects.HasCollectibleEffect(COLLECTIBLE_BOOK_OF_SHADOWS); if (isInvincible) { bool isBloodSlot = source.type == ENTITY_SLOT && (source.variant == BLOOD_DONATION_VARIANT || source.variant == BLOOD_BANK_VARIANT); if (isBloodSlot && effects.GetCollectibleEffect(COLLECTIBLE_BOOK_OF_SHADOWS)->unknown != 0) isInvincible = false; } if (!isInvincible) { TemporaryEffect* taurus = effects.HasCollectibleEffect(COLLECTIBLE_TAURUS) ? effects.GetCollectibleEffect(COLLECTIBLE_TAURUS) : nullptr; isInvincible = std::ranges::any_of(INVINCIBLE_EFFECTS, [&](int item) { return effects.HasCollectibleEffect(item); }) || (HasCollectible(COLLECTIBLE_GNAWED_LEAF) && mass == GNAWED_LEAF_MASS && !isRedHit) || effects.HasCollectibleEffect(COLLECTIBLE_BREATH_OF_LIFE) || (taurus && taurus->cooldown != 0) || (effects.HasNullEffect(NULLITEM_INVINCIBLE_SHIELD) && !isRedHit) || (effects.HasNullEffect(NULLITEM_REVERSE_CHARIOT) && !isRedHit) || ((effects.HasCollectibleEffect(COLLECTIBLE_DARK_ARTS) || isDarkArtsBlastPending) && !isRedHit) || (suplexState != 0 && !isRedHit) || effects.HasCollectibleEffect(COLLECTIBLE_MEGA_MUSH); } return isInvincible || (variant == PLAYER_VARIANT_COOP_BABY && babySkin == BABY_HALO) || isCoopGhost; } // 007c3320 Whether poison passes the player by: Jupiter, Bob's Curse and the Bob transformation. bool Entity_Player::HasPoisonImmunity() { return HasCollectible(COLLECTIBLE_JUPITER) || HasCollectible(COLLECTIBLE_BOBS_CURSE) || HasPlayerForm(PLAYER_FORM_BOB); } // 007dba30 Whether Evil Charm keeps a hazard off the player: fireplaces always, creep and the like only for their // first frames on it. bool Entity_Player::is_evil_charm_immune(EntityRef source) { if (!HasCollectible(COLLECTIBLE_EVIL_CHARM) && !temporaryEffects.HasCollectibleEffect(COLLECTIBLE_EVIL_CHARM)) return false; if (source.type == ENTITY_FIREPLACE) return true; bool isHazard = (source.type == 0 && source.variant == EVIL_CHARM_GRID_VARIANT) || (source.type == ENTITY_PROJECTILE && source.variant == 2) || (source.type == ENTITY_EFFECT && is_listed(EVIL_CHARM_EFFECTS, source.variant)); if (!isInEvilCharmHazard && !isHazard) { isInEvilCharmHazard = false; return false; } isInEvilCharmHazard = true; return isHazard && evilCharmHazardFrames < EVIL_CHARM_GRACE_FRAMES; } // 007c9ad0 The pitch of the player's voice: higher for babies, Pluto, Inner Child, Binky and Helium pills, lower // for Puberty pills and the Adult transformation. float Entity_Player::get_voice_pitch() { float pitch = variant == PLAYER_VARIANT_PLAYER ? VOICE_PITCH_PLAYER : VOICE_PITCH_BABY; pitch += (float)(pillEffectUses[PILL_EFFECT_PUBERTY] - pillEffectUses[PILL_EFFECT_HELIUM]) * VOICE_PITCH_PER_PILL; if (HasCollectible(COLLECTIBLE_PLUTO) || temporaryEffects.HasCollectibleEffect(COLLECTIBLE_INNER_CHILD)) pitch += VOICE_PITCH_PLUTO; if (HasCollectible(COLLECTIBLE_BINKY)) pitch += VOICE_PITCH_STEP; if (HasPlayerForm(PLAYER_FORM_ADULT)) pitch -= VOICE_PITCH_STEP; return std::clamp(pitch, VOICE_PITCH_MIN, VOICE_PITCH_MAX); } // 007cf8c0 Whether the player plays on this machine: every one does offline. bool Entity_Player::IsLocalPlayer() { return !g_manager->netplayManager.is_online() || g_manager->netplayManager.IsIdxLocalPlayer(controllerIndex); } // 007cf8f0 The volume of the player's sounds: full for a local player, the remote players' option for others. float Entity_Player::local_volume_get() { if (IsLocalPlayer()) return 1; return (float)g_manager->optionsConfig.onlinePlayerVolume * REMOTE_VOLUME_SCALE; } // 007d1c10 Breath of Life's holy light when the player is hit as it runs out, not written yet. True when it shines. uint32_t Entity_Player::play_hurt_effects() { TemporaryEffect* effect = temporaryEffects.GetCollectibleEffect(COLLECTIBLE_BREATH_OF_LIFE); bool isBlocked = damageCooldown > 0 && !HasEntityFlags(FLAG_NO_DAMAGE_BLINK); if (isBlocked || !effect || effect->count != 2) return 0; if (effect->cooldown < g_manager->itemConfig.GetCollectible(COLLECTIBLE_BREATH_OF_LIFE)->maxCooldown - BREATH_OF_LIFE_WINDOW) return 0; reconstruction_missing("Entity_Player::play_hurt_effects 007d1c10 (Breath of Life)"); } // 007caaa0 Whether a heart container is a bone heart. bool Entity_Player::IsBoneHeart(int heart) { return boneHearts > 0 && (boneHeartsMask & 1 << heart); } // 00759220 Whether a soul heart, counted in halves from 1, is the first half of a black heart. bool Entity_Player::IsBlackHeart(int heart) { return heart <= soulHearts && heart >= 1 && (heart & 1) && (blackHearts & 1 << ((heart - 1) / 2)); } // 007caad0 Leaves a player a last half heart of its kind when a hit was not to kill. True when it did. bool Entity_Player::TryPreventDeath() { if (boneHearts + redHearts + soulHearts != 0) return false; switch (GetHealthType()) { case HEALTH_DEFAULT: if (playerType == PLAYER_BETHANY) { if (maxHearts < 2) AddMaxHearts(2, false); AddHearts(1, true, false); return true; } if (maxHearts <= 0) break; AddHearts(scale_for_hard_difficulty(1), true, false); return true; case HEALTH_COIN: if (maxHearts < 2) AddMaxHearts(2, false); AddHearts(2, true, false); return true; case HEALTH_BONE: AddBoneHearts(1); return true; default: break; } soulHearts = 1; return true; } // 007afc20 Kills the player out of hearts and starts the death sequence, unless it is dead, a ghost, berserk or // projected. Spirit Shackles' second chance is not written yet. True when it killed. bool Entity_Player::try_trigger_astral_projection() { bool isOutOfHearts = redHearts < 1 && soulHearts < 1 && boneHearts < 1; if (g_game->deathmatchManager.is_active() && isOutOfHearts && blackHearts > 0) isOutOfHearts = false; if (isDead || !isOutOfHearts || isCoopGhost) return false; TemporaryEffect* astral = temporaryEffects.isDisabled ? nullptr : temporaryEffects.GetCollectibleEffect(COLLECTIBLE_ASTRAL_PROJECTION); int astralState = astral ? astral->count : 0; if (astralState == 1 || temporaryEffects.HasCollectibleEffect(COLLECTIBLE_BERSERK)) return false; if (astralState != 2) { bool isShackled = HasCollectible(COLLECTIBLE_SPIRIT_SHACKLES) && temporaryEffects.GetNullEffectNum(NULLITEM_SPIRIT_SHACKLES_DISABLED) == 0 && temporaryEffects.GetNullEffectNum(NULLITEM_SHACKLES_GHOST) == 0; if (isShackled) reconstruction_missing("Entity_Player::try_trigger_astral_projection 007afc20 (Spirit Shackles)"); // The online stats tally of deaths to spikes (Player_stats_add 00425ac0) is not written yet. lastDamageSource = EntityRef(); } Kill(EntityRef()); return true; } // 007d35b0 Ends Astral Projection's spirit form when the spirit is hit, not written yet. True when it ended. bool Entity_Player::try_end_astral_projection() { TemporaryEffect* astral = temporaryEffects.isDisabled ? nullptr : temporaryEffects.GetCollectibleEffect(COLLECTIBLE_ASTRAL_PROJECTION); if (!astral || astral->count != 1) return false; reconstruction_missing("Entity_Player::try_end_astral_projection 007d35b0"); } // 007828f0 The animation the player dies with: the Lost's for ghosts and the cursed, Forgotten's, or falling in a hole. const char* Entity_Player::GetDeathAnimName() { bool isGhost = playerType == PLAYER_THELOST || playerType == PLAYER_THELOST_B || playerType == PLAYER_JACOB2_B || playerType == PLAYER_THESOUL_B || playerType == PLAYER_THESOUL || temporaryEffects.GetCollectibleEffectNum(COLLECTIBLE_ASTRAL_PROJECTION) == 1 || temporaryEffects.GetNullEffectNum(NULLITEM_SHACKLES_GHOST) == 1 || temporaryEffects.HasNullEffect(NULLITEM_LOST_CURSE) || (variant == PLAYER_VARIANT_COOP_BABY && babySkin == BABY_GHOST) || isCoopGhost; if (isGhost) return "LostDeath"; if (playerType == PLAYER_THEFORGOTTEN_B) return "ForgottenDeath"; return pitfallState == 0 ? "Death" : "HoleDeath"; } // 007abe20 Plays an animation on the whole sprite, over the body and head, until it ends. void Entity_Player::PlayExtraAnimation(std::string_view animName) { isPlayingItemAnimation = false; bodySprite.Reset(); sprite.playbackSpeed = 1; sprite.overlayAnimState.SetAnimationData(nullptr); if (sprite.SetAnimation(animName)) { sprite.animState.Rewind(); sprite.animState.isPlaying = true; } isPlayingItemAnimation = false; isPlayingExtraAnimation = true; } // 007abe90 Plays an animation of the player's sprite on its body sprite, as picking items up does. void Entity_Player::PlayExtraAnimation(std::string_view animation, bool) { bodySprite = sprite; bodySprite.playbackSpeed = 1; if (bodySprite.SetAnimation(animation)) { bodySprite.animState.Rewind(); bodySprite.animState.isPlaying = true; } isPlayingExtraAnimation = false; isPlayingItemAnimation = true; } // 007c36b0 Puts away what the player holds up for an item: its costumes for the hold, and the item over its head. void Entity_Player::ResetItemState() { if (itemState == COLLECTIBLE_SHOOP_DA_WHOOP) reconstruction_missing("Entity_Player::ResetItemState 007c36b0 (TryRemoveCollectibleCostume)"); else if (itemState == COLLECTIBLE_BOOMERANG) RemoveCostume(g_manager->itemConfig.GetNullItem(NULLITEM_BOOMERANG)); if (variant == PLAYER_VARIANT_PLAYER && !isCoopGhost) { std::erase_if(costumeSpriteDescs, [](const CostumeSpriteDesc& desc) { return desc.isItemStateOnly; }); UpdateCostumes(); } bool isHiding = bodySprite.animState.animData && bodySprite.animState.isPlaying && bodySprite.GetAnimation() == "HideItem"; if ((isPlayingExtraAnimation || isPlayingItemAnimation) && !isHiding && itemState == COLLECTIBLE_MOMS_BRACELET) PlayExtraAnimation("HideItem"); itemState = 0; }