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
@@ -27,6 +27,7 @@
|
||||
#include <set>
|
||||
|
||||
constexpr float NECRONOMICON_DAMAGE = 40;
|
||||
constexpr int PANDORA_COINS = 20;
|
||||
constexpr float NECRONOMICON_VERSUS_DAMAGE = 20;
|
||||
constexpr float NECRONOMICON_VERSUS_PAGE_DAMAGE = 10;
|
||||
constexpr int NECRONOMICON_SHAKE = 15;
|
||||
@@ -1423,6 +1424,174 @@ static void diplopia_use(ItemUse& use)
|
||||
for (Entity* wisp : entity_query(ENTITY_FAMILIAR, Entity_Familiar::WISP))
|
||||
player.AddWisp(wisp->subtype, player.pos, false, false);
|
||||
}
|
||||
|
||||
// What Pandora's Box holds: count pickups of a variant and subtype, each at a free spot near the player.
|
||||
struct BoxPickups
|
||||
{
|
||||
int count = 1;
|
||||
int subType = 1;
|
||||
int variant = PICKUP_HEART;
|
||||
};
|
||||
|
||||
// Pandora's Box puts a pickup at a free spot near the player, seeded by the box.
|
||||
static void box_pickup_spawn(Entity_Player& player, const BoxPickups& pickup, uint32_t seed)
|
||||
{
|
||||
Vector spot = room_free_pickup_position_find({.position = player.pos, .step = PICKUP_SPOT_STEP});
|
||||
g_game->Spawn({.position = spot, .spawner = &player, .subType = pickup.subType, .type = ENTITY_PICKUP,
|
||||
.variant = pickup.variant, .seed = seed});
|
||||
}
|
||||
|
||||
// Pandora's Box spills pickups.
|
||||
static void box_pickups_spawn(Entity_Player& player, const BoxPickups& pickups)
|
||||
{
|
||||
for (int i = 0; i < pickups.count; i++)
|
||||
box_pickup_spawn(player, pickups, player.GetCollectibleRNG(COLLECTIBLE_BLUE_BOX).Next());
|
||||
}
|
||||
|
||||
// Pandora's Box puts count collectibles from a pool on pedestals.
|
||||
static void box_collectibles_spawn(Entity_Player& player, ItemPoolType pool, int count)
|
||||
{
|
||||
RNG& rng = player.GetCollectibleRNG(COLLECTIBLE_BLUE_BOX);
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
uint32_t seed = rng.Next();
|
||||
int item = g_game->itemPool.GetCollectible(pool, rng.Next(), 0, 0, 0);
|
||||
box_pickup_spawn(player, {.subType = item, .variant = PICKUP_COLLECTIBLE}, seed);
|
||||
}
|
||||
}
|
||||
|
||||
// Pandora's Box with the Strange Key: the key goes, and a collectible comes from each of the first pools of a shuffled
|
||||
// list (six, eight or ten with the key's multiplier). The original reads an unset tenth pool with a tripled key in
|
||||
// Greed mode. Here the draws stop at the end of the list.
|
||||
static void strange_key_open(Entity_Player& player)
|
||||
{
|
||||
constexpr std::array<ItemPoolType, 10> NORMAL_POOLS = {POOL_TREASURE, POOL_BOSS, POOL_SHOP, POOL_DEVIL, POOL_ANGEL,
|
||||
POOL_LIBRARY, POOL_GOLDEN_CHEST, POOL_CURSE, POOL_PLANETARIUM,
|
||||
POOL_SECRET};
|
||||
constexpr std::array<ItemPoolType, 9> GREED_POOLS = {POOL_GREED_TREASURE, POOL_GREED_BOSS, POOL_GREED_SHOP,
|
||||
POOL_GREED_DEVIL, POOL_GREED_ANGEL, POOL_LIBRARY,
|
||||
POOL_GOLDEN_CHEST, POOL_GREED_CURSE, POOL_PLANETARIUM};
|
||||
int multiplier = player.GetTrinketMultiplier(TRINKET_STRANGE_KEY);
|
||||
int count = multiplier == 2 ? 8 : multiplier == 3 ? 10 : 6;
|
||||
player.TryRemoveTrinket(TRINKET_STRANGE_KEY);
|
||||
std::vector<ItemPoolType> pools = g_game->IsGreedMode()
|
||||
? std::vector<ItemPoolType>(GREED_POOLS.begin(), GREED_POOLS.end())
|
||||
: std::vector<ItemPoolType>(NORMAL_POOLS.begin(), NORMAL_POOLS.end());
|
||||
|
||||
RNG& rng = player.GetCollectibleRNG(COLLECTIBLE_BLUE_BOX);
|
||||
for (size_t i = 0; i + 1 < pools.size(); i++)
|
||||
if (uint32_t offset = rng.RandomInt((uint32_t)(pools.size() - i)); offset != 0)
|
||||
std::swap(pools[i], pools[i + offset]);
|
||||
for (int i = 0; i < std::min(count, (int)pools.size()); i++) box_collectibles_spawn(player, pools[i], 1);
|
||||
}
|
||||
|
||||
// What Pandora's Box gives on a Greed mode floor, by the floor.
|
||||
static void greed_box_open(Entity_Player& player, int stage)
|
||||
{
|
||||
switch (stage)
|
||||
{
|
||||
case 1:
|
||||
box_pickups_spawn(player, {.count = 2, .variant = PICKUP_KEY});
|
||||
return box_pickups_spawn(player, {.count = 2, .variant = PICKUP_BOMB});
|
||||
case 2:
|
||||
box_collectibles_spawn(player, POOL_BOSS, 1);
|
||||
return box_pickups_spawn(player, {.count = 2, .subType = HEART_SOUL});
|
||||
case 3:
|
||||
return box_pickups_spawn(player, {.count = PANDORA_COINS, .variant = PICKUP_COIN});
|
||||
case 4:
|
||||
return box_collectibles_spawn(player, POOL_BOSS, 2);
|
||||
case 5:
|
||||
box_collectibles_spawn(player, POOL_DEVIL, 1);
|
||||
return box_pickups_spawn(player, {.subType = HEART_BLACK});
|
||||
case 6:
|
||||
case 7:
|
||||
return box_pickups_spawn(player, {.variant = PICKUP_COIN});
|
||||
default:
|
||||
log_printf(LOG_INFO, "[warn] Blue Box, can't generate a specific collectible for the current stage %d\n", stage);
|
||||
}
|
||||
}
|
||||
|
||||
// What Pandora's Box gives, by the floor: hearts, keys and bombs, coins, boss items, the Bible, a devil or angel deal
|
||||
// (by the floor's side), the Moving Box unlocked, nothing in the Chest, or the Red Key on the Home floor.
|
||||
static void box_open(Entity_Player& player, int stage)
|
||||
{
|
||||
switch (stage)
|
||||
{
|
||||
case 1:
|
||||
return box_pickups_spawn(player, {.count = 2, .subType = HEART_SOUL});
|
||||
case 2:
|
||||
box_pickups_spawn(player, {.count = 2, .variant = PICKUP_KEY});
|
||||
return box_pickups_spawn(player, {.count = 2, .variant = PICKUP_BOMB});
|
||||
case 3:
|
||||
return box_collectibles_spawn(player, POOL_BOSS, 1);
|
||||
case 4:
|
||||
box_collectibles_spawn(player, POOL_BOSS, 1);
|
||||
return box_pickups_spawn(player, {.count = 2, .subType = HEART_SOUL});
|
||||
case 5:
|
||||
return box_pickups_spawn(player, {.count = 4, .subType = HEART_SOUL});
|
||||
case 6:
|
||||
return box_pickups_spawn(player, {.count = PANDORA_COINS, .variant = PICKUP_COIN});
|
||||
case 7:
|
||||
return box_collectibles_spawn(player, POOL_BOSS, 2);
|
||||
case 8:
|
||||
return box_pickups_spawn(player, {.subType = COLLECTIBLE_BIBLE, .variant = PICKUP_COLLECTIBLE});
|
||||
case 10:
|
||||
if (!g_game->IsAltStage())
|
||||
{
|
||||
box_collectibles_spawn(player, POOL_DEVIL, 1);
|
||||
return box_pickups_spawn(player, {.subType = HEART_BLACK});
|
||||
}
|
||||
box_collectibles_spawn(player, POOL_ANGEL, 1);
|
||||
return box_pickups_spawn(player, {.subType = HEART_ETERNAL});
|
||||
case 11:
|
||||
if (g_game->IsAltStage()) return box_pickups_spawn(player, {.variant = PICKUP_COIN});
|
||||
g_manager->persistentGameData.TryUnlock(ACHIEVEMENT_MOVING_BOX);
|
||||
return;
|
||||
case 12:
|
||||
return;
|
||||
case 13:
|
||||
if (!g_manager->persistentGameData.Unlocked(ACHIEVEMENT_RED_KEY))
|
||||
g_manager->persistentGameData.TryUnlock(ACHIEVEMENT_RED_KEY);
|
||||
return box_pickups_spawn(player, {.subType = COLLECTIBLE_RED_KEY, .variant = PICKUP_COLLECTIBLE});
|
||||
default:
|
||||
log_printf(LOG_INFO, "[warn] Blue Box, can't generate a specific collectible for the current stage %d\n", stage);
|
||||
}
|
||||
}
|
||||
|
||||
// Pandora's Box: opened by a main player, it gives what the floor holds (or the Strange Key's collectibles), one wisp
|
||||
// per floor past the first with Book of Virtues and a devil familiar with Judas's kept Book of Belial. It goes once
|
||||
// owned, or used through the Void.
|
||||
static void pandoras_box_use(ItemUse& use)
|
||||
{
|
||||
constexpr std::array<int, 8> BELIAL_FAMILIARS = {278, 113, 360, 275, 417, 679, 565, 698};
|
||||
Entity_Player& player = use.player;
|
||||
if (player.variant != PLAYER_VARIANT_PLAYER) return use_animate(use);
|
||||
|
||||
sound_play_local(player, SOUND_PANDORAS_BOX);
|
||||
if (use.request.flags & (USE_OWNED | USE_VOID)) use.result.isRemove = true;
|
||||
int stage = g_game->stage;
|
||||
if (player.HasTrinket(TRINKET_STRANGE_KEY)) strange_key_open(player);
|
||||
else if (g_game->deathmatchManager.is_active())
|
||||
reconstruction_missing("Entity_Player::UseActiveItem 005b39d0 (Pandora's Box in a versus match)");
|
||||
else if (g_game->IsGreedMode()) greed_box_open(player, stage);
|
||||
else box_open(player, stage);
|
||||
|
||||
if (is_wisp_use(use))
|
||||
for (int i = 0; i < stage - 1; i++) player.AddWisp(COLLECTIBLE_BLUE_BOX, player.pos, false, false);
|
||||
if (player.HasCollectible(COLLECTIBLE_BOOK_OF_BELIAL_PASSIVE))
|
||||
{
|
||||
RNG& rng = player.GetCollectibleRNG(COLLECTIBLE_BLUE_BOX);
|
||||
int familiar = g_game->itemPool.GetCollectibleFromList(BELIAL_FAMILIARS, rng.Next(), COLLECTIBLE_DEMON_BABY,
|
||||
LIST_PICK_BLACKLIST);
|
||||
uint32_t seed = rng.Next();
|
||||
Vector spot = room_free_pickup_position_find({.position = player.pos, .step = PICKUP_SPOT_STEP});
|
||||
g_game->Spawn({.position = spot, .subType = familiar, .type = ENTITY_PICKUP, .variant = PICKUP_COLLECTIBLE,
|
||||
.seed = seed})
|
||||
->Update();
|
||||
}
|
||||
use_animate(use);
|
||||
}
|
||||
|
||||
// Runs the own effect of a Rebirth or early Afterbirth active (below 400) the main dispatch does not case. The ones not
|
||||
// written yet stop the game.
|
||||
void rebirth_item_effect_run(ItemUse& use)
|
||||
@@ -1524,6 +1693,8 @@ void rebirth_item_effect_run(ItemUse& use)
|
||||
return undefined_use(use);
|
||||
case COLLECTIBLE_VENTRICLE_RAZOR:
|
||||
return ventricle_razor_use(use);
|
||||
case COLLECTIBLE_BLUE_BOX:
|
||||
return pandoras_box_use(use);
|
||||
default:
|
||||
return active_missing_report(use);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user