feat: Add Mana Circulation discipline with regen multiplier and meditation cap perks
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m23s
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m23s
This commit is contained in:
@@ -18,15 +18,22 @@ import {
|
||||
const KNOWN_BONUS_STATS = new Set([
|
||||
'maxManaBonus',
|
||||
'regenBonus',
|
||||
'regenMultiplier',
|
||||
'clickManaBonus',
|
||||
'baseDamageBonus',
|
||||
'elementCapBonus',
|
||||
'meditationCapBonus',
|
||||
]);
|
||||
|
||||
export interface DisciplineEffectsResult {
|
||||
bonuses: Record<string, number>;
|
||||
multipliers: Record<string, number>;
|
||||
specials: Set<string>;
|
||||
/**
|
||||
* Bonus to the meditation multiplier cap from disciplines.
|
||||
* Each point of meditationCapBonus adds +0.5 to the max meditation multiplier.
|
||||
*/
|
||||
meditationCapBonus: number;
|
||||
/**
|
||||
* Conversion entries: for each active discipline with a conversionRate,
|
||||
* maps target mana type → { rate, sourceManaTypes }.
|
||||
@@ -45,9 +52,18 @@ export function computeDisciplineEffects(_state?: DisciplineStoreState): Discipl
|
||||
const bonuses: Record<string, number> = {};
|
||||
const multipliers: Record<string, number> = {};
|
||||
const specials = new Set<string>();
|
||||
let meditationCapBonus = 0;
|
||||
const conversions: Record<string, { rate: number; sourceManaTypes: string[] }> = {};
|
||||
|
||||
function addBonus(stat: string, amount: number) {
|
||||
if (stat === 'meditationCapBonus') {
|
||||
meditationCapBonus += amount;
|
||||
return;
|
||||
}
|
||||
if (stat === 'regenMultiplier') {
|
||||
multipliers[stat] = (multipliers[stat] || 0) + amount;
|
||||
return;
|
||||
}
|
||||
bonuses[stat] = (bonuses[stat] || 0) + amount;
|
||||
}
|
||||
|
||||
@@ -90,7 +106,10 @@ export function computeDisciplineEffects(_state?: DisciplineStoreState): Discipl
|
||||
}
|
||||
} else if (perk.type === 'capped') {
|
||||
if (perk.bonus) {
|
||||
const tier = calculatePerkTier(disc.xp, perk.threshold, perk.value);
|
||||
let tier = calculatePerkTier(disc.xp, perk.threshold, perk.value);
|
||||
if (tier > 0 && perk.maxTier !== undefined) {
|
||||
tier = Math.min(tier, perk.maxTier);
|
||||
}
|
||||
if (tier > 0) {
|
||||
addBonus(perk.bonus.stat, tier * perk.bonus.amount);
|
||||
}
|
||||
@@ -101,5 +120,5 @@ export function computeDisciplineEffects(_state?: DisciplineStoreState): Discipl
|
||||
}
|
||||
}
|
||||
|
||||
return { bonuses, multipliers, specials, conversions };
|
||||
return { bonuses, multipliers, specials, meditationCapBonus, conversions };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user