Curation round 19: EvaluateItems and charged shots, actives split into Rebirth and Repentance dispatches, cards and runes, champions and death effects, War, Death, Uriel and the boss sweep, Delirium, T. Lilith's Gello and familiars, effects, price sprites and the devil room
This commit is contained in:
1 parent
9dfc09518c
commit
ee863e70e6
105 files changed
+14201
-2331
No files matched your search
+198
-389
@@ -5,6 +5,7 @@
|
||||
#include "entity_config.h"
|
||||
#include "entity_effect.h"
|
||||
#include "entity_familiar.h"
|
||||
#include "entity_laser.h"
|
||||
#include "entity_pickup.h"
|
||||
#include "entity_player.h"
|
||||
#include "entity_projectile.h"
|
||||
@@ -37,7 +38,6 @@ constexpr int ENTITY_FEAR_IMMUNE = 205;
|
||||
constexpr int ENTITY_NO_DECOY_TYPE = 213;
|
||||
constexpr uint32_t DOPLE_PICK_SHIFT = 11;
|
||||
constexpr int ENTITY_UNREACHABLE_EXEMPT = 886;
|
||||
constexpr int ENTITY_FLICKER_TYPE = 252;
|
||||
constexpr int ENTITY_DEATH_SPARK_TYPE = 882;
|
||||
constexpr int ENTITY_DAMAGE_NUMBERS_TYPE = 964;
|
||||
constexpr int ENTITY_ERASE_EXEMPT = 950;
|
||||
@@ -48,6 +48,7 @@ constexpr std::array<int, 9> FLUSH_TYPES = {217, 220, 223, 261, 402, 870, 871, 8
|
||||
constexpr int FLUSH_PROP_TYPE = 237;
|
||||
constexpr int FLUSH_PROP_VARIANT = 2;
|
||||
constexpr int FLUSH_RENDER_Z = 5000;
|
||||
constexpr int HUSH_ASH_SHAKE = 30;
|
||||
|
||||
// The bosses' death events: Isaac's cry, Baby Plum's last ring, Singe's blast, Mother's slam and Clutch's explosions.
|
||||
constexpr int ISAAC_DEATH_CRY_FRAME = 17;
|
||||
@@ -74,7 +75,6 @@ constexpr int ENTITY_FORWARD_DOWN_A = 262;
|
||||
constexpr int ENTITY_FORWARD_DOWN_B = 263;
|
||||
constexpr int DEATH_NO_BURST_FIRST = 74;
|
||||
constexpr int DEATH_NO_BURST_LAST = 76;
|
||||
constexpr int MULLIGAN_VARIANT_FLEEING = 2;
|
||||
constexpr int CHALLENGE_KILL_CHARGE = 33;
|
||||
constexpr std::string_view BIG_HORN_SPLASH_EVENT = "Poof";
|
||||
constexpr std::string_view DIRT_LAYER = "dirt";
|
||||
@@ -88,7 +88,6 @@ constexpr int MORPH_COLOR_PRIORITY = -1000;
|
||||
constexpr ColorMod COLOR_INVISIBLE = {{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0}};
|
||||
constexpr int UNREACHABLE_CHECK_FRAMES = 60;
|
||||
constexpr int UNREACHABLE_GRACE_FRAMES = 900;
|
||||
constexpr int SHRINK_PULSE_FRAMES = 60;
|
||||
constexpr float MIDAS_COIN_SPEED = 3;
|
||||
constexpr float TOXIC_CREEP_SCALE = 0.05f;
|
||||
constexpr int TOXIC_SHOCK_POISON = -40;
|
||||
@@ -116,6 +115,32 @@ constexpr float SHIELD_SECOND = 30;
|
||||
constexpr float SHIELD_BASE = 0.09f;
|
||||
constexpr float SHIELD_FALLOFF = 0.18f;
|
||||
constexpr uint32_t BLACK_HEART_CHANCE = 5;
|
||||
constexpr uint32_t STICKY_SPIDERS_RANGE = 3;
|
||||
constexpr uint32_t STICKY_SPIDERS_BLAST_RANGE = 5;
|
||||
constexpr int JAR_OF_FLIES_MAX = 20;
|
||||
constexpr float HALF_SPEED = 0.5f;
|
||||
constexpr float LADDER_FOOT_MARGIN = 0.5f;
|
||||
constexpr float LADDER_DROP_SPEED = 3.5f;
|
||||
|
||||
// The kill items: Contagion's cloud, Athame's ring at a quarter plus a fortieth of the luck, and the soul wisps
|
||||
// Book of Virtues takes from a captured enemy by its soul tag.
|
||||
constexpr float CONTAGION_RADIUS = 85;
|
||||
constexpr uint32_t ATHAME_RNG_SHIFT_INDEX = 66;
|
||||
constexpr float ATHAME_BASE_CHANCE = 0.25f;
|
||||
constexpr float ATHAME_LUCK_CHANCE = 0.025f;
|
||||
constexpr int ATHAME_RING_TIMEOUT = 60;
|
||||
constexpr int WISP_SOUL = 0x1000a;
|
||||
constexpr int WISP_SOUL_EXPLOSIVE = 0x1000b;
|
||||
constexpr int WISP_SOUL_HOMING = 0x1000c;
|
||||
constexpr int WISP_SOUL_BRIMSTONE = 0x1000d;
|
||||
|
||||
// A Brimstone marked enemy's burst: its mark and statuses spread within 120 with a hit of 10.
|
||||
constexpr float MARK_SPREAD_RADIUS = 120;
|
||||
constexpr int MARK_SPREAD_FRAMES = 150;
|
||||
constexpr int STATUS_SPREAD_FRAMES = 90;
|
||||
constexpr float MARK_SPREAD_DAMAGE = 10;
|
||||
constexpr int MARK_SPREAD_COUNTDOWN = 30;
|
||||
constexpr ColorMod SPREAD_SLOW_COLOR = {{1, 1, 1.3f, 1}, {0, 0, 0, 0}, {40 / 255.0f, 40 / 255.0f, 40 / 255.0f}};
|
||||
constexpr int SOUND_POOP_DEATH = 237;
|
||||
constexpr float POOP_DEATH_VOLUME = 0.9f;
|
||||
constexpr uint64_t FLAG_FRIENDLY_BALL_DYING = 1ull << 60;
|
||||
@@ -146,9 +171,6 @@ constexpr int COLLECTIBLE_SOUL_ID = 335;
|
||||
constexpr int COLLECTIBLE_TOXIC_SHOCK_ID = 350;
|
||||
constexpr int COLLECTIBLE_BETRAYAL_ID = 391;
|
||||
constexpr int COLLECTIBLE_SPIDER_MOD_ID = 403;
|
||||
constexpr int COLLECTIBLE_MAW_OF_THE_VOID_ID = 408;
|
||||
constexpr int COLLECTIBLE_JAR_OF_FLIES_ID = 434;
|
||||
constexpr int COLLECTIBLE_CONTAGION_ID = 466;
|
||||
constexpr int COLLECTIBLE_BROKEN_MODEM_ID = 514;
|
||||
constexpr int COLLECTIBLE_GUPPYS_EYE_ID = 665;
|
||||
constexpr int COLLECTIBLE_SALVATION_ID = 696;
|
||||
@@ -249,7 +271,7 @@ void npc_sound_play(int sound, float volume, int frameDelay, float pitch)
|
||||
}
|
||||
|
||||
// The size class of the poofs and blood bursts an NPC leaves: 1 small to 4 huge, the last only when isHugeAllowed.
|
||||
static int poof_size_get(Entity& entity, bool isHugeAllowed)
|
||||
int poof_size_get(Entity& entity, bool isHugeAllowed)
|
||||
{
|
||||
int poof = entity.size < POOF_SMALL_SIZE ? 1 : 2;
|
||||
if (entity.size >= POOF_LARGE_SIZE || entity.shadowSize > POOF_LARGE_SHADOW) poof = 3;
|
||||
@@ -258,7 +280,7 @@ static int poof_size_get(Entity& entity, bool isHugeAllowed)
|
||||
}
|
||||
|
||||
// Spawns an entity where an NPC stands.
|
||||
static Entity* spawn_at(int type, int variant, int subType, const Vector& position, Entity* spawner)
|
||||
Entity* spawn_at(int type, int variant, int subType, const Vector& position, Entity* spawner)
|
||||
{
|
||||
return g_game->Spawn({.position = position,
|
||||
.spawner = spawner,
|
||||
@@ -371,7 +393,7 @@ static float target_score_get(const Vector& position, Entity* source, Entity& ta
|
||||
|
||||
// 007069a0 What an enemy at a position goes after: the nearest visible player within reach (Dark Esau only Jacob),
|
||||
// else a Punching Bag or a baited enemy. An enemy forced onto a target keeps it.
|
||||
// The stand-in targets players keep (Entity_Player 0x144c and 0x1450) wait for Entity_Player to name them.
|
||||
// The stand-in target a player keeps at Entity_Player 0x144c waits for Entity_Player to name it.
|
||||
Entity* game_nearest_target_player(const Vector& position, Entity* source, bool isPlayersOnly, bool isTargetDecoys,
|
||||
float maxDistance)
|
||||
{
|
||||
@@ -396,7 +418,8 @@ Entity* game_nearest_target_player(const Vector& position, Entity* source, bool
|
||||
if (source && source->IsFriendly() && source->IsDamageSourceFriendly(EntityRef(candidate))) continue;
|
||||
|
||||
Entity* target = candidate;
|
||||
if (!isPlayersOnly && candidate->darkArtsLastSnare) target = candidate->darkArtsLastSnare->GetLastParent();
|
||||
if (!isPlayersOnly && candidate->bestFriend) target = candidate->bestFriend.get();
|
||||
else if (!isPlayersOnly && candidate->darkArtsLastSnare) target = candidate->darkArtsLastSnare->GetLastParent();
|
||||
Entity_Player* player = target && target->type == ENTITY_PLAYER ? static_cast<Entity_Player*>(target) : nullptr;
|
||||
if (!target) continue;
|
||||
|
||||
@@ -866,247 +889,9 @@ void Entity_NPC::SetBossColorIdx(int bossColorIdx, int)
|
||||
ResetColor();
|
||||
}
|
||||
|
||||
// A champion color's look, the exe's table at 00c354c0: the color its _champion sheets draw in (none without alpha)
|
||||
// and the color its sprite otherwise shows.
|
||||
struct ChampionLook
|
||||
{
|
||||
ColorMod sheetColor;
|
||||
ColorMod spriteColor;
|
||||
};
|
||||
|
||||
// A look from its sheet color's channels and its sprite's tint and offset.
|
||||
constexpr ChampionLook champion_look(float red, float green, float blue, float alpha, ColorMod spriteColor = COLOR_DEFAULT)
|
||||
{
|
||||
return {{{red, green, blue, alpha}, {0, 0, 0, 0}, {0, 0, 0}}, spriteColor};
|
||||
}
|
||||
|
||||
constexpr float CHAMPION_GLOW = 30 / 255.0f;
|
||||
constexpr std::array<ChampionLook, CHAMPION_COUNT> CHAMPION_LOOKS = {{
|
||||
champion_look(1, 0.1f, 0.1f, 1),
|
||||
champion_look(0.6f, 0.6f, 0, 1),
|
||||
champion_look(0.1f, 0.8f, 0.2f, 1),
|
||||
champion_look(1, 0.6f, 0.2f, 1),
|
||||
champion_look(0.2f, 0.2f, 1, 1),
|
||||
champion_look(0.03f, 0.24f, 0.24f, 1),
|
||||
champion_look(1, 1, 1, 1, {{1, 1, 1, 1}, {0, 0, 0, 0}, {90 / 255.0f, 90 / 255.0f, 90 / 255.0f}}),
|
||||
champion_look(0.5f, 0.5f, 0.5f, 1),
|
||||
champion_look(1, 1, 1, 1, {{1, 1, 1, 0.6f}, {0, 0, 0, 0}, {120 / 255.0f, 120 / 255.0f, 120 / 255.0f}}),
|
||||
champion_look(0, 0, 0, 0, {{0, 0, 0, 1}, {0, 0, 0, 0}, {0, 0, 0}}),
|
||||
champion_look(1, 0, 1, 1),
|
||||
champion_look(0.75f, 0, 1, 1),
|
||||
champion_look(0.5f, 0, 0, 1),
|
||||
champion_look(0.5f, 0.5f, 1, 1),
|
||||
champion_look(0, 0, 0, 0),
|
||||
champion_look(0.1f, 0.8f, 0.2f, 1, {{0.9f, 1, 0.9f, 1}, {0, 0, 0, 0}, {0, CHAMPION_GLOW, 0}}),
|
||||
champion_look(0.5f, 0.5f, 0.5f, 1, {{0.9f, 0.9f, 0.9f, 1}, {0, 0, 0, 0}, {CHAMPION_GLOW, CHAMPION_GLOW, CHAMPION_GLOW}}),
|
||||
champion_look(0.8f, 0.8f, 0.8f, 1, {{1, 1, 1, 1}, {0, 0, 0, 0}, {50 / 255.0f, 50 / 255.0f, 50 / 255.0f}}),
|
||||
champion_look(0, 0, 0, 0),
|
||||
champion_look(0, 0, 0, 0),
|
||||
champion_look(1, 0.2f, 0.2f, 1, {{1, 0.9f, 0.9f, 1}, {0, 0, 0, 0}, {CHAMPION_GLOW, 0, 0}}),
|
||||
champion_look(0, 0, 0, 0),
|
||||
champion_look(0, 0, 0, 0),
|
||||
champion_look(0.3f, 0.3f, 0.3f, 1, {{0.8f, 0.8f, 0.8f, 1}, {0, 0, 0, 0}, {0, 0, 0}}),
|
||||
champion_look(0.28f, 0.14f, 0.134f, 1),
|
||||
champion_look(1, 1, 1, 1),
|
||||
}};
|
||||
|
||||
// The colors a seed's champion roll picks among: the common ones (the late stages' with yellow), the rare, the
|
||||
// pulsing and sized, the late stages' special ones, and the late stages' uncommon ones.
|
||||
constexpr std::array<int, 6> CHAMPIONS_EARLY = {CHAMPION_RED, CHAMPION_GREEN, CHAMPION_DARK_GREEN,
|
||||
CHAMPION_GREY, CHAMPION_PINK, CHAMPION_LIGHT_BLUE};
|
||||
constexpr std::array<int, 7> CHAMPIONS_LATE = {CHAMPION_RED, CHAMPION_YELLOW, CHAMPION_GREEN, CHAMPION_DARK_GREEN,
|
||||
CHAMPION_GREY, CHAMPION_PINK, CHAMPION_LIGHT_BLUE};
|
||||
constexpr std::array<int, 3> CHAMPIONS_RARE = {CHAMPION_ORANGE, CHAMPION_DARK_BLUE, CHAMPION_DARK_RED};
|
||||
constexpr std::array<int, 6> CHAMPIONS_PULSING = {CHAMPION_CAMO, CHAMPION_PULSE_GREEN, CHAMPION_PULSE_GREY,
|
||||
CHAMPION_FLY_PROTECTED, CHAMPION_TINY, CHAMPION_GIANT};
|
||||
constexpr std::array<int, 4> CHAMPIONS_SPECIAL = {CHAMPION_PULSE_RED, CHAMPION_SIZE_PULSE, CHAMPION_KING,
|
||||
CHAMPION_DEATH};
|
||||
constexpr std::array<int, 4> CHAMPIONS_UNCOMMON = {CHAMPION_TRANSPARENT, CHAMPION_FLICKER, CHAMPION_PURPLE,
|
||||
CHAMPION_BROWN};
|
||||
constexpr uint32_t CHAMPION_RNG_SHIFT_INDEX = 33;
|
||||
constexpr uint32_t CHAMPION_LATE_STAGE = 5;
|
||||
constexpr uint32_t CHAMPION_YELLOW_STAGE = 3;
|
||||
constexpr uint32_t CHAMPION_PULSING_EARLY_COUNT = 4;
|
||||
constexpr float CHAMPION_ROLL_WHITE = 0.005f;
|
||||
constexpr float CHAMPION_ROLL_RAINBOW = 0.01f;
|
||||
constexpr float CHAMPION_ROLL_UNCOMMON = 0.05f;
|
||||
constexpr float CHAMPION_ROLL_RARE = 0.15f;
|
||||
constexpr float CHAMPION_ROLL_PULSING = 0.3f;
|
||||
constexpr float CHAMPION_ROLL_SPECIAL = 0.35f;
|
||||
constexpr std::array<int, 4> CHAMPION_NO_DARK_RED_TYPES = {240, 241, 242, 304};
|
||||
constexpr int ENTITY_NO_WHITE_CHAMPION = 889;
|
||||
|
||||
// The champions' health, speed, size and contact damage, and the effect variant some keep around them.
|
||||
constexpr float CHAMPION_SCALE = 1.15f;
|
||||
constexpr float CHAMPION_TINY_SCALE = 0.5f;
|
||||
constexpr float CHAMPION_GIANT_SCALE = 1.5f;
|
||||
constexpr float CHAMPION_CONTACT_DAMAGE = 2;
|
||||
constexpr float CHAMPION_DEATH_CONTACT_DAMAGE = 4;
|
||||
constexpr float CHAMPION_HP_RED = 1.333f;
|
||||
constexpr float CHAMPION_HP_YELLOW = 0.75f;
|
||||
constexpr float CHAMPION_HP_GREY = 0.333f;
|
||||
constexpr float CHAMPION_HP_BIG = 1.5f;
|
||||
constexpr float CHAMPION_HP_KING = 3;
|
||||
constexpr float CHAMPION_SPEED_FAST = 1.333f;
|
||||
constexpr float CHAMPION_SPEED_SLOW = 0.8f;
|
||||
constexpr float CHAMPION_SPEED_GIANT = 0.9f;
|
||||
constexpr int CHAMPION_FLICKER_MIN = 60;
|
||||
constexpr int CHAMPION_FLICKER_RANGE = 30;
|
||||
constexpr int CHAMPION_SHOT_MIN = 40;
|
||||
constexpr int CHAMPION_SHOT_RANGE = 20;
|
||||
constexpr int EFFECT_PULLING = 57;
|
||||
constexpr int CHAMPION_CREEP_FRAMES = 7;
|
||||
constexpr int CHAMPION_CREEP_TIMEOUT = 30;
|
||||
constexpr float CHAMPION_SHOT_SPEED = 5;
|
||||
constexpr float CHAMPION_SHOT_FALL_ACCEL = 0.3f;
|
||||
constexpr float CHAMPION_SHOT_FALL_SPEED = -5;
|
||||
constexpr float FLICKER_FADE = 0.05f;
|
||||
constexpr ColorMod FRIENDLY_COLOR = {{0.8f, 0.8f, 0.8f, 1}, {1, 1, 1, -0.5f}, {0.1f, 0.1f, 0.1f}};
|
||||
constexpr ColorMod FROZEN_COLOR = {{0.8f, 0.8f, 0.8f, 1}, {1, 1, 1, 0.5f}, {0.3f, 0.5f, 0.8f}};
|
||||
|
||||
// Where a flickering champion is in its fade.
|
||||
enum FlickerState : int
|
||||
{
|
||||
FLICKER_SHOWN,
|
||||
FLICKER_FADING_OUT,
|
||||
FLICKER_FADING_IN,
|
||||
FLICKER_HIDDEN
|
||||
};
|
||||
constexpr int PULLING_PURPLE = 0;
|
||||
constexpr int PULLING_GREY = 1;
|
||||
constexpr int PULLING_RED = 2;
|
||||
constexpr ColorMod PULLING_RED_COLOR = {{1, 0.2f, 0.2f, 1}, {0, 0, 0, 0}, {0, 0, 0}};
|
||||
|
||||
// 00505b80 The color a champion shows over a sprite without its sheets: its sheet color laid over its sprite color
|
||||
// (Color::__mul), or the sprite color for a look drawn on no sheet.
|
||||
ColorMod champion_sprite_color_get(int championColor)
|
||||
{
|
||||
const ChampionLook& look = CHAMPION_LOOKS[championColor];
|
||||
if (look.sheetColor._tint[3] <= 0) return look.spriteColor;
|
||||
|
||||
ColorMod color = look.sheetColor;
|
||||
const ColorMod& other = look.spriteColor;
|
||||
for (int i = 0; i < 4; i++) color._tint[i] *= other._tint[i];
|
||||
if (other._colorize[0] + other._colorize[1] + other._colorize[2] != 0)
|
||||
for (int i = 0; i < 4; i++) color._colorize[i] = other._colorize[i];
|
||||
for (int i = 0; i < 3; i++) color._offset[i] += other._offset[i];
|
||||
return color;
|
||||
}
|
||||
|
||||
// The sheet color of a champion color's look, or none for a look drawn on no _champion sheet.
|
||||
const ColorMod* champion_color_get(int championColor)
|
||||
{
|
||||
if (championColor < 0 || championColor >= CHAMPION_COUNT) return nullptr;
|
||||
const ColorMod& sheetColor = CHAMPION_LOOKS[championColor].sheetColor;
|
||||
return sheetColor._tint[3] > 0 ? &sheetColor : nullptr;
|
||||
}
|
||||
|
||||
// Part of 006d03e0: a seed's champion color by the stage: rarely white or rainbow and uncommonly a strange one late,
|
||||
// else a rare, pulsing or sized, special late, or common one.
|
||||
static int champion_color_roll(uint32_t seed)
|
||||
{
|
||||
RNG rng;
|
||||
rng.SetSeed(seed, CHAMPION_RNG_SHIFT_INDEX);
|
||||
float roll = rng.RandomFloat();
|
||||
uint32_t stage = g_game->stage;
|
||||
bool isLate = stage >= CHAMPION_LATE_STAGE;
|
||||
|
||||
if (roll < CHAMPION_ROLL_RAINBOW && isLate) return roll < CHAMPION_ROLL_WHITE ? CHAMPION_WHITE : CHAMPION_RAINBOW;
|
||||
if (roll < CHAMPION_ROLL_UNCOMMON && isLate) return CHAMPIONS_UNCOMMON[rng.RandomInt(CHAMPIONS_UNCOMMON.size())];
|
||||
if (roll < CHAMPION_ROLL_RARE) return CHAMPIONS_RARE[rng.RandomInt(CHAMPIONS_RARE.size())];
|
||||
if (roll < CHAMPION_ROLL_PULSING)
|
||||
{
|
||||
uint32_t count = stage >= CHAMPION_YELLOW_STAGE ? CHAMPIONS_PULSING.size() : CHAMPION_PULSING_EARLY_COUNT;
|
||||
return CHAMPIONS_PULSING[rng.RandomInt(count)];
|
||||
}
|
||||
if (roll < CHAMPION_ROLL_SPECIAL && isLate) return CHAMPIONS_SPECIAL[rng.RandomInt(CHAMPIONS_SPECIAL.size())];
|
||||
if (stage < CHAMPION_YELLOW_STAGE) return CHAMPIONS_EARLY[rng.RandomInt(CHAMPIONS_EARLY.size())];
|
||||
return CHAMPIONS_LATE[rng.RandomInt(CHAMPIONS_LATE.size())];
|
||||
}
|
||||
|
||||
// Part of 006d03e0: what a champion color changes beside the look: health, speed, grid collision, timers, and the
|
||||
// pulling effect or eternal fly some keep with them.
|
||||
void Entity_NPC::champion_traits_apply(bool isInit)
|
||||
{
|
||||
switch (championColorIdx)
|
||||
{
|
||||
case CHAMPION_RED: maxHitPoints *= CHAMPION_HP_RED; break;
|
||||
case CHAMPION_YELLOW:
|
||||
championSpeed = CHAMPION_SPEED_FAST;
|
||||
maxHitPoints *= CHAMPION_HP_YELLOW;
|
||||
break;
|
||||
case CHAMPION_GREY: maxHitPoints *= CHAMPION_HP_GREY; [[fallthrough]];
|
||||
case CHAMPION_DARK_BLUE: championSpeed = CHAMPION_SPEED_SLOW; break;
|
||||
case CHAMPION_TRANSPARENT: entityGridCollisionClass = GRIDCOLL_WALLS; break;
|
||||
case CHAMPION_FLICKER: flickerTimer = random_below(CHAMPION_FLICKER_RANGE) + CHAMPION_FLICKER_MIN; break;
|
||||
case CHAMPION_PINK: championTimer = random_below(CHAMPION_SHOT_RANGE) + CHAMPION_SHOT_MIN; break;
|
||||
case CHAMPION_PURPLE: spawn_at(ENTITY_EFFECT, EFFECT_PULLING, PULLING_PURPLE, pos, this)->parent = this; break;
|
||||
case CHAMPION_PULSE_GREY: spawn_at(ENTITY_EFFECT, EFFECT_PULLING, PULLING_GREY, pos, this)->parent = this; break;
|
||||
case CHAMPION_FLY_PROTECTED:
|
||||
if (!isInit) reconstruction_missing("Entity_NPC::MakeChampion 006d03e0: the fly protected champion's fly");
|
||||
break;
|
||||
case CHAMPION_TINY:
|
||||
maxHitPoints *= CHAMPION_HP_GREY;
|
||||
championSpeed *= CHAMPION_SPEED_FAST;
|
||||
break;
|
||||
case CHAMPION_GIANT:
|
||||
maxHitPoints *= CHAMPION_HP_BIG;
|
||||
championSpeed *= CHAMPION_SPEED_GIANT;
|
||||
[[fallthrough]];
|
||||
case CHAMPION_DEATH:
|
||||
if (collisionDamage > 0) collisionDamage = CHAMPION_DEATH_CONTACT_DAMAGE;
|
||||
break;
|
||||
case CHAMPION_PULSE_RED:
|
||||
{
|
||||
Entity* pulling = spawn_at(ENTITY_EFFECT, EFFECT_PULLING, PULLING_RED, pos, this);
|
||||
pulling->parent = this;
|
||||
pulling->SetColor(PULLING_RED_COLOR, -1, COLOR_PRIORITY_DEFAULT, false, true);
|
||||
break;
|
||||
}
|
||||
case CHAMPION_KING: maxHitPoints *= CHAMPION_HP_KING; break;
|
||||
case CHAMPION_RAINBOW: reconstruction_missing("Entity_NPC::MakeChampion 006d03e0: the rainbow champion");
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
// 006d03e0 Makes it a champion of a color, or of one its seed draws for the stage at -1: twice the health and 2
|
||||
// contact damage, its size (half for the tiny, 1.5 for the giant, 1.15 else), its champion sprite and its color's
|
||||
// traits. Dark red never befalls the slides and white not the fly protected kind. Only Init makes a champion twice.
|
||||
void Entity_NPC::MakeChampion(uint32_t seed, int championColor, bool isInit)
|
||||
{
|
||||
if (isChampion && !isInit) return;
|
||||
|
||||
float baseMaxHitPoints = maxHitPoints;
|
||||
maxHitPoints = baseMaxHitPoints + baseMaxHitPoints;
|
||||
ResetColor();
|
||||
if (collisionDamage > 0) collisionDamage = CHAMPION_CONTACT_DAMAGE;
|
||||
isChampion = true;
|
||||
championColorIdx = championColor;
|
||||
if (championColor < 0) championColor = champion_color_roll(seed);
|
||||
|
||||
bool isNoDarkRed = std::ranges::find(CHAMPION_NO_DARK_RED_TYPES, type) != CHAMPION_NO_DARK_RED_TYPES.end();
|
||||
if (championColor == CHAMPION_DARK_RED && isNoDarkRed) championColor = CHAMPION_RED;
|
||||
else if (championColor == CHAMPION_WHITE && type == ENTITY_NO_WHITE_CHAMPION) championColor = CHAMPION_FLY_PROTECTED;
|
||||
championColorIdx = std::clamp(championColor, (int)CHAMPION_RED, (int)CHAMPION_RAINBOW);
|
||||
|
||||
float championScale = CHAMPION_SCALE;
|
||||
if (championColorIdx == CHAMPION_TINY)
|
||||
{
|
||||
SetSize(size * CHAMPION_TINY_SCALE, sizeMulti, config->gridCollisionPoints);
|
||||
championScale = CHAMPION_TINY_SCALE;
|
||||
}
|
||||
else if (championColorIdx == CHAMPION_GIANT) championScale = CHAMPION_GIANT_SCALE;
|
||||
scale = championScale;
|
||||
sprite.scale = vector_make(championScale * shrinkStatus1, championScale * shrinkStatus1);
|
||||
load_graphics(false);
|
||||
champion_traits_apply(isInit);
|
||||
|
||||
if (type == ENTITY_MULLIGAN && variant == MULLIGAN_VARIANT_FLEEING)
|
||||
maxHitPoints = std::min(maxHitPoints, baseMaxHitPoints);
|
||||
if (!isInit) health = maxHitPoints;
|
||||
ResetColor();
|
||||
}
|
||||
|
||||
// The enemy a "random enemy" spawn (type 306) turns into on each stage, on Normal and on Hard.
|
||||
struct StageEnemy
|
||||
{
|
||||
@@ -1608,8 +1393,12 @@ void Entity_NPC::death_animation_update()
|
||||
death_events_update(*this);
|
||||
|
||||
if (const NullFrame* bloodGuide = sprite.GetNullFrame("BloodGuide")) npc_blood_guide_update(*this, *bloodGuide);
|
||||
if (type == ENTITY_HUSH && sprite.IsEventTriggered("ash"))
|
||||
reconstruction_missing("Entity_NPC::Update 006c4b30: the ash a boss leaves");
|
||||
if (type == ENTITY_HUSH && sprite.IsEventTriggered("ash") && !HasEntityFlags(FLAG_DELIRIUM_FORM))
|
||||
{
|
||||
if (Entity* ashes = spawn_at(ENTITY_EFFECT, EFFECT_HUSH_ASHES, 0, pos, this)) ashes->Update();
|
||||
game_shake_screen(HUSH_ASH_SHAKE);
|
||||
npc_sound_play(SOUND_SUPERHOLY, 1, 2, 1);
|
||||
}
|
||||
if (sprite.IsFinished() && isExists) trigger_kill_item_effects();
|
||||
}
|
||||
|
||||
@@ -1657,109 +1446,6 @@ void Entity_NPC::decoy_update()
|
||||
else if (decoyTargetTimer != 0) decoyTargetTimer--;
|
||||
}
|
||||
|
||||
// Part of 006c4b30: what a champion's color does each frame (the fly-spawning, flickering, regenerating, pulsing,
|
||||
// creep and shot champions), and Wrath's twin flicker.
|
||||
void Entity_NPC::champion_update()
|
||||
{
|
||||
const NullFrame* overlay = sprite.animState.animData ? sprite.animState.GetNullFrame("OverlayEffect") : nullptr;
|
||||
bool isEffectShown = !overlay || overlay->isVisible;
|
||||
bool isShrunk = HasEntityFlags(FLAG_SHRINK);
|
||||
int champion = championColorIdx;
|
||||
|
||||
bool isGreen = champion == CHAMPION_GREEN || champion == CHAMPION_RAINBOW;
|
||||
if (isGreen && isEffectShown && IsFrame(CHAMPION_CREEP_FRAMES, 0) && !isShrunk)
|
||||
{
|
||||
Entity_Effect* creep = static_cast<Entity_Effect*>(spawn_at(ENTITY_EFFECT, EFFECT_CREEP_GREEN, 0, pos, this));
|
||||
creep->SetTimeout(CHAMPION_CREEP_TIMEOUT);
|
||||
creep->Update();
|
||||
}
|
||||
if (champion == CHAMPION_BROWN) reconstruction_missing("Entity_NPC::Update 006c4b30: the brown champion's poop");
|
||||
if (champion == CHAMPION_WHITE) white_champion_update();
|
||||
if (champion == CHAMPION_FLICKER || type == ENTITY_FLICKER_TYPE) flicker_update();
|
||||
if (champion == CHAMPION_TRANSPARENT) entityGridCollisionClass = GRIDCOLL_WALLS;
|
||||
else if ((champion == CHAMPION_PINK || champion == CHAMPION_RAINBOW) && --championTimer < 1 && isEffectShown &&
|
||||
!isShrunk)
|
||||
champion_shot_fire();
|
||||
if ((champion == CHAMPION_PURPLE || champion == CHAMPION_RAINBOW) && isEffectShown)
|
||||
reconstruction_missing("Entity_NPC::Update 006c4b30: the purple champion's pull");
|
||||
if (champion == CHAMPION_DARK_RED && (isDead || championRegenTimer != 0))
|
||||
reconstruction_missing("Entity_NPC::Update 006c4b30: the dark red champion's regeneration");
|
||||
bool isPulsing = champion == CHAMPION_CAMO || champion == CHAMPION_PULSE_GREEN || champion == CHAMPION_PULSE_GREY ||
|
||||
champion == CHAMPION_PULSE_RED || champion == CHAMPION_KING || champion == CHAMPION_RAINBOW;
|
||||
if (isPulsing) reconstruction_missing("Entity_NPC::Update 006c4b30: the camouflaged, pulsing and king champions");
|
||||
if (champion == CHAMPION_SIZE_PULSE && championTimer > 0) championTimer--;
|
||||
if (isShrunk && shrinkCountdown >= 1 && shrinkCountdown < SHRINK_PULSE_FRAMES)
|
||||
reconstruction_missing("Entity_NPC::Update 006c4b30: the shrinking pulse");
|
||||
}
|
||||
|
||||
// Part of 006c4b30: a white champion cannot be hurt while another enemy holding the doors lives, unless that one is
|
||||
// white too.
|
||||
void Entity_NPC::white_champion_update()
|
||||
{
|
||||
isInvincible = false;
|
||||
ClearEntityFlags(FLAG_NO_STATUS_EFFECTS);
|
||||
for (Entity* entity : g_game->room->GetEntities()->updateEL)
|
||||
{
|
||||
Entity_NPC* npc = entity->IsEnemy() ? dynamic_cast<Entity_NPC*>(entity) : nullptr;
|
||||
if (!npc || !npc->CanShutDoors() || (npc->isChampion && npc->championColorIdx == CHAMPION_WHITE)) continue;
|
||||
isInvincible = true;
|
||||
AddEntityFlags(FLAG_NO_STATUS_EFFECTS);
|
||||
}
|
||||
}
|
||||
|
||||
// Part of 006c4b30: the flickering champion (and the Flicker kind) waits visible, fades out, hides, then fades back
|
||||
// in, its sprite's alpha following.
|
||||
void Entity_NPC::flicker_update()
|
||||
{
|
||||
switch (flickerState)
|
||||
{
|
||||
case FLICKER_SHOWN:
|
||||
if (flickerTimer-- < 0) flickerState = FLICKER_FADING_OUT;
|
||||
break;
|
||||
case FLICKER_FADING_OUT:
|
||||
if (flickerAlpha > 0) flickerAlpha -= FLICKER_FADE;
|
||||
else
|
||||
{
|
||||
flickerState = FLICKER_HIDDEN;
|
||||
flickerTimer = random_below(CHAMPION_FLICKER_RANGE) + CHAMPION_FLICKER_MIN;
|
||||
}
|
||||
break;
|
||||
case FLICKER_FADING_IN:
|
||||
if (flickerAlpha < 1) flickerAlpha += FLICKER_FADE;
|
||||
else
|
||||
{
|
||||
flickerState = FLICKER_SHOWN;
|
||||
flickerTimer = random_below(CHAMPION_FLICKER_RANGE) + CHAMPION_FLICKER_MIN;
|
||||
}
|
||||
break;
|
||||
case FLICKER_HIDDEN:
|
||||
isVisible = false;
|
||||
if (flickerTimer-- < 0)
|
||||
{
|
||||
isVisible = true;
|
||||
flickerState = FLICKER_FADING_IN;
|
||||
}
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
sprite.color._tint[3] = flickerAlpha;
|
||||
}
|
||||
|
||||
// Part of 006c4b30: the pink champion shoots along its walk every 40 to 59 frames while it moves.
|
||||
void Entity_NPC::champion_shot_fire()
|
||||
{
|
||||
float speed = vector_length(velocity);
|
||||
if (speed <= 0) return;
|
||||
|
||||
Vector direction = vector_scale(velocity, 1 / speed);
|
||||
championTimer = random_below(CHAMPION_SHOT_RANGE) + CHAMPION_SHOT_MIN;
|
||||
ProjectileParams params;
|
||||
params.fallingAccelModifier = CHAMPION_SHOT_FALL_ACCEL;
|
||||
params.fallingSpeedModifier = CHAMPION_SHOT_FALL_SPEED;
|
||||
FireProjectiles(pos, vector_scale(direction, CHAMPION_SHOT_SPEED), PROJECTILES_SINGLE, params);
|
||||
PlaySound(SOUND_BLOODSHOOT, 1, 2, false, 1);
|
||||
}
|
||||
|
||||
// Part of 006c4b30: in a room that checks it, an enemy no grounded player has a path to stops holding the doors
|
||||
// after its second miss, checked every 60 frames once 900 frames passed.
|
||||
void Entity_NPC::unreachable_update()
|
||||
@@ -1807,8 +1493,22 @@ void Entity_NPC::dead_update()
|
||||
state = NPC_STATE_DEATH;
|
||||
stateFrame = 0;
|
||||
}
|
||||
if (g_game->room->roomType == ROOM_DUNGEON && !IsFlying())
|
||||
reconstruction_missing("Entity_NPC::Update 006c4b30: a crawlspace enemy dropping off its ladder");
|
||||
if (g_game->room->roomType == ROOM_DUNGEON && !IsFlying()) ladder_drop();
|
||||
}
|
||||
|
||||
// Part of 006c4b30: an enemy dying on a crawlspace ladder keeps its speed sideways and drops off it, unless a wall
|
||||
// is right under it.
|
||||
void Entity_NPC::ladder_drop()
|
||||
{
|
||||
GridEntity* cell = room_grid_entity_at(pos);
|
||||
if (!cell || cell->type != GRID_GRAVITY) return;
|
||||
|
||||
velocity.y *= HALF_SPEED;
|
||||
if (velocity.x > 0) velocity.x = vector_length(velocity);
|
||||
else if (velocity.x < 0) velocity.x = -vector_length(velocity);
|
||||
velocity.y = 0;
|
||||
Vector below = vector_add(pos, vector_make(0, sizeMulti.y * size + LADDER_FOOT_MARGIN));
|
||||
if (room_grid_collision_at(below) != COLLISION_WALL) AddVelocity_divided(vector_make(0, LADDER_DROP_SPEED), false);
|
||||
}
|
||||
|
||||
// Part of 006c4b30: a gold enemy's coins, one to three (none to two for a coin hearted player).
|
||||
@@ -2151,7 +1851,7 @@ bool Entity_NPC::TakeDamage(float damage, uint64_t damageFlags, const EntityRef&
|
||||
PlayerManager& players = g_game->playerManager;
|
||||
if (source.entity && players.FirstCollectibleOwner(COLLECTIBLE_BETRAYAL_ID, LAZARUS_SHARE_CHECK))
|
||||
reconstruction_missing("Entity_NPC::TakeDamage 006d60a0: Betrayal");
|
||||
if (players.FirstCollectibleOwner(COLLECTIBLE_JAR_OF_FLIES_ID, LAZARUS_SHARE_CHECK))
|
||||
if (players.FirstCollectibleOwner(COLLECTIBLE_JAR_OF_FLIES, LAZARUS_SHARE_CHECK))
|
||||
{
|
||||
bool isBlueFly = source.type == ENTITY_FAMILIAR && source.variant == Entity_Familiar::BLUE_FLY;
|
||||
bool isPlayerKill = source.type == ENTITY_PLAYER || (source.spawnerType == ENTITY_PLAYER && !isBlueFly) ||
|
||||
@@ -2160,8 +1860,11 @@ bool Entity_NPC::TakeDamage(float damage, uint64_t damageFlags, const EntityRef&
|
||||
if (isPlayerKill) AddEntityFlags(FLAG_ADD_JAR_FLY);
|
||||
else ClearEntityFlags(FLAG_ADD_JAR_FLY);
|
||||
}
|
||||
if (championColorIdx == CHAMPION_SIZE_PULSE && !isDead && pendingDamage < health)
|
||||
reconstruction_missing("Entity_NPC::TakeDamage 006d60a0: the size pulsing champion's flies");
|
||||
bool isPlayerHit = source.type == ENTITY_PLAYER ||
|
||||
(source.spawnerType == ENTITY_PLAYER &&
|
||||
(source.type != ENTITY_FAMILIAR || source.variant != Entity_Familiar::BLUE_FLY));
|
||||
bool isFlyDue = !isDead && pendingDamage < health && championTimer < 1 && !(damageFlags & DAMAGE_ACID);
|
||||
if (championColorIdx == CHAMPION_SIZE_PULSE && isFlyDue && isPlayerHit) champion_fly_spawn();
|
||||
if (!isHurt || HasEntityFlags(FLAG_NO_STATUS_EFFECTS)) return isHurt;
|
||||
|
||||
Entity* attacker = source.entity;
|
||||
@@ -2229,7 +1932,7 @@ void Entity_NPC::ResetColor()
|
||||
bool isChampionSheet = std::ranges::any_of(sprite.layerStates, [](const LayerState& layer)
|
||||
{ return layer.bitflags & LAYER_CHAMPION_SHEET; });
|
||||
if (championColorIdx >= 0 && championColorIdx < CHAMPION_COUNT)
|
||||
sprite.color = isChampionSheet ? CHAMPION_LOOKS[championColorIdx].spriteColor
|
||||
sprite.color = isChampionSheet ? champion_look_get(championColorIdx).spriteColor
|
||||
: champion_sprite_color_get(championColorIdx);
|
||||
}
|
||||
else if (bosscoloridx < 0) sprite.color = color;
|
||||
@@ -2704,49 +2407,155 @@ void Entity_NPC::update_damage_history()
|
||||
}
|
||||
}
|
||||
|
||||
// 006d5400 What happens as it leaves for good: a champion's drop or a boss's death, the dead enemy's flags'
|
||||
// rewards (sticky spiders, black hearts), Jar of Flies' count, its removal, the on-kill items and its record.
|
||||
// Part of 006d5400: a sticky enemy bursts into blue spiders for the nearest player, one to three (two to six when
|
||||
// an explosion killed it).
|
||||
void Entity_NPC::sticky_spiders_spawn()
|
||||
{
|
||||
int spiders = killDamageFlags & DAMAGE_EXPLOSION ? (int)(Random() % STICKY_SPIDERS_BLAST_RANGE) + 2
|
||||
: (int)(Random() % STICKY_SPIDERS_RANGE) + 1;
|
||||
for (int i = 0; i < spiders; i++)
|
||||
{
|
||||
Entity_Player* player = game_nearest_player(pos);
|
||||
player->numBlueSpiders++;
|
||||
spawn_blue_spider(pos, player, {});
|
||||
}
|
||||
}
|
||||
|
||||
// Part of 006d5400: the rewards of a dead enemy that gives any: one in five a black heart for Black Lipstick's
|
||||
// sticky kind, and Jar of Flies' count for a fly a player killed, froze or iced.
|
||||
void Entity_NPC::kill_rewards_spawn()
|
||||
{
|
||||
if (HasEntityFlags(FLAG_SPAWN_BLACK_HP) && dropRNG.Next() % BLACK_HEART_CHANCE == 0)
|
||||
{
|
||||
uint32_t seed = Random();
|
||||
g_game->Spawn({.position = room_free_tile_position_find(pos, 0),
|
||||
.subType = HEART_BLACK,
|
||||
.type = ENTITY_PICKUP,
|
||||
.variant = PICKUP_HEART,
|
||||
.seed = seed});
|
||||
}
|
||||
|
||||
PlayerManager& players = g_game->playerManager;
|
||||
Entity_Player* jarOwner = players.RandomCollectibleOwner(COLLECTIBLE_JAR_OF_FLIES, dropRNG.Next(), nullptr);
|
||||
if (!jarOwner || !(HasEntityFlags(FLAG_ADD_JAR_FLY | FLAG_FREEZE) || HasEntityFlags(FLAG_ICE_FROZEN))) return;
|
||||
jarOwner->jarFlies = std::min(jarOwner->jarFlies + 1, JAR_OF_FLIES_MAX);
|
||||
g_game->hud.refresh_request(HUD_REFRESH_PLAYER);
|
||||
}
|
||||
|
||||
// Part of 006d5400: the items a kill wakes: Contagion's cloud on the first kill of a room or a contagious enemy's,
|
||||
// spreading the contagion, Athame's ring by the players' luck, a friendly enemy's recharge of the Friendly Ball in
|
||||
// challenge 33, and a captured enemy's soul wisp for Book of Virtues.
|
||||
void Entity_NPC::kill_items_trigger()
|
||||
{
|
||||
PlayerManager& players = g_game->playerManager;
|
||||
Entity_Player* contagion = players.FirstCollectibleOwner(COLLECTIBLE_CONTAGION, LAZARUS_SHARE_IGNORE);
|
||||
if (contagion && (HasEntityFlags(FLAG_CONTAGIOUS) || !g_game->room->isFirstEnemyDead))
|
||||
{
|
||||
game_fart({.position = pos, .source = contagion, .radius = CONTAGION_RADIUS, .subType = 1});
|
||||
for (Entity* enemy : entity_query_radius(pos, CONTAGION_RADIUS, QUERY_ENEMIES))
|
||||
if (enemy != this && enemy->IsVulnerableEnemy(nullptr)) enemy->AddEntityFlags(FLAG_CONTAGIOUS);
|
||||
}
|
||||
|
||||
if (Entity_Player* athame = players.FirstCollectibleOwner(COLLECTIBLE_ATHAME, LAZARUS_SHARE_IGNORE))
|
||||
{
|
||||
RNG rng;
|
||||
rng.SetSeed(initSeed, ATHAME_RNG_SHIFT_INDEX);
|
||||
float luck = 0;
|
||||
for (Entity_Player* player : players.playerList)
|
||||
if (player->variant == PLAYER_VARIANT_PLAYER && !player->isCoopGhost) luck += player->luck;
|
||||
if (rng.RandomFloat() < luck * ATHAME_LUCK_CHANCE + ATHAME_BASE_CHANCE)
|
||||
{
|
||||
Entity_Laser* ring = athame->SpawnMawOfVoid(ATHAME_RING_TIMEOUT);
|
||||
ring->pos = pos;
|
||||
ring->isDisableFollowParent = true;
|
||||
ring->Update();
|
||||
}
|
||||
}
|
||||
|
||||
bool isFriendlyKill = IsFriendly() && g_game->challenge == CHALLENGE_KILL_CHARGE &&
|
||||
players.FirstCollectibleOwner(COLLECTIBLE_FRIEND_BALL, LAZARUS_SHARE_CHECK) &&
|
||||
(spawnerType == ENTITY_PLAYER || spawnerType == ENTITY_FAMILIAR) && spawnerEntity &&
|
||||
spawnerEntity->type == ENTITY_PLAYER;
|
||||
if (isFriendlyKill)
|
||||
{
|
||||
auto* owner = static_cast<Entity_Player*>(spawnerEntity.get());
|
||||
for (int slot = 0; slot < ACTIVE_SLOT_COUNT; slot++)
|
||||
{
|
||||
if (owner->activeItems[slot].item != COLLECTIBLE_FRIEND_BALL) continue;
|
||||
owner->FullCharge(slot, false, false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!HasEntityFlags(FLAG_FRIENDLY_BALL)) return;
|
||||
Entity_Player* virtues = players.RandomCollectibleOwner(COLLECTIBLE_BOOK_OF_VIRTUES, dropRNG.Next(), nullptr);
|
||||
EntityConfig_Entity* entry = g_manager->entityConfig.GetEntity(type, variant, 0);
|
||||
if (!virtues || virtues->type != ENTITY_PLAYER || !entry) return;
|
||||
|
||||
int wisp = WISP_SOUL;
|
||||
if (entry->tags & ENTITY_TAG_HOMING_SOUL) wisp = WISP_SOUL_HOMING;
|
||||
else if (entry->tags & ENTITY_TAG_EXPLOSIVE_SOUL) wisp = WISP_SOUL_EXPLOSIVE;
|
||||
else if (entry->tags & ENTITY_TAG_BRIMSTONE_SOUL) wisp = WISP_SOUL_BRIMSTONE;
|
||||
virtues->AddWisp(wisp, pos, false, false);
|
||||
}
|
||||
|
||||
// Part of 006d5400: a Brimstone marked enemy's burst marks the vulnerable enemies within 120 for 150 frames, hands
|
||||
// them its statuses for 90, hits them for 10, and recharges the Hemoptysis of the players with Brimstone.
|
||||
void Entity_NPC::marked_status_spread()
|
||||
{
|
||||
EntityRef none(nullptr);
|
||||
for (Entity* enemy : entity_query_radius(pos, MARK_SPREAD_RADIUS, QUERY_ENEMIES))
|
||||
{
|
||||
if (enemy == this || !enemy->IsVulnerableEnemy(nullptr)) continue;
|
||||
|
||||
enemy->AddBrimstoneMark(none, MARK_SPREAD_FRAMES);
|
||||
if (HasEntityFlags(FLAG_SLOW))
|
||||
enemy->AddSlowing(none, STATUS_SPREAD_FRAMES, slowingAmount, SPREAD_SLOW_COLOR, false);
|
||||
if (HasEntityFlags(FLAG_POISON)) enemy->AddPoison(none, STATUS_SPREAD_FRAMES, poisonTickDamage, false);
|
||||
if (HasEntityFlags(FLAG_MIDAS_FREEZE)) enemy->AddMidasFreeze(none, STATUS_SPREAD_FRAMES, false);
|
||||
else if (HasEntityFlags(FLAG_FREEZE)) enemy->AddFreeze(none, STATUS_SPREAD_FRAMES, false);
|
||||
if (HasEntityFlags(FLAG_SHRINK)) enemy->AddShrink(none, STATUS_SPREAD_FRAMES, false, false);
|
||||
else if (HasEntityFlags(FLAG_FEAR)) enemy->AddFear(none, STATUS_SPREAD_FRAMES, false);
|
||||
if (HasEntityFlags(FLAG_CHARM)) enemy->AddCharmed(none, STATUS_SPREAD_FRAMES, false, false);
|
||||
if (HasEntityFlags(FLAG_CONFUSION)) enemy->AddConfusion(none, STATUS_SPREAD_FRAMES, false);
|
||||
if (HasEntityFlags(FLAG_BURN)) enemy->AddBurn(none, STATUS_SPREAD_FRAMES, 0, false);
|
||||
if (HasEntityFlags(FLAG_MAGNETIZED)) enemy->AddMagnetized(none, STATUS_SPREAD_FRAMES);
|
||||
if (HasEntityFlags(FLAG_ICE)) enemy->AddIce(none, STATUS_SPREAD_FRAMES);
|
||||
if (HasEntityFlags(FLAG_BAITED)) enemy->AddBaited(none, STATUS_SPREAD_FRAMES);
|
||||
enemy->TakeDamage(MARK_SPREAD_DAMAGE, 0, none, MARK_SPREAD_COUNTDOWN);
|
||||
}
|
||||
MakeBloodPoof(pos, COLOR_DEFAULT, 1);
|
||||
|
||||
for (Entity_Player* player : g_game->playerManager.playerList)
|
||||
{
|
||||
Weapon* weapon = player->weapons[0] ? player->weapons[0].get() : player->weapons[1].get();
|
||||
if (!weapon || weapon->weaponType != WEAPON_BRIMSTONE) continue;
|
||||
player->temporaryEffects.RemoveNullEffect(NULLITEM_HEMOPTYSIS_BOOST, -1);
|
||||
player->temporaryEffects.AddNullEffect(NULLITEM_HEMOPTYSIS_BOOST, true, 1);
|
||||
}
|
||||
}
|
||||
|
||||
// 006d5400 What happens as it leaves for good: a champion's drop or a boss's death, Rotgut's death, the sticky
|
||||
// spiders, its rewards, its removal (Hush stays, drawn on the floor), the items a kill wakes, its record and a
|
||||
// marked enemy's spreading statuses.
|
||||
void Entity_NPC::trigger_kill_item_effects()
|
||||
{
|
||||
if (isBoss) g_game->room->TriggerBossDeath(*this);
|
||||
else if (isChampion) champion_drop();
|
||||
if (type == ENTITY_ROTGUT && variant == 1)
|
||||
reconstruction_missing("Entity_NPC::trigger_kill_item_effects 006d5400: Rotgut's death");
|
||||
if (HasEntityFlags(FLAG_SPAWN_STICKY_SPIDERS))
|
||||
reconstruction_missing("Entity_NPC::trigger_kill_item_effects 006d5400: the sticky spiders");
|
||||
|
||||
if (!HasEntityFlags(FLAG_NO_REWARD))
|
||||
{
|
||||
if (HasEntityFlags(FLAG_SPAWN_BLACK_HP) && dropRNG.Next() % BLACK_HEART_CHANCE == 0)
|
||||
g_game->Spawn({.position = room_free_tile_position_find(pos, 0),
|
||||
.subType = HEART_BLACK,
|
||||
.type = ENTITY_PICKUP,
|
||||
.variant = PICKUP_HEART,
|
||||
.seed = Random()});
|
||||
Entity_Player* jarOwner =
|
||||
g_game->playerManager.RandomCollectibleOwner(COLLECTIBLE_JAR_OF_FLIES_ID, dropRNG.Next(), nullptr);
|
||||
if (jarOwner && (HasEntityFlags(FLAG_ADD_JAR_FLY | FLAG_FREEZE) || HasEntityFlags(FLAG_ICE_FROZEN)))
|
||||
reconstruction_missing("Entity_NPC::trigger_kill_item_effects 006d5400: Jar of Flies' count");
|
||||
}
|
||||
reconstruction_missing("rotgut_death_spawn_effects 00581200: Rotgut's death");
|
||||
if (HasEntityFlags(FLAG_SPAWN_STICKY_SPIDERS)) sticky_spiders_spawn();
|
||||
if (!HasEntityFlags(FLAG_NO_REWARD)) kill_rewards_spawn();
|
||||
|
||||
if (type == ENTITY_HUSH) AddEntityFlags(FLAG_RENDER_FLOOR);
|
||||
else Remove();
|
||||
|
||||
PlayerManager& players = g_game->playerManager;
|
||||
bool isKillItem = players.FirstCollectibleOwner(COLLECTIBLE_CONTAGION_ID, LAZARUS_SHARE_IGNORE) ||
|
||||
players.FirstCollectibleOwner(COLLECTIBLE_MAW_OF_THE_VOID_ID, LAZARUS_SHARE_IGNORE) ||
|
||||
(IsFriendly() && g_game->challenge == CHALLENGE_KILL_CHARGE) ||
|
||||
HasEntityFlags(FLAG_FRIENDLY_BALL);
|
||||
if (isKillItem)
|
||||
reconstruction_missing(
|
||||
"Entity_NPC::trigger_kill_item_effects 006d5400: Contagion, Maw of the Void and Lemegeton");
|
||||
kill_items_trigger();
|
||||
|
||||
g_game->room->isFirstEnemyDead = true;
|
||||
// Room::record_killed_npc 00820d30 waits for Room to hold the list of killed enemies, which nothing reads yet.
|
||||
entityRef = nullptr;
|
||||
aimTargetEffect = nullptr;
|
||||
if (HasEntityFlags(FLAG_BRIMSTONE_MARKED) && HasEntityFlags(FLAG_EXTRA_GORE))
|
||||
reconstruction_missing("Entity_NPC::trigger_kill_item_effects 006d5400: the marked enemy's spreading status");
|
||||
if (HasEntityFlags(FLAG_BRIMSTONE_MARKED) && HasEntityFlags(FLAG_EXTRA_GORE)) marked_status_spread();
|
||||
lua_engine_get().PostNPCDeath(this);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user