Release Healer Man 0.1.38
This commit is contained in:
1 parent
361734bc41
commit
b417b7c3c3
48 files changed
+1982
-90
No files matched your search
+60
-16
@@ -129,6 +129,7 @@ import {
|
||||
} from "./combatAuras";
|
||||
import { rollBossLoot } from "./lootCatalog";
|
||||
import { adaptRunewakerEnemyDamage } from "./runewakerCombatFormula";
|
||||
import { channelAmountEffects } from "./combatChannelAmounts";
|
||||
import { normalizeInventory, type InventoryItem } from "./lootTypes";
|
||||
import {
|
||||
PLAYER_EQUIPMENT_OWNER_ID,
|
||||
@@ -721,6 +722,8 @@ export interface CombatState {
|
||||
damageSummon: (id: string, amount: number) => number;
|
||||
healPlayer: (amount: number) => number;
|
||||
revivePlayer: (percentMaxHealth?: number) => number;
|
||||
/** Checkpoint recovery of the player only; keeps the party and current pull intact. */
|
||||
respawnPlayerOnly: (position: CombatPosition, now?: number) => boolean;
|
||||
cancelCast: (message?: string) => boolean;
|
||||
engageNearbyMobs: (now?: number, playerPosition?: CombatPosition) => number;
|
||||
advanceMobCombat: (now?: number, playerPosition?: CombatPosition) => number;
|
||||
@@ -1183,7 +1186,7 @@ function abilityAttackKind(classId: ClassId, ability: AbilityDefinition): WotlkA
|
||||
const physicalKeyword = /\b(?:strike|slash|stab|shot|arrow|mangle|claw|bite|weapon|melee)\b/.test(searchable);
|
||||
const rangedPhysicalKeyword = /\b(?:shot|arrow|bow|gun|bullet|javelin)\b/.test(searchable);
|
||||
if (healing) return "spell";
|
||||
if (ability.range.max > 4 && (rangedPhysicalKeyword || baseClassFor(classId) === "hunter")) return "ranged";
|
||||
if (ability.range.max > 5 && (rangedPhysicalKeyword || baseClassFor(classId) === "hunter")) return "ranged";
|
||||
if (["warrior", "rogue", "death-knight"].includes(baseClassFor(classId)) || physicalKeyword) return "melee";
|
||||
return "spell";
|
||||
}
|
||||
@@ -1202,7 +1205,7 @@ export function abilityDamageSchool(classId: ClassId, ability: AbilityDefinition
|
||||
return "arcane";
|
||||
}
|
||||
|
||||
function equipmentAdjustedCombatAmount(
|
||||
export function equipmentAdjustedCombatAmount(
|
||||
scaling: number | (AbilityAmountScaling & { readonly coefficient: number }),
|
||||
level: number,
|
||||
gearStats: ItemStats,
|
||||
@@ -6106,12 +6109,7 @@ export const useCombatStore = create<CombatState>((set, get) => ({
|
||||
const sourceActor = state.actors[sourceActorId];
|
||||
const sourceMember = usePartyStore.getState().members.find((member) => member.id === sourceActorId);
|
||||
const amount = sourceMember
|
||||
? Math.max(1, Math.round((effect.basePoints ?? 0) + Math.max(0.1, effect.coefficient) * (
|
||||
sourceMember.level * 4
|
||||
+ sourceMember.gearStats.spellPower
|
||||
+ sourceMember.gearStats.attackPower * 0.35
|
||||
+ sourceMember.gearStats.rangedAttackPower * 0.35
|
||||
)))
|
||||
? equipmentAdjustedCombatAmount(effect, sourceMember.level, sourceMember.gearStats, sourceMember.classId, ability)
|
||||
: Math.max(1, Math.round((effect.basePoints ?? 0) + Math.max(0.1, effect.coefficient) * sourceActor.level * 4));
|
||||
const next = state.effects.filter((entry) => !(
|
||||
entry.kind === effect.kind
|
||||
@@ -6417,6 +6415,51 @@ export const useCombatStore = create<CombatState>((set, get) => ({
|
||||
return restored;
|
||||
},
|
||||
|
||||
respawnPlayerOnly: (position, now = combatNow()) => {
|
||||
const state = get();
|
||||
if (state.health > 0 || state.maxHealth <= 0 || !Number.isFinite(now)
|
||||
|| position.length !== 3 || !position.every(Number.isFinite)) return false;
|
||||
const auras = syncPassiveAuras(state.auras.filter((aura) => (
|
||||
aura.targetId !== PLAYER_AURA_ENTITY_ID || aura.definition.disposition === "buff"
|
||||
)), state.abilities, state.level, state.talentRanks, now);
|
||||
const maxHealth = auraAdjustedPlayerMaxHealth(state.classId, state.level, state.talentModifiers,
|
||||
state.gearStats, state.raceId, state.secondaryClassId, auras);
|
||||
const patch: Partial<CombatState> = {
|
||||
health: maxHealth,
|
||||
maxHealth,
|
||||
resource: initialResourceForMaximum(state.classId, state.maxResource),
|
||||
resourcePools: Object.fromEntries(Object.entries(state.maxResourcePools).map(([type, maximum]) => [
|
||||
type, type === resourceProfileForClass(state.classId).type
|
||||
? initialResourceForMaximum(state.classId, maximum ?? state.maxResource) : 0,
|
||||
])),
|
||||
controlledUntil: 0,
|
||||
controlMechanic: null,
|
||||
schoolLockedUntil: {},
|
||||
shield: 0,
|
||||
shieldExpiresAt: 0,
|
||||
activeCast: null,
|
||||
pendingGroundTarget: null,
|
||||
autoAttackTargetId: null,
|
||||
nextAutoAttackAt: 0,
|
||||
comboPoints: 0,
|
||||
comboTargetId: null,
|
||||
playerPosition: [...position],
|
||||
playerAnimationEvent: nextAnimationEvent("ability-cancel"),
|
||||
effects: state.effects.filter((effect) => effect.targetId !== null && effect.targetId !== PLAYER_AURA_ENTITY_ID),
|
||||
auras,
|
||||
combatEvents: recordCombatEvent(state.combatEvents, {
|
||||
occurredAt: now, kind: "resurrection", sourceActorId: PLAYER_AURA_ENTITY_ID,
|
||||
targetActorId: PLAYER_AURA_ENTITY_ID, abilityId: "player-checkpoint-resurrection",
|
||||
rawAmount: maxHealth, effectiveAmount: maxHealth, overheal: 0, absorbed: 0, critical: false,
|
||||
}),
|
||||
feedback: nextFeedback("success", "You have revived. Your party is still fighting; use Recall only if you want to regroup."),
|
||||
};
|
||||
// Publish only the player snapshot; never replace or mirror companion/enemy actors.
|
||||
const player = combatActorSnapshots({ ...state, ...patch })[PLAYER_AURA_ENTITY_ID];
|
||||
set({ ...patch, actors: { ...state.actors, [PLAYER_AURA_ENTITY_ID]: player } });
|
||||
return true;
|
||||
},
|
||||
|
||||
cancelCast: (message = "Casting interrupted.") => {
|
||||
const cast = get().activeCast;
|
||||
if (!cast) return false;
|
||||
@@ -8151,30 +8194,31 @@ export const useCombatStore = create<CombatState>((set, get) => ({
|
||||
: "Channel interrupted: target unavailable.");
|
||||
return;
|
||||
}
|
||||
const damageAmount = ability.effects.reduce(
|
||||
(total, effect) => total + (effect.kind === "damage" || effect.kind === "dot"
|
||||
const channelEffects = channelAmountEffects(ability, cast.totalTicks);
|
||||
const damageAmount = channelEffects.reduce(
|
||||
(total, { effect, multiplier }) => total + (effect.kind === "damage" || effect.kind === "dot"
|
||||
? equipmentAdjustedCombatAmount(
|
||||
effect,
|
||||
get().level,
|
||||
get().gearStats,
|
||||
get().classId,
|
||||
ability,
|
||||
) * (effect.kind === "dot" ? effect.ticks : 1)
|
||||
) * multiplier
|
||||
: 0),
|
||||
0,
|
||||
) / cast.totalTicks;
|
||||
const healingAmount = ability.effects.reduce(
|
||||
(total, effect) => total + (effect.kind === "heal" || effect.kind === "hot"
|
||||
);
|
||||
const healingAmount = channelEffects.reduce(
|
||||
(total, { effect, multiplier }) => total + (effect.kind === "heal" || effect.kind === "hot"
|
||||
? equipmentAdjustedCombatAmount(
|
||||
effect,
|
||||
get().level,
|
||||
get().gearStats,
|
||||
get().classId,
|
||||
ability,
|
||||
) * (effect.kind === "hot" ? effect.ticks : 1)
|
||||
) * multiplier
|
||||
: 0),
|
||||
0,
|
||||
) / cast.totalTicks;
|
||||
);
|
||||
if (damageAmount > 0) {
|
||||
const channelCenter = channelHostile ? targetPosition ?? cast.origin : get().playerPosition;
|
||||
const channelTargets = ability.radius === undefined
|
||||
|
||||
Reference in new issue
Block a user