fix: handle undefined state/obj in mana calculations to prevent runtime error
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 2m20s
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 2m20s
This commit is contained in:
@@ -29,7 +29,7 @@ export function computeMaxMana(
|
||||
): number {
|
||||
const pu = state.prestigeUpgrades;
|
||||
const skillMult = (effects as any)?.skillLevelMultiplier || 1;
|
||||
const base = 100 + (state.skills.manaWell || 0) * 100 * skillMult + (pu.manaWell || 0) * 500;
|
||||
const base = 100 + ((state.skills || {}).manaWell || 0) * 100 * skillMult + ((pu || {}).manaWell || 0) * 500;
|
||||
|
||||
// Check if we need to compute effects from equipment
|
||||
if (!effects && state.equipmentInstances && state.equippedInstances) {
|
||||
|
||||
@@ -34,7 +34,7 @@ export function computeMaxMana(
|
||||
const base =
|
||||
100 +
|
||||
manaWellLevel.level * 100 * manaWellLevel.tierMultiplier +
|
||||
(pu.manaWell || 0) * 500;
|
||||
((pu || {}).manaWell || 0) * 500;
|
||||
|
||||
const computedEffects = effects ?? computeEffects(skillUpgrades, skillTiers);
|
||||
// Apply MANA_HEART bonus (+10% per loop, compounds)
|
||||
|
||||
@@ -12,8 +12,8 @@ export function computeMaxMana(
|
||||
const pu = state.prestigeUpgrades;
|
||||
const base =
|
||||
100 +
|
||||
(state.skills.manaWell || 0) * 100 +
|
||||
(pu.manaWell || 0) * 500;
|
||||
((state.skills || {}).manaWell || 0) * 100 +
|
||||
((pu || {}).manaWell || 0) * 500;
|
||||
|
||||
// Apply upgrade effects if provided
|
||||
if (effects) {
|
||||
@@ -34,9 +34,9 @@ export function computeRegen(
|
||||
const temporalBonus = 1 + (pu.temporalEcho || 0) * 0.1;
|
||||
const base =
|
||||
2 +
|
||||
(state.skills.manaFlow || 0) * 1 +
|
||||
(state.skills.manaSpring || 0) * 2 +
|
||||
(pu.manaFlow || 0) * 0.5;
|
||||
((state.skills || {}).manaFlow || 0) * 1 +
|
||||
((state.skills || {}).manaSpring || 0) * 2 +
|
||||
((pu || {}).manaFlow || 0) * 0.5;
|
||||
|
||||
let regen = base * temporalBonus;
|
||||
|
||||
@@ -90,8 +90,8 @@ export function computeEffectiveRegen(
|
||||
export function computeClickMana(state: Pick<GameState, 'skills'>): number {
|
||||
return (
|
||||
1 +
|
||||
(state.skills.manaTap || 0) * 1 +
|
||||
(state.skills.manaSurge || 0) * 3
|
||||
((state.skills || {}).manaTap || 0) * 1 +
|
||||
((state.skills || {}).manaSurge || 0) * 3
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user