1065 lines
54 KiB
C++
1065 lines
54 KiB
C++
#include "entity_player.h"
|
|
#include "entity_familiar.h"
|
|
#include "entity_tear.h"
|
|
#include "game.h"
|
|
#include "lua_engine.h"
|
|
#include "room.h"
|
|
#include "log.h"
|
|
#include "manager.h"
|
|
#include <algorithm>
|
|
#include <cmath>
|
|
#include <span>
|
|
|
|
// The stat evaluation's constants: the tears formula, the base stats and the clamps that end it.
|
|
constexpr float TEARS_CURVE_SCALE = 1.3f;
|
|
constexpr float TEARS_DELAY_BASE = 16;
|
|
constexpr float TEARS_DELAY_STEP = 6;
|
|
constexpr float TEARS_DELAY_MIN = 5;
|
|
constexpr float FIRE_RATE_FRAMES = 30;
|
|
constexpr float CRACKED_CROWN_FIRE_RATE = 2.7272727f;
|
|
constexpr float NEGATIVE_TEARS_SCALE = 0.686655f;
|
|
constexpr float DAMAGE_CURVE_SCALE = 1.2f;
|
|
constexpr float DAMAGE_BASE = 3.5f;
|
|
constexpr float RANGE_BASE = 260;
|
|
constexpr float TEAR_HEIGHT_BASE = -23.75f;
|
|
constexpr float RANGE_MIN = 40;
|
|
constexpr float SPEED_MAX = 2;
|
|
constexpr float SPEED_MIN = 0.1f;
|
|
constexpr float SHOT_SPEED_MIN = 0.6f;
|
|
constexpr float DAMAGE_MIN = 0.5f;
|
|
constexpr float MAX_FIRE_DELAY_MIN = -0.75f;
|
|
constexpr float TEAR_HEIGHT_MAX = -5;
|
|
constexpr float FALL_SPEED_RANGE_SCALE = 10;
|
|
constexpr float FALL_SPEED_DECAY = 0.9f;
|
|
constexpr float FALL_SPEED_SLOPE = -9.49122142791748f;
|
|
constexpr float FALL_SPEED_MIN_SLOPE = 0.01f;
|
|
constexpr float G_FUEL_SPEED = 0.2f;
|
|
constexpr uint32_t DEBUG_HIGH_DAMAGE = 1 << 3;
|
|
constexpr uint32_t DEBUG_HIGH_LUCK = 1 << 8;
|
|
constexpr float DEBUG_DAMAGE_BONUS = 40;
|
|
constexpr float DEBUG_LUCK_BONUS = 50;
|
|
constexpr int PILL_TEARS_DOWN = 15;
|
|
constexpr int PILL_RANGE_DOWN = 11;
|
|
constexpr int PILL_RANGE_UP = 12;
|
|
constexpr int PILL_SPEED_DOWN = 13;
|
|
constexpr int PILL_SPEED_UP = 14;
|
|
constexpr int PILL_LUCK_DOWN = 17;
|
|
constexpr int PILL_LUCK_UP = 18;
|
|
constexpr int PILL_SHOT_SPEED_DOWN = 47;
|
|
constexpr int PILL_SHOT_SPEED_UP = 48;
|
|
constexpr int PLAYER_FORM_SPUN = 5;
|
|
constexpr int PLAYER_FORM_CONJOINED = 7;
|
|
constexpr int PLAYER_FORM_LEVIATHAN = 14;
|
|
constexpr int TRINKET_CRACKED_CROWN = 92;
|
|
constexpr int FAMILIAR_ITEM_WISP = 206;
|
|
constexpr int COLLECTIBLE_FORTUNE_COOKIE = 557;
|
|
constexpr int COOP_BUFF_DAMAGE = 0;
|
|
constexpr int COOP_BUFF_TEARS = 1;
|
|
constexpr int COOP_BUFF_SPEED = 2;
|
|
constexpr int COOP_BUFF_RANGE = 3;
|
|
constexpr int COOP_BUFF_LUCK = 4;
|
|
|
|
// The run states the evaluation is reconstructed for: the stat changes of other characters, effects, trinkets,
|
|
// seeds, challenges, procedural items, wisps and the items below stop the game until reached.
|
|
// Candy Heart, Soul Locket, Experimental Treatment, Libra, Rock Bottom, Adrenaline, the pill items, Mega Mush,
|
|
// Berserk!, Jupiter, Dogma, Purity.
|
|
constexpr std::array<int, 13> EVALUATION_UNHANDLED_ITEMS = {671, 686, 240, 304, 562, 493, 654, 407, 625, 704, 594, 633, 556};
|
|
// The weapon items, which the frame does not handle yet: Ludovico, Tech X, Spirit Sword, C Section, Dr. Fetus,
|
|
// Technology, Mom's Knife, Brimstone, Epic Fetus, Monstro's Lung.
|
|
constexpr std::array<int, 10> WEAPON_ITEMS = {329, 395, 579, 678, 52, 68, 114, 118, 168, 229};
|
|
|
|
// The constants of the other sections: the collectibles, trinkets, null items and characters they ask about.
|
|
constexpr int COLLECTIBLE_BINGE_EATER = 664;
|
|
constexpr int COLLECTIBLE_PASSIVE_DAMOCLES = 656;
|
|
constexpr int PLAYER_FORM_SPIDER_BABY = 12;
|
|
constexpr int PILL_TEARS_UP = 16;
|
|
constexpr int PILL_LARGER = 32;
|
|
constexpr int PILL_SMALLER = 33;
|
|
constexpr int COOP_BUFF_SMALLER = 5;
|
|
constexpr int COOP_BUFF_LARGER = 6;
|
|
constexpr int BABY_SKIN_SPOON = 4;
|
|
constexpr int BABY_SKIN_BONE = 57;
|
|
constexpr int BABY_SKIN_GHOST_A = 58;
|
|
constexpr int BABY_SKIN_GHOST_B = 59;
|
|
constexpr int TRINKET_AZAZELS_STUMP = 162;
|
|
constexpr int NULLITEM_BLOODY_BABYLON = 110;
|
|
constexpr int NULLITEM_SPIRIT_SHACKLES_SOUL = 101;
|
|
constexpr int NULLITEM_REVERSE_DEVIL = 67;
|
|
constexpr int NULLITEM_ESAU_JR = 100;
|
|
constexpr int NULLITEM_HUGE_GROWTH = 41;
|
|
constexpr int COLLECTIBLE_SPIRIT_SWORD = 579;
|
|
constexpr int COLLECTIBLE_C_SECTION = 678;
|
|
constexpr int COLLECTIBLE_EPIC_FETUS = 168;
|
|
constexpr int COLLECTIBLE_MOMS_KNIFE = 114;
|
|
constexpr int COLLECTIBLE_HAEMOLACRIA = 531;
|
|
constexpr int COLLECTIBLE_MONSTROS_LUNG = 229;
|
|
constexpr int COLLECTIBLE_DR_FETUS = 52;
|
|
constexpr int COLLECTIBLE_TECH_X = 395;
|
|
constexpr int COLLECTIBLE_TECHNOLOGY = 68;
|
|
constexpr int COLLECTIBLE_LUDOVICO = 329;
|
|
constexpr int COLLECTIBLE_BERSERK = 704;
|
|
constexpr int COLLECTIBLE_SPIRIT_SHACKLES = 677;
|
|
constexpr int COLLECTIBLE_ANTI_GRAVITY = 222;
|
|
constexpr int COLLECTIBLE_2SPOOKY = 554;
|
|
constexpr int COLLECTIBLE_VIRUS = 13;
|
|
constexpr int COLLECTIBLE_TOXIC_SHOCK = 350;
|
|
constexpr int COLLECTIBLE_LUSTY_BLOOD = 411;
|
|
constexpr int SPRITE_SCALE_UNLOCK = 3;
|
|
constexpr int ACHIEVEMENT_HUGE = 361;
|
|
constexpr float SIZE_STEP = 0.322f;
|
|
constexpr float SIZE_SCALE_KNEE = 2;
|
|
constexpr float SIZE_SCALE_SLOPE = 2.77259f;
|
|
constexpr float SIZE_SCALE_AT_KNEE = 4;
|
|
constexpr int DAILY_BIG_SIZE = 45;
|
|
constexpr float DAILY_BIG_SIZE_BONUS = 0.485f;
|
|
constexpr float BIG_HEAD_BONUS = 1.585f;
|
|
constexpr int BLOOD_LUST_COLOR_CAP = 6;
|
|
constexpr float BLOOD_LUST_COLOR_STEP = 0.125f;
|
|
constexpr float BERSERK_CHARGE_FULL = 100000;
|
|
constexpr float HOLOGRAM_ALPHA = 0.2f;
|
|
constexpr float COLOR_OFFSET_UNIT = 0.003921569f;
|
|
constexpr float HELD_THROW_SCALE = 0.1f;
|
|
constexpr int COLLECTIBLE_MOMS_BRACELET = 604;
|
|
constexpr int COLLECTIBLE_SUPLEX = 709;
|
|
|
|
// Whether the player owns any of the listed collectibles.
|
|
static bool is_owning_any(Entity_Player& player, std::span<const int> collectibles)
|
|
{
|
|
return std::ranges::any_of(collectibles, [&](int id) { return player.HasCollectible(id); });
|
|
}
|
|
|
|
// Whether the player owns an item whose cache flags ask for a section.
|
|
static bool is_cache_owned(Entity_Player& player, uint32_t flag)
|
|
{
|
|
ItemConfig& items = g_manager->itemConfig;
|
|
for (int id = 0; id < (int)player.collectibleCounts.size(); id++)
|
|
if (player.collectibleCounts[id] > 0)
|
|
if (ItemConfig_Item* item = items.GetCollectible(id); item && (item->cacheFlags & flag)) return true;
|
|
return false;
|
|
}
|
|
|
|
// How often a pill effect was taken, 0 for one never seen.
|
|
static float pill_uses(Entity_Player& player, int pillEffect)
|
|
{
|
|
return pillEffect < (int)player.pillEffectUses.size() ? (float)player.pillEffectUses[pillEffect] : 0;
|
|
}
|
|
|
|
// Whether the character and run are ones the evaluation is reconstructed for (see EVALUATION_UNHANDLED_ITEMS).
|
|
bool Entity_Player::is_character_plain()
|
|
{
|
|
Game& game = *g_game;
|
|
bool isSmelted = std::ranges::any_of(smeltedTrinkets, [](SmeltedTrinket& t) { return t.count || t.goldenCount; });
|
|
return playerType == PLAYER_ISAAC && variant == PLAYER_VARIANT_PLAYER && !isCoopGhost && !hasCurseMistEffect &&
|
|
game.challenge == 0 && game.dailyChallenge._id == 0 && game.seedEffects.CountSeedEffects() == 0 &&
|
|
!game.deathmatchManager.is_active() && temporaryEffects.effects.empty() &&
|
|
trinkets == std::array<uint32_t, TRINKET_SLOT_COUNT>{} && !isSmelted && proceduralItems.empty() &&
|
|
itemWispsList.empty();
|
|
}
|
|
|
|
// The bonuses Binge Eater's foods give: damage, tears, range, shot speed, speed and luck, each food also slowing.
|
|
struct StatBonuses
|
|
{
|
|
float damage = 0;
|
|
float tears = 0;
|
|
float range = 0;
|
|
float shotSpeed = 0;
|
|
float speed = 0;
|
|
float luck = 0;
|
|
};
|
|
|
|
// The part of 00763570 before the sections: Binge Eater's foods add to the stats it lowers speed for.
|
|
static StatBonuses stat_bonuses_get(Entity_Player& player)
|
|
{
|
|
constexpr float FOOD_SLOW = 0.15f;
|
|
StatBonuses bonus;
|
|
|
|
if (!player.HasCollectible(COLLECTIBLE_BINGE_EATER)) return bonus;
|
|
auto food = [&](int id, std::initializer_list<float*> stats)
|
|
{
|
|
float count = (float)player.GetCollectibleNum(id);
|
|
for (float* stat : stats) *stat = count + *stat;
|
|
bonus.speed = bonus.speed - count * FOOD_SLOW;
|
|
};
|
|
food(22, {&bonus.tears, &bonus.range});
|
|
food(23, {&bonus.tears, &bonus.shotSpeed});
|
|
food(24, {&bonus.damage, &bonus.shotSpeed});
|
|
food(25, {&bonus.range, &bonus.shotSpeed});
|
|
food(26, {&bonus.damage, &bonus.range});
|
|
food(346, {&bonus.luck, &bonus.shotSpeed});
|
|
food(456, {&bonus.damage, &bonus.luck});
|
|
food(707, {&bonus.tears, &bonus.luck});
|
|
return bonus;
|
|
}
|
|
|
|
// The fire delay section of 00763570: tears ups through the tears curve, fire rate items, then the multipliers of
|
|
// the shot changing items, as frames between shots.
|
|
static void fire_delay_evaluate(Entity_Player& p, const StatBonuses& bonus, float crownScale)
|
|
{
|
|
auto n = [&](int id) { return (float)p.GetCollectibleNum(id); };
|
|
auto has = [&](int id) { return p.HasCollectible(id); };
|
|
|
|
float tears = pill_uses(p, PILL_TEARS_UP) * 0.5f - pill_uses(p, PILL_TEARS_DOWN) * 0.4f;
|
|
for (int id : {32, 80, 381, 1, 370, 341, 342, 183, 394, 547, 601}) tears = n(id) + tears;
|
|
tears = (n(598) + tears) * 0.7f;
|
|
tears = n(6) * 1.5f + tears;
|
|
tears = (n(669) + n(564) + n(255) + n(115) + n(72)) * 0.5f + tears;
|
|
tears = (float)(p.GetCollectibleNum(196) - p.GetCollectibleNum(182)) * 0.4f + tears;
|
|
tears = (float)(p.GetCollectibleNum(189) + p.GetCollectibleNum(101) + p.GetCollectibleNum(90)) * 0.2f + tears;
|
|
tears = tears - (float)(p.GetCollectibleNum(331) + p.GetCollectibleNum(237)) * 0.3f;
|
|
tears = n(438) * 0.75f + tears;
|
|
tears = n(443) * 0.3f + tears;
|
|
tears = n(465) * 0.35f + tears;
|
|
float bonusTears = bonus.tears * 0.5f;
|
|
if (bonusTears < 0) bonusTears *= NEGATIVE_TEARS_SCALE;
|
|
tears = bonusTears + tears;
|
|
if (p.HasPlayerForm(PLAYER_FORM_CONJOINED)) tears = tears - 0.3f;
|
|
if (p.coopBabyBuffTimers[COOP_BUFF_TEARS] > 0) tears = tears + 1;
|
|
|
|
float curve = std::sqrt(std::max(tears * TEARS_CURVE_SCALE + 1, 0.0f));
|
|
float delay = std::max(TEARS_DELAY_BASE - curve * TEARS_DELAY_STEP - std::min(tears, 0.0f) * TEARS_DELAY_STEP,
|
|
TEARS_DELAY_MIN);
|
|
float rate = FIRE_RATE_FRAMES / (delay + 1);
|
|
if (has(600)) rate *= 1.2f;
|
|
if (crownScale != 1 && rate > CRACKED_CROWN_FIRE_RATE) rate = rate + (rate - CRACKED_CROWN_FIRE_RATE) * (crownScale - 1);
|
|
|
|
float zodiacA = p.GetZodiacEffect() == 307 ? 1.0f : 0.0f;
|
|
float zodiacB = p.GetZodiacEffect() == 309 ? 1.0f : 0.0f;
|
|
float pairs = (float)(p.GetCollectibleNum(307) + p.GetCollectibleNum(228) + p.GetCollectibleNum(224) +
|
|
p.GetCollectibleNum(206)) + zodiacA;
|
|
pairs = (n(309) + pairs + zodiacB + (float)p.fireDelayModifier) * 0.5f;
|
|
float flat = (float)p.brittleBonesUpgrades * 0.4f + pairs;
|
|
flat = n(397) + flat;
|
|
rate = flat + rate;
|
|
if (has(120)) rate = n(120) * 0.7f + 1 + rate;
|
|
rate = n(554) * 0.5f + rate;
|
|
if (!p.HasWeaponType(WEAPON_BRIMSTONE)) rate = n(222) + rate;
|
|
rate = (float)p.g_fuel_count() * 0.5f + rate;
|
|
if (p.grantedCollectibleCountdown > 0) rate = rate + 1.5f;
|
|
|
|
if (!has(245))
|
|
{
|
|
if (has(153) || (has(169) && !p.HasWeaponType(WEAPON_FETUS))) rate *= 0.42f;
|
|
else if (has(2)) rate *= 0.51f;
|
|
}
|
|
if (has(149) && (p.HasWeaponType(WEAPON_TEARS) || p.HasWeaponType(WEAPON_MONSTROS_LUNGS) ||
|
|
p.HasWeaponType(WEAPON_LASER)))
|
|
rate /= 3;
|
|
if (has(531))
|
|
{
|
|
if (!has(149) && p.HasWeaponType(WEAPON_TEARS)) rate *= 0.5f;
|
|
float frames = FIRE_RATE_FRAMES / rate;
|
|
float pause = p.HasWeaponType(WEAPON_FETUS) ? 4.0f : 10.0f;
|
|
rate = rate - rate * pause / (frames + pause);
|
|
float charge = has(118) ? 20.0f : has(52) ? 10.0f : 0.0f;
|
|
if (p.HasWeaponType(WEAPON_MONSTROS_LUNGS)) charge *= 0.5f;
|
|
rate = rate - charge * rate / (FIRE_RATE_FRAMES / rate + charge);
|
|
}
|
|
if (p.HasWeaponType(WEAPON_BRIMSTONE)) rate /= 3;
|
|
else if (p.HasWeaponType(WEAPON_BOMBS)) rate /= 2.5f;
|
|
else if (p.HasWeaponType(WEAPON_BONE)) rate *= 0.5f;
|
|
if (has(152)) rate /= 1.5f;
|
|
if (has(310)) rate *= 0.66f;
|
|
if (p.HasWeaponType(WEAPON_MONSTROS_LUNGS)) rate /= 4.3f;
|
|
else if (p.HasWeaponType(WEAPON_TECH_X) && has(229)) rate /= 3.1f;
|
|
if (has(561)) rate *= 4;
|
|
else if (has(330)) rate *= 5.5f;
|
|
if (p.hallowedGroundCountdown != 0) rate *= 2.5f;
|
|
if (has(368) && p.epiphoraCharge > 0) rate *= (float)p.epiphoraCharge / 180 + 1;
|
|
if (p.peeBurstCooldown > 0) rate = ((float)p.peeBurstCooldown * 5 / (float)p.maxPeeBurstCooldown + 1) * rate;
|
|
if (has(695) && !p.temporaryEffects.isDisabled)
|
|
{
|
|
float lust = std::clamp((float)p.bloodLustCounter, 0.0f, 6.0f);
|
|
rate = lust * 0.05f * lust + lust * 0.2f + rate;
|
|
}
|
|
|
|
p.maxFireDelay = FIRE_RATE_FRAMES / (rate * p.d8FireDelayModifier) - 1;
|
|
static_cast<LuaEngine*>(g_luaEngine)->EvaluateItems(&p, CACHE_FIREDELAY);
|
|
p.maxFireDelay = std::max(p.maxFireDelay, MAX_FIRE_DELAY_MIN);
|
|
}
|
|
|
|
// The damage section of 00763570: damage ups through the damage curve on 3.5, then the multiplying items.
|
|
static void damage_evaluate(Entity_Player& p, const StatBonuses& bonus, float crownScale)
|
|
{
|
|
auto n = [&](int id) { return p.GetCollectibleNum(id); };
|
|
auto has = [&](int id) { return p.HasCollectible(id); };
|
|
float damage = 0;
|
|
|
|
p.meleeDamage = 0;
|
|
for (int id : {7, 90, 216})
|
|
if (has(id)) damage = damage + 1;
|
|
if (p.HasPlayerForm(PLAYER_FORM_SPUN)) damage = damage + 2;
|
|
if (p.HasPlayerForm(PLAYER_FORM_CONJOINED)) damage = damage - 0.3f;
|
|
if (has(109)) damage = (float)p.numCoins * 0.04f + damage;
|
|
if (p.redStewBonusDuration > 0 && !p.temporaryEffects.isDisabled)
|
|
damage = (float)(p.redStewBonusDuration / 10) * 0.04f + damage;
|
|
if (has(716)) damage = (float)((p.keepersSackBonus / 3 + 2) / 3) * 0.5f + damage;
|
|
if (p.grantedCollectibleCountdown > 0) damage = damage + 1;
|
|
|
|
int ups = n(708) + n(592) + n(572) + n(531) + n(345) + n(328) + n(259) + n(208) + n(206) + n(165) + n(121) +
|
|
n(79) + n(70) + n(51) + n(50) + std::max(n(118) - 1, 0);
|
|
float sum = (float)ups;
|
|
sum = (float)n(732) + sum;
|
|
sum = (float)n(730) * 0.75f + sum;
|
|
sum = (float)p.g_fuel_count() * 0.75f + sum;
|
|
sum = (float)((int)has(261) + n(669) + n(331) + n(307) + n(197) + n(80) + n(4)) * 0.5f + sum;
|
|
sum = (float)(n(463) + n(445) + n(201) + n(193) + n(189) + n(138) + n(101) + n(62) + n(12)) * 0.3f + sum;
|
|
float mushrooms = (float)n(633);
|
|
damage = (float)(n(359) + n(237) + n(230) + n(5)) * 1.5f + sum + mushrooms + mushrooms + damage;
|
|
if (has(694)) damage = (float)p.brokenHearts * 0.25f + damage;
|
|
if (has(120)) damage = damage * 0.9f - 0.4f;
|
|
if (p.coopBabyBuffTimers[COOP_BUFF_DAMAGE] > 0) damage = damage + 2;
|
|
|
|
damage = std::sqrt(std::max(damage * DAMAGE_CURVE_SCALE + 1, 0.0f)) * DAMAGE_BASE;
|
|
if (has(169))
|
|
damage = !has(2) && !has(153) && !p.HasWeaponType(WEAPON_FETUS) && !has(245) ? damage + 4 + damage + 4
|
|
: damage + 5;
|
|
damage = (float)(p.potatoPeelerBandageCounter + p.potatoPeelerCounter) * 0.2f + damage;
|
|
damage = std::max((float)p.damageModifier + bonus.damage + damage, DAMAGE_MIN);
|
|
if (has(513)) damage = damage + 0.1f;
|
|
if (p.HasWeaponType(WEAPON_BONE) && has(114)) damage = damage + 4;
|
|
if (has(182)) damage = damage * 2.3f + 1;
|
|
if (has(COLLECTIBLE_BOOK_OF_BELIAL_PASSIVE) && has(COLLECTIBLE_PASSIVE_DAMOCLES)) damage = damage * 1.4f + 1;
|
|
if (has(573) || p.hallowedGroundCountdown > 0) damage = damage * 1.2f;
|
|
if (has(157) && !p.temporaryEffects.isDisabled)
|
|
{
|
|
float cap = has(COLLECTIBLE_BIRTHRIGHT) && p.playerType == PLAYER_SAMSON ? 10.0f : 6.0f;
|
|
float lust = std::clamp((float)p.bloodLustCounter, 0.0f, cap);
|
|
damage = lust * 0.1f * lust + lust * 0.4f + damage;
|
|
}
|
|
|
|
if (has(531)) damage = damage * 1.5f;
|
|
float melee = damage;
|
|
if (has(149))
|
|
{
|
|
bool isTears = p.HasWeaponType(WEAPON_TEARS) || p.HasWeaponType(WEAPON_MONSTROS_LUNGS) ||
|
|
p.HasWeaponType(WEAPON_FETUS);
|
|
damage = damage + (isTears ? 40.0f : 2.0f);
|
|
melee = melee + 2;
|
|
}
|
|
if (has(4) || has(12))
|
|
{
|
|
damage = damage * 1.5f;
|
|
melee = melee * 1.5f;
|
|
}
|
|
if (has(310))
|
|
{
|
|
damage = damage + damage;
|
|
melee = melee + melee;
|
|
}
|
|
if (has(561) || has(330))
|
|
{
|
|
float scale = has(561) ? 0.3f : 0.2f;
|
|
damage = damage * scale;
|
|
melee = melee * scale;
|
|
}
|
|
if (has(245))
|
|
{
|
|
damage = damage * 0.8f;
|
|
melee = melee * 0.8f;
|
|
}
|
|
if (has(373))
|
|
{
|
|
float scale = (float)p.deadEyeCharges * 0.125f + 1;
|
|
damage = scale * damage;
|
|
melee = scale * melee;
|
|
}
|
|
else
|
|
{
|
|
p.deadEyeMisses = 0;
|
|
p.deadEyeCharges = 0;
|
|
}
|
|
if (p.damageMultiplierStacks > 0)
|
|
{
|
|
float scale = std::pow(1.5f, (float)p.damageMultiplierStacks);
|
|
damage = scale * damage;
|
|
melee = scale * melee;
|
|
}
|
|
damage = p.d8DamageModifier * damage;
|
|
melee = p.d8DamageModifier * melee;
|
|
if (crownScale != 0 && damage > DAMAGE_BASE)
|
|
{
|
|
damage = (damage - DAMAGE_BASE) * (crownScale - 1) + damage;
|
|
melee = (melee - DAMAGE_BASE) * (crownScale - 1) + melee;
|
|
}
|
|
p.damage = damage;
|
|
p.meleeDamage = melee;
|
|
|
|
static_cast<LuaEngine*>(g_luaEngine)->EvaluateItems(&p, CACHE_DAMAGE);
|
|
if (g_game->debugFlags & DEBUG_HIGH_DAMAGE)
|
|
{
|
|
p.damage = p.damage + DEBUG_DAMAGE_BONUS;
|
|
p.meleeDamage = p.meleeDamage + DEBUG_DAMAGE_BONUS;
|
|
}
|
|
p.damage = std::max(p.damage, DAMAGE_MIN);
|
|
p.meleeDamage = std::max(p.meleeDamage, DAMAGE_MIN);
|
|
}
|
|
|
|
// The shot speed section of 00763570: shot speed ups and downs on 1.
|
|
static void shot_speed_evaluate(Entity_Player& p, const StatBonuses& bonus, float crownScale)
|
|
{
|
|
auto n = [&](int id) { return p.GetCollectibleNum(id); };
|
|
auto has = [&](int id) { return p.HasCollectible(id); };
|
|
|
|
float pills = (float)(int)(pill_uses(p, PILL_SHOT_SPEED_UP) - pill_uses(p, PILL_SHOT_SPEED_DOWN));
|
|
int occult = std::min(n(572), 1);
|
|
int mascara = std::min(n(310), 1);
|
|
float ups = (float)(n(176) + n(669) + ((n(183) - occult) - n(342)) + n(397) + n(341) + n(339) + n(194)) * 0.16f;
|
|
float drops = (float)(n(564) + n(255) + n(143)) * 0.2f;
|
|
float speed = (float)n(165) * 0.23f + 1 + drops + ups + pills * 0.15f;
|
|
speed = speed - (float)n(182) * 0.25f;
|
|
speed = speed - (float)n(213) * 0.15f;
|
|
speed = speed - (float)mascara * 0.5f;
|
|
speed = speed - (float)n(336) * 0.4f;
|
|
speed = speed - (float)n(331) * 0.3f;
|
|
speed = ((float)p.shotSpeedModifier + bonus.shotSpeed) * 0.2f + (float)n(329) * 0.2f + speed;
|
|
if (p.coopBabyBuffTimers[COOP_BUFF_RANGE] > 0) speed = speed + 0.5f;
|
|
speed = (float)n(554) * 0.2f + speed;
|
|
if (has(5)) speed = speed * 1.6f;
|
|
if (has(149)) speed = speed * 0.8f;
|
|
if (crownScale != 1 && speed - 1 > 0) speed = (crownScale - 1) * (speed - 1) + speed;
|
|
p.shotSpeed = speed;
|
|
|
|
static_cast<LuaEngine*>(g_luaEngine)->EvaluateItems(&p, CACHE_SHOTSPEED);
|
|
p.shotSpeed = std::max(p.shotSpeed, SHOT_SPEED_MIN);
|
|
}
|
|
|
|
// The range section of 00763570: range ups in tiles of 100, the height and fall of the tears, and the range items.
|
|
static void range_evaluate(Entity_Player& p, const StatBonuses& bonus, float crownScale)
|
|
{
|
|
auto n = [&](int id) { return (float)p.GetCollectibleNum(id); };
|
|
auto has = [&](int id) { return p.HasCollectible(id); };
|
|
|
|
p.tearRange = RANGE_BASE;
|
|
p.tearHeight = TEAR_HEIGHT_BASE;
|
|
p.tearFallingSpeed = 0;
|
|
p.tearFallingAcceleration = 0;
|
|
|
|
float pills = pill_uses(p, PILL_RANGE_UP) * 0.5f - pill_uses(p, PILL_RANGE_DOWN) * 0.4f;
|
|
float ups = (float)(p.tearRangeModifier + p.GetCollectibleNum(71) + p.GetCollectibleNum(12)) + bonus.range;
|
|
ups = n(30) + ups;
|
|
ups = n(31) * 1.5f + ups;
|
|
ups = n(397) + ups;
|
|
ups = n(29) + ups + pills;
|
|
for (int id : {339, 345, 14, 370, 189, 455, 355, 659}) ups = n(id) + ups;
|
|
ups = (n(669) + ups) * 100;
|
|
float tiles = (float)(p.GetCollectibleNum(462) + p.GetCollectibleNum(453) + p.GetCollectibleNum(197) +
|
|
p.GetCollectibleNum(121) + p.GetCollectibleNum(110) + p.GetCollectibleNum(101)) * 60 + ups;
|
|
tiles = tiles - n(336) * 60;
|
|
tiles = n(369) * 120 + tiles;
|
|
p.tearRange = n(394) * 120 + tiles + p.tearRange;
|
|
|
|
if (has(572))
|
|
{
|
|
p.tearHeight = p.tearHeight - 8;
|
|
p.tearRange = p.tearRange + 80;
|
|
}
|
|
if (has(594)) p.tearHeight = p.tearHeight - 8;
|
|
if (has(598)) p.tearHeight = p.tearHeight * 0.4f;
|
|
if (has(716)) p.tearRange = (float)((p.keepersSackBonus / 3 + 1) / 3) * 10 + p.tearRange;
|
|
if (p.coopBabyBuffTimers[COOP_BUFF_RANGE] > 0) p.tearRange = p.tearRange + 80;
|
|
if (has(149) || has(531))
|
|
{
|
|
if (!has(229))
|
|
{
|
|
p.tearFallingAcceleration = 0.8f;
|
|
p.tearRange = p.tearRange * 0.8f;
|
|
}
|
|
}
|
|
else if (has(224)) p.tearRange = p.tearRange * 0.8f;
|
|
if (has(233))
|
|
{
|
|
p.tearRange = p.tearRange + RANGE_BASE;
|
|
p.tearFallingAcceleration = p.tearFallingAcceleration * 0.01f;
|
|
}
|
|
if (has(307) || p.GetZodiacEffect() == 307) p.tearRange = p.tearRange + 30;
|
|
if (has(214)) p.tearRange = p.tearRange + 60;
|
|
if (has(6))
|
|
{
|
|
p.tearHeight = p.tearHeight + 18;
|
|
p.tearRange = std::min(p.tearRange, std::max(p.tearRange - 60, 200.0f) * 0.8f);
|
|
}
|
|
else if (has(440)) p.tearHeight = p.tearHeight + 18;
|
|
if (has(5)) p.tearRange = p.tearRange + p.tearRange + 60;
|
|
p.tearRange = p.tearRange * p.d8RangeModifier;
|
|
if (crownScale != 1 && p.tearRange > RANGE_BASE)
|
|
p.tearRange = (p.tearRange - RANGE_BASE) * (crownScale - 1) + p.tearRange;
|
|
|
|
static_cast<LuaEngine*>(g_luaEngine)->EvaluateItems(&p, CACHE_RANGE);
|
|
if (p.tearRange < RANGE_MIN) p.tearRange = RANGE_MIN;
|
|
if (p.tearFallingAcceleration > 0)
|
|
p.tearFallingAcceleration = p.shotSpeed * p.shotSpeed * p.tearFallingAcceleration;
|
|
}
|
|
|
|
// The speed section of 00763570: speed ups on 1, and the items that set or cap it.
|
|
static void speed_evaluate(Entity_Player& p, const StatBonuses& bonus, float crownScale)
|
|
{
|
|
auto n = [&](int id) { return p.GetCollectibleNum(id); };
|
|
auto has = [&](int id) { return p.HasCollectible(id); };
|
|
|
|
float pills = pill_uses(p, PILL_SPEED_UP) * 0.5f - pill_uses(p, PILL_SPEED_DOWN) * 0.4f;
|
|
int rollers = p.g_fuel_count() < 1 ? n(143) : 0;
|
|
float ups = (float)(n(232) + n(119) + n(28) + n(27)) + pills;
|
|
for (int id : {340, 12, 71, 101, 120}) ups = (float)n(id) + ups;
|
|
ups = ups + (float)rollers;
|
|
ups = (float)n(82) + ups;
|
|
ups = (float)n(571) + ups;
|
|
float quick = ups * 0.3f;
|
|
float steady = (float)n(70) * 0.5f;
|
|
steady = (float)n(590) + steady;
|
|
steady = steady * 0.4f;
|
|
int sharp = std::min(n(14), 1);
|
|
int slow = std::min(n(13), 1);
|
|
float speed = (float)((((slow - n(90)) - n(129)) - n(121)) + n(669) + n(189) + n(79)) * 0.2f +
|
|
(float)sharp * 0.3f + 1 + steady + quick;
|
|
p.moveSpeed = ((float)p.speedModifier + bonus.speed) * 0.2f + (float)n(445) * 0.1f + speed;
|
|
|
|
if (has(695) && !p.temporaryEffects.isDisabled)
|
|
{
|
|
float lust = std::clamp((float)p.bloodLustCounter, 0.0f, 6.0f);
|
|
p.moveSpeed = lust * 0.02f * lust + lust * 0.05f + p.moveSpeed;
|
|
}
|
|
if (has(716)) p.moveSpeed = (float)(p.keepersSackBonus / 9) * 0.03f + p.moveSpeed;
|
|
if (p.coopBabyBuffTimers[COOP_BUFF_SPEED] > 0) p.moveSpeed = p.moveSpeed + 0.15f;
|
|
if (has(230)) p.moveSpeed = p.moveSpeed + 0.2f;
|
|
if (p.HasPlayerForm(PLAYER_FORM_SPUN)) p.moveSpeed = p.moveSpeed + 0.15f;
|
|
if (p.HasPlayerForm(PLAYER_FORM_LEVIATHAN)) p.moveSpeed = p.moveSpeed + 0.2f;
|
|
if (has(130) || has(181)) p.moveSpeed = std::max(p.moveSpeed, 1.5f);
|
|
if (has(COLLECTIBLE_TAURUS) || p.GetZodiacEffect() == COLLECTIBLE_TAURUS) p.moveSpeed = p.moveSpeed - 0.3f;
|
|
if (has(300) || p.GetZodiacEffect() == 300) p.moveSpeed = p.moveSpeed + 0.25f;
|
|
if (has(306) || p.GetZodiacEffect() == 306) p.moveSpeed = p.moveSpeed + 0.2f;
|
|
if (has(307) || p.GetZodiacEffect() == 307) p.moveSpeed = p.moveSpeed + 0.1f;
|
|
if (has(314)) p.moveSpeed = p.moveSpeed - 0.4f;
|
|
p.moveSpeed = p.d8SpeedModifier * p.moveSpeed;
|
|
if (crownScale != 1 && p.moveSpeed > 1) p.moveSpeed = (p.moveSpeed - 1) * (crownScale - 1) + p.moveSpeed;
|
|
|
|
static_cast<LuaEngine*>(g_luaEngine)->EvaluateItems(&p, CACHE_SPEED);
|
|
}
|
|
|
|
// The luck section of 00763570: luck ups, and Fortune Cookie's wisps.
|
|
static void luck_evaluate(Entity_Player& p, const StatBonuses& bonus)
|
|
{
|
|
auto n = [&](int id) { return (float)p.GetCollectibleNum(id); };
|
|
|
|
float pills = pill_uses(p, PILL_LUCK_UP) - pill_uses(p, PILL_LUCK_DOWN);
|
|
float luck = (float)p.luckModifier + bonus.luck + pills + (float)p.donateLuck + p.edenLuck + n(253);
|
|
for (int id : {46, 343, 355, 439}) luck = n(id) + luck;
|
|
luck = luck - n(5);
|
|
luck = n(669) + luck;
|
|
luck = (float)(p.GetCollectibleNum(632) * 2) + luck;
|
|
p.luck = n(730) + luck;
|
|
|
|
int wisps = 0;
|
|
for (Entity* entity : g_game->room->entityList.updateEL)
|
|
if (entity && entity->type == ENTITY_FAMILIAR && entity->variant == FAMILIAR_ITEM_WISP &&
|
|
entity->subtype == COLLECTIBLE_FORTUNE_COOKIE && static_cast<Entity_Familiar*>(entity)->player == &p)
|
|
wisps++;
|
|
p.luck = (float)wisps * 0.2f + p.luck;
|
|
if (p.coopBabyBuffTimers[COOP_BUFF_LUCK] > 0) p.luck = p.luck + 2;
|
|
if (p.HasCollectible(492)) p.luck = p.luck + 1;
|
|
if (g_game->debugFlags & DEBUG_HIGH_LUCK) p.luck = p.luck + DEBUG_LUCK_BONUS;
|
|
|
|
static_cast<LuaEngine*>(g_luaEngine)->EvaluateItems(&p, CACHE_LUCK);
|
|
}
|
|
|
|
// How fast a tear falls to reach its range at its shot speed from its height (0067da40).
|
|
static float tear_fall_speed(float height, float range, float shotSpeed, float acceleration)
|
|
{
|
|
float flight = range / shotSpeed;
|
|
float slope = std::max((std::pow(FALL_SPEED_DECAY, flight) - 1) * FALL_SPEED_SLOPE, FALL_SPEED_MIN_SLOPE);
|
|
return ((TEAR_HEIGHT_MAX - height) - (acceleration * FALL_SPEED_RANGE_SCALE + 1) * (flight - slope)) / slope;
|
|
}
|
|
|
|
// The flag (and a second one, or -1) an item gives tears, the item or (when isEffectToo) its temporary effect.
|
|
struct TearFlagGrant
|
|
{
|
|
int collectible = 0;
|
|
bool isEffectToo = false;
|
|
int bit = 0;
|
|
int otherBit = -1;
|
|
};
|
|
|
|
// The tear flags of single items: Eye of the Occult, Uranus, Terra, Playdough Cookie, Lump of Coal, Technology Zero,
|
|
// Proptosis, Polyphemus, Parasite, My Reflection, Tiny Planet, Cricket's Body, Rubber Cement, Strange Attractor,
|
|
// Godhead, Continuum, Tractor Beam, Trisagion, Fire Mind, Mysterious Liquid, Dark Matter, Compound Fracture, Eye of
|
|
// Belial, Jacob's Ladder, Lachryphagy, Pop!, Flat Stone and Backstabber.
|
|
constexpr std::array<TearFlagGrant, 28> TEAR_FLAG_GRANTS = {{{572, true, TEAR_OCCULT},
|
|
{596, true, TEAR_ICE_FLAG},
|
|
{592, true, TEAR_ROCK_FLAG},
|
|
{570, false, TEAR_RAINBOW},
|
|
{132, false, TEAR_GROW},
|
|
{524, false, TEAR_LASER},
|
|
{261, true, TEAR_SHRINK},
|
|
{169, false, TEAR_PERSISTENT},
|
|
{104, false, TEAR_SPLIT},
|
|
{5, true, TEAR_BOOMERANG},
|
|
{233, false, TEAR_ORBIT, TEAR_SPECTRAL},
|
|
{224, false, TEAR_QUADSPLIT},
|
|
{221, false, TEAR_BOUNCE},
|
|
{315, false, TEAR_ATTRACTOR},
|
|
{331, false, TEAR_GLOW},
|
|
{369, false, TEAR_CONTINUUM, TEAR_SPECTRAL},
|
|
{397, false, TEAR_TRACTOR_BEAM},
|
|
{533, false, TEAR_LASERSHOT},
|
|
{257, true, TEAR_BURN},
|
|
{317, true, TEAR_MYSTERIOUS_LIQUID_CREEP},
|
|
{259, true, TEAR_DARK_MATTER_FLAG},
|
|
{453, false, TEAR_BONE_FLAG},
|
|
{462, false, TEAR_PIERCING, TEAR_BELIAL_FLAG},
|
|
{494, false, TEAR_JACOBS},
|
|
{532, false, TEAR_ABSORB},
|
|
{529, false, TEAR_POP},
|
|
{540, false, TEAR_HYDROBOUNCE},
|
|
{506, false, TEAR_BACKSTAB}}};
|
|
|
|
// The tear flags of the worm trinkets: Brain, Wiggle, Hook, Pulse, Ring, Flat and Ouroboros Worm.
|
|
constexpr std::array<TearFlagGrant, 7> WORM_GRANTS = {{{144, false, TEAR_TURN_HORIZONTAL},
|
|
{10, false, TEAR_WIGGLE, TEAR_SPECTRAL},
|
|
{26, false, TEAR_SQUARE, TEAR_SPECTRAL},
|
|
{9, false, TEAR_PULSE},
|
|
{11, false, TEAR_SPIRAL, TEAR_SPECTRAL},
|
|
{12, false, TEAR_FLAT},
|
|
{96, false, TEAR_BIG_SPIRAL, TEAR_SPECTRAL}}};
|
|
|
|
// Whether the player has a collectible, or its temporary effect.
|
|
static bool is_having(Entity_Player& p, int collectible)
|
|
{
|
|
return p.HasCollectible(collectible) || p.temporaryEffects.HasCollectibleEffect(collectible);
|
|
}
|
|
|
|
// Whether the player is one of the spirits whose tears and lasers glow and pass through rocks: the Lost and its
|
|
// tainted and cursed forms, the Soul, the ghost babies, co-op ghosts, Spirit Shackles' soul, and the nulls doing so.
|
|
static bool is_spirit(Entity_Player& p)
|
|
{
|
|
TemporaryEffects& effects = p.temporaryEffects;
|
|
bool isGhostBaby = p.variant == PLAYER_VARIANT_COOP_BABY &&
|
|
(p.babySkin == BABY_SKIN_GHOST_B || p.babySkin == BABY_SKIN_GHOST_A);
|
|
return p.playerType == PLAYER_THELOST || p.playerType == PLAYER_THELOST_B || p.playerType == PLAYER_JACOB2_B ||
|
|
p.playerType == PLAYER_THESOUL || isGhostBaby || p.isCoopGhost ||
|
|
effects.GetCollectibleEffectNum(COLLECTIBLE_SPIRIT_SHACKLES) == 1 ||
|
|
effects.HasNullEffect(NULLITEM_REVERSE_SUN) || effects.HasNullEffect(NULLITEM_SPIRIT_SHACKLES_SOUL) ||
|
|
effects.HasNullEffect(NULLITEM_LOST_CURSE);
|
|
}
|
|
|
|
// The tear flags section of 00763570: the flags of single items and worms, then those several items share.
|
|
static void tear_flags_evaluate(Entity_Player& p)
|
|
{
|
|
auto has = [&](int id) { return p.HasCollectible(id); };
|
|
auto add = [&](std::initializer_list<int> bits)
|
|
{
|
|
for (int bit : bits)
|
|
if (bit >= 0) p.tearFlags.set(bit);
|
|
};
|
|
TemporaryEffects& effects = p.temporaryEffects;
|
|
bool isLudovico = p.HasWeaponType(WEAPON_LUDOVICO_TECHNIQUE);
|
|
|
|
p.tearFlags.reset();
|
|
for (const TearFlagGrant& grant : TEAR_FLAG_GRANTS)
|
|
if (grant.isEffectToo ? is_having(p, grant.collectible) : has(grant.collectible)) add({grant.bit, grant.otherBit});
|
|
for (const TearFlagGrant& grant : WORM_GRANTS)
|
|
if (p.HasTrinket(grant.collectible)) add({grant.bit, grant.otherBit});
|
|
|
|
bool isHoming = has(182) || is_having(p, 3) || effects.HasCollectibleEffect(192) || has(331) ||
|
|
(p.variant == PLAYER_VARIANT_COOP_BABY && p.babySkin == BABY_SKIN_SPOON) ||
|
|
p.hallowedGroundCountdown > 0;
|
|
bool isSpectral = has(185) || is_having(p, 115) || has(159) || isLudovico || has(336) || has(379) ||
|
|
is_having(p, 358) || is_spirit(p);
|
|
bool isPiercing = has(48) || is_having(p, 237) || has(306) || p.GetZodiacEffect() == 306 || isLudovico || has(336);
|
|
bool isWaiting = has(222) && !isLudovico && !p.HasWeaponType(WEAPON_MONSTROS_LUNGS) &&
|
|
(!p.HasWeaponType(WEAPON_TEARS) || (!has(316) && !has(69)));
|
|
bool isKnockback = has(309) || p.GetZodiacEffect() == 309 || has(359) || p.HasTrinket(77) || has(592);
|
|
if (isHoming) add({TEAR_HOMING});
|
|
if (isSpectral) add({TEAR_SPECTRAL});
|
|
if (isPiercing) add({TEAR_PIERCING});
|
|
if (has(305) || p.GetZodiacEffect() == 305) add({TEAR_POISON});
|
|
if (has(149) && (!isLudovico || has(540))) add({TEAR_EXPLOSIVE, TEAR_POISON});
|
|
if (isWaiting) add({TEAR_WAIT});
|
|
if (isKnockback) add({TEAR_KNOCKBACK});
|
|
if (has(213) || effects.HasNullEffect(NULLITEM_SOUL_FORGOTTEN)) add({TEAR_SHIELDED});
|
|
static_cast<LuaEngine*>(g_luaEngine)->EvaluateItems(&p, CACHE_TEARFLAG);
|
|
}
|
|
|
|
// A colour with only its tint, colorize and offset set.
|
|
static constexpr ColorMod color_make(std::array<float, 4> tint, std::array<float, 4> colorize = {},
|
|
std::array<float, 3> offset = {})
|
|
{
|
|
return {{tint[0], tint[1], tint[2], tint[3]},
|
|
{colorize[0], colorize[1], colorize[2], colorize[3]},
|
|
{offset[0], offset[1], offset[2]}};
|
|
}
|
|
|
|
// A colorized white colour, offset alike on every channel.
|
|
static constexpr ColorMod colorized(float r, float g, float b, float offset = 0)
|
|
{
|
|
return color_make({1, 1, 1, 1}, {r, g, b, 1}, {offset, offset, offset});
|
|
}
|
|
|
|
// An offset given in 0 to 255 steps (00683010).
|
|
static constexpr std::array<float, 3> offset_255(int r, int g, int b)
|
|
{
|
|
return {(float)r * COLOR_OFFSET_UNIT, (float)g * COLOR_OFFSET_UNIT, (float)b * COLOR_OFFSET_UNIT};
|
|
}
|
|
|
|
// The first colour whose condition holds, or the default.
|
|
static ColorMod color_pick(std::initializer_list<std::pair<bool, ColorMod>> choices)
|
|
{
|
|
for (const auto& [isMatch, color] : choices)
|
|
if (isMatch) return color;
|
|
return COLOR_DEFAULT;
|
|
}
|
|
|
|
// Whether two colours match on every channel (00753560).
|
|
static bool color_equals(const ColorMod& a, const ColorMod& b)
|
|
{
|
|
return std::ranges::equal(a._tint, b._tint) && std::ranges::equal(a._colorize, b._colorize) &&
|
|
std::ranges::equal(a._offset, b._offset);
|
|
}
|
|
|
|
// The laser colour part of 00763570: the first item in a fixed order picks it.
|
|
static ColorMod laser_color_get(Entity_Player& p)
|
|
{
|
|
auto has = [&](int id) { return p.HasCollectible(id); };
|
|
bool isSpoon = is_having(p, 3) || p.temporaryEffects.HasCollectibleEffect(192) ||
|
|
(p.variant == PLAYER_VARIANT_COOP_BABY && p.babySkin == BABY_SKIN_SPOON);
|
|
bool isPoison = has(103) || has(317) || has(305) || p.GetZodiacEffect() == 305 || has(459);
|
|
|
|
return color_pick({{is_having(p, 429), colorized(6, 4, 1)},
|
|
{has(149), colorized(1.8f, 3, 1)},
|
|
{has(182) || p.hallowedGroundCountdown > 0, colorized(5, 6, 6)},
|
|
{has(596), colorized(4, 4.4f, 6, 0.1f)},
|
|
{is_having(p, 572), colorized(3, 0.5f, 3)},
|
|
{has(257), colorized(5, 3, 1)},
|
|
{isPoison, colorized(1.8f, 4, 1)},
|
|
{has(104), colorized(3, 1.5f, 0.4f)},
|
|
{has(89), colorized(5.2f, 5.2f, 5)},
|
|
{is_having(p, 315) || has(401) || has(617), colorized(1, 1, 1)},
|
|
{has(618), colorized(5, 1, 0)},
|
|
{has(553), colorized(2, 2, 4)},
|
|
{has(494), colorized(3.8f, 4.9f, 6, 0.1f)},
|
|
{is_having(p, 6), colorized(5, 4.9f, 1)},
|
|
{isSpoon, colorized(3, 1, 3.5f)},
|
|
{has(200), colorized(4, 1, 3.5f)},
|
|
{is_having(p, 398), colorized(1.2f, 1.2f, 4)},
|
|
{has(69), colorized(3, 1.7f, 1.7f)},
|
|
{has(561), colorized(5.6f, 5.2f, 3.8f)},
|
|
{has(330), colorized(5.6f, 5, 4.2f)},
|
|
{has(132), color_make({3, 3, 3, 1}, {1.3f, 1.2f, 1.2f, 1}, {-0.5f, -0.5f, -0.5f})},
|
|
{has(259), color_make({3, 3, 3, 1}, {1, 1, 1, 1}, {-0.5f, -0.5f, -0.5f})},
|
|
{p.playerType == PLAYER_BLUEBABY_B, color_make({2, 2, 2, 1}, {0.7f, 0.3f, 0.1f, 1})}});
|
|
}
|
|
|
|
// The tear colour part of 00763570: the first item in a fixed order picks it.
|
|
static ColorMod tear_color_get(Entity_Player& p)
|
|
{
|
|
auto has = [&](int id) { return p.HasCollectible(id); };
|
|
bool isSpoon = is_having(p, 3) || p.temporaryEffects.HasCollectibleEffect(192) ||
|
|
(p.variant == PLAYER_VARIANT_COOP_BABY && p.babySkin == BABY_SKIN_SPOON);
|
|
|
|
if (g_game->deathmatchManager.is_active())
|
|
reconstruction_missing("Entity_Player::EvaluateItems 00763570 (the deathmatch's tear colour)");
|
|
return color_pick(
|
|
{{is_having(p, 317), color_make({1, 1, 1, 1}, {0.2f, 1, 0.2f, 1}, {0, 0.2f, 0})},
|
|
{is_having(p, 257), color_make({1, 1, 1, 1}, {1.8f, 0.9f, 0.3f, 1}, {0.3f, 0, 0})},
|
|
{is_having(p, 259), colorized(0.3f, 0.3f, 0.3f)},
|
|
{has(149) && !p.HasWeaponType(WEAPON_BOMBS), color_make({0.5f, 0.9f, 0.4f, 1})},
|
|
{has(182) || p.hallowedGroundCountdown > 0, color_make({1.5f, 2, 2, 1})},
|
|
{is_having(p, 572), colorized(0.3f, 0, 0.25f)},
|
|
{has(132), color_make({0.2f, 0.09f, 0.065f, 1})},
|
|
{has(104), color_make({0.9f, 0.3f, 0.08f, 1})},
|
|
{has(69), color_make({0.33f, 0.18f, 0.18f, 1}, {}, offset_255(66, 40, 40))},
|
|
{is_having(p, 6), color_make({1, 1, 0, 1}, {}, offset_255(45, 15, 0))},
|
|
{isSpoon, color_make({0.4f, 0.15f, 0.38f, 1}, {}, offset_255(71, 0, 116))},
|
|
{has(310), color_make({0.2f, 0.2f, 0.2f, 1})},
|
|
{has(221), color_make({1, 1, 0.8f, 1}, {}, {0.1f, 0.1f, 0.1f})},
|
|
{has(336), color_make({0.5f, 0.25f, 0.1f, 0.9f})},
|
|
{has(561), color_make({1.8f, 1.7f, 1, 1})},
|
|
{has(330), color_make({1.5f, 2, 2, 1})},
|
|
{is_having(p, 398) && p.HasWeaponType(WEAPON_KNIFE), color_make({0.5f, 0.5f, 1, 1})},
|
|
{p.HasWeaponType(WEAPON_BONE) && has(COLLECTIBLE_HAEMOLACRIA), color_make({0.92f, 0.05f, 0.03f, 1})},
|
|
{p.playerType == PLAYER_BLUEBABY_B && !has(COLLECTIBLE_C_SECTION),
|
|
color_make({1.5f, 1.5f, 1.5f, 1}, {0.7f, 0.6f, 0.5f, 1}, {-0.4f, -0.45f, -0.4f})}});
|
|
}
|
|
|
|
// The tear colour section of 00763570: the laser and tear colours, both glowing for spirits and faded for holograms.
|
|
static void tear_color_evaluate(Entity_Player& p)
|
|
{
|
|
constexpr ColorMod SPIRIT_GLOW = color_make({1.5f, 2, 2, 0.5f});
|
|
|
|
p.laserColor = laser_color_get(p);
|
|
p.tearColor = tear_color_get(p);
|
|
if (is_having(p, 115) || p.HasCollectible(159) || p.HasCollectible(185) || is_spirit(p))
|
|
{
|
|
color_multiply(p.tearColor, SPIRIT_GLOW);
|
|
color_multiply(p.laserColor, SPIRIT_GLOW);
|
|
}
|
|
if (p.IsHologram())
|
|
{
|
|
p.tearColor._tint[3] = HOLOGRAM_ALPHA;
|
|
p.laserColor._tint[3] = HOLOGRAM_ALPHA;
|
|
}
|
|
static_cast<LuaEngine*>(g_luaEngine)->EvaluateItems(&p, CACHE_TEARCOLOR);
|
|
}
|
|
|
|
// Whether the player flies: the flying items and transformations, the flying characters, effects and nulls.
|
|
static bool is_flying(Entity_Player& p)
|
|
{
|
|
TemporaryEffects& effects = p.temporaryEffects;
|
|
int wings = effects.GetCollectibleEffectNum(20);
|
|
for (int id : {185, 184, 181, 179, 159, 130, 82, 20}) wings += p.GetCollectibleNum(id);
|
|
if (wings >= 1 || p.HasPlayerForm(0) || p.HasPlayerForm(1) || p.HasPlayerForm(8)) return true;
|
|
|
|
bool isFlyingType = p.variant == PLAYER_VARIANT_COOP_BABY || p.playerType == PLAYER_THELOST ||
|
|
p.playerType == PLAYER_THELOST_B || p.playerType == PLAYER_JACOB2_B ||
|
|
p.playerType == PLAYER_THESOUL_B || p.playerType == PLAYER_AZAZEL ||
|
|
p.playerType == PLAYER_THESOUL;
|
|
return isFlyingType || p.HasPlayerForm(3) || effects.HasCollectibleEffect(33) || effects.HasCollectibleEffect(20) ||
|
|
effects.HasCollectibleEffect(409) || effects.HasTrinketEffect(118) || p.HasPlayerForm(14) ||
|
|
effects.GetCollectibleEffectNum(COLLECTIBLE_SPIRIT_SHACKLES) == 1 ||
|
|
effects.HasNullEffect(NULLITEM_REVERSE_SUN) || effects.HasNullEffect(NULLITEM_REVERSE_DEVIL) ||
|
|
effects.HasNullEffect(NULLITEM_ESAU_JR) || effects.HasNullEffect(NULLITEM_SPIRIT_SHACKLES_SOUL) ||
|
|
effects.HasNullEffect(NULLITEM_LOST_CURSE) || effects.HasTrinketEffect(TRINKET_AZAZELS_STUMP) ||
|
|
(effects.HasCollectibleEffect(714) && p.playerType == PLAYER_THEFORGOTTEN_B) || p.HasCollectible(643) ||
|
|
p.HasCollectible(633);
|
|
}
|
|
|
|
// The flying section of 00763570: flight and the grid collision it gives. Losing flight asks whether the player can
|
|
// walk back to the entrance (the original keeps it flying by a Transcendence effect if not), which stops the game.
|
|
static void flying_evaluate(Entity_Player& p)
|
|
{
|
|
bool wasFlying = p.canFly;
|
|
|
|
p.canFly = is_flying(p);
|
|
p.entityGridCollisionClass = p.canFly ? GRIDCOLL_WALLS : GRIDCOLL_GROUND;
|
|
if (wasFlying && !p.canFly)
|
|
reconstruction_missing("Entity_Player::EvaluateItems 00763570 (Room::is_reachable_from_player 00823be0)");
|
|
static_cast<LuaEngine*>(g_luaEngine)->EvaluateItems(&p, CACHE_FLYING);
|
|
p.entityGridCollisionClass = p.canFly ? GRIDCOLL_WALLS : GRIDCOLL_GROUND;
|
|
if (p.canFly != wasFlying) p.UpdateCostumes();
|
|
}
|
|
|
|
// The scale a size step gives: doubling each step up to two, then growing in a line.
|
|
static float size_scale(float steps)
|
|
{
|
|
return steps < SIZE_SCALE_KNEE ? std::pow(SIZE_SCALE_KNEE, steps)
|
|
: (steps - SIZE_SCALE_KNEE) * SIZE_SCALE_SLOPE + SIZE_SCALE_AT_KNEE;
|
|
}
|
|
|
|
// The size section of 00763570: the sprite and head grow or shrink by the size items, pills and co-op buffs.
|
|
static void size_evaluate(Entity_Player& p)
|
|
{
|
|
auto n = [&](int id) { return p.GetCollectibleNum(id); };
|
|
auto effect = [&](int id) { return p.temporaryEffects.GetCollectibleEffectNum(id); };
|
|
Game& game = *g_game;
|
|
bool isMistOrGhost = p.hasCurseMistEffect || p.isCoopGhost;
|
|
|
|
int pills = isMistOrGhost ? 0 : (int)pill_uses(p, PILL_LARGER) - (int)pill_uses(p, PILL_SMALLER);
|
|
int steps = (int)(p.coopBabyBuffTimers[COOP_BUFF_LARGER] > 0) - (int)(p.coopBabyBuffTimers[COOP_BUFF_SMALLER] > 0) +
|
|
pills - n(71) - effect(71);
|
|
float body = (float)(n(12) + (steps - n(438)) + effect(12)) * SIZE_STEP + 0;
|
|
body = (float)n(302) * 0.263f + body;
|
|
body = body - (float)n(340) * 0.152f;
|
|
body = (float)p.temporaryEffects.GetNullEffectNum(NULLITEM_HUGE_GROWTH) * 0.678f + body;
|
|
body = body - (float)(n(598) + effect(688));
|
|
float head = (float)(effect(121) + ((n(121) - n(120)) - effect(120))) * 0.152f + 0;
|
|
if (game.seedEffects.HasSeedEffect(SEED_BIG_HEAD)) head = head + BIG_HEAD_BONUS;
|
|
if (game.seedEffects.HasSeedEffect(SEED_SMALL_HEAD)) head = head - 1;
|
|
if (game.dailyChallenge._id == DAILY_BIG_SIZE) body = body + DAILY_BIG_SIZE_BONUS;
|
|
|
|
float bodyScale = size_scale(body);
|
|
float headScale = size_scale(head);
|
|
p.playerSpriteScale = vector_make(bodyScale, bodyScale);
|
|
p.headScale = vector_make(headScale, headScale);
|
|
p.bodyScale = vector_make(1, 1);
|
|
static_cast<LuaEngine*>(g_luaEngine)->EvaluateItems(&p, CACHE_SIZE);
|
|
if (std::min(p.playerSpriteScale.x, p.playerSpriteScale.y) >= SPRITE_SCALE_UNLOCK)
|
|
g_manager->persistentGameData.TryUnlock(ACHIEVEMENT_HUGE);
|
|
}
|
|
|
|
// The color section of 00763570: the character's and items' tints over the colour override, then a red flush with
|
|
// Taurus, Lusty Blood, Bloody Lust and Tainted Samson's berserk charge. A sprite showing the entity's colour follows.
|
|
static void color_evaluate(Entity_Player& p)
|
|
{
|
|
constexpr ColorMod SOUL_TINT = color_make({1.5f, 1.7f, 2, 1}, {}, {0.05f, 0.12f, 0.2f});
|
|
constexpr ColorMod ANTI_GRAVITY_TINT = color_make({1.4f, 2, 1.8f, 1});
|
|
constexpr ColorMod SPOOKY_TINT = color_make({1, 1, 1, 1}, {}, {0, -0.5f, -0.5f});
|
|
constexpr ColorMod TOXIC_TINT = color_make({1, 1, 1, 1}, {}, {0, 0.2f, 0});
|
|
constexpr ColorMod FLUSH_RED = color_make({1, 0, 0, 1});
|
|
TemporaryEffects& effects = p.temporaryEffects;
|
|
bool isSynced = color_equals(p.sprite.color, p.color);
|
|
|
|
ColorMod base = COLOR_DEFAULT;
|
|
if (p.playerType == PLAYER_THESOUL || effects.HasNullEffect(NULLITEM_SPIRIT_SHACKLES_SOUL) ||
|
|
p.playerType == PLAYER_THESOUL_B)
|
|
color_multiply(base, SOUL_TINT);
|
|
else if (p.HasCollectible(COLLECTIBLE_ANTI_GRAVITY)) color_multiply(base, ANTI_GRAVITY_TINT);
|
|
if (p.HasCollectible(COLLECTIBLE_2SPOOKY)) color_multiply(base, SPOOKY_TINT);
|
|
|
|
p.color = base;
|
|
color_multiply(p.color, p.colorOverride);
|
|
if (p.HasCollectible(COLLECTIBLE_VIRUS)) std::ranges::copy(std::array{1.25f, 1.25f, 1.25f, 0.25f}, p.color._colorize);
|
|
if (p.HasCollectible(COLLECTIBLE_TOXIC_SHOCK))
|
|
{
|
|
std::ranges::copy(std::array{0.0f, 1.0f, 0.0f, 0.5f}, p.color._colorize);
|
|
color_multiply(p.color, TOXIC_TINT);
|
|
}
|
|
|
|
float flush = 0;
|
|
if (TemporaryEffect* taurus = effects.GetCollectibleEffect(COLLECTIBLE_TAURUS); taurus && taurus->cooldown == 0)
|
|
flush = std::max(flush, p.taurusSpeedBonus * 0.5f);
|
|
int lustyBlood = effects.GetCollectibleEffectNum(COLLECTIBLE_LUSTY_BLOOD);
|
|
if (p.bloodLustCounter > 0 || lustyBlood > 0)
|
|
flush = std::max(flush, (float)std::min(std::max((int)p.bloodLustCounter, lustyBlood), BLOOD_LUST_COLOR_CAP) *
|
|
BLOOD_LUST_COLOR_STEP);
|
|
if (p.playerType == PLAYER_SAMSON_B)
|
|
flush = std::max(flush, std::clamp((float)p.samsonBerserkCharge / BERSERK_CHARGE_FULL, 0.0f, 1.0f));
|
|
if (flush > 0)
|
|
{
|
|
ColorMod red = base;
|
|
color_multiply(red, FLUSH_RED);
|
|
p.color = color_lerp(p.color, red, flush);
|
|
}
|
|
static_cast<LuaEngine*>(g_luaEngine)->EvaluateItems(&p, CACHE_COLOR);
|
|
if (isSynced) p.ResetColor();
|
|
}
|
|
|
|
// The familiars section of 00763570, not written yet: it stops the game when an owned item, effect or trinket asks
|
|
// for familiars, and otherwise only hands the section to the mods.
|
|
static void familiars_check(Entity_Player& p)
|
|
{
|
|
bool isAsked = is_cache_owned(p, CACHE_FAMILIARS) || !p.temporaryEffects.effects.empty() ||
|
|
std::ranges::any_of(p.trinkets, [](uint32_t trinket) { return trinket != 0; }) ||
|
|
p.numLeprosy > 0 || p.tonsilCount > 0 || p.potatoPeelerCounter > 0 ||
|
|
p.potatoPeelerBandageCounter > 0 || p.HasPlayerForm(PLAYER_FORM_SPIDER_BABY);
|
|
if (isAsked) reconstruction_missing("Entity_Player::EvaluateItems 00763570 (familiars)");
|
|
static_cast<LuaEngine*>(g_luaEngine)->EvaluateItems(&p, CACHE_FAMILIARS);
|
|
}
|
|
|
|
// The weapon the player's items and character give, before the pairs that cancel out.
|
|
static WeaponType weapon_type_get(Entity_Player& p)
|
|
{
|
|
auto has = [&](int id) { return p.HasCollectible(id); };
|
|
TemporaryEffects& effects = p.temporaryEffects;
|
|
bool isLung = has(COLLECTIBLE_MONSTROS_LUNG);
|
|
bool isAzazel = p.playerType == PLAYER_AZAZEL || effects.HasTrinketEffect(TRINKET_AZAZELS_STUMP) ||
|
|
p.playerType == PLAYER_AZAZEL_B;
|
|
bool isBone = p.playerType == PLAYER_THEFORGOTTEN || p.playerType == PLAYER_THEFORGOTTEN_B ||
|
|
(p.variant == PLAYER_VARIANT_COOP_BABY && p.babySkin == BABY_SKIN_BONE) ||
|
|
effects.HasCollectibleEffect(COLLECTIBLE_BERSERK);
|
|
|
|
if (isBone) return WEAPON_BONE;
|
|
if (effects.HasCollectibleEffect(COLLECTIBLE_MEGA_MUSH)) return WEAPON_TEARS;
|
|
if (effects.HasNullEffect(NULLITEM_BLOODY_BABYLON)) return WEAPON_KNIFE;
|
|
if (has(COLLECTIBLE_SPIRIT_SWORD)) return has(COLLECTIBLE_C_SECTION) ? WEAPON_FETUS : WEAPON_SPIRIT_SWORD;
|
|
if (has(COLLECTIBLE_EPIC_FETUS)) return WEAPON_ROCKETS;
|
|
if (has(COLLECTIBLE_C_SECTION)) return WEAPON_FETUS;
|
|
if (has(COLLECTIBLE_MOMS_KNIFE)) return WEAPON_KNIFE;
|
|
if (has(COLLECTIBLE_HAEMOLACRIA)) return isLung ? WEAPON_MONSTROS_LUNGS : WEAPON_TEARS;
|
|
if (has(COLLECTIBLE_DR_FETUS)) return isLung ? WEAPON_MONSTROS_LUNGS : WEAPON_BOMBS;
|
|
if ((has(COLLECTIBLE_BRIMSTONE) || isAzazel) && !has(COLLECTIBLE_TECH_X)) return WEAPON_BRIMSTONE;
|
|
if (has(COLLECTIBLE_TECH_X)) return WEAPON_TECH_X;
|
|
if (has(COLLECTIBLE_TECHNOLOGY)) return WEAPON_LASER;
|
|
if (has(COLLECTIBLE_LUDOVICO)) return WEAPON_LUDOVICO_TECHNIQUE;
|
|
return isLung ? WEAPON_MONSTROS_LUNGS : WEAPON_TEARS;
|
|
}
|
|
|
|
// The weapon section of 00763570: the weapon types the items give, and new weapons when they changed (dropping what
|
|
// the player holds up first), which asks for the damage again.
|
|
static void weapons_evaluate(Entity_Player& p)
|
|
{
|
|
std::array<bool, WEAPON_TYPE_COUNT> previous = p.weaponTypes;
|
|
bool isAzazel = p.playerType == PLAYER_AZAZEL || p.temporaryEffects.HasTrinketEffect(TRINKET_AZAZELS_STUMP) ||
|
|
p.playerType == PLAYER_AZAZEL_B;
|
|
bool isBrimstoneKept = (p.HasCollectible(COLLECTIBLE_BRIMSTONE) || isAzazel) && !p.HasCollectible(COLLECTIBLE_TECH_X);
|
|
|
|
p.weaponTypes.fill(false);
|
|
p.EnableWeaponType(weapon_type_get(p), true);
|
|
if (p.HasWeaponType(WEAPON_BRIMSTONE) && p.HasWeaponType(WEAPON_KNIFE)) p.EnableWeaponType(WEAPON_BRIMSTONE, false);
|
|
if (p.HasWeaponType(WEAPON_FETUS) && isBrimstoneKept)
|
|
{
|
|
p.EnableWeaponType(WEAPON_FETUS, false);
|
|
p.EnableWeaponType(WEAPON_BRIMSTONE, true);
|
|
}
|
|
if (p.HasWeaponType(WEAPON_MONSTROS_LUNGS) && p.HasWeaponType(WEAPON_BOMBS)) p.EnableWeaponType(WEAPON_BOMBS, false);
|
|
if (p.HasWeaponType(WEAPON_BRIMSTONE) && p.HasWeaponType(WEAPON_LASER)) p.EnableWeaponType(WEAPON_LASER, false);
|
|
static_cast<LuaEngine*>(g_luaEngine)->EvaluateItems(&p, CACHE_WEAPON);
|
|
if (p.weaponTypes == previous) return;
|
|
|
|
bool isHeldThrowable = p.itemState != COLLECTIBLE_MOMS_BRACELET && p.itemState != COLLECTIBLE_SUPLEX;
|
|
if (p.heldEntity && isHeldThrowable)
|
|
{
|
|
if (p.heldEntity->IsEnemy())
|
|
p.ThrowHeldEntity(vector_make(p.velocity.x * HELD_THROW_SCALE, p.velocity.y * HELD_THROW_SCALE));
|
|
else p.heldEntity->Remove();
|
|
}
|
|
for (int slot = 1; slot < WEAPON_SLOT_COUNT; slot++) p.weapons[slot].reset();
|
|
int slot = 1;
|
|
for (int type = 0; type < WEAPON_TYPE_COUNT && slot < WEAPON_SLOT_COUNT; type++)
|
|
if (p.weaponTypes[type]) p.weapons[slot++] = weapon_create((WeaponType)type, &p);
|
|
p.cacheFlags |= CACHE_DAMAGE;
|
|
}
|
|
|
|
// 00763570 Recomputes what the cache flags ask for: the weapons, then fire delay, damage, shot speed, range, speed and
|
|
// luck from the items, pills, modifiers and Binge Eater's foods, then the tear flags and colours, flight, size and
|
|
// colour, each section handed to the mods. Then it clamps the stats and works out how fast tears fall. A shot speed
|
|
// change redoes the range. Familiars, other characters, effects, trinkets and run modifiers stop the game when they
|
|
// have work to do.
|
|
void Entity_Player::EvaluateItems()
|
|
{
|
|
if (!is_character_plain() || is_owning_any(*this, EVALUATION_UNHANDLED_ITEMS))
|
|
reconstruction_missing("Entity_Player::EvaluateItems 00763570 (characters, effects, trinkets or special items)");
|
|
|
|
StatBonuses bonus = stat_bonuses_get(*this);
|
|
float crownScale = (float)GetTrinketMultiplier(TRINKET_CRACKED_CROWN) * 0.2f + 1;
|
|
if (cacheFlags & CACHE_WEAPON) weapons_evaluate(*this);
|
|
if (cacheFlags & CACHE_SHOTSPEED) cacheFlags |= CACHE_RANGE;
|
|
if (cacheFlags & CACHE_FIREDELAY) fire_delay_evaluate(*this, bonus, crownScale);
|
|
if (cacheFlags & CACHE_DAMAGE) damage_evaluate(*this, bonus, crownScale);
|
|
if (cacheFlags & CACHE_SHOTSPEED) shot_speed_evaluate(*this, bonus, crownScale);
|
|
if (cacheFlags & CACHE_RANGE) range_evaluate(*this, bonus, crownScale);
|
|
if (cacheFlags & CACHE_SPEED) speed_evaluate(*this, bonus, crownScale);
|
|
if (cacheFlags & CACHE_TEARFLAG) tear_flags_evaluate(*this);
|
|
if (cacheFlags & CACHE_TEARCOLOR) tear_color_evaluate(*this);
|
|
if (cacheFlags & CACHE_FLYING) flying_evaluate(*this);
|
|
if ((cacheFlags & CACHE_FAMILIARS) && variant == PLAYER_VARIANT_PLAYER && isValid) familiars_check(*this);
|
|
if (cacheFlags & CACHE_LUCK) luck_evaluate(*this, bonus);
|
|
if ((cacheFlags & CACHE_SIZE) && variant == PLAYER_VARIANT_PLAYER) size_evaluate(*this);
|
|
if (cacheFlags & CACHE_COLOR) color_evaluate(*this);
|
|
|
|
if ((cacheFlags & CACHE_SPEED) && std::ranges::any_of(g_game->playerManager.playerList,
|
|
[this](Entity_Player* other) { return other->parent == this; }))
|
|
reconstruction_missing("Entity_Player::EvaluateItems 00763570 (the speed of a player's helpers)");
|
|
if (cacheFlags & CACHE_PICKUP_VISION) g_game->room->isPickupVisionInvalid = true;
|
|
if (cacheFlags & CACHE_SPEED) moveSpeed = std::max(SPEED_MIN, std::min(SPEED_MAX, moveSpeed));
|
|
shotSpeed = std::max(shotSpeed, SHOT_SPEED_MIN);
|
|
if (tearHeight > TEAR_HEIGHT_MAX) tearHeight = TEAR_HEIGHT_MAX;
|
|
tearRange = std::max(tearRange, RANGE_MIN);
|
|
damage = std::max(damage, DAMAGE_MIN);
|
|
maxFireDelay = std::max(maxFireDelay, MAX_FIRE_DELAY_MIN);
|
|
if (cacheFlags & (CACHE_SHOTSPEED | CACHE_RANGE))
|
|
tearFallingSpeed = -tear_fall_speed(tearHeight, tearRange, shotSpeed * FALL_SPEED_RANGE_SCALE,
|
|
tearFallingAcceleration);
|
|
if ((cacheFlags & CACHE_SPEED) && g_fuel_count() > 0) moveSpeed = (float)g_fuel_count() * G_FUEL_SPEED + moveSpeed;
|
|
cacheFlags = 0;
|
|
}
|
|
|
|
// The collectibles the frame (00782af0) and the tear parameters (007bf6c0) look at themselves, which their plain
|
|
// paths do not cover yet.
|
|
constexpr std::array<int, 15> FRAME_ITEMS = {375, 397, 465, 493, 497, 534, 575, 593, 619, 632, 641, 59, 202, 210, 399};
|
|
constexpr std::array<int, 72> TEAR_HIT_ITEMS = {
|
|
7, 48, 52, 59, 68, 69, 80, 89, 90, 103, 110, 118, 138, 150, 154, 155, 183, 200, 201, 213, 228, 229, 230, 231,
|
|
237, 247, 254, 259, 261, 305, 306, 309, 315, 316, 330, 336, 359, 374, 379, 393, 395, 398, 399, 401, 418, 429,
|
|
440, 443, 444, 453, 459, 460, 461, 462, 463, 496, 503, 529, 531, 532, 553, 561, 570, 592, 596, 606, 617, 618,
|
|
637, 659, 708, 731};
|
|
|
|
// Whether the player's frame runs its plain path: a plain character holding none of the items the frame handles.
|
|
bool Entity_Player::is_frame_plain()
|
|
{
|
|
return is_character_plain() && !is_owning_any(*this, FRAME_ITEMS) && !is_owning_any(*this, WEAPON_ITEMS) &&
|
|
!is_owning_any(*this, EVALUATION_UNHANDLED_ITEMS);
|
|
}
|
|
|
|
// Whether the player's tears take their plain parameters: a plain character holding none of the tear items.
|
|
bool Entity_Player::is_tear_hit_plain()
|
|
{
|
|
return is_frame_plain() && !is_owning_any(*this, TEAR_HIT_ITEMS);
|
|
}
|