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
@@ -0,0 +1,98 @@
|
||||
#include "npc_depths.h"
|
||||
#include "entity_tear.h"
|
||||
#include "game.h"
|
||||
#include "room_grid.h"
|
||||
#include "sfx_manager.h"
|
||||
|
||||
// The Nerve Ending stays rooted to its spot. Its second variant lashes at a prey (or its controller's aim) within 80
|
||||
// across and 20 up or down while idle, hurting everything in an 80 by 40 box 40 out to that side for 15 (players
|
||||
// for 1, under the 50 that makes it 2).
|
||||
constexpr float NERVE_FRICTION = 0.5f;
|
||||
constexpr float NERVE_DEADZONE = 0.1f;
|
||||
constexpr float NERVE_REACH = 80;
|
||||
constexpr float NERVE_REACH_HEIGHT = 20;
|
||||
constexpr float NERVE_BOX_HALF_WIDTH = 40;
|
||||
constexpr float NERVE_BOX_HALF_HEIGHT = 20;
|
||||
constexpr float NERVE_BOX_SHIFT = 40;
|
||||
constexpr float NERVE_DAMAGE = 15;
|
||||
constexpr float NERVE_PLAYER_THRESHOLD = 50;
|
||||
constexpr int NERVE_DAMAGE_COUNTDOWN = 30;
|
||||
constexpr float NERVE_TEAR_DAMAGE = 3.5f;
|
||||
constexpr float NERVE_HIT_PITCH = 0.8f;
|
||||
|
||||
// 006fefd0 The lash: everything collidable inside the box is hurt, players and familiars unless the lasher is friendly,
|
||||
// enemies (with the tear effects) only when it is charmed or friendly. The box's bottom is cut at its right edge's x,
|
||||
// as in the original. Deathmatch players are not told apart.
|
||||
static void nerve_ending_lash(Entity_NPC& npc, Vector low, Vector high)
|
||||
{
|
||||
EntityRef source(&npc);
|
||||
bool isHitPlayers = !npc.HasEntityFlags(FLAG_FRIENDLY);
|
||||
bool isHitEnemies = npc.HasEntityFlags(FLAG_CHARM | FLAG_FRIENDLY);
|
||||
Vector center = vector_make((high.x + low.x) * 0.5f, (high.y + low.y) * 0.5f);
|
||||
float radius = vector_length(vector_sub(high, low)) * 0.5f;
|
||||
|
||||
for (Entity* entity : entity_query_radius(center, radius, QUERY_ALL))
|
||||
{
|
||||
bool isInside = std::min(std::max(entity->pos.x, low.x), high.x) == entity->pos.x &&
|
||||
std::min(std::max(entity->pos.y, low.y), high.x) == entity->pos.y;
|
||||
if (!isInside || entity->entityCollisionClass == ENTCOLL_NONE) continue;
|
||||
|
||||
bool isPlayerSide = entity->type == ENTITY_PLAYER || entity->type == ENTITY_FAMILIAR;
|
||||
if (isPlayerSide && isHitPlayers)
|
||||
entity->TakeDamage(NERVE_DAMAGE < NERVE_PLAYER_THRESHOLD ? 1 : 2, 0, source, NERVE_DAMAGE_COUNTDOWN);
|
||||
else if (entity->type >= ENTITY_FIRST_ENEMY && entity->type <= ENTITY_LAST_ENEMY && isHitEnemies)
|
||||
{
|
||||
entity->TakeDamage(NERVE_DAMAGE, 0, source, NERVE_DAMAGE_COUNTDOWN);
|
||||
Entity_Tear::ApplyTearFlagEffects(entity, center, TearFlags{}, &npc, NERVE_TEAR_DAMAGE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The lashing Nerve Ending swings toward its prey while idle, and hurts what it sweeps on the "Hit" event.
|
||||
static void nerve_ending_swing(Entity_NPC& npc)
|
||||
{
|
||||
ANM2& sprite = npc.sprite;
|
||||
Vector toward = vector_sub(npc.GetPlayerTarget()->pos, npc.pos);
|
||||
if (sprite.animState.animData && sprite.animState.animData->isLooping)
|
||||
{
|
||||
if (npc.controllerID != -1) toward = npc.GetControllerMovementInput(NERVE_DEADZONE);
|
||||
bool isInReach =
|
||||
toward.x != 0 && std::abs(toward.y) < NERVE_REACH_HEIGHT && std::abs(toward.x) < NERVE_REACH;
|
||||
PlayMode mode = !sprite.animState.animData || !sprite.animState.isPlaying ? PLAY_FORCED : PLAY_UNFORCED;
|
||||
if (isInReach) sprite.Play(toward.x <= 0 ? "SwingLeft" : "SwingRight", mode);
|
||||
}
|
||||
if (!sprite.animState.animData) return sprite.Play("Idle");
|
||||
|
||||
if (sprite.animState.IsEventTriggered("Hit"))
|
||||
{
|
||||
npc_sound_play(SOUND_SCAMPER, 1, 2, 1);
|
||||
npc_sound_play(SOUND_SPLATTER, 1, 2, NERVE_HIT_PITCH);
|
||||
float shift = sprite.IsPlaying("SwingRight") ? NERVE_BOX_SHIFT : -NERVE_BOX_SHIFT;
|
||||
Vector low = vector_make(npc.pos.x - NERVE_BOX_HALF_WIDTH + shift, npc.pos.y - NERVE_BOX_HALF_HEIGHT);
|
||||
Vector high = vector_make(npc.pos.x + NERVE_BOX_HALF_WIDTH + shift, npc.pos.y + NERVE_BOX_HALF_HEIGHT);
|
||||
nerve_ending_lash(npc, low, high);
|
||||
}
|
||||
if (!sprite.animState.animData || !sprite.animState.isPlaying) sprite.Play("Idle");
|
||||
}
|
||||
|
||||
// 00537e20 The Nerve Ending's AI, for both Nerve Endings and the training Dummy: rooted to its spot, the second
|
||||
// Nerve Ending lashing out to its sides. The Dummy never loses health and tallies the damage it takes in v1.
|
||||
void npc_nerve_ending_update(Entity_NPC& npc)
|
||||
{
|
||||
if (npc.state == NPC_STATE_INIT)
|
||||
{
|
||||
npc.AddEntityFlags(FLAG_DONT_COUNT_BOSS_HP);
|
||||
npc.state = NPC_STATE_IDLE;
|
||||
npc.targetPosition = npc.pos;
|
||||
return;
|
||||
}
|
||||
|
||||
npc.velocity = vector_sub(npc.targetPosition, npc.pos);
|
||||
npc.friction *= NERVE_FRICTION;
|
||||
if (npc.type == ENTITY_NERVE_ENDING && npc.variant != 0) nerve_ending_swing(npc);
|
||||
else if (npc.type == ENTITY_NERVE_ENDING) npc.sprite.Play("Idle");
|
||||
if (npc.type != ENTITY_DUMMY) return;
|
||||
|
||||
npc.health = npc.maxHitPoints;
|
||||
for (const DamageEvent& hit : npc.damageEvents) npc.v1.x += hit.damage;
|
||||
}
|
||||
Reference in new issue
Block a user