Curation round 25 (code only): the ultra horsemen and the Beast's background, the Scourge and Polty, the player's last gaps with the frame gate removed, game core, debug and daily, local co-op and player-controlled enemies, TMTRAINER, local versus, the vanilla Lua API, the special-daily fix, shared constants folded (60 duplicates, 10 offline gaps)
This commit is contained in:
1 parent
534339a496
commit
5c89798773
280 files changed
+14904
-5309
No files matched your search
+117
-18
@@ -100,10 +100,8 @@ constexpr float BISHOP_SHIELD_HEIGHT = -24;
|
||||
constexpr float BISHOP_SHIELD_NULL_Y = 4;
|
||||
constexpr float NULL_OFFSET_SCALE = 0.5f / 0.65f;
|
||||
|
||||
// Entity_Tear::HandleCollision: the hit countdown, the tears' push, the bounce of a just fired tear off a bomb, and
|
||||
// Entity_Tear::HandleCollision: the bounce of a just fired tear off a bomb, and
|
||||
// the burning tear's explosion chance from luck.
|
||||
constexpr int TEAR_HIT_COUNTDOWN = 30;
|
||||
constexpr float TEAR_PUSH_MIN_DISTANCE = 0.0001f;
|
||||
constexpr float TEAR_DEFLECTOR_MASS_SCALE = 0.1f;
|
||||
constexpr int BOMB_GRACE_FRAMES = 3;
|
||||
constexpr float FLY_PUSH = 0.5f;
|
||||
@@ -140,6 +138,18 @@ constexpr float BABY_CONTACT_DAMAGE = 10;
|
||||
constexpr float HORN_DAMAGE = 3.5f;
|
||||
constexpr float RAM_DAMAGE = 20;
|
||||
constexpr float RAM_FINISH_HEALTH = 40;
|
||||
// A versus ram deals 15 and waits a second, and Gamekid's touch scares a player (for the original's -60 frames).
|
||||
constexpr float RAM_VERSUS_DAMAGE = 15;
|
||||
constexpr int RAM_VERSUS_COOLDOWN = 30;
|
||||
constexpr int GAMEKID_VERSUS_FEAR = -60;
|
||||
// The kill trinkets a versus tear hit rolls.
|
||||
constexpr uint32_t LOCUST_ODDS_MASK = 0xf;
|
||||
constexpr uint32_t FISH_TAIL_EXTRA_ODDS = 5;
|
||||
constexpr uint32_t VERSUS_BAT_WING_ODDS = 50;
|
||||
constexpr uint32_t VERSUS_CRICKET_LEG_ODDS = 33;
|
||||
constexpr uint32_t VERSUS_SIGIL_ODDS = 10;
|
||||
constexpr int VERSUS_SIGIL_FRAMES = 30;
|
||||
constexpr int VERSUS_SIGIL_MAX_FRAMES = 150;
|
||||
constexpr int MIDAS_CONTACT_FREEZE = 90;
|
||||
constexpr int MIDAS_CONTACT_FREEZE_VERSUS = 45;
|
||||
constexpr float MIDAS_CONTACT_DAMAGE = 3.5f;
|
||||
@@ -221,7 +231,7 @@ static Entity_Effect* effect_spawn(int variant, int subType, Vector position, Ve
|
||||
// A random angle of a full turn, as the bursts draw it.
|
||||
static float random_angle()
|
||||
{
|
||||
float angle = random_unit() * RANDOM_HALF_TURN;
|
||||
float angle = random_unit() * PI_ROUGH;
|
||||
return angle + angle;
|
||||
}
|
||||
|
||||
@@ -317,7 +327,8 @@ static int coop_player_count()
|
||||
|
||||
// 006ace60 Queues a hit for the next update: nothing from a friendly source, nothing from a fire or countdown hit
|
||||
// while its cooldown runs, and nothing a Bishop shields. A boss takes less in co-op, a weakened entity double, and a
|
||||
// mod's MC_ENTITY_TAKE_DMG may cancel it. Whether the hit was queued.
|
||||
// mod's MC_ENTITY_TAKE_DMG may cancel it. A hit on an enemy (or a versus player) counts toward the damage its
|
||||
// attacking player dealt this frame. Whether the hit was queued.
|
||||
bool Entity::TakeDamage(float damage, uint64_t damageFlags, const EntityRef& source, int countdown)
|
||||
{
|
||||
if (type == ENTITY_PLAYER) log_printf(LOG_ASSERT, "Entity TakeDamage should not be called for Entity Player!");
|
||||
@@ -355,7 +366,10 @@ bool Entity::TakeDamage(float damage, uint64_t damageFlags, const EntityRef& sou
|
||||
damageEvents.push_back({.source = source, .damage = damage, .damageFlags = damageFlags});
|
||||
pendingDamageFlags |= damageFlags;
|
||||
pendingDamage += damage;
|
||||
// The damage the attacking player dealt is tallied only for the online stats screen, which is not written yet.
|
||||
|
||||
// The online stats screen also tallies the damage, which netplay being offline leaves out.
|
||||
Entity* attacker = source.entity ? source.entity->GetPlayerAncestor() : nullptr;
|
||||
if (attacker && is_enemy_type(type)) static_cast<Entity_Player*>(attacker)->versus.damageDealt += (uint32_t)damage;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -441,6 +455,28 @@ static void burst_drops_spawn(Entity& entity, int gibsAmount)
|
||||
}
|
||||
}
|
||||
|
||||
constexpr ColorMod BULB_FLASH_COLOR = {{1, 1, 0, 1}, {0, 0, 0, 0}, {0, 0, 0}};
|
||||
constexpr int BULB_FLASH_FRAMES = 3;
|
||||
constexpr float BULB_FLASH_SCALE = 0.75f;
|
||||
constexpr float BULB_FLASH_RAISE = -10;
|
||||
|
||||
// Part of 006b45c0: the Bulb's death flash, a yellow additive light 10 up for 3 frames.
|
||||
static void bulb_flash_spawn(const Vector& position)
|
||||
{
|
||||
npc_sound_play(SOUND_BULB_FLASH, 1, 2, 1);
|
||||
uint32_t seed = Random();
|
||||
auto* flash = static_cast<Entity_Effect*>(
|
||||
g_game->Spawn({.position = position, .type = ENTITY_EFFECT, .variant = EFFECT_LIGHT, .seed = seed}));
|
||||
flash->SetColor(BULB_FLASH_COLOR, -1, COLOR_PRIORITY_DEFAULT, false, true);
|
||||
flash->timeout = BULB_FLASH_FRAMES;
|
||||
flash->lifespan = BULB_FLASH_FRAMES;
|
||||
flash->sprite.scale = vector_make(BULB_FLASH_SCALE, BULB_FLASH_SCALE);
|
||||
flash->state = BULB_FLASH_FRAMES;
|
||||
flash->posOffset = vector_make(0, BULB_FLASH_RAISE);
|
||||
if (flash->sprite.animState.animData) flash->sprite.animState.SetFrameFloat(1);
|
||||
layer_additive_set(*flash->sprite.GetLayer(0));
|
||||
}
|
||||
|
||||
// 006b45c0 Bursts it: an iced or frozen enemy only shatters into shards, anything else plays its burst sound and
|
||||
// throws its config's gibs, a big burst (extra gore, or a huge config) shaking the screen, pushed away from the first
|
||||
// hit and with blood drops. It leaves a blood splat unless it is a bomb, a pickup or splashes no blood.
|
||||
@@ -467,8 +503,7 @@ void Entity::BloodExplode()
|
||||
}
|
||||
|
||||
burst_sound_play(*this);
|
||||
if (type == ENTITY_SUCKER && variant == SUCKER_BULB)
|
||||
reconstruction_missing("Entity::BloodExplode 006b45c0: the bulb's death flash");
|
||||
if (type == ENTITY_SUCKER && variant == SUCKER_BULB) bulb_flash_spawn(pos);
|
||||
|
||||
int gibsAmount = config->gibsAmount;
|
||||
if (gibsAmount >= 1 && HasEntityFlags(FLAG_REDUCE_GIBS)) gibsAmount = std::max(gibsAmount / REDUCED_GIBS_DIVISOR, 1);
|
||||
@@ -558,7 +593,7 @@ static Entity_Effect* gib_fling(const GibSpawn& gibs, int variant, int subType,
|
||||
// Part of 006b31b0: a tooth or chain gib, scattered within half the spread and flung at its own speed.
|
||||
static Entity_Effect* gib_scatter(const GibSpawn& gibs, int variant, uint32_t angleDraw)
|
||||
{
|
||||
float angle = (float)angleDraw * RANDOM_UNIT_SCALE * RANDOM_HALF_TURN;
|
||||
float angle = (float)angleDraw * RANDOM_UNIT_SCALE * PI_ROUGH;
|
||||
angle += angle;
|
||||
float reach = random_unit();
|
||||
Vector position = vector_add(gibs.position, vector_make(std::cos(angle) * reach * HALF_F * gibs.spread,
|
||||
@@ -707,7 +742,7 @@ static void tear_push(Entity_Tear& tear, Entity& collider, float massScale)
|
||||
{
|
||||
Vector offset = vector_sub(collider.pos, tear.pos);
|
||||
float distance = vector_length(offset);
|
||||
if (distance < TEAR_PUSH_MIN_DISTANCE) return;
|
||||
if (distance < PUSH_MIN_DISTANCE) return;
|
||||
|
||||
Vector relative = vector_sub(tear.velocity, collider.velocity);
|
||||
float speed = vector_length(relative);
|
||||
@@ -850,6 +885,54 @@ static TearContact tear_contact_get(Entity_Tear& tear, Entity& collider, Entity*
|
||||
return TEAR_CONTACT_HIT;
|
||||
}
|
||||
|
||||
// How many locusts a locust trinket sends: one, or with Fish Tail two (sometimes three doubled, four tripled).
|
||||
static int locust_count_get(Entity_Player& player)
|
||||
{
|
||||
if (!player.HasTrinket(TRINKET_FISH_TAIL)) return 1;
|
||||
int multiplier = player.GetTrinketMultiplier(TRINKET_FISH_TAIL);
|
||||
if (multiplier == 2) return Random() % FISH_TAIL_EXTRA_ODDS == 0 ? 3 : 2;
|
||||
if (multiplier == 3 && Random() % FISH_TAIL_EXTRA_ODDS == 0) return 4;
|
||||
return 2;
|
||||
}
|
||||
|
||||
// Part of 00673660: a versus player's tear landing on another player rolls its kill trinkets: each locust one in 16
|
||||
// (Conquest's twice as many), Bat Wing's flight one in 50, Cricket Leg's pickup one in 33 and Sigil of Baphomet's
|
||||
// shield one in 10 for a second, up to five.
|
||||
static void versus_hit_trinkets(Entity_Player& player)
|
||||
{
|
||||
TemporaryEffects& effects = player.temporaryEffects;
|
||||
for (int trinket = TRINKET_LOCUST_OF_WRATH; trinket <= TRINKET_LOCUST_OF_CONQUEST; trinket++)
|
||||
{
|
||||
if (!player.HasTrinket(trinket) || (Random() & LOCUST_ODDS_MASK) != 0) continue;
|
||||
int locusts = locust_count_get(player) * (trinket == TRINKET_LOCUST_OF_CONQUEST ? 2 : 1);
|
||||
for (int i = 0; i < locusts; i++)
|
||||
{
|
||||
uint32_t seed = Random();
|
||||
Entity* locust = g_game->Spawn({.position = player.pos, .spawner = &player,
|
||||
.subType = trinket - TRINKET_LOCUST_OF_WRATH + 1, .type = ENTITY_FAMILIAR,
|
||||
.variant = Entity_Familiar::BLUE_FLY, .seed = seed});
|
||||
locust->ClearEntityFlags(FLAG_APPEAR);
|
||||
}
|
||||
}
|
||||
if (player.HasTrinket(TRINKET_BAT_WING) && !effects.HasTrinketEffect(TRINKET_BAT_WING) &&
|
||||
player.GetTrinketRNG(TRINKET_BAT_WING).RandomInt(VERSUS_BAT_WING_ODDS) == 0)
|
||||
{
|
||||
effects.AddTrinketEffect(TRINKET_BAT_WING, true, 1);
|
||||
player.AddCostume(g_manager->itemConfig.GetNullItem(NULLITEM_BATWING_WINGS), false);
|
||||
}
|
||||
if (player.HasTrinket(TRINKET_CRICKET_LEG) && Random() % VERSUS_CRICKET_LEG_ODDS == 0) player.SpawnTrinketRandomPickup();
|
||||
if (!player.HasTrinket(TRINKET_SIGIL_OF_BAPHOMET) || Random() % VERSUS_SIGIL_ODDS != 0) return;
|
||||
|
||||
TemporaryEffect* shadows = effects.GetCollectibleEffect(COLLECTIBLE_BOOK_OF_SHADOWS);
|
||||
if (shadows && shadows->cooldown >= VERSUS_SIGIL_MAX_FRAMES) return;
|
||||
TemporaryEffect added;
|
||||
added.item = g_manager->itemConfig.GetCollectible(COLLECTIBLE_BOOK_OF_SHADOWS);
|
||||
added.cooldown = VERSUS_SIGIL_FRAMES;
|
||||
added.unknown = shadows ? 0 : 1;
|
||||
if (!shadows) sound_play(SOUND_BOOK_SHADOWS_SIGIL);
|
||||
effects.AddEffect(added, true, 1);
|
||||
}
|
||||
|
||||
// Part of 00673660: a tear hitting what it may hurt: whether its owner's side may hurt it, and whether it faces the
|
||||
// tear's way (a shielded front blocks). Piercing passes the fronts, and a spectral tear an obstacle with no grid
|
||||
// damage. Whether the tear flies through.
|
||||
@@ -872,10 +955,15 @@ static bool tear_damage_deal(Entity_Tear& tear, Entity& collider, bool& isHit)
|
||||
bool isSpectral = tear.tearFlags[TEAR_SPECTRAL];
|
||||
if (collider.IsEnemy() && (!isPiercing || isObstacle) && (!isSpectral || !isObstacle) && !isFacing) return false;
|
||||
if (isSpectral && isObstacle && tear.tearFlags[TEAR_NO_GRID_DAMAGE]) return true;
|
||||
if (g_game->deathmatchManager.is_active()) reconstruction_missing("Entity_Tear::HandleCollision 00673660: the versus trinkets");
|
||||
Entity_Player* shooterPlayer = shooter ? shooter->ToPlayer() : nullptr;
|
||||
if (g_game->deathmatchManager.is_active() && shooterPlayer)
|
||||
{
|
||||
shooterPlayer->trigger_vampire_charm_kill();
|
||||
if (collider.type == ENTITY_PLAYER) versus_hit_trinkets(*shooterPlayer);
|
||||
}
|
||||
|
||||
isHit = true;
|
||||
collider.TakeDamage(damage, damageFlags, EntityRef(&tear), TEAR_HIT_COUNTDOWN);
|
||||
collider.TakeDamage(damage, damageFlags, EntityRef(&tear), HIT_COUNTDOWN);
|
||||
if (tear.tearFlags[TEAR_FETUS_FLAG] && !isObstacle) tear.fetus_hit(collider);
|
||||
if (collider.IsEnemy()) tear.isCanTriggerStreakEnd = false;
|
||||
return collider.IsEnemy() && (tear.tearFlags[TEAR_BOOGER_FLAG] || tear.tearFlags[TEAR_STICKY] || tear.tearFlags[TEAR_SPORE_FLAG]);
|
||||
@@ -1017,8 +1105,8 @@ bool Entity_Tear::HandleCollision(Entity* collider, bool isLow)
|
||||
{
|
||||
apply_death_flag_effects(collider);
|
||||
if (tearFlags[TEAR_BELIAL_FLAG]) belial_turn();
|
||||
if (g_game->deathmatchManager.is_active() && collider->type == ENTITY_FAMILIAR)
|
||||
reconstruction_missing("Entity_Tear::HandleCollision 00673660: a versus familiar's block");
|
||||
bool isPassed = collider->type == ENTITY_FAMILIAR && !static_cast<Entity_Familiar*>(collider)->CanBlockProjectiles();
|
||||
if (g_game->deathmatchManager.is_active() && isPassed) return true;
|
||||
if (tear_flies_on(*this, *collider)) return true;
|
||||
deathFlags |= TEAR_DEATH_ENTITY;
|
||||
isDead = true;
|
||||
@@ -1084,7 +1172,8 @@ void Entity_NPC::on_player_damaged()
|
||||
}
|
||||
}
|
||||
|
||||
// Part of 0078e1f0: the damage a player's touch deals: the ramming items (more against the weak), Mom's Heels, The
|
||||
// Part of 0078e1f0: the damage a player's touch deals: in a versus fight 1 to a Sumo player (and Gamekid's fear), the
|
||||
// ramming items (more against the weak, 15 against a versus player once a second), Mom's Heels, The
|
||||
// Virus and Serpent's Kiss, Isaac's Heart's melee, Midas' Touch's gold freeze, the crow baby, Little Horn, Breath of Life, Aries at speed (which makes the player heavy and briefly unhurt),
|
||||
// Tooth and Nail, all tripled when thrown. Whether Breath of Life adds to it goes back through isBreath.
|
||||
static float player_contact_damage(Entity_Player& player, Entity& collider, bool& isBreath)
|
||||
@@ -1093,14 +1182,24 @@ static float player_contact_damage(Entity_Player& player, Entity& collider, bool
|
||||
TemporaryEffects& effects = player.temporaryEffects;
|
||||
float damage = 0;
|
||||
if (collider.type == ENTITY_PLAYER && g_game->deathmatchManager.is_fighting())
|
||||
reconstruction_missing("Entity_Player::HandleCollision 0078e1f0: the versus rules' contact damage");
|
||||
{
|
||||
damage = g_game->deathmatchManager.type->is_bouncy(static_cast<Entity_Player&>(collider)) ? 1 : 0;
|
||||
if (effects.HasCollectibleEffect(COLLECTIBLE_GAMEKID)) collider.AddFear(EntityRef(&player), GAMEKID_VERSUS_FEAR, false);
|
||||
}
|
||||
|
||||
TemporaryEffect* taurus = effects.GetCollectibleEffect(COLLECTIBLE_TAURUS);
|
||||
bool isRamming = effects.HasCollectibleEffect(COLLECTIBLE_MY_LITTLE_UNICORN) ||
|
||||
effects.HasCollectibleEffect(COLLECTIBLE_GAMEKID) || effects.HasCollectibleEffect(COLLECTIBLE_THE_NAIL) ||
|
||||
(taurus && taurus->cooldown != 0);
|
||||
if (isRamming && isVersus) reconstruction_missing("Entity_Player::HandleCollision 0078e1f0: the versus ramming cooldown");
|
||||
if (isRamming) damage += collider.health <= RAM_FINISH_HEALTH ? RAM_DAMAGE + RAM_DAMAGE : RAM_DAMAGE;
|
||||
if (isRamming && player.versus.ramCooldown == 0)
|
||||
{
|
||||
damage += collider.health <= RAM_FINISH_HEALTH ? RAM_DAMAGE + RAM_DAMAGE : RAM_DAMAGE;
|
||||
if (isVersus && collider.type == ENTITY_PLAYER)
|
||||
{
|
||||
damage = RAM_VERSUS_DAMAGE;
|
||||
player.versus.ramCooldown = RAM_VERSUS_COOLDOWN;
|
||||
}
|
||||
}
|
||||
if (player.HasCollectible(COLLECTIBLE_MOMS_HEELS)) damage += isVersus ? HEELS_DAMAGE_VERSUS : HEELS_DAMAGE;
|
||||
if (player.HasCollectible(COLLECTIBLE_VIRUS)) damage += isVersus ? VIRUS_DAMAGE_VERSUS : VIRUS_DAMAGE;
|
||||
if (player.HasCollectible(COLLECTIBLE_SERPENTS_KISS)) damage += isVersus ? VIRUS_DAMAGE_VERSUS : VIRUS_DAMAGE;
|
||||
|
||||
Reference in new issue
Block a user