Curation round 21: rock drops, Boss Rush and room setup, Dross, Ashpit and Gehenna enemies, Book of Virtues wisps and Dream Catcher, the last familiars and effects, player damage branches, a Corpse floor and Abyss crash fix, shared constants (186 duplicates)
This commit is contained in:
1 parent
8dbeb1bc4a
commit
6a11163842
184 files changed
+16980
-1419
No files matched your search
+62
-3
@@ -79,6 +79,13 @@ constexpr float DROWNED_CHARGE_SCALE = 0.9f;
|
||||
constexpr float DANK_CHARGE_SCALE = 14;
|
||||
constexpr int MAGGOT_CHARGE_SOUND_DELAY = 20;
|
||||
|
||||
// The Carrion Princess charges along a diagonal: at a target within 20 of one of its cell's diagonal lanes (20 to
|
||||
// either side of its cell's middle) in a clear line to 10 short of it, kept on that lane.
|
||||
constexpr float CARRION_TURN = 45;
|
||||
constexpr float CARRION_LANE_WIDTH = 20;
|
||||
constexpr float CARRION_LANE_SIDE = 20;
|
||||
constexpr float CARRION_END_SHORT = 10;
|
||||
|
||||
// A charge stops at the grid or a status, when it stalls for five frames (moving less than its speed's root of two),
|
||||
// or when it slows to a crawl while slowed.
|
||||
constexpr float CHARGE_STALL_SQUARED = 2;
|
||||
@@ -417,6 +424,52 @@ static void maggot_rest_update(Entity_NPC& npc)
|
||||
|
||||
// Starts a charge at its target (or its controller's push): in line with one of its axes, close and in a clear line
|
||||
// from its cell, it screams and dashes along that axis. The dank one shows its alert first.
|
||||
// The nearer of the two diagonal lanes through a cell, 20 to either side of its middle, across a charge.
|
||||
static Vector carrion_lane_get(Vector position, Vector cell, Vector across)
|
||||
{
|
||||
Vector left = vector_make(cell.x - CARRION_LANE_SIDE, cell.y);
|
||||
Vector right = vector_make(cell.x + CARRION_LANE_SIDE, cell.y);
|
||||
float leftOffset = vector_dot(vector_sub(position, left), across);
|
||||
float rightOffset = vector_dot(vector_sub(position, right), across);
|
||||
return std::abs(rightOffset) <= std::abs(leftOffset) ? right : left;
|
||||
}
|
||||
|
||||
// The Carrion Princess's charge along the diagonal its target lies on, from its lane in a clear line to the target.
|
||||
static void carrion_charge_try(Entity_NPC& npc, Vector cell, Vector spot, Vector delta)
|
||||
{
|
||||
Vector turned = vector_rotated(delta, CARRION_TURN);
|
||||
bool isOnDiagonal = std::abs(turned.x) < CARRION_LANE_WIDTH || std::abs(turned.y) < CARRION_LANE_WIDTH;
|
||||
if (!isOnDiagonal || npc.HasEntityFlags(FLAG_DISTRACTED)) return;
|
||||
|
||||
Vector direction = vector_rotated(vector_cardinal(turned), -CARRION_TURN);
|
||||
Vector across = vector_rotated(direction, RIGHT_ANGLE_DEGREES);
|
||||
Vector lane = carrion_lane_get(npc.pos, cell, across);
|
||||
Vector start = vector_sub(npc.pos, vector_scale(across, vector_dot(vector_sub(npc.pos, lane), across)));
|
||||
Vector end = vector_sub(vector_sub(spot, vector_scale(across, vector_dot(vector_sub(spot, lane), across))),
|
||||
vector_scale(direction, CARRION_END_SHORT));
|
||||
if (npc.controllerID == -1 && !room_check_line(start, end, LINE_MODE_CELL, 0)) return;
|
||||
|
||||
npc.PlaySound(SOUND_MAGGOTCHARGE, 1, MAGGOT_CHARGE_SOUND_DELAY, false, 1);
|
||||
npc.v1 = vector_scale(direction, MAGGOT_CHARGE_SPEED);
|
||||
npc.state = NPC_STATE_ATTACK;
|
||||
npc.stateFrame = 0;
|
||||
npc.v2 = npc.pos;
|
||||
npc.pathfinder.gridPathTarget = npc.pos;
|
||||
npc.pathfinder.moveCountdown = 0;
|
||||
}
|
||||
|
||||
// The Carrion Princess's charge: facing up or down its diagonal, kept on its lane.
|
||||
static void carrion_charge_steer(Entity_NPC& npc, Vector cell)
|
||||
{
|
||||
npc.sprite.Play(npc.v1.y >= 0 ? "Attack Down" : "Attack Up");
|
||||
npc.sprite.isFlipX = npc.v1.x < 0;
|
||||
Vector across = vector_normalized(vector_rotated(npc.v1, RIGHT_ANGLE_DEGREES));
|
||||
float offset = vector_dot(vector_sub(npc.pos, carrion_lane_get(npc.pos, cell, across)), across);
|
||||
float drift = vector_dot(npc.velocity, across);
|
||||
float keep = 1 - timescale_factor(CHARGE_ALIGN_FRICTION, npc.speedMultiplier);
|
||||
npc.velocity = vector_sub(npc.velocity, vector_scale(across, (offset + drift) * keep));
|
||||
}
|
||||
|
||||
static void maggot_charge_try(Entity_NPC& npc, MaggotFrame& frame)
|
||||
{
|
||||
Room& room = *g_game->room;
|
||||
@@ -431,6 +484,7 @@ static void maggot_charge_try(Entity_NPC& npc, MaggotFrame& frame)
|
||||
bool isControlled = npc.controllerID != -1;
|
||||
Vector delta = vector_sub(spot, cell);
|
||||
if (isControlled) delta = vector_scale(npc.GetControllerInput(0), CHARGE_INPUT_SCALE);
|
||||
if (npc.type == ENTITY_CHARGER && npc.variant == CHARGER_CARRION) return carrion_charge_try(npc, cell, spot, delta);
|
||||
if (npc.HasEntityFlags(FLAG_DISTRACTED) || frame.isClimbing) return;
|
||||
if (!isControlled)
|
||||
{
|
||||
@@ -602,6 +656,7 @@ static void maggot_charge_update(Entity_NPC& npc, MaggotFrame& frame)
|
||||
npc.AddVelocity_divided(npc.v1, false);
|
||||
Vector cell = g_game->room->GetGridPosition(frame.cell);
|
||||
if (npc.controllerID != -1) cell = npc.v2;
|
||||
if (npc.type == ENTITY_CHARGER && npc.variant == CHARGER_CARRION) return carrion_charge_steer(npc, cell);
|
||||
if (npc.type != ENTITY_GURGLING)
|
||||
{
|
||||
float keep = 1 - timescale_factor(CHARGE_ALIGN_FRICTION, npc.speedMultiplier);
|
||||
@@ -784,7 +839,8 @@ static void shadow_spread(Entity_NPC& npc)
|
||||
npc.velocity.y += npc.speedMultiplier * total.y;
|
||||
}
|
||||
|
||||
// The forward vector other code reads: the Gurgling's down, the others' facing.
|
||||
// The forward vector other code reads: the Gurgling's down, a charging Carrion Princess's diagonal, the others'
|
||||
// facing.
|
||||
static void maggot_forward_set(Entity_NPC& npc, int facing)
|
||||
{
|
||||
if (npc.type == ENTITY_GURGLING)
|
||||
@@ -792,6 +848,11 @@ static void maggot_forward_set(Entity_NPC& npc, int facing)
|
||||
npc.forwardVector = vector_make(0, 1);
|
||||
return;
|
||||
}
|
||||
if (npc.type == ENTITY_CHARGER && npc.variant == CHARGER_CARRION && npc.state == NPC_STATE_ATTACK)
|
||||
{
|
||||
npc.forwardVector = vector_normalized(npc.v1);
|
||||
return;
|
||||
}
|
||||
int direction = facing == FACING_UP ? DIRECTION_UP
|
||||
: facing == FACING_DOWN ? DIRECTION_DOWN
|
||||
: (npc.sprite.isFlipX ? DIRECTION_LEFT : DIRECTION_RIGHT);
|
||||
@@ -803,8 +864,6 @@ static void maggot_forward_set(Entity_NPC& npc, int facing)
|
||||
// the drowned one and the Leeches burst as they die, and the Gurglings leave trails and summon.
|
||||
void npc_maggot_update(Entity_NPC& npc)
|
||||
{
|
||||
if (npc.type == ENTITY_CHARGER && npc.variant == CHARGER_CARRION)
|
||||
reconstruction_missing("NpcAI::ENTITY_MAGGOT 0052db50: the Carrion Princess's diagonal charge");
|
||||
bool isShadow = npc.type == ENTITY_CHARGER && npc.variant == 0 && npc.subtype == MY_SHADOW_SUBTYPE;
|
||||
if (npc.type == ENTITY_LEECH && npc.variant != 0 && npc.IsControllerActionPressed(CONTROLLER_ACTION_BURST))
|
||||
npc.Kill(EntityRef());
|
||||
|
||||
Reference in new issue
Block a user