Release Healer Man 0.1.6
This commit is contained in:
1 parent
55cfd43d66
commit
b12fb84859
96 files changed
+10874
-609
No files matched your search
+25
-4
@@ -143,6 +143,16 @@ export interface AuraDefinition {
|
||||
readonly stackBehavior?: AuraStackBehavior;
|
||||
/** Defaults to true. False makes applications from all sources share one aura. */
|
||||
readonly uniqueBySource?: boolean;
|
||||
/** A target can have only one aura from an exclusive stance/form/seal/etc. group. */
|
||||
readonly exclusiveGroup?: string;
|
||||
/** Explicit non-numeric gameplay state such as stealth, tracking, flight, or water walking. */
|
||||
readonly utilityTags?: readonly string[];
|
||||
/** Enemy control mechanics ignored while this aura is active. */
|
||||
readonly controlImmunities?: readonly ("fear" | "sleep" | "root" | "stun" | "silence")[];
|
||||
/** Chance from 0 through 1 to reflect an incoming spell. */
|
||||
readonly reflectSpellChance?: number;
|
||||
/** Portion of incoming target damage transferred to the aura source. */
|
||||
readonly redirectDamagePercent?: number;
|
||||
readonly dispelCategory?: DispelCategory;
|
||||
readonly dispelPriority?: number;
|
||||
readonly modifiers?: readonly AuraModifier[];
|
||||
@@ -309,14 +319,25 @@ export function applyAura(
|
||||
const maxStacks = boundedPositiveInteger(definition.maxStacks, 1);
|
||||
const requestedStacks = Math.min(maxStacks, boundedPositiveInteger(request.stacks, 1));
|
||||
const instanceId = auraIdentity(definition, request.sourceId, request.targetId);
|
||||
const existingIndex = current.findIndex((aura) => aura.instanceId === instanceId);
|
||||
const exclusive = definition.exclusiveGroup
|
||||
? current.filter((aura) => (
|
||||
aura.targetId === request.targetId
|
||||
&& aura.definition.exclusiveGroup === definition.exclusiveGroup
|
||||
&& aura.instanceId !== instanceId
|
||||
))
|
||||
: [];
|
||||
const exclusiveIds = new Set(exclusive.map((aura) => aura.instanceId));
|
||||
const base = exclusiveIds.size > 0
|
||||
? current.filter((aura) => !exclusiveIds.has(aura.instanceId))
|
||||
: current;
|
||||
const existingIndex = base.findIndex((aura) => aura.instanceId === instanceId);
|
||||
|
||||
if (existingIndex < 0) {
|
||||
const aura = makeAura(request, requestedStacks);
|
||||
return { auras: [...current, aura], aura };
|
||||
return { auras: [...base, aura], aura, ...(exclusive[0] ? { replaced: exclusive[0] } : {}) };
|
||||
}
|
||||
|
||||
const existing = current[existingIndex];
|
||||
const existing = base[existingIndex];
|
||||
const behavior = definition.stackBehavior ?? "refresh";
|
||||
const stacks = behavior === "add"
|
||||
? Math.min(maxStacks, existing.stacks + requestedStacks)
|
||||
@@ -333,7 +354,7 @@ export function applyAura(
|
||||
procStates: existing.procStates,
|
||||
}
|
||||
: replacement;
|
||||
const auras = [...current];
|
||||
const auras = [...base];
|
||||
auras[existingIndex] = aura;
|
||||
return { auras, aura, replaced: existing };
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user