Curation round 23 (code only): the Mods menu and HUD pieces, Dogma and the Beast, Visage, Hornfel and other bosses, enemies and Entity_NPC branches, player revivals and missing methods, the player's frame, familiars, lasers, weapons and bombs, shared constants folded (115 duplicates, 385 gaps)
This commit is contained in:
1 parent
b9405bfb31
commit
11c71fe041
208 files changed
+20487
-5741
No files matched your search
+569
-67
@@ -3,6 +3,7 @@
|
||||
#include "active_items.h"
|
||||
#include "boss_ai.h"
|
||||
#include "boss_death.h"
|
||||
#include "boss_final.h"
|
||||
#include "entity_bomb.h"
|
||||
#include "entity_config.h"
|
||||
#include "entity_effect.h"
|
||||
@@ -27,6 +28,7 @@
|
||||
#include "room_config.h"
|
||||
#include "room_descriptor.h"
|
||||
#include "room_grid.h"
|
||||
#include "room_render.h"
|
||||
#include "sfx_manager.h"
|
||||
#include "menu_manager.h"
|
||||
#include "mines.h"
|
||||
@@ -232,8 +234,6 @@ constexpr float CHAMPION_CHANCE_VICTORY_LAP = 0.25f;
|
||||
constexpr float CHAMPION_CHANCE_PURPLE_HEART = 3;
|
||||
|
||||
constexpr unsigned int STATUS_SHARED = 1u << 31;
|
||||
// Dogma and the generic prop's TV (960.4) draw with the static shader.
|
||||
constexpr int GENERIC_PROP_TV = 4;
|
||||
constexpr std::string_view STATUS_EFFECTS_ANM2 = "gfx/StatusEffects.anm2";
|
||||
|
||||
// The target search: how far enemies look for players, and what pushes a player back or pulls a twin forward.
|
||||
@@ -244,6 +244,11 @@ constexpr float TWIN_NEAR_SQUARED = 10000;
|
||||
constexpr float BULB_CHARGE_BASE = 10000;
|
||||
constexpr float BULB_CHARGE_STEP = 2000;
|
||||
constexpr float BULB_DISTANCE_SCALE = 0.001f;
|
||||
constexpr float BAIT_REACH = 500;
|
||||
constexpr float BAITED_DISTANCE_SCALE = 1e-05f;
|
||||
constexpr float PUPPY_SMALL_PREY_SCALE = 0.5f;
|
||||
constexpr float PUPPY_BISHOP_SCALE = 0.01f;
|
||||
constexpr float PUPPY_KIN_PENALTY = 250000;
|
||||
constexpr int TARGET_REFRESH_FRAMES = 15;
|
||||
constexpr int DECOY_TIMER_MAX = 180;
|
||||
|
||||
@@ -405,7 +410,7 @@ static int active_charges_get(Entity_Player& player)
|
||||
}
|
||||
|
||||
// What a target counts as from a position: its squared distance, pushed back while its player is invincible or (for
|
||||
// Baby Plum) without control, pulled to a twin walking into the other, and for Bulb led by the active charge it holds.
|
||||
// the Blood Puppy) without control, pulled to a twin walking into the other, and for Bulb led by the active charge it holds.
|
||||
static float target_score_get(const Vector& position, Entity* source, Entity& target, Entity_Player* player,
|
||||
bool isBulb)
|
||||
{
|
||||
@@ -414,7 +419,7 @@ static float target_score_get(const Vector& position, Entity* source, Entity& ta
|
||||
|
||||
Entity_Player* twin = player->twin_get();
|
||||
if (player->HasInvincibility(0, EntityRef())) distance += TARGET_INVINCIBLE_PENALTY;
|
||||
else if ((!player->isControlsEnabled || player->controlsCooldown > 0) && source && source->type == ENTITY_BABY_PLUM)
|
||||
else if ((!player->isControlsEnabled || player->controlsCooldown > 0) && source && source->type == ENTITY_BLOOD_PUPPY)
|
||||
distance += TARGET_UNCONTROLLED_PENALTY;
|
||||
else if (twin)
|
||||
{
|
||||
@@ -429,8 +434,28 @@ static float target_score_get(const Vector& position, Entity* source, Entity& ta
|
||||
return distance * BULB_DISTANCE_SCALE + priority;
|
||||
}
|
||||
|
||||
// Whether a player found among the enemies is one a friendly source spares. The original reads the source's flags
|
||||
// even without one, which this skips.
|
||||
static bool prey_is_friendly(Entity* candidate, Entity* source)
|
||||
{
|
||||
return candidate->type == ENTITY_PLAYER && source && source->HasEntityFlags(FLAG_FRIENDLY) &&
|
||||
source->IsDamageSourceFriendly(EntityRef(candidate));
|
||||
}
|
||||
|
||||
// Whether the hunting enemies (the Blood Puppy, the level 2 Willo) may hunt it: a player in deathmatch, or an enemy
|
||||
// that is not a fire, shopkeeper, TNT, prop, minecart, poop or the Cultist's blood pool.
|
||||
bool entity_is_prey(Entity& prey)
|
||||
{
|
||||
if (prey.type == ENTITY_PLAYER) return g_game->deathmatchManager.is_active();
|
||||
if (!Entity::is_enemy_type(prey.type) || prey.type == ENTITY_FIREPLACE || prey.type == ENTITY_SHOPKEEPER || prey.type == ENTITY_MOVABLE_TNT)
|
||||
return false;
|
||||
if (prey.type == ENTITY_CULTIST) return prey.variant != CULTIST_POOL;
|
||||
return prey.type != ENTITY_GENERIC_PROP && prey.type != ENTITY_MINECART && prey.type != ENTITY_POOP;
|
||||
}
|
||||
|
||||
// 007069a0 What an enemy at a position goes after: the nearest visible player within reach (Dark Esau only Jacob),
|
||||
// else a Punching Bag or a baited enemy. An enemy forced onto a target keeps it.
|
||||
// else a Punching Bag, then a baited enemy, or for the Blood Puppy its nearest prey. An enemy forced onto a target keeps
|
||||
// it. Isaac's Heart stands in for its player.
|
||||
// The stand-in target a player keeps at Entity_Player 0x144c waits for Entity_Player to name it.
|
||||
Entity* game_nearest_target_player(const Vector& position, Entity* source, bool isPlayersOnly, bool isTargetDecoys,
|
||||
float maxDistance)
|
||||
@@ -464,8 +489,8 @@ Entity* game_nearest_target_player(const Vector& position, Entity* source, bool
|
||||
bool isJacob = candidate->playerType == PLAYER_JACOB || candidate->playerType == PLAYER_JACOB_B ||
|
||||
candidate->playerType == PLAYER_JACOB2_B;
|
||||
if (source && source->type == ENTITY_DARK_ESAU && !isJacob) continue;
|
||||
if (target->type == ENTITY_FAMILIAR)
|
||||
reconstruction_missing("Game::GetNearestTargetPlayer 007069a0: a familiar standing in for its player");
|
||||
if (target->type == ENTITY_FAMILIAR && target->variant == Entity_Familiar::ISAACS_HEART)
|
||||
player = static_cast<Entity_Familiar*>(target)->player;
|
||||
if (player && player->IsInvisible()) continue;
|
||||
|
||||
float score = target_score_get(position, source, *target, player, isBulb);
|
||||
@@ -473,9 +498,7 @@ Entity* game_nearest_target_player(const Vector& position, Entity* source, bool
|
||||
best = score;
|
||||
nearest = target;
|
||||
}
|
||||
if (isPlayersOnly) return nearest;
|
||||
|
||||
if (isTargetDecoys)
|
||||
if (!isPlayersOnly && isTargetDecoys)
|
||||
{
|
||||
for (Entity* decoy : g_game->room->entityList.mainEL)
|
||||
{
|
||||
@@ -486,10 +509,38 @@ Entity* game_nearest_target_player(const Vector& position, Entity* source, bool
|
||||
nearest = decoy;
|
||||
}
|
||||
}
|
||||
if (g_game->room->entityList.isAnyBaited)
|
||||
reconstruction_missing("Game::GetNearestTargetPlayer 007069a0: the baited enemies that draw attacks");
|
||||
if (source && source->type == ENTITY_BLOOD_PUPPY)
|
||||
reconstruction_missing("Game::GetNearestTargetPlayer 007069a0: the Blood Puppy's prey");
|
||||
if (!isPlayersOnly && g_game->room->entityList.isAnyBaited)
|
||||
{
|
||||
for (Entity* baited : entity_query_radius(position, std::min(maxDistance, BAIT_REACH), QUERY_ENEMIES))
|
||||
{
|
||||
if (prey_is_friendly(baited, source) || baited->isDead || !baited->HasEntityFlags(FLAG_BAITED)) continue;
|
||||
if (!source || !source->IsValidTarget(baited)) continue;
|
||||
float distance = vector_length_squared(vector_sub(baited->pos, position)) * BAITED_DISTANCE_SCALE;
|
||||
if (distance >= best) continue;
|
||||
best = distance;
|
||||
nearest = baited;
|
||||
}
|
||||
return nearest;
|
||||
}
|
||||
if (!source || source->type != ENTITY_BLOOD_PUPPY) return nearest;
|
||||
|
||||
float preyScale = source->variant == 0 ? PUPPY_SMALL_PREY_SCALE : 1;
|
||||
for (Entity* prey : entity_query_radius(position, std::min(maxDistance, BAIT_REACH), QUERY_ENEMIES))
|
||||
{
|
||||
if (prey_is_friendly(prey, source) || prey->isDead || prey == source) continue;
|
||||
if (g_game->frameCount - prey->spawnFrame <= 1 || !prey->IsVulnerableEnemy(nullptr) || !entity_is_prey(*prey))
|
||||
continue;
|
||||
if (prey->HasEntityFlags(FLAG_NO_TARGET)) continue;
|
||||
|
||||
float distance = vector_length_squared(vector_sub(prey->pos, position));
|
||||
bool isFriendly = prey->HasEntityFlags(FLAG_FRIENDLY);
|
||||
if (prey->type == ENTITY_BISHOP && !isFriendly) distance *= PUPPY_BISHOP_SCALE;
|
||||
if (prey->type == ENTITY_BLOOD_PUPPY) distance += PUPPY_KIN_PENALTY;
|
||||
if (!isFriendly) distance *= preyScale;
|
||||
if (distance >= best) continue;
|
||||
best = distance;
|
||||
nearest = prey;
|
||||
}
|
||||
return nearest;
|
||||
}
|
||||
|
||||
@@ -882,7 +933,7 @@ void Entity_NPC::load_graphics(bool isReloadAnm2)
|
||||
}
|
||||
sprite.championColor = isChampionSheetUsed && championLook ? *championLook : ColorMod{};
|
||||
|
||||
bool isStatic = type == ENTITY_DOGMA || (type == ENTITY_GENERIC_PROP && variant == GENERIC_PROP_TV);
|
||||
bool isStatic = type == ENTITY_DOGMA || (type == ENTITY_GENERIC_PROP && variant == PROP_TV);
|
||||
sprite.bitflags &= ~ANIM_RENDER_STATIC;
|
||||
if (isStatic) sprite.bitflags |= ANIM_RENDER_STATIC;
|
||||
sprite.LoadGraphics();
|
||||
@@ -1590,30 +1641,79 @@ void Entity_NPC::toxic_shock_creep_spawn()
|
||||
creep->Update();
|
||||
}
|
||||
|
||||
// Part of 006c4b30: the items whose aura works on enemies near a player: Super Magnet's nearest holder pulls the
|
||||
// enemy in one frame in three. The Soul's push and Salvation's beam stop the game until reached.
|
||||
// Part of 006c4b30: the items whose aura works on enemies near a player, each from its nearest holder. The Soul pushes
|
||||
// the enemy off within 80 one frame in three. Super Magnet pulls it in one frame in three. Salvation's beam locks
|
||||
// onto it within reach of its halo.
|
||||
void Entity_NPC::player_aura_update()
|
||||
{
|
||||
constexpr float SUPER_MAGNET_REACH_SQUARED = 1e9f;
|
||||
constexpr float SOUL_PUSH_REACH = 80;
|
||||
constexpr float SOUL_PUSH_SHARE = 0.1f;
|
||||
constexpr float SOUL_SPEED_SHARE = 0.2f;
|
||||
constexpr float SOUL_PUSH_BASE = 0.05f;
|
||||
constexpr float AURA_REACH_SQUARED = 1e9f;
|
||||
constexpr float SUPER_MAGNET_PULL = 0.5f;
|
||||
constexpr int SUPER_MAGNET_ODDS = 3;
|
||||
constexpr int AURA_ODDS = 3;
|
||||
constexpr float SALVATION_HALO_RADIUS = 70;
|
||||
constexpr int SALVATION_BEAM_SUBTYPE = 3;
|
||||
constexpr float SALVATION_BEAM_DAMAGE = 3.5f;
|
||||
if (state == NPC_STATE_DEATH || state == NPC_STATE_UNIQUE_DEATH || IsFriendly() || !IsVulnerableEnemy(nullptr))
|
||||
return;
|
||||
|
||||
Entity_Player* soul = nullptr;
|
||||
Entity_Player* magnet = nullptr;
|
||||
float magnetDistance = SUPER_MAGNET_REACH_SQUARED;
|
||||
Entity_Player* salvation = nullptr;
|
||||
float soulDistance = SOUL_PUSH_REACH * SOUL_PUSH_REACH;
|
||||
float magnetDistance = AURA_REACH_SQUARED;
|
||||
float salvationDistance = AURA_REACH_SQUARED;
|
||||
for (Entity_Player* player : g_game->playerManager.playerList)
|
||||
{
|
||||
if (player->HasCollectible(COLLECTIBLE_SOUL_ID) || player->HasCollectible(COLLECTIBLE_SALVATION_ID))
|
||||
reconstruction_missing("Entity_NPC::Update 006c4b30: The Soul's push and Salvation's beam");
|
||||
if (!player->HasTrinket(TRINKET_SUPER_MAGNET_ID)) continue;
|
||||
Vector away = vector_sub(player->pos, pos);
|
||||
float distance = away.x * away.x + away.y * away.y;
|
||||
if (distance >= magnetDistance) continue;
|
||||
magnet = player;
|
||||
magnetDistance = distance;
|
||||
bool isSoul = player->HasCollectible(COLLECTIBLE_SOUL_ID);
|
||||
bool isMagnet = player->HasTrinket(TRINKET_SUPER_MAGNET_ID);
|
||||
bool isSalvation = player->HasCollectible(COLLECTIBLE_SALVATION_ID);
|
||||
if (!isSoul && !isMagnet && !isSalvation) continue;
|
||||
|
||||
float distance = vector_length_squared(vector_sub(player->pos, pos));
|
||||
if (isSoul && distance < soulDistance)
|
||||
{
|
||||
soul = player;
|
||||
soulDistance = distance;
|
||||
}
|
||||
if (isMagnet && distance < magnetDistance)
|
||||
{
|
||||
magnet = player;
|
||||
magnetDistance = distance;
|
||||
}
|
||||
if (!isSalvation || distance >= salvationDistance) continue;
|
||||
float haloReach = player->get_salvation_scale() * SALVATION_HALO_RADIUS + size;
|
||||
if (distance >= haloReach * haloReach) continue;
|
||||
salvation = player;
|
||||
salvationDistance = distance;
|
||||
}
|
||||
if (magnet && random_below(SUPER_MAGNET_ODDS) == 0) velocity = vector_add(velocity, vector_resized(vector_sub(magnet->pos, pos), SUPER_MAGNET_PULL));
|
||||
|
||||
if (soul && random_below(AURA_ODDS) == 0)
|
||||
{
|
||||
float push = random_unit() * (SOUL_PUSH_REACH - std::sqrt(soulDistance)) * SOUL_PUSH_SHARE;
|
||||
float strength = vector_length(velocity) * push * SOUL_SPEED_SHARE + SOUL_PUSH_BASE;
|
||||
velocity = vector_add(velocity, vector_resized(vector_sub(pos, soul->pos), strength));
|
||||
}
|
||||
if (magnet && random_below(AURA_ODDS) == 0) velocity = vector_add(velocity, vector_resized(vector_sub(magnet->pos, pos), SUPER_MAGNET_PULL));
|
||||
if (!salvation) return;
|
||||
|
||||
if (!salvationTarget)
|
||||
{
|
||||
Entity* beam = g_game->Spawn({.position = pos,
|
||||
.spawner = salvation,
|
||||
.subType = SALVATION_BEAM_SUBTYPE,
|
||||
.type = ENTITY_EFFECT,
|
||||
.variant = EFFECT_CRACK_THE_SKY,
|
||||
.seed = Random()});
|
||||
beam->target = this;
|
||||
beam->parent = salvation;
|
||||
beam->SetCollisionDamage(SALVATION_BEAM_DAMAGE);
|
||||
beam->Update();
|
||||
salvationTarget = beam;
|
||||
}
|
||||
if (salvationTarget) static_cast<Entity_Effect*>(salvationTarget.get())->state = 1;
|
||||
}
|
||||
|
||||
// Whether Lighter or Ice Cube catches an enemy entering the room: a fifth, a third or a half by strength, more with
|
||||
@@ -1805,8 +1905,7 @@ void Entity_NPC::Update()
|
||||
spawn_damage_numbers();
|
||||
update_damage_history();
|
||||
if (aiCallFlags & AI_CALL_PRE_UPDATE) ai_call(AI_PHASE_PRE_UPDATE);
|
||||
if (HasEntityFlags(FLAG_PERSISTENT | FLAG_FRIENDLY_BALL_DYING))
|
||||
reconstruction_missing("Entity_NPC::Update 006c4b30: a captured enemy wasting away");
|
||||
if (HasEntityFlags(FLAG_PERSISTENT | FLAG_FRIENDLY_BALL_DYING)) captured_update();
|
||||
|
||||
float healthBefore = health;
|
||||
if (type == ENTITY_MINECART) update_physics();
|
||||
@@ -1838,6 +1937,153 @@ void Entity_NPC::Update()
|
||||
forced_target_update();
|
||||
}
|
||||
|
||||
// Part of 006c4b30: an enemy captured in a Friendly Ball (or dying out of one) wastes a quarter of health every 15
|
||||
// frames down to 1, greying and shrinking with it. A hit this frame that is not fire, spikes or poop passes on as 1
|
||||
// damage from its biggest hit, or as 5 from an explosion.
|
||||
// The shrink is lost at once, as the frame's scale reset (FUN_006d6650) overwrites it.
|
||||
void Entity_NPC::captured_update()
|
||||
{
|
||||
constexpr int WASTE_FRAMES = 15;
|
||||
constexpr float WASTE_STEP = 0.25f;
|
||||
constexpr float WASTE_LEAST_TINT = 0.6f;
|
||||
constexpr float WASTE_LEAST_SCALE = 0.6f;
|
||||
constexpr float WASTE_MOST_SCALE = 1.1f;
|
||||
constexpr float CAPTURED_HIT_DAMAGE = 1;
|
||||
constexpr float CAPTURED_BLAST_DAMAGE = 5;
|
||||
constexpr uint64_t UNFELT_DAMAGE = DAMAGE_FIRE | DAMAGE_SPIKES | DAMAGE_POOP;
|
||||
if (IsFrame(WASTE_FRAMES, 0) && health > 1) health = std::max(health - WASTE_STEP, 1.0f);
|
||||
|
||||
float tint = std::lerp(WASTE_LEAST_TINT, 1.0f, std::clamp(health * health / (maxHitPoints * maxHitPoints), 0.0f, 1.0f));
|
||||
std::fill_n(sprite.color._tint, 3, tint);
|
||||
sprite.color._tint[3] = 1;
|
||||
float shrink = std::lerp(WASTE_LEAST_SCALE, WASTE_MOST_SCALE, std::clamp(health / maxHitPoints, 0.0f, 1.0f));
|
||||
sprite.scale = vector_make(shrink, shrink);
|
||||
|
||||
const DamageEvent* felt = nullptr;
|
||||
float feltDamage = 0;
|
||||
float biggest = 0;
|
||||
for (const DamageEvent& event : damageEvents)
|
||||
{
|
||||
if (event.damageFlags & UNFELT_DAMAGE) continue;
|
||||
if (event.damageFlags & DAMAGE_EXPLOSION)
|
||||
{
|
||||
felt = &event;
|
||||
feltDamage = CAPTURED_BLAST_DAMAGE;
|
||||
break;
|
||||
}
|
||||
if (event.damage <= biggest) continue;
|
||||
felt = &event;
|
||||
feltDamage = CAPTURED_HIT_DAMAGE;
|
||||
biggest = event.damage;
|
||||
}
|
||||
if (felt) TakeDamage(feltDamage, felt->damageFlags, felt->source, 0);
|
||||
}
|
||||
|
||||
// The camouflage seeds: an enemy takes on the floor under it, sampled on its first frames and every 30 after, and
|
||||
// blends a tenth of the way toward it each frame, nearly black underneath.
|
||||
void Entity_NPC::camouflage_update()
|
||||
{
|
||||
constexpr float CAMO_ALPHA = 0.7f;
|
||||
constexpr float CAMO_FLOOR_TONE = 0.9f;
|
||||
constexpr float CAMO_ALPHA_BLEND = 0.3f;
|
||||
constexpr float CAMO_FLOOR_BLEND = 0.5f;
|
||||
constexpr float CAMO_SPRITE_BLEND = 0.1f;
|
||||
constexpr float CAMO_DARKNESS = 0.02f;
|
||||
constexpr int CAMO_RESAMPLE_FRAMES = 30;
|
||||
constexpr int CAMO_SAMPLE_WINDOW = 2;
|
||||
Room& room = *g_game->room;
|
||||
if (FrameCount() < CAMO_SAMPLE_WINDOW)
|
||||
{
|
||||
KColor floor = room_floor_texel_get(room, pos);
|
||||
const float shares[] = {floor._red, floor._green, floor._blue};
|
||||
std::fill_n(floorColor._tint, 3, 0.0f);
|
||||
floorColor._tint[3] = CAMO_ALPHA;
|
||||
for (int i = 0; i < 3; i++) floorColor._offset[i] = shares[i] * CAMO_FLOOR_TONE;
|
||||
sprite.color = floorColor;
|
||||
}
|
||||
if ((uint32_t)(g_game->frameCount + index) % CAMO_RESAMPLE_FRAMES < CAMO_SAMPLE_WINDOW)
|
||||
{
|
||||
KColor floor = room_floor_texel_get(room, pos);
|
||||
floorColor._tint[3] = std::lerp(floorColor._tint[3], CAMO_ALPHA, CAMO_ALPHA_BLEND);
|
||||
const float shares[] = {floor._red, floor._green, floor._blue};
|
||||
for (int i = 0; i < 3; i++)
|
||||
floorColor._offset[i] = std::lerp(floorColor._offset[i], shares[i] * CAMO_FLOOR_TONE, CAMO_FLOOR_BLEND);
|
||||
}
|
||||
ColorMod blended = color_lerp(sprite.color, floorColor, CAMO_SPRITE_BLEND);
|
||||
std::fill_n(blended._tint, 3, CAMO_DARKNESS);
|
||||
blended._tint[3] = 1;
|
||||
sprite.color = blended;
|
||||
}
|
||||
|
||||
// The pacifist seed and the quick kill debug mode drain every enemy by 1/900 of its health a frame, faster for the
|
||||
// split bosses, Satan, Mega Satan's fight and outside boss rooms, and a hundred times faster in quick kill. The pacifist
|
||||
// seed makes them invincible. Outside quick kill only bosses drain, and the doors open once no boss is left. A drained
|
||||
// boss dies with a hit, except those whose death waits on their partners, which give up holding the doors instead.
|
||||
void Entity_NPC::quick_kill_update()
|
||||
{
|
||||
constexpr float DRAIN_SECONDS = 30;
|
||||
constexpr float SPLIT_DRAIN_SCALE = 3;
|
||||
constexpr float MEGA_SATAN_ROOM_DRAIN_SCALE = 4;
|
||||
constexpr float MEGA_SATAN_DRAIN_SCALE = 0.33333f;
|
||||
constexpr float BOSS_RUSH_DRAIN_SCALE = 2;
|
||||
constexpr float MINIBOSS_DRAIN_SCALE = 3;
|
||||
constexpr float ROOM_DRAIN_SCALE = 6;
|
||||
constexpr float QUICK_KILL_DRAIN_SCALE = 100;
|
||||
constexpr int QUICK_KILL_COUNTDOWN = 30;
|
||||
Room& room = *g_game->room;
|
||||
bool isQuickKill = g_game->debugFlags & DEBUG_QUICK_KILL;
|
||||
bool isBlastocyst = type == ENTITY_BLASTOCYST_BIG || type == ENTITY_BLASTOCYST_MEDIUM || type == ENTITY_BLASTOCYST_SMALL;
|
||||
bool isSplitBoss = type == ENTITY_FISTULA_BIG || type == ENTITY_FISTULA_MEDIUM || type == ENTITY_FISTULA_SMALL ||
|
||||
isBlastocyst || (type == ENTITY_THE_HAUNT && variant == HAUNT_LIL_VARIANT);
|
||||
bool isSatanFight = type == ENTITY_FALLEN && room.bossId == BOSS_SATAN;
|
||||
bool isMegaSatan = type == ENTITY_MEGA_SATAN || type == ENTITY_MEGA_SATAN_2;
|
||||
float drain = maxHitPoints / DRAIN_SECONDS / DRAIN_SECONDS;
|
||||
if (g_game->seedEffects.HasSeedEffect(SEED_PACIFIST)) isInvincible = true;
|
||||
|
||||
if (isSplitBoss || isSatanFight) drain *= SPLIT_DRAIN_SCALE;
|
||||
else if (isMegaSatan) drain = isInvincible ? 0 : drain * MEGA_SATAN_DRAIN_SCALE;
|
||||
else if (room.bossId == BOSS_MEGA_SATAN) drain *= MEGA_SATAN_ROOM_DRAIN_SCALE;
|
||||
if (room.roomType == ROOM_BOSSRUSH) drain *= BOSS_RUSH_DRAIN_SCALE;
|
||||
else if (room.roomType == ROOM_MINIBOSS) drain *= MINIBOSS_DRAIN_SCALE;
|
||||
else if (room.roomType != ROOM_BOSS) drain *= ROOM_DRAIN_SCALE;
|
||||
if (isQuickKill) drain *= QUICK_KILL_DRAIN_SCALE;
|
||||
|
||||
if (!IsBoss() && !isQuickKill)
|
||||
{
|
||||
if (room.GetAliveBossesCount() < 1) isCanShutDoors = false;
|
||||
return;
|
||||
}
|
||||
if (isBlastocyst)
|
||||
{
|
||||
if (health > 0 || entityCollisionClass == ENTCOLL_NONE) health -= drain;
|
||||
else
|
||||
{
|
||||
isInvincible = false;
|
||||
health = 1;
|
||||
isDead = true;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (health > 0)
|
||||
{
|
||||
health -= drain;
|
||||
return;
|
||||
}
|
||||
|
||||
bool isHeldOn = type == ENTITY_GURDY || type == ENTITY_MEGA_MAW || type == ENTITY_GATE || type == ENTITY_MOMS_HEART ||
|
||||
type == ENTITY_FISTULA_BIG || type == ENTITY_FISTULA_MEDIUM || type == ENTITY_FISTULA_SMALL ||
|
||||
(type == ENTITY_THE_HAUNT && variant == HAUNT_LIL_VARIANT);
|
||||
bool isKilled = isQuickKill || isHeldOn || room.roomType == ROOM_BOSSRUSH || room.bossId == BOSS_MEGA_SATAN || isSatanFight;
|
||||
if (!isKilled)
|
||||
{
|
||||
isCanShutDoors = false;
|
||||
return;
|
||||
}
|
||||
isInvincible = false;
|
||||
TakeDamage(1, 0, EntityRef(), QUICK_KILL_COUNTDOWN);
|
||||
isDead = true;
|
||||
}
|
||||
|
||||
// Part of 006c4b30: the seeds and the debug mode that change every enemy: invisible enemies, camouflage, and the
|
||||
// pacifist seed and quick kill that make them waste away.
|
||||
void Entity_NPC::seed_effects_update()
|
||||
@@ -1849,11 +2095,9 @@ void Entity_NPC::seed_effects_update()
|
||||
sprite.color = COLOR_INVISIBLE;
|
||||
shadowSize = 0;
|
||||
}
|
||||
if (seeds.HasSeedEffect(SEED_CAMO_ENEMIES) || seeds.HasSeedEffect(SEED_CAMO_EVERYTHING))
|
||||
reconstruction_missing("Entity_NPC::Update 006c4b30: the camouflage seeds");
|
||||
if (seeds.HasSeedEffect(SEED_CAMO_ENEMIES) || seeds.HasSeedEffect(SEED_CAMO_EVERYTHING)) camouflage_update();
|
||||
bool isQuickKill = seeds.HasSeedEffect(SEED_PACIFIST) || (g_game->debugFlags & DEBUG_QUICK_KILL);
|
||||
if (isQuickKill && IsActiveEnemy(DEAD_EXCLUDED))
|
||||
reconstruction_missing("Entity_NPC::Update 006c4b30: the pacifist seed and quick kill debug mode");
|
||||
if (isQuickKill && IsActiveEnemy(DEAD_EXCLUDED)) quick_kill_update();
|
||||
}
|
||||
|
||||
// Part of 006c4b30: the few enemies with their own per-frame step: Hornfel, Gideon's camera, the Heart's partner and
|
||||
@@ -1911,6 +2155,32 @@ float Entity_NPC::compute_speed_multiplier()
|
||||
return speed;
|
||||
}
|
||||
|
||||
// Part of 006d60a0: Betrayal turns an enemy on the nearest enemy up its attacker's parent line, for 150 frames, unless
|
||||
// it is the same body, newborn or not vulnerable. One already set on another target switches only one hit in four. A
|
||||
// switch it survives shows an angry heart over it.
|
||||
void Entity_NPC::betrayal_turn(Entity* attacker)
|
||||
{
|
||||
constexpr int BETRAYAL_FRAMES = 150;
|
||||
constexpr uint32_t BETRAYAL_SWITCH_MASK = 3;
|
||||
constexpr int BETRAYAL_HEART_SUBTYPE = 2;
|
||||
constexpr float BETRAYAL_HEART_LIFT = -24;
|
||||
for (; attacker; attacker = attacker->parent)
|
||||
{
|
||||
if (!Entity::is_enemy_type(attacker->type)) continue;
|
||||
if (attacker == this || attacker->GetStatusEffectTarget() == GetStatusEffectTarget()) return;
|
||||
if (g_game->frameCount - attacker->spawnFrame <= 0 || !attacker->IsVulnerableEnemy(nullptr)) return;
|
||||
Entity* previous = forcedTarget;
|
||||
if (previous && previous != attacker && (Random() & BETRAYAL_SWITCH_MASK) != 0) return;
|
||||
if (!TryForceTarget(attacker, BETRAYAL_FRAMES) || previous == attacker || pendingDamage >= health) return;
|
||||
|
||||
Entity* heart = g_game->Spawn({.position = pos, .subType = BETRAYAL_HEART_SUBTYPE, .type = ENTITY_EFFECT,
|
||||
.variant = EFFECT_HEART, .seed = Random()});
|
||||
heart->sprite.offset = vector_make(0, BETRAYAL_HEART_LIFT);
|
||||
heart->renderDepthOffset = 1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// 006d60a0 Takes a hit as any entity (Entity::TakeDamage) and lets the items that react to it act: a player's hit
|
||||
// ends Pacifist, Betrayal turns it on its attacker, the pulsing champion spawns its flies, and a hit taken spawns
|
||||
// a blue fly for a hit that spawns one, marks a player's kill for Jar of Flies, and triggers the attacker's
|
||||
@@ -1923,8 +2193,7 @@ bool Entity_NPC::TakeDamage(float damage, uint64_t damageFlags, const EntityRef&
|
||||
if (!IsFriendly() && isPlayerSource) g_game->room->isPacifist = false;
|
||||
|
||||
PlayerManager& players = g_game->playerManager;
|
||||
if (source.entity && players.FirstCollectibleOwner(COLLECTIBLE_BETRAYAL_ID, LAZARUS_SHARE_CHECK))
|
||||
reconstruction_missing("Entity_NPC::TakeDamage 006d60a0: Betrayal");
|
||||
if (source.entity && players.FirstCollectibleOwner(COLLECTIBLE_BETRAYAL_ID, LAZARUS_SHARE_CHECK)) betrayal_turn(source.entity);
|
||||
if (players.FirstCollectibleOwner(COLLECTIBLE_JAR_OF_FLIES, LAZARUS_SHARE_CHECK))
|
||||
{
|
||||
bool isBlueFly = source.type == ENTITY_FAMILIAR && source.variant == Entity_Familiar::BLUE_FLY;
|
||||
@@ -2463,11 +2732,35 @@ void Entity_NPC::status_overlay_render(const Vector& offset)
|
||||
statusEffectSprite.Render(SpriteDraw{at, {}, {}});
|
||||
}
|
||||
|
||||
// 006d90e0 Moves the effect a controlled enemy aims with along the controller's input and keeps it in reach.
|
||||
void Entity_NPC::UpdateChildEffectPosition(bool)
|
||||
// 006d90e0 Moves the effect a controlled enemy aims with along the controller's input and keeps it in reach. A target
|
||||
// effect in mode 2 sits on the enemy (half a step ahead when predicting), one in another mode follows the aim input,
|
||||
// and anything else the movement input. A target effect with a reach (its rotation) is pulled back within 40 of it.
|
||||
void Entity_NPC::UpdateChildEffectPosition(bool isPredictMovement)
|
||||
{
|
||||
constexpr int AIM_MODE_SELF = 2;
|
||||
constexpr float AIM_SPEED = 8;
|
||||
constexpr float AIM_REACH_MARGIN = 40;
|
||||
constexpr float AIM_REACH_PULL = 0.1f;
|
||||
if (controllerID == -1 || !aimTargetEffect) return;
|
||||
reconstruction_missing("Entity_NPC::UpdateChildEffectPosition 006d90e0");
|
||||
|
||||
Entity* aim = aimTargetEffect;
|
||||
int mode = aim->type == ENTITY_EFFECT ? (int)static_cast<Entity_Effect*>(aim)->varData[2] : 0;
|
||||
if (aim->type == ENTITY_EFFECT && mode == AIM_MODE_SELF)
|
||||
{
|
||||
aim->pos = isPredictMovement ? vector_add(prevPosition, vector_scale(prevVelocity, HALF * speedMultiplier)) : prevPosition;
|
||||
aim->velocity = {};
|
||||
return;
|
||||
}
|
||||
|
||||
Vector input = aim->type == ENTITY_EFFECT && mode != 0 ? GetControllerInput(0) : GetControllerMovementInput(0);
|
||||
if (!vector_is_zero(input)) aim->velocity = vector_add(aim->velocity, vector_scale(input, AIM_SPEED));
|
||||
float reach = aim->type == ENTITY_EFFECT ? static_cast<Entity_Effect*>(aim)->rotation : 0;
|
||||
if (reach <= 0) return;
|
||||
|
||||
float limit = std::max(reach - AIM_REACH_MARGIN, 0.0f);
|
||||
Vector back = vector_sub(pos, aim->pos);
|
||||
float distance = vector_length(back);
|
||||
if (distance > limit) aim->velocity = vector_add(aim->velocity, vector_scale(back, (distance - limit) / distance * AIM_REACH_PULL));
|
||||
}
|
||||
|
||||
// 006d7010 With Spider Mod, shows the damage each hit of this frame dealt it as a rising number.
|
||||
@@ -2852,18 +3145,6 @@ bool Entity_NPC::TryThrow(const EntityRef& source, const Vector& throwVelocity,
|
||||
return true;
|
||||
}
|
||||
|
||||
// 004b92e0
|
||||
void Entity_NPC::Hornfel_UpdateAI()
|
||||
{
|
||||
reconstruction_missing("Entity_NPC::Hornfel_UpdateAI 004b92e0");
|
||||
}
|
||||
|
||||
// 004bb0e0
|
||||
void Entity_NPC::Hornfel_UpdateFrame()
|
||||
{
|
||||
reconstruction_missing("Entity_NPC::Hornfel_UpdateFrame 004bb0e0");
|
||||
}
|
||||
|
||||
// 006be760 Kills it with no source into its own death animation (Flush! and Lua's KillUnique).
|
||||
void Entity_NPC::KillUnique()
|
||||
{
|
||||
@@ -3016,16 +3297,10 @@ void Entity_NPC::update_frozen()
|
||||
}
|
||||
}
|
||||
|
||||
// 006d0c60
|
||||
void* Entity_NPC::QueryNPCsType(void*, int, int)
|
||||
// 006d0c60 The room's entities of a type, and of a variant unless -1.
|
||||
std::vector<Entity*> Entity_NPC::QueryNPCsType(int type, int variant)
|
||||
{
|
||||
reconstruction_missing("Entity_NPC::QueryNPCsType 006d0c60");
|
||||
}
|
||||
|
||||
// 006d1580
|
||||
void* Entity_NPC::fireplace_get_loot(void*, bool)
|
||||
{
|
||||
reconstruction_missing("Entity_NPC::fireplace_get_loot 006d1580");
|
||||
return entity_query(type, variant);
|
||||
}
|
||||
|
||||
// 006d4db0 Whether a reroll may turn it into another enemy: not when its tags forbid it, for a Lil Haunt still tied
|
||||
@@ -3092,20 +3367,247 @@ void Entity_NPC::UpdateChargeBar(float start, float end, float value, bool isHid
|
||||
chargeBarSprite.color._tint[3] = 0;
|
||||
}
|
||||
|
||||
// 006d97e0
|
||||
uint8_t Entity_NPC::split(float, const EntityRef&, bool)
|
||||
// The bosses a split would kill outright instead, and the ones it only hurts.
|
||||
static bool split_is_killed(Entity_NPC& npc)
|
||||
{
|
||||
reconstruction_missing("Entity_NPC::split 006d97e0");
|
||||
switch (npc.type)
|
||||
{
|
||||
case ENTITY_DINGA:
|
||||
case ENTITY_SQUIRT:
|
||||
case ENTITY_MEMBRAIN:
|
||||
case ENTITY_MOTER:
|
||||
case ENTITY_BIG_SPIDER:
|
||||
case ENTITY_FISTULA_BIG:
|
||||
case ENTITY_FISTULA_MEDIUM:
|
||||
case ENTITY_FISTULA_SMALL:
|
||||
case ENTITY_BLASTOCYST_BIG:
|
||||
case ENTITY_BLASTOCYST_MEDIUM:
|
||||
case ENTITY_BLASTOCYST_SMALL:
|
||||
case ENTITY_ENVY:
|
||||
return true;
|
||||
default:
|
||||
return npc.championColorIdx == CHAMPION_PULSE_GREEN;
|
||||
}
|
||||
}
|
||||
|
||||
static bool split_is_unsplittable(Entity_NPC& npc)
|
||||
{
|
||||
switch (npc.type)
|
||||
{
|
||||
case ENTITY_MOM:
|
||||
return npc.variant != MOM_STOMP;
|
||||
case ENTITY_VISAGE:
|
||||
return npc.variant == 0 || npc.variant == 1;
|
||||
case ENTITY_MOMS_HEART:
|
||||
case ENTITY_SATAN:
|
||||
case ENTITY_MEGA_SATAN:
|
||||
case ENTITY_MEGA_SATAN_2:
|
||||
case ENTITY_ISAAC:
|
||||
case ENTITY_THE_LAMB:
|
||||
case ENTITY_MAMA_GURDY:
|
||||
case ENTITY_DADDYLONGLEGS:
|
||||
case ENTITY_PIN:
|
||||
case ENTITY_ROTGUT:
|
||||
case ENTITY_MOTHER:
|
||||
case ENTITY_HUSH:
|
||||
case ENTITY_ULTRA_GREED:
|
||||
case ENTITY_DOGMA:
|
||||
case ENTITY_BEAST:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Whether a split's halves stand side by side (left and right) rather than at random about it.
|
||||
static bool split_is_side_by_side(Entity_NPC& npc)
|
||||
{
|
||||
if (npc.type == ENTITY_THE_HAUNT || npc.type == ENTITY_LOKI) return npc.variant == 0;
|
||||
return npc.type == ENTITY_GURDY || npc.type == ENTITY_MEGA_MAW || npc.type == ENTITY_GATE;
|
||||
}
|
||||
|
||||
// Hands the children of the split boss over to a half: the Lil Haunts, Peep's eyes, Gemini's twins (whose cords go)
|
||||
// and Mom's parts, which heal.
|
||||
static void split_half_link(Entity_NPC& npc, Entity_NPC& half, int halfIndex, Entity_NPC* first)
|
||||
{
|
||||
auto adopt = [&](int type, int variant, auto&& isChild) {
|
||||
for (Entity* child : entity_query(type, variant))
|
||||
if (child->parent.get() == &npc && isChild(*child)) child->parent = ½
|
||||
};
|
||||
constexpr float SPLIT_HAUNT_DRIFT = 0.3f;
|
||||
switch (npc.type)
|
||||
{
|
||||
case ENTITY_THE_HAUNT:
|
||||
if (npc.variant == 0)
|
||||
{
|
||||
half.state = NPC_STATE_IDLE;
|
||||
half.entityCollisionClass = ENTCOLL_ALL;
|
||||
half.targetPosition = vector_make(SPLIT_HAUNT_DRIFT, 0);
|
||||
}
|
||||
else if (npc.variant == HAUNT_LIL_VARIANT && npc.parent)
|
||||
{
|
||||
half.parent = npc.parent;
|
||||
if (halfIndex != 0) static_cast<Entity_NPC*>(half.parent.get())->i1++;
|
||||
half.spawnFrame = npc.spawnFrame;
|
||||
half.state = npc.state;
|
||||
}
|
||||
return;
|
||||
case ENTITY_PEEP:
|
||||
half.i1 = npc.i1;
|
||||
half.sprite.ReplaceSpritesheet(0, npc.sprite.GetLayer(0)->spriteSheetPath);
|
||||
half.sprite.LoadGraphics();
|
||||
adopt(ENTITY_PEEP, -1, [](Entity& eye) { return eye.variant >= PEEP_EYE_FIRST; });
|
||||
return;
|
||||
case ENTITY_GEMINI:
|
||||
if (npc.variant != 0 && npc.variant != GEMINI_STEVEN && npc.variant != GEMINI_BLIGHTED_OVUM) return;
|
||||
half.state = NPC_STATE_MOVE;
|
||||
for (Entity* cord : entity_query(ENTITY_GEMINI, GEMINI_CORD))
|
||||
if (cord->parent.get() == &npc) cord->Remove();
|
||||
if (npc.variant == GEMINI_BLIGHTED_OVUM) adopt(ENTITY_GEMINI, GEMINI_BLIGHTED_OVUM_BABY, [](Entity&) { return true; });
|
||||
return;
|
||||
case ENTITY_MASK_OF_INFAMY:
|
||||
half.state = NPC_STATE_ATTACK2;
|
||||
return;
|
||||
case ENTITY_WAR:
|
||||
if (npc.variant != 1) return;
|
||||
half.spawnerType = 0;
|
||||
half.spawnerVariant = 0;
|
||||
return;
|
||||
case ENTITY_PESTILENCE:
|
||||
if (npc.i1 == 0) return;
|
||||
half.i1 = 1;
|
||||
half.sprite.GetLayer(1)->isVisible = false;
|
||||
return;
|
||||
case ENTITY_FAMINE:
|
||||
if (npc.state == NPC_STATE_ATTACK2) half.state = NPC_STATE_ATTACK2;
|
||||
return;
|
||||
case ENTITY_REAP_CREEP:
|
||||
half.state = npc.state;
|
||||
half.entityGridCollisionClass = GRIDCOLL_WALLS;
|
||||
half.sprite.isOverlayRenderFirst = true;
|
||||
return;
|
||||
case ENTITY_MOM:
|
||||
if (halfIndex != 0)
|
||||
{
|
||||
half.parent = first;
|
||||
return;
|
||||
}
|
||||
for (Entity* part : entity_query(ENTITY_MOM, -1))
|
||||
{
|
||||
if (part == &npc || part->parent.get() != &npc) continue;
|
||||
part->health = part->maxHitPoints;
|
||||
part->parent = ½
|
||||
}
|
||||
return;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Spawns one half of a split boss beside it, a champion like it, with 40 percent of its health and two thirds of its
|
||||
// size. Horny Boys split into Hornfel and Loki, Loki into Lokii. Hornfel out of doors to run to turns sad.
|
||||
static Entity_NPC* split_half_spawn(Entity_NPC& npc, RNG& rng, int halfIndex, Entity_NPC* first)
|
||||
{
|
||||
constexpr float SPLIT_SPREAD = 0.5f;
|
||||
constexpr float SPLIT_HALF_SCALE = 0.66f;
|
||||
constexpr float SPLIT_HALF_HEALTH = 0.4f;
|
||||
constexpr float SPLIT_SCORE = 0.5f;
|
||||
float spread = npc.size * SPLIT_SPREAD;
|
||||
Vector offset = split_is_side_by_side(npc) ? vector_make(halfIndex == 0 ? -spread : spread, 0)
|
||||
: vector_scale(RandomVector(rng.Next()), spread);
|
||||
int type = npc.type;
|
||||
int variant = npc.variant;
|
||||
if (type == ENTITY_LOKI && variant == 0) variant = LOKII;
|
||||
else if (type == ENTITY_HORNY_BOYS)
|
||||
{
|
||||
type = halfIndex == 0 ? ENTITY_HORNFEL : ENTITY_LOKI;
|
||||
variant = 0;
|
||||
}
|
||||
|
||||
auto* half = static_cast<Entity_NPC*>(g_game->Spawn(
|
||||
{.position = vector_add(npc.pos, offset), .spawner = &npc, .subType = npc.subtype, .type = type, .variant = variant, .seed = rng.Next()}));
|
||||
if (npc.isChampion) half->Morph(type, variant, npc.subtype, npc.championColorIdx);
|
||||
half->scoreMultiplier = npc.scoreMultiplier * SPLIT_SCORE;
|
||||
if (half->type == ENTITY_BLOOD_PUPPY)
|
||||
{
|
||||
half->parent = npc.parent;
|
||||
// The original reads the parent's type even without one, which this skips.
|
||||
if (halfIndex == 0 && npc.parent && npc.parent->type == ENTITY_FAMILIAR)
|
||||
static_cast<Entity_Familiar*>(npc.parent.get())->linkedEntity = half;
|
||||
g_game->room->entityList.AddPersistentEntity(half);
|
||||
}
|
||||
if (npc.type == ENTITY_LOKI && npc.variant == 0) half->sprite.isFlipX = halfIndex != 0;
|
||||
else if (npc.type != ENTITY_HORNY_BOYS)
|
||||
{
|
||||
half->SetScale(npc.scale * SPLIT_HALF_SCALE);
|
||||
half->scaleMulti = npc.scaleMulti * SPLIT_HALF_SCALE;
|
||||
}
|
||||
if (half->type == ENTITY_HORNFEL && entity_query(ENTITY_HORNFEL_DOOR, -1).empty())
|
||||
{
|
||||
if (half->minecart) half->minecart->Remove();
|
||||
half->state = NPC_STATE_SUMMON;
|
||||
npc_anim_loop(half->sprite, "Sad");
|
||||
half->entityGridCollisionClass = GRIDCOLL_GROUND;
|
||||
}
|
||||
half->maxHitPoints = npc.maxHitPoints * SPLIT_HALF_HEALTH;
|
||||
half->health = npc.health * SPLIT_HALF_HEALTH;
|
||||
half->hitPointsMulti = npc.hitPointsMulti * SPLIT_HALF_HEALTH;
|
||||
split_half_link(npc, *half, halfIndex, first);
|
||||
|
||||
half->spawnGridIndex = npc.spawnGridIndex;
|
||||
if (npc.HasEntityFlags(FLAG_AMBUSH)) half->AddEntityFlags(FLAG_AMBUSH);
|
||||
return half;
|
||||
}
|
||||
|
||||
// 006d97e0 Meat Cleaver's cut: splits the enemy into two halves (split_half_spawn) and removes it in a burst of blood.
|
||||
// The Fallen (outside Satan's fight) only drops to 40 percent, some bosses die outright and the ones too small or
|
||||
// too big to split are only hurt, the split worm bodies and Visage's and the Scourge's chains for twice their health.
|
||||
// Conquest dies unless it is a boss. With a sound it shakes the screen. A dead enemy does nothing.
|
||||
bool Entity_NPC::split(float damage, const EntityRef& source, bool isPlaySound)
|
||||
{
|
||||
constexpr float SPLIT_LEAST_SCALE = 0.5f;
|
||||
constexpr float FALLEN_SPLIT_HEALTH = 0.4f;
|
||||
constexpr int SPLIT_HURT_COUNTDOWN = 30;
|
||||
constexpr int SPLIT_SHAKE = 15;
|
||||
constexpr uint32_t SPLIT_SHIFT_INDEX = 22;
|
||||
if (isDead || !isExists) return false;
|
||||
|
||||
if (isPlaySound) npc_sound_play(SOUND_MEATY_DEATHS, 1, 2, 1);
|
||||
bool isHurtOnly = scale < SPLIT_LEAST_SCALE || split_is_unsplittable(*this);
|
||||
bool isChain = (type == ENTITY_VISAGE && variant == VISAGE_CHAIN) || (type == ENTITY_SCOURGE && variant == SCOURGE_CHAIN);
|
||||
if (isHurtOnly) TakeDamage(damage, 0, source, SPLIT_HURT_COUNTDOWN);
|
||||
else if (type == ENTITY_FALLEN && variant == 0 && spawnerType != ENTITY_FALLEN)
|
||||
health = std::min(health, maxHitPoints * FALLEN_SPLIT_HEALTH);
|
||||
else if (is_same_segmented_body(nullptr) || isChain) TakeDamage(health + health, 0, source, SPLIT_HURT_COUNTDOWN);
|
||||
else if (split_is_killed(*this) || (type == ENTITY_WAR && variant == 1 && !IsBoss())) Kill(EntityRef());
|
||||
else
|
||||
{
|
||||
RNG rng;
|
||||
rng.SetSeed(initSeed, SPLIT_SHIFT_INDEX);
|
||||
Entity_NPC* first = split_half_spawn(*this, rng, 0, nullptr);
|
||||
split_half_spawn(*this, rng, 1, first);
|
||||
BloodExplode();
|
||||
Remove();
|
||||
}
|
||||
if (isPlaySound) game_shake_screen(SPLIT_SHAKE);
|
||||
return true;
|
||||
}
|
||||
|
||||
// 006da530 While a player holds Guppy's Eye, a lit fireplace or a living shopkeeper shows the loot it would drop as
|
||||
// ghosts. Otherwise the ghosts shown before go.
|
||||
// ghosts. Otherwise, or with nothing to drop, the ghosts shown before go.
|
||||
void Entity_NPC::UpdatePickupGhosts()
|
||||
{
|
||||
bool isLootHolder = (type == ENTITY_FIREPLACE && health > 1) || (type == ENTITY_SHOPKEEPER && !isDead);
|
||||
|
||||
if (isLootHolder && g_game->playerManager.FirstCollectibleOwner(COLLECTIBLE_GUPPYS_EYE_ID, LAZARUS_SHARE_CHECK))
|
||||
reconstruction_missing("Entity_NPC::UpdatePickupGhosts 006da530 (the loot ghosts)");
|
||||
{
|
||||
LootList loot = type == ENTITY_FIREPLACE ? fireplace_get_loot(false) : LootList{shopkeeper_loot_get(*this, false)};
|
||||
if (!loot.entries.empty())
|
||||
{
|
||||
pickupGhostsEntity = Entity_Effect::CreateLootPreview(
|
||||
&loot, pos, this, static_cast<Entity_Effect*>(pickupGhostsEntity.get()));
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (pickupGhostsEntity) pickupGhostsEntity->Remove();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user