Curation round 14: console and Lua API, effects, lasers, enemies, eleven bosses, the Depths and Mom, status effects, the playable characters
This commit is contained in:
1 parent
8ae02a8422
commit
6e3da161fc
138 files changed
+16754
-6825
No files matched your search
+130
-11
@@ -1,5 +1,6 @@
|
||||
#include "level.h"
|
||||
#include "boss_pool.h"
|
||||
#include "entity_familiar.h"
|
||||
#include "entity_player.h"
|
||||
#include "game.h"
|
||||
#include "grid_entity_door.h"
|
||||
@@ -73,7 +74,6 @@ constexpr uint32_t SPECIAL_DAILY_DEALS = 17;
|
||||
constexpr uint32_t SPECIAL_DAILY_CURSED = 37;
|
||||
constexpr uint32_t SPECIAL_DAILY_CURSES = CURSE_OF_THE_LOST | CURSE_OF_THE_UNKNOWN | CURSE_OF_BLIND;
|
||||
|
||||
constexpr int ACHIEVEMENT_THE_WOMB = 4;
|
||||
constexpr int ACHIEVEMENT_EVERYTHING_IS_TERRIBLE = 33;
|
||||
constexpr int ACHIEVEMENT_STRANGE_DOOR = 635;
|
||||
constexpr int ACHIEVEMENT_SOMETHING_FROM_THE_FUTURE = 16;
|
||||
@@ -84,7 +84,6 @@ constexpr int ACHIEVEMENT_STORE_UPGRADE_1 = 151;
|
||||
constexpr int ACHIEVEMENT_STORE_UPGRADE_2 = 152;
|
||||
constexpr int ACHIEVEMENT_STORE_UPGRADE_3 = 153;
|
||||
constexpr int ACHIEVEMENT_STORE_UPGRADE_4 = 154;
|
||||
constexpr int ACHIEVEMENT_THE_VOID = 320;
|
||||
constexpr int ACHIEVEMENT_SOMETHING_WICKED = 346;
|
||||
constexpr int ACHIEVEMENT_SOMETHING_WICKED_PLUS = 347;
|
||||
constexpr int ACHIEVEMENT_THE_FORGOTTEN = 390;
|
||||
@@ -226,6 +225,25 @@ constexpr std::array<DoubleTroubleLock, 6> DOUBLE_TROUBLE_LOCKS = {{{ACHIEVEMENT
|
||||
{ACHIEVEMENT_SOMETHING_WICKED_PLUS, 67, 72}}};
|
||||
|
||||
constexpr int DEVILS_CROWN_TRIES = 10;
|
||||
|
||||
// The deal room draws ten times among the first 100 variants (the Womb's special one is 100). Krampus waits in 1 in
|
||||
// 20 devil rooms after a visited one, 3 with a deal taken, 10 more on the deals daily.
|
||||
constexpr int DEAL_ROOM_TRIES = 10;
|
||||
constexpr uint32_t DEAL_VARIANT_LAST = 99;
|
||||
constexpr uint32_t DEAL_VARIANT_WOMB = 100;
|
||||
constexpr uint32_t KRAMPUS_ROLL = 20;
|
||||
constexpr uint32_t KRAMPUS_ODDS_VISITED = 1;
|
||||
constexpr uint32_t KRAMPUS_ODDS_DEAL = 3;
|
||||
constexpr uint32_t KRAMPUS_ODDS_DEALS_DAILY = 10;
|
||||
|
||||
// The angel chance starts at 1 (half after Famine or a visited devil room) and each item adds a quarter of what is
|
||||
// left, ten donations half, a beggar left a tenth. Eucharist sets it past 1.
|
||||
constexpr float ANGEL_CHANCE_HALVED = 0.5f;
|
||||
constexpr float ANGEL_ITEM_SHARE = 0.25f;
|
||||
constexpr float ANGEL_DONATION_SHARE = 0.5f;
|
||||
constexpr float ANGEL_BEGGAR_SHARE = 0.1f;
|
||||
constexpr int ANGEL_DONATIONS = 10;
|
||||
constexpr float ANGEL_CHANCE_EUCHARIST = 77;
|
||||
constexpr uint32_t DEVILS_CROWN_VARIANT_LAST = 99;
|
||||
constexpr int GREED_SUBTYPE = 4;
|
||||
constexpr int GREED_SUBTYPE_SUPER = 11;
|
||||
@@ -2385,11 +2403,9 @@ static void corpse_door_splats_spawn(Level& level)
|
||||
if (!(target.flags & ROOM_DESCRIPTOR_FLAG_USE_ALTERNATE_BACKDROP)) continue;
|
||||
|
||||
RNG rng = {target.decorationSeed, 2, 15, 17};
|
||||
Vector direction{};
|
||||
Vector direction = direction_unit(door->direction);
|
||||
int gridIndex = (int)door->gridIndex;
|
||||
|
||||
Isaac::GetAxisAlignedUnitVectorFromDir(&direction, door->direction);
|
||||
|
||||
Vector out = {-direction.x, -direction.y};
|
||||
Vector across = {out.x * rotationCos - out.y * rotationSin, out.x * rotationSin + out.y * rotationCos};
|
||||
float baseX = out.x * SPLAT_DOOR_OFFSET + (float)(gridIndex % room.gridWidth) * GRID_CELL_SIZE + GRID_ORIGIN_X;
|
||||
@@ -2663,9 +2679,25 @@ bool Level::boss_count_adjust(int&, int&)
|
||||
}
|
||||
|
||||
// 0073fa20 Enters a room config directly, for debugging.
|
||||
void Level::DEBUG_goto_room(RoomConfig_Room*)
|
||||
void Level::DEBUG_goto_room(RoomConfig_Room* roomConfig)
|
||||
{
|
||||
reconstruction_missing("Level::DEBUG_goto_room 0073fa20");
|
||||
RoomDescriptor& debug = *GetRoomByIdx(ROOM_DEBUG_IDX);
|
||||
|
||||
for (GridEntityDesc& grid : debug.savedGridEntities) grid._type = 0;
|
||||
debug.flags &= ~ROOM_DESCRIPTOR_FLAG_CLEAR;
|
||||
debug.visitedCount = 0;
|
||||
debug.savedEntities.clear();
|
||||
debug.restrictedGridIndexes.clear();
|
||||
debug.savedEffects.clear();
|
||||
debug.allowedDoors = roomConfig->doors;
|
||||
debug.data = roomConfig;
|
||||
debug.spawnSeed = Random();
|
||||
debug.decorationSeed = Random();
|
||||
debug.awardSeed = Random();
|
||||
debug.bossDeathSeed = Random();
|
||||
debug.shopItemDiscountIdx = -1;
|
||||
debug.shopItemIdx = -1;
|
||||
g_game->StartRoomTransition({.animation = TRANSITION_WALK, .roomIndex = ROOM_DEBUG_IDX});
|
||||
}
|
||||
|
||||
// The floor's state flags the map effects keep, by bit, so they apply again.
|
||||
@@ -2945,10 +2977,95 @@ bool Level::CanSpawnDevilRoom()
|
||||
return std::popcount(roomList[lastBossRoomListIdx].data->doors & 0xff) > 1;
|
||||
}
|
||||
|
||||
// 007499a0 Picks the deal room.
|
||||
void Level::InitializeDevilAngelRoom(bool, bool)
|
||||
// 007f96f0 The chance the floor's deal room is an angel room: halved after Famine or a visited devil room, raised
|
||||
// by the Key Pieces, Book of Virtues, donations and a killed evil beggar, moved a tenth by a beggar left or an evil
|
||||
// one left, and scaled by the floor's own chance (none without it, unless no deal was taken since a devil room
|
||||
// spawned). Eucharist makes it sure.
|
||||
float get_angel_room_chance()
|
||||
{
|
||||
reconstruction_missing("Level::InitializeDevilAngelRoom 007499a0");
|
||||
Game& game = *g_game;
|
||||
PlayerManager& players = game.playerManager;
|
||||
auto isHeld = [&](int item) { return players.FirstCollectibleOwner(item, LAZARUS_SHARE_CHECK) != nullptr; };
|
||||
auto raise = [](float chance, float share) { return chance + (1 - chance) * share; };
|
||||
bool isFamineOrVisited = game.gameStateFlags & (1ull << GAME_STATE_FAMINE_SPAWNED | 1ull << GAME_STATE_DEVILROOM_VISITED);
|
||||
bool isDevilSpawned = game.gameStateFlags & (1ull << GAME_STATE_DEVILROOM_SPAWNED);
|
||||
|
||||
float chance = isFamineOrVisited ? ANGEL_CHANCE_HALVED : 1;
|
||||
if (isHeld(COLLECTIBLE_KEY_PIECE_1)) chance = raise(chance, ANGEL_ITEM_SHARE);
|
||||
if (isHeld(COLLECTIBLE_KEY_PIECE_2)) chance = raise(chance, ANGEL_ITEM_SHARE);
|
||||
if (isHeld(COLLECTIBLE_BOOK_OF_VIRTUES)) chance = raise(chance, ANGEL_ITEM_SHARE);
|
||||
if (game.donationModAngel >= ANGEL_DONATIONS) chance = raise(chance, ANGEL_DONATION_SHARE);
|
||||
|
||||
uint32_t flags = game.levelStateFlags;
|
||||
bool isBumLeft = flags & (1u << LEVEL_STATE_BUM_LEFT);
|
||||
bool isEvilBumLeft = flags & (1u << LEVEL_STATE_EVIL_BUM_LEFT);
|
||||
if (flags & (1u << LEVEL_STATE_EVIL_BUM_KILLED)) chance = raise(chance, ANGEL_ITEM_SHARE);
|
||||
if (isBumLeft != isEvilBumLeft) chance = raise(chance, isBumLeft ? ANGEL_BEGGAR_SHARE : -ANGEL_BEGGAR_SHARE);
|
||||
|
||||
bool isScaled = game.angelRoomChance > 0 || (isHeld(COLLECTIBLE_ACT_OF_CONTRITION) && isDevilSpawned) ||
|
||||
isHeld(COLLECTIBLE_BOOK_OF_VIRTUES);
|
||||
if (isScaled) chance = raise(chance, game.angelRoomChance);
|
||||
else if (!isDevilSpawned || game.devilRoomDeals != 0) chance = 0;
|
||||
if (isHeld(COLLECTIBLE_EUCHARIST)) chance = ANGEL_CHANCE_EUCHARIST;
|
||||
return std::clamp(chance, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
// How many of a boss room's doors could lead to a deal room: a slot the boss room has whose side the deal room has.
|
||||
static int deal_door_matches(uint32_t bossDoors, uint32_t dealDoors, int startSlot)
|
||||
{
|
||||
int matches = 0;
|
||||
for (int i = 0; i < DOOR_SLOT_COUNT; i++)
|
||||
{
|
||||
int slot = (startSlot + i) & (DOOR_SLOT_COUNT - 1);
|
||||
if ((bossDoors & (1u << slot)) && (dealDoors & (1u << ((slot - 2) & 3)))) matches++;
|
||||
}
|
||||
return matches;
|
||||
}
|
||||
|
||||
// 007499a0 Picks the floor's deal room once: an angel room on the angel roll (or when forced), else a devil room
|
||||
// (Number Magnet's kind with one). The Womb's first deal is the special one until It Lives! is unlocked. Up to ten
|
||||
// draws look for one that fits two of the last boss room's doors. Krampus may wait in a devil room once unlocked:
|
||||
// 1 in 20 after a visited devil room, 3 with a deal taken (10 more on the deals daily).
|
||||
void Level::InitializeDevilAngelRoom(bool isForceAngel, bool isForceDevil)
|
||||
{
|
||||
RoomDescriptor& desc = *GetRoomByIdx(ROOM_DEVIL_IDX);
|
||||
if (desc.data) return;
|
||||
|
||||
float angelChance = get_angel_room_chance();
|
||||
bool isAngelRoll = devilAngelRoomRNG.RandomFloat() < angelChance;
|
||||
int effectiveStage = (int)stage + (filter_curses(CURSE_OF_LABYRINTH) ? 1 : 0);
|
||||
RoomQuery query = room_query(STAGE_ID_SPECIAL_ROOMS, ROOM_DEVIL, 0);
|
||||
query.maxVariant = DEAL_VARIANT_LAST;
|
||||
if (effectiveStage == (int)STAGE_WOMB_II && IsStageWithinEnd(STAGE_SHEOL, isAngelRoll) &&
|
||||
!is_unlocked(ACHIEVEMENT_IT_LIVES))
|
||||
query.minVariant = query.maxVariant = DEAL_VARIANT_WOMB;
|
||||
if (isAngelRoll || isForceAngel) query.type = ROOM_ANGEL;
|
||||
if (isForceDevil) query.type = ROOM_DEVIL;
|
||||
if (query.type == ROOM_DEVIL) query.subtype = g_game->playerManager.AnyoneHasTrinket(TRINKET_NUMBER_MAGNET) ? 1 : 0;
|
||||
|
||||
desc.InitSeeds(devilAngelRoomRNG);
|
||||
for (int tries = DEAL_ROOM_TRIES; tries > 0; tries--)
|
||||
{
|
||||
desc.data = random_room_get(devilAngelRoomRNG.Next(), query, WEIGHT_KEEP);
|
||||
if (!CanSpawnDevilRoom()) break;
|
||||
|
||||
int startSlot = (int)(Random() & (DOOR_SLOT_COUNT - 1));
|
||||
if (deal_door_matches(roomList[lastBossRoomListIdx].data->doors, desc.data->doors, startSlot) >= 2) break;
|
||||
}
|
||||
|
||||
Game& game = *g_game;
|
||||
bool isKrampusFree = is_unlocked(ACHIEVEMENT_KRAMPUS) && !(game.gameStateFlags & (1ull << GAME_STATE_KRAMPUS_SPAWNED));
|
||||
if (query.type != ROOM_DEVIL || !isKrampusFree || query.subtype != 0) return;
|
||||
|
||||
uint32_t odds = 0;
|
||||
if (game.gameStateFlags & (1ull << GAME_STATE_DEVILROOM_VISITED | 1ull << GAME_STATE_KRAMPUS_SPAWNED))
|
||||
odds = game.devilRoomDeals > 0 ? KRAMPUS_ODDS_DEAL : KRAMPUS_ODDS_VISITED;
|
||||
bool isDealsDaily = game.dailyChallenge._specialDailyId == SPECIAL_DAILY_DEALS;
|
||||
if (isDealsDaily) odds += KRAMPUS_ODDS_DEALS_DAILY;
|
||||
if (devilAngelRoomRNG.Next() % KRAMPUS_ROLL >= odds || query.minVariant >= DEAL_VARIANT_WOMB) return;
|
||||
|
||||
desc.flags |= ROOM_DESCRIPTOR_FLAG_SURPRISE_MINIBOSS;
|
||||
if (!isDealsDaily) game.gameStateFlags |= 1ull << GAME_STATE_KRAMPUS_SPAWNED;
|
||||
}
|
||||
|
||||
// 0074ba00 Starts Mama Mega's explosion.
|
||||
@@ -3042,7 +3159,9 @@ bool Level::UpdateBackwardsPathStages()
|
||||
// 0074b960 The stage counted as in normal runs.
|
||||
int Level::GetAbsoluteStage()
|
||||
{
|
||||
reconstruction_missing("Level::GetAbsoluteStage 0074b960");
|
||||
if (g_game->difficulty != DIFFICULTY_GREED && g_game->difficulty != DIFFICULTY_GREEDIER) return (int)stage;
|
||||
if (stage < STAGE_GREED_SHEOL) return (int)stage * 2 - 1;
|
||||
return stage == STAGE_GREED_SHEOL ? STAGE_SHEOL : 0;
|
||||
}
|
||||
|
||||
// 0074bae0 The secret exit the floor's depth calls for, an XL floor counting as its second stage and the alternate path
|
||||
|
||||
Reference in new issue
Block a user