#ifndef STATUS_EFFECT_CLASS #define STATUS_EFFECT_CLASS #include // Something lasting put on a character, changing how it moves or what it can do while it's on struct StatusEffect { enum class Type { HeavyGravity, // pulled down harder: slower, can't jump, and falls faster Knockdown, // on the floor: can't do anything, and only attacks that hit the knocked down can hit it Executed, // playing out how it was killed: can't do anything or be hit until it's over Invulnerable // iframes: nothing at all can hit it, not even what hits the knocked down }; Type type = Type::HeavyGravity; float timeLeft = -1.0f; // real seconds, below 0 lasts forever }; // How much each one changes, and what the HUD calls it struct StatusEffectInfo { std::string name; float speedMultiplier = 1.0f; // times its walking speed float gravityMultiplier = 1.0f; // times the world's gravity while it's in the air bool preventsJumping = false; bool preventsActing = false; // can't move, turn, attack or anything else, like a stun bool dodgesHits = false; // only hitboxes that hit the knocked down can touch it bool invulnerable = false; // no hitbox can touch it }; inline const StatusEffectInfo& GetStatusEffectInfo(StatusEffect::Type type) { static const StatusEffectInfo heavyGravity = { "HEAVY", 0.5f, 3.0f, true }; static const StatusEffectInfo knockdown = { "KNOCKED DOWN", 0.0f, 1.0f, true, true, true }; static const StatusEffectInfo executed = { "", 0.0f, 1.0f, true, true, true, true }; static const StatusEffectInfo invulnerable = { "", 1.0f, 1.0f, false, false, false, true }; switch (type) { case StatusEffect::Type::Invulnerable: return invulnerable; case StatusEffect::Type::Executed: return executed; case StatusEffect::Type::Knockdown: return knockdown; case StatusEffect::Type::HeavyGravity: default: return heavyGravity; } } #endif