feat: sync rules with vault 2026-10-20 (borrowed mana, Odetchnięcie limit, Oszołomiony, Akcje Natychmiastowe)
Adds src/logic/rules.ts, counters, migration 1.4.0, III/IV mana swap, thaumaturgy school, tests, recompiled translations. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
import { HbmTSRoll } from '../dice/ts-roll';
|
||||
import { TS_DEFAULT_REQUIRED, TS_DEFAULT_THRESHOLD, getMagicPowerEntry } from '../constants';
|
||||
import type { CastableActor } from './spell-cast';
|
||||
import { MANA_ELIXIR_NORMAL, MANA_ELIXIR_QUICK_DIE, manaElixirGain } from './rules';
|
||||
|
||||
export interface ElixirRecipe {
|
||||
name: string;
|
||||
@@ -61,3 +62,21 @@ export async function brewElixir(actor: CastableActor, recipe: ElixirRecipe): Pr
|
||||
});
|
||||
return { roll, success: !!roll.ts?.isSuccess };
|
||||
}
|
||||
|
||||
/**
|
||||
* Eliksir Odnowienia Many: normal use restores 3 mana (capped at the daily pool) and
|
||||
* raises Maksymalny Koszt Zaklęcia by 1 until the end of the drinker's next turn;
|
||||
* quick use (Akcja Natychmiastowa) restores 1d3 mana only.
|
||||
*/
|
||||
export async function drinkManaElixir(actor: CastableActor, quick = false): Promise<{ gained: number }> {
|
||||
const a = actor.system.attributes as any;
|
||||
let amount = MANA_ELIXIR_NORMAL;
|
||||
if (quick) {
|
||||
const roll = new Roll(`1d${MANA_ELIXIR_QUICK_DIE}`);
|
||||
await roll.evaluate();
|
||||
amount = roll.total ?? 1;
|
||||
}
|
||||
const gained = manaElixirGain(a.mana.value, a.mana.max, amount);
|
||||
await actor.update({ 'system.attributes.mana.value': a.mana.value + gained });
|
||||
return { gained };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user