Release Healer Man 0.1.15
This commit is contained in:
1 parent
7b41b102fa
commit
f49e54f35f
43 files changed
+1478
-112
No files matched your search
+78
-9
@@ -131,7 +131,6 @@ import { rollBossLoot } from "./lootCatalog";
|
||||
import { normalizeInventory, type InventoryItem } from "./lootTypes";
|
||||
import {
|
||||
PLAYER_EQUIPMENT_OWNER_ID,
|
||||
equipmentStats,
|
||||
activeEquipmentStatsForClass,
|
||||
equipInventoryItem,
|
||||
normalizeEquipment,
|
||||
@@ -139,6 +138,12 @@ import {
|
||||
type EquipmentAssignments,
|
||||
type EquipmentSlot,
|
||||
} from "./equipment";
|
||||
import {
|
||||
resolvedEquipmentStats,
|
||||
type HeirloomContext,
|
||||
} from "./heirloomEquipment";
|
||||
import { defaultPartyRoleForClass, type PartyRole } from "./partyRoles";
|
||||
import { specializationById } from "./specializationCatalog";
|
||||
import {
|
||||
EMPTY_ITEM_STATS,
|
||||
itemStatSummary,
|
||||
@@ -491,6 +496,8 @@ export interface ActorHealingRequest {
|
||||
|
||||
export interface CharacterCombatSeed {
|
||||
readonly classId: ClassId;
|
||||
readonly specializationId?: string | null;
|
||||
readonly role?: PartyRole;
|
||||
readonly secondaryClassId?: ClassId | null;
|
||||
readonly raceId?: RaceId;
|
||||
readonly level?: number;
|
||||
@@ -593,6 +600,8 @@ export interface PendingGroundTarget {
|
||||
|
||||
export interface CombatState {
|
||||
classId: ClassId;
|
||||
specializationId: string | null;
|
||||
gearRole: PartyRole;
|
||||
secondaryClassId: ClassId | null;
|
||||
raceId: RaceId;
|
||||
level: number;
|
||||
@@ -645,6 +654,7 @@ export interface CombatState {
|
||||
settings: GameplaySettings;
|
||||
playerPosition: CombatPosition;
|
||||
initializeCharacter: (profile: CharacterCombatSeed) => void;
|
||||
refreshResolvedGear: () => void;
|
||||
registerMob: (id: string, registration: MobRegistration) => void;
|
||||
removeMob: (id: string) => void;
|
||||
lootMob: (id: string, now?: number) => boolean;
|
||||
@@ -3117,6 +3127,8 @@ function initialState() {
|
||||
const initialPools = initialResourcePools(classId, abilities, maxResource);
|
||||
return {
|
||||
classId,
|
||||
specializationId: null,
|
||||
gearRole: "healer" as PartyRole,
|
||||
secondaryClassId: null,
|
||||
raceId,
|
||||
level,
|
||||
@@ -3175,6 +3187,9 @@ export const useCombatStore = create<CombatState>((set, get) => ({
|
||||
initializeCharacter: (profile) => {
|
||||
resetCombatPresentationSession();
|
||||
const classId = profile.classId;
|
||||
const specialization = specializationById(profile.specializationId);
|
||||
const specializationId = specialization?.classId === classId ? specialization.id : null;
|
||||
const gearRole = specialization?.role ?? profile.role ?? defaultPartyRoleForClass(classId);
|
||||
const secondaryClassId = profile.secondaryClassId ?? null;
|
||||
const raceId = profile.raceId ?? "human";
|
||||
const progression = normalizeProgression(profile.level ?? 1, profile.xp ?? profile.experience ?? 0);
|
||||
@@ -3184,7 +3199,14 @@ export const useCombatStore = create<CombatState>((set, get) => ({
|
||||
const abilities = abilitiesForCharacter(classId, secondaryClassId);
|
||||
const inventory = normalizeInventory(profile.inventory);
|
||||
const equipment = normalizeEquipment(profile.equipment, inventory);
|
||||
const gearStats = activeEquipmentStatsForClass(equipment, inventory, PLAYER_EQUIPMENT_OWNER_ID, classId);
|
||||
const gearStats = specializationId !== null || classId.startsWith("rom-") ? resolvedEquipmentStats(equipment, inventory, {
|
||||
ownerId: PLAYER_EQUIPMENT_OWNER_ID,
|
||||
ownerKind: "player",
|
||||
classId,
|
||||
specializationId,
|
||||
role: gearRole,
|
||||
level: progression.level,
|
||||
}) : activeEquipmentStatsForClass(equipment, inventory, PLAYER_EQUIPMENT_OWNER_ID, classId);
|
||||
const maxHealth = talentAdjustedMaxHealth(
|
||||
classId,
|
||||
progression.level,
|
||||
@@ -3231,6 +3253,44 @@ export const useCombatStore = create<CombatState>((set, get) => ({
|
||||
}));
|
||||
},
|
||||
|
||||
refreshResolvedGear: () => set((state) => {
|
||||
const context: HeirloomContext = {
|
||||
ownerId: PLAYER_EQUIPMENT_OWNER_ID,
|
||||
ownerKind: "player",
|
||||
classId: state.classId,
|
||||
specializationId: state.specializationId,
|
||||
role: state.gearRole,
|
||||
level: state.level,
|
||||
};
|
||||
const gearStats = state.specializationId !== null || state.classId.startsWith("rom-")
|
||||
? resolvedEquipmentStats(state.equipment, state.inventory, context)
|
||||
: activeEquipmentStatsForClass(state.equipment, state.inventory, PLAYER_EQUIPMENT_OWNER_ID, state.classId);
|
||||
const maxHealth = talentAdjustedMaxHealth(
|
||||
state.classId,
|
||||
state.level,
|
||||
state.talentModifiers,
|
||||
gearStats,
|
||||
state.raceId,
|
||||
state.secondaryClassId,
|
||||
);
|
||||
const maxResource = talentAdjustedMaxResource(
|
||||
state.classId,
|
||||
state.level,
|
||||
state.talentModifiers,
|
||||
gearStats,
|
||||
state.raceId,
|
||||
state.secondaryClassId,
|
||||
);
|
||||
if (gearStats === state.gearStats && maxHealth === state.maxHealth && maxResource === state.maxResource) return state;
|
||||
return {
|
||||
gearStats,
|
||||
maxHealth,
|
||||
maxResource,
|
||||
health: clamp(state.maxHealth > 0 ? state.health / state.maxHealth * maxHealth : maxHealth, 0, maxHealth),
|
||||
resource: clamp(state.maxResource > 0 ? state.resource / state.maxResource * maxResource : maxResource, 0, maxResource),
|
||||
};
|
||||
}),
|
||||
|
||||
registerMob: (id, registration) => set((state) => {
|
||||
if (!id) return state;
|
||||
const existing = state.mobs[id];
|
||||
@@ -3471,12 +3531,14 @@ export const useCombatStore = create<CombatState>((set, get) => ({
|
||||
const ownerName = ownerId === PLAYER_EQUIPMENT_OWNER_ID
|
||||
? "You"
|
||||
: usePartyStore.getState().members.find((member) => member.id === ownerId)?.name ?? "Companion";
|
||||
const gearStats = activeEquipmentStatsForClass(
|
||||
change.assignments,
|
||||
state.inventory,
|
||||
PLAYER_EQUIPMENT_OWNER_ID,
|
||||
state.classId,
|
||||
);
|
||||
const gearStats = state.specializationId !== null || state.classId.startsWith("rom-") ? resolvedEquipmentStats(change.assignments, state.inventory, {
|
||||
ownerId: PLAYER_EQUIPMENT_OWNER_ID,
|
||||
ownerKind: "player",
|
||||
classId: state.classId,
|
||||
specializationId: state.specializationId,
|
||||
role: state.gearRole,
|
||||
level: state.level,
|
||||
}) : activeEquipmentStatsForClass(change.assignments, state.inventory, PLAYER_EQUIPMENT_OWNER_ID, state.classId);
|
||||
const maxHealth = talentAdjustedMaxHealth(
|
||||
state.classId,
|
||||
state.level,
|
||||
@@ -3518,7 +3580,14 @@ export const useCombatStore = create<CombatState>((set, get) => ({
|
||||
const state = get();
|
||||
const next = unequipInventorySlot(state.equipment, ownerId, slot);
|
||||
if (next === state.equipment) return false;
|
||||
const gearStats = activeEquipmentStatsForClass(next, state.inventory, PLAYER_EQUIPMENT_OWNER_ID, state.classId);
|
||||
const gearStats = state.specializationId !== null || state.classId.startsWith("rom-") ? resolvedEquipmentStats(next, state.inventory, {
|
||||
ownerId: PLAYER_EQUIPMENT_OWNER_ID,
|
||||
ownerKind: "player",
|
||||
classId: state.classId,
|
||||
specializationId: state.specializationId,
|
||||
role: state.gearRole,
|
||||
level: state.level,
|
||||
}) : activeEquipmentStatsForClass(next, state.inventory, PLAYER_EQUIPMENT_OWNER_ID, state.classId);
|
||||
const maxHealth = talentAdjustedMaxHealth(
|
||||
state.classId,
|
||||
state.level,
|
||||
|
||||
Reference in new issue
Block a user