Curation round 15: restart and mods, Brimstone and Tech X, room gaps, eight bosses, the Womb and Mom's Heart, the Forgotten and tainted starts, alt path enemies and exits
This commit is contained in:
1 parent
6e3da161fc
commit
78a2680134
128 files changed
+13196
-2933
No files matched your search
+133
-41
@@ -1,12 +1,15 @@
|
||||
#include "entity_effect_combat.h"
|
||||
#include "entity_familiar.h"
|
||||
#include "entity_npc.h"
|
||||
#include "entity_player.h"
|
||||
#include "entity_player_characters.h"
|
||||
#include "entity_tear.h"
|
||||
#include "game.h"
|
||||
#include "level.h"
|
||||
#include "log.h"
|
||||
#include "lua_engine.h"
|
||||
#include "manager.h"
|
||||
#include "npc_ai.h"
|
||||
#include "room.h"
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
@@ -66,15 +69,12 @@ constexpr uint32_t CHALLENGE_PAY_TO_PLAY = 24;
|
||||
|
||||
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_INVINCIBLE_IGNORED = 1ull << 13;
|
||||
constexpr uint64_t DAMAGE_FAKE = 1ull << 21;
|
||||
constexpr uint64_t DAMAGE_NO_MODIFIERS = 1ull << 25;
|
||||
constexpr uint64_t DAMAGE_IGNORED = 1ull << 34;
|
||||
constexpr uint64_t DAMAGE_NO_HURT_EFFECTS = 0x100d0400;
|
||||
constexpr uint64_t DAMAGE_ISAACS_HEART_PIERCE = 0x2820;
|
||||
@@ -93,6 +93,20 @@ 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;
|
||||
|
||||
// A bone heart's break: its shards and snap, and Brittle Bones' ring of tears.
|
||||
constexpr ColorMod BONE_SHARD_COLOR = {{0.7f, 0.7f, 0.65f, 1}, {0, 0, 0, 0}, {0, 0, 0}};
|
||||
constexpr int BONE_SHARD_COUNT = 8;
|
||||
constexpr float BONE_SHARD_SPEED_MIN = 2;
|
||||
constexpr float BONE_SHARD_SPEED_RANDOM = 3;
|
||||
constexpr float BONE_SNAP_VOLUME = 0.7f;
|
||||
constexpr float BONE_SNAP_PITCH_RANDOM = 0.2f;
|
||||
constexpr float BRITTLE_BONES_TURN = 360;
|
||||
constexpr int BRITTLE_BONES_TEARS = 10;
|
||||
constexpr float BRITTLE_BONES_SPEED = 10;
|
||||
constexpr float BRITTLE_BONES_SCALE = 1.355f;
|
||||
constexpr float BRITTLE_BONES_DAMAGE_SCALE = 2;
|
||||
constexpr float BRITTLE_BONES_DAMAGE_BONUS = 22;
|
||||
constexpr float DAMAGE_ROUNDING = 0.5f;
|
||||
constexpr float HALVED_DAMAGE = 0.5f;
|
||||
constexpr float HALVED_DAMAGE_DEATHMATCH = 0.75f;
|
||||
@@ -207,12 +221,6 @@ template <size_t N> 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)
|
||||
{
|
||||
@@ -264,22 +272,122 @@ static int damage_amount_get(Entity_Player& player, float damage, uint64_t damag
|
||||
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)
|
||||
// The soul half hearts above the last bone heart, which a hit takes before the bone heart.
|
||||
static int souls_above_bones_count(Entity_Player& player)
|
||||
{
|
||||
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 count = 0;
|
||||
|
||||
for (int slot = player.boneHearts + (player.soulHearts + 1) / 2 - 1; slot >= 0 && !player.IsBoneHeart(slot); slot--)
|
||||
count = count == 0 && (player.soulHearts & 1) ? 1 : count + 2;
|
||||
return std::min(count, player.soulHearts);
|
||||
}
|
||||
|
||||
// A bone heart breaking: bone shards and a snap, The Forgotten's floor marked as hurt, and Brittle Bones' ring of bone
|
||||
// tears with its tears up.
|
||||
static void bone_heart_break(Entity_Player& player, bool isPenalized)
|
||||
{
|
||||
player.boneHearts--;
|
||||
player.UpdateHeartDependentEffects();
|
||||
if (player.playerType == PLAYER_THEFORGOTTEN && isPenalized && !player.parent)
|
||||
{
|
||||
g_game->SetRedHeartDamage();
|
||||
g_game->room->isRedHeartDamaged = true;
|
||||
}
|
||||
game_particles_spawn({.color = BONE_SHARD_COLOR, .position = player.pos, .height = player.posOffset.y,
|
||||
.speed = random_unit() * BONE_SHARD_SPEED_RANDOM + BONE_SHARD_SPEED_MIN,
|
||||
.count = BONE_SHARD_COUNT, .variant = EFFECT_TOOTH_PARTICLE});
|
||||
voice_play(SOUND_BONE_SNAP, BONE_SNAP_VOLUME, SOUND_FRAME_DELAY, random_unit() * BONE_SNAP_PITCH_RANDOM + 1);
|
||||
if (!player.HasCollectible(COLLECTIBLE_BRITTLE_BONES)) return;
|
||||
|
||||
float turn = random_unit() * BRITTLE_BONES_TURN;
|
||||
for (int i = 0; i < BRITTLE_BONES_TEARS; i++)
|
||||
{
|
||||
uint32_t seed = Random();
|
||||
Vector direction = vector_from_angle(((float)i / BRITTLE_BONES_TEARS + turn) * BRITTLE_BONES_TURN);
|
||||
auto* tear = static_cast<Entity_Tear*>(g_game->Spawn({.position = player.pos,
|
||||
.velocity = vector_scale(direction, BRITTLE_BONES_SPEED),
|
||||
.spawner = &player, .type = ENTITY_TEAR,
|
||||
.variant = TEAR_BONE, .seed = seed}));
|
||||
TearParams params = player.GetTearHitParams(WEAPON_TEARS, 1, random_below(2) * 2 - 1, nullptr);
|
||||
params.tearFlags.set(TEAR_BONE_FLAG);
|
||||
tear->SetTearFlags(params.tearFlags);
|
||||
tear->SetScale(params.tearScale * BRITTLE_BONES_SCALE);
|
||||
tear->SetCollisionDamage(params.tearDamage * BRITTLE_BONES_DAMAGE_SCALE + BRITTLE_BONES_DAMAGE_BONUS);
|
||||
tear->SetHeight(params.tearHeight);
|
||||
tear->parent = &player;
|
||||
tear->Update();
|
||||
}
|
||||
player.brittleBonesUpgrades++;
|
||||
player.cacheFlags |= CACHE_FIREDELAY;
|
||||
player.EvaluateItems();
|
||||
}
|
||||
|
||||
// Takes a hit's half hearts from the red hearts: rotten hearts double what they lose, a bone heart filled with red only
|
||||
// loses its own heart, an eternal heart soaks up the hit (when red hearts are not hit first or not enough), and a red
|
||||
// heart lost marks the floor as hurt unless Crow Heart keeps it. Returns what was taken.
|
||||
static int red_hearts_remove(Entity_Player& player, int amount, bool isRedFirst, bool isBoneFilled, uint64_t damageFlags,
|
||||
bool isPenalized)
|
||||
{
|
||||
if (player.rottenHearts > 0 && player.eternalHearts < 1)
|
||||
{
|
||||
int rotten = isRedFirst ? std::max(0, player.rottenHearts * 2 - player.redHearts + amount) : amount;
|
||||
amount += std::min(player.rottenHearts, rotten);
|
||||
}
|
||||
if (player.boneHearts > 0 && isBoneFilled) amount = std::min(amount, (player.redHearts & 1) ? 1 : 2);
|
||||
if (player.eternalHearts > 0)
|
||||
{
|
||||
int unshielded = player.redHearts - (player.soulHearts + player.boneHearts < 1 ? 1 : 0) - player.rottenHearts;
|
||||
if (!(damageFlags & DAMAGE_RED_HEARTS) || amount > unshielded)
|
||||
{
|
||||
amount = std::max(amount - player.eternalHearts, 0);
|
||||
player.eternalHearts = 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool isRedLost = amount > player.rottenHearts * 2;
|
||||
int rottenLost = isRedFirst ? std::max(0, player.rottenHearts * 2 - player.redHearts + amount) : amount;
|
||||
player.rottenHearts = std::max(player.rottenHearts - (rottenLost + 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;
|
||||
}
|
||||
}
|
||||
return amount;
|
||||
}
|
||||
|
||||
// Takes a hit's half hearts: the soul hearts above the last bone heart first (a black heart among them sets off the
|
||||
// Necronomicon), then a bone heart, then the red hearts. Red Heart damage and Crow Heart hit the red hearts first when
|
||||
// there are enough. An eternal heart soaks up a hit that would empty the last heart. Golden hearts break with the
|
||||
// hearts emptied. Returns what was taken.
|
||||
static int hearts_remove(Entity_Player& player, int amount, uint64_t damageFlags, bool isPenalized)
|
||||
{
|
||||
int soulBoneCount = (player.soulHearts + 1) / 2 + player.boneHearts;
|
||||
int filledCount = (std::min(player.redHearts, player.maxHearts) + 1) / 2;
|
||||
bool isRedAsked = (damageFlags & DAMAGE_RED_HEARTS) || player.HasTrinket(TRINKET_CROW_HEART);
|
||||
bool isRedFirst = isRedAsked && player.redHearts >= amount;
|
||||
int soulsAbove = player.boneHearts > 0 ? souls_above_bones_count(player) : player.soulHearts;
|
||||
bool isBoneFilled = player.boneHearts > 0 && player.redHearts >= player.maxHearts + player.boneHearts * 2 - 1;
|
||||
|
||||
if (player.soulHearts > 0)
|
||||
if (soulsAbove > 0 && !isRedFirst)
|
||||
{
|
||||
amount = std::min(amount, player.soulHearts);
|
||||
amount = std::min(amount, soulsAbove);
|
||||
for (int heart = player.soulHearts; heart > player.soulHearts - amount; heart--)
|
||||
if (player.IsBlackHeart(heart)) reconstruction_missing("Entity_Player::TakeDamage 007729d0 (black hearts)");
|
||||
{
|
||||
if (!player.IsBlackHeart(heart)) continue;
|
||||
player.RemoveBlackHeart(heart);
|
||||
player.UseActiveItem({.item = COLLECTIBLE_NECRONOMICON, .flags = USE_NOANIM | USE_ALLOWNONMAIN});
|
||||
voice_play(SOUND_BLACK_POOF, 1, SOUND_FRAME_DELAY, 1);
|
||||
}
|
||||
if (player.eternalHearts > 0 && player.redHearts < 1 && player.boneHearts < 1 && player.soulHearts - amount < 1)
|
||||
{
|
||||
amount = std::max(amount - player.eternalHearts, 0);
|
||||
@@ -287,33 +395,16 @@ static void hearts_remove(Entity_Player& player, int amount, uint64_t damageFlag
|
||||
}
|
||||
if (amount > 0) player.soulHearts -= std::min(player.soulHearts, amount);
|
||||
}
|
||||
else
|
||||
else if (player.boneHearts > 0 && !isBoneFilled && !isRedFirst)
|
||||
{
|
||||
if (player.rottenHearts > 0 && player.eternalHearts < 1) amount += std::min(player.rottenHearts, amount);
|
||||
if (player.eternalHearts > 0)
|
||||
if (player.eternalHearts > 0 && player.redHearts < 1 && player.soulHearts < 1 && player.boneHearts < 2)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
if (amount > 0) bone_heart_break(player, isPenalized);
|
||||
}
|
||||
else amount = red_hearts_remove(player, amount, isRedFirst, isBoneFilled, damageFlags, isPenalized);
|
||||
|
||||
player.update_greeds_gullet();
|
||||
int golden = player.goldenHearts;
|
||||
@@ -322,6 +413,7 @@ static void hearts_remove(Entity_Player& player, int amount, uint64_t damageFlag
|
||||
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);
|
||||
return amount;
|
||||
}
|
||||
|
||||
// The items a landed hit sets off, Eve's Dead Bird and Samson's Bloody Lust the only ones written yet, then Tainted
|
||||
@@ -446,7 +538,7 @@ bool Entity_Player::TakeDamage(float damage, uint64_t damageFlags, const EntityR
|
||||
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,
|
||||
voice_play(source.type == ENTITY_MOM ? SOUND_MOM_VOX_EVILLAUGH : SOUND_MOM_VOX_FILTERED_EVILLAUGH, 1,
|
||||
random_below(SOUND_BOSS_DELAY_RANDOM) + SOUND_BOSS_DELAY_MIN, 1);
|
||||
|
||||
hit_items_check(*this, damageFlags, isPenalized);
|
||||
@@ -467,7 +559,7 @@ bool Entity_Player::TakeDamage(float damage, uint64_t damageFlags, const EntityR
|
||||
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);
|
||||
else if (amount > 0) amount = hearts_remove(*this, amount, damageFlags, isPenalized);
|
||||
|
||||
bool isAstral = HasCollectible(COLLECTIBLE_ASTRAL_PROJECTION) && !game.room->IsClear() &&
|
||||
!temporaryEffects.HasCollectibleEffect(COLLECTIBLE_ASTRAL_PROJECTION) && !astralProjectionBody;
|
||||
|
||||
Reference in new issue
Block a user