Curation round 13: grid entities, more enemies, Caves, boss helpers and five bosses, chests and costumes, curses and alt stages, the Lua API
This commit is contained in:
1 parent
f8ce24fc6c
commit
8ae02a8422
160 files changed
+16231
-1689
No files matched your search
+34
-11
@@ -2,6 +2,7 @@
|
||||
#include "entity_bomb.h"
|
||||
#include "entity_config.h"
|
||||
#include "entity_effect.h"
|
||||
#include "entity_effect_combat.h"
|
||||
#include "entity_familiar.h"
|
||||
#include "entity_laser.h"
|
||||
#include "entity_list.h"
|
||||
@@ -70,17 +71,24 @@ constexpr int BLUE_FLY_MAX = 30;
|
||||
constexpr int MAGGY_SWING_READY = 3;
|
||||
|
||||
// Lua's DamageFlag bits beyond entity.h's.
|
||||
constexpr uint64_t DAMAGE_BOOGER = 1ull << 22;
|
||||
constexpr uint64_t DAMAGE_CRUSH = 1ull << 24;
|
||||
constexpr uint64_t DAMAGE_THROUGH_COOLDOWN = 1ull << 35;
|
||||
|
||||
// The effects the combat code spawns (Lua's EffectVariant).
|
||||
constexpr int EFFECT_TOOTH_PARTICLE = 35;
|
||||
constexpr int EFFECT_POOP_PARTICLE = 58;
|
||||
constexpr int EFFECT_BISHOP_SHIELD = 160;
|
||||
constexpr int EFFECT_CHAIN_GIB = 163;
|
||||
constexpr int ROCK_PARTICLE_SUBTYPE = 0x10001;
|
||||
|
||||
// An iced enemy shatters into 3 to 6 shards at 3 to 5, a frozen one into its gibs and up to 2 more as rocks at 5, both
|
||||
// in a cold white and with a pitch of 0.9 to 1.1.
|
||||
constexpr ColorMod SHATTER_COLOR = {{0.8f, 0.8f, 0.8f, 1}, {1, 1, 1, 0.5f}, {0.3f, 0.5f, 0.8f}};
|
||||
constexpr float SHATTER_PITCH_MIN = 0.9f;
|
||||
constexpr float SHATTER_PITCH_RANGE = 0.2f;
|
||||
constexpr float ICE_SHARD_SPEED_MIN = 3;
|
||||
constexpr uint32_t ICE_SHARD_EXTRA_MASK = 3;
|
||||
constexpr int ICE_SHARD_COUNT_MIN = 3;
|
||||
constexpr uint32_t FROZEN_SHARD_EXTRA = 3;
|
||||
constexpr float FROZEN_SHARD_SPEED = 5;
|
||||
|
||||
// The sounds the combat code plays (Lua's SoundEffect).
|
||||
constexpr int SOUND_DEATH_BURST_BONE = 27;
|
||||
constexpr int SOUND_DEATH_BURST_SMALL = 30;
|
||||
@@ -334,7 +342,7 @@ bool Entity::TakeDamage(float damage, uint64_t damageFlags, const EntityRef& sou
|
||||
if (HasEntityFlags(FLAG_WEAKNESS)) damage += damage;
|
||||
if (maxHitPoints <= 0) return false;
|
||||
|
||||
lua_callback_check(MC_ENTITY_TAKE_DMG, "Entity::TakeDamage 006ace60: MC_ENTITY_TAKE_DMG");
|
||||
if (!lua_engine_get().EntityTakeDamage(this, damage, damageFlags, source, countdown)) return false;
|
||||
damageEvents.push_back({.source = source, .damage = damage, .damageFlags = damageFlags});
|
||||
pendingDamageFlags |= damageFlags;
|
||||
pendingDamage += damage;
|
||||
@@ -354,7 +362,7 @@ void Entity::Kill(const EntityRef& source)
|
||||
{
|
||||
bool isPowderable = variant == FIREPLACE_NORMAL || variant == FIREPLACE_RED || variant == FIREPLACE_MOVEABLE;
|
||||
if (static_cast<Entity_Player*>(killer)->HasCollectible(COLLECTIBLE_BLACK_POWDER) && isPowderable)
|
||||
reconstruction_missing("Entity::Kill 006ac920: Black Powder's fireplace blast (BombExplosionEffects)");
|
||||
explosion_effects({.position = pos, .source = killer, .damage = BLACK_POWDER_DAMAGE});
|
||||
}
|
||||
if (!IsBoss() && type != ENTITY_FAMILIAR) BloodExplode();
|
||||
lua_engine_get().PostEntityKill(this);
|
||||
@@ -424,15 +432,30 @@ static void burst_drops_spawn(Entity& entity, int gibsAmount)
|
||||
}
|
||||
}
|
||||
|
||||
// 006b45c0 Bursts it: an iced enemy shatters, 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.
|
||||
// 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.
|
||||
void Entity::BloodExplode()
|
||||
{
|
||||
if (HasEntityFlags(FLAG_ICE) && !IsBoss() && !config->isBoss)
|
||||
reconstruction_missing("Entity::BloodExplode 006b45c0: an iced enemy shattering (Game::SpawnParticles)");
|
||||
{
|
||||
npc_sound_play(SOUND_FREEZE, 1, 2, random_unit() * SHATTER_PITCH_RANGE + SHATTER_PITCH_MIN);
|
||||
float speed = random_unit();
|
||||
speed = speed + speed + ICE_SHARD_SPEED_MIN;
|
||||
int count = (int)(Random() & ICE_SHARD_EXTRA_MASK) + ICE_SHARD_COUNT_MIN;
|
||||
game_particles_spawn({.color = SHATTER_COLOR, .position = pos, .speed = speed, .count = count,
|
||||
.variant = EFFECT_TOOTH_PARTICLE});
|
||||
return;
|
||||
}
|
||||
if (HasEntityFlags(FLAG_ICE_FROZEN))
|
||||
reconstruction_missing("Entity::BloodExplode 006b45c0: a frozen enemy shattering (Game::SpawnParticles)");
|
||||
{
|
||||
npc_sound_play(SOUND_FREEZE_SHATTER, 1, 2, random_unit() * SHATTER_PITCH_RANGE + SHATTER_PITCH_MIN);
|
||||
npc_sound_play(SOUND_ROCK_CRUMBLE, 1, 2, 1);
|
||||
int count = config->gibsAmount + (int)(Random() % FROZEN_SHARD_EXTRA);
|
||||
game_particles_spawn({.color = SHATTER_COLOR, .position = pos, .speed = FROZEN_SHARD_SPEED, .count = count,
|
||||
.variant = EFFECT_ROCK_PARTICLE});
|
||||
return;
|
||||
}
|
||||
|
||||
burst_sound_play(*this);
|
||||
if (type == ENTITY_SUCKER && variant == SUCKER_BULB)
|
||||
|
||||
Reference in new issue
Block a user