Release Healer Man 0.1.24
This commit is contained in:
1 parent
c4346751a9
commit
bac0da9300
118 files changed
+857
-289
No files matched your search
+42
-3
@@ -23,6 +23,7 @@ import {
|
||||
} from "./itemStats";
|
||||
import {
|
||||
damageAfterEquipmentMitigation,
|
||||
deriveCharacterStats,
|
||||
} from "./wotlkStats";
|
||||
import type { InventoryItem } from "./lootTypes";
|
||||
import { runtimePartyTalentRanksForLevel } from "./partyTalentRuntime";
|
||||
@@ -195,6 +196,18 @@ function memberMaxHealth(
|
||||
return base + healthFromStamina(gearStats.stamina);
|
||||
}
|
||||
|
||||
function memberMaxResource(
|
||||
classId: ClassId,
|
||||
level: number,
|
||||
raceId: RaceId,
|
||||
gearStats: ItemStats = EMPTY_ITEM_STATS,
|
||||
): number {
|
||||
const profile = resourceProfileForClass(classId);
|
||||
return profile.type === "mana"
|
||||
? deriveCharacterStats(classId, level, gearStats, raceId).mana
|
||||
: profile.maximum;
|
||||
}
|
||||
|
||||
function withMemberGearStats(member: PartyMember, gearStats: ItemStats): PartyMember {
|
||||
const maxHealth = memberMaxHealth(
|
||||
member.level,
|
||||
@@ -206,7 +219,19 @@ function withMemberGearStats(member: PartyMember, gearStats: ItemStats): PartyMe
|
||||
const health = member.health <= 0
|
||||
? 0
|
||||
: Math.max(1, Math.round(member.health / Math.max(1, member.maxHealth) * maxHealth));
|
||||
return { ...member, gearStats, health, maxHealth };
|
||||
const maxResource = memberMaxResource(member.classId, member.level, member.raceId, gearStats);
|
||||
const resource = Math.max(0, Math.round(
|
||||
member.resource / Math.max(1, member.maxResource) * maxResource,
|
||||
));
|
||||
return {
|
||||
...member,
|
||||
gearStats,
|
||||
health,
|
||||
maxHealth,
|
||||
resource,
|
||||
maxResource,
|
||||
resourcePools: Object.freeze({ ...member.resourcePools, [member.resourceType]: resource }),
|
||||
};
|
||||
}
|
||||
|
||||
function createMember(
|
||||
@@ -242,8 +267,10 @@ function createMember(
|
||||
});
|
||||
const maxHealth = memberMaxHealth(level, role, gearStats, template.classId, race.id);
|
||||
const resourceProfile = resourceProfileForClass(template.classId);
|
||||
const maxResource = resourceProfile.maximum;
|
||||
const resource = resourceProfile.initial;
|
||||
const maxResource = memberMaxResource(template.classId, level, race.id, gearStats);
|
||||
const resource = Math.round(
|
||||
maxResource * (resourceProfile.maximum > 0 ? resourceProfile.initial / resourceProfile.maximum : 0),
|
||||
);
|
||||
return {
|
||||
id,
|
||||
name: template.name,
|
||||
@@ -452,11 +479,23 @@ export const usePartyStore = create<PartyState>((set, get) => ({
|
||||
const health = member.health <= 0
|
||||
? 0
|
||||
: Math.max(1, Math.round(member.health / Math.max(1, member.maxHealth) * maxHealth));
|
||||
const maxResource = memberMaxResource(
|
||||
member.classId,
|
||||
safeLevel,
|
||||
member.raceId,
|
||||
member.gearStats,
|
||||
);
|
||||
const resource = Math.max(0, Math.round(
|
||||
member.resource / Math.max(1, member.maxResource) * maxResource,
|
||||
));
|
||||
return {
|
||||
...member,
|
||||
level: safeLevel,
|
||||
health,
|
||||
maxHealth,
|
||||
resource,
|
||||
maxResource,
|
||||
resourcePools: Object.freeze({ ...member.resourcePools, [member.resourceType]: resource }),
|
||||
talentRanks: runtimePartyTalentRanksForLevel(member.classId, member.specialization, safeLevel),
|
||||
};
|
||||
}),
|
||||
|
||||
Reference in new issue
Block a user