Files
isaac-port/src/grid_entity_poop.h
T

72 lines
2.2 KiB
C++

#pragma once
#include "grid_entity.h"
#include <string>
// The kinds of poop (Lua's PoopGridEntityVariant). Stone, flaming and stinky are the poop enemies' own, for their gibs
// and break effects.
enum PoopVariant : int
{
POOP_NORMAL,
POOP_RED,
POOP_CORNY,
POOP_GOLDEN,
POOP_RAINBOW,
POOP_BLACK,
POOP_WHITE,
POOP_GIGA_TOP_LEFT,
POOP_GIGA_TOP_RIGHT,
POOP_GIGA_BOTTOM_LEFT,
POOP_GIGA_BOTTOM_RIGHT,
POOP_CHARMING,
POOP_STONE,
POOP_FLAMING,
POOP_STINKY
};
// A poop's state once broken, and a red poop's while it grows back.
constexpr int POOP_STATE_BROKEN = 1000;
constexpr int POOP_STATE_REVIVING = 1000;
// A hit on a poop as its rewards and drops see it: where it broke, its kind and seed, the state before the hit and
// the damage dealt, and who dealt it. A poop reduced by ReduceSpawnRate rarely drops. The poop enemies leave out
// the swinging player's wisps.
struct PoopHit
{
EntityRef source{};
Vector position{};
uint32_t seed = 0;
int damage = 0;
int previousState = 0;
int variant = POOP_NORMAL;
bool isLowDropChance = false;
bool isNoWisp = false;
};
// Destruction (0070bc60) is the default, and Destroy is the base hurt of 4. ReduceSpawnRate (00456870) sets varData
// to 1. A poop (Lua's GridEntityPoop): it breaks in four hits into gibs and drops, red poop grows back, and four
// giant poop parts share one state through the bottom left part.
struct GridEntity_Poop : GridEntity
{
EntityRef destroySource{};
std::string stateAnimation;
int reviveTimer = 0;
bool isEnemyInside = false;
bool isUnderPlayer = false;
void subclass_init() override;
void PostInit() override;
void Update() override;
void Render(const Vector& offset) override;
bool Hurt(int damage, const EntityRef& source) override;
WaterClipInfo GetWaterClipInfo() override;
void RespawnRedPoop();
Vector center_get();
GridEntity_Poop* get_giga_part(int partVariant, bool isCreate);
static void spawn_hit_gibs(const Vector& position, int poopVariant, int maxGibs);
static void destroy_effects(const Vector& position, int poopVariant);
static void spawn_rewards(const PoopHit& hit);
static void spawn_drops(const PoopHit& hit);
};